You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.nio.file.FileSystemException: storage\5b87e2a903751c247c164465: The process cannot access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86) ~[?:1.8.0_144]
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) ~[?:1.8.0_144]
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) ~[?:1.8.0_144]
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269) ~[?:1.8.0_144]
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108) ~[?:1.8.0_144]
at java.nio.file.Files.deleteIfExists(Files.java:1165) ~[?:1.8.0_144]
at java.nio.file.Files.copy(Files.java:3004) ~[?:1.8.0_144]
at tusserver.storage.services.StorageServiceImpl.processStream(StorageServiceImpl.java:84) ~[classes/:?]
at tusserver.StorageController.processPatch(StorageController.java:186) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE
Code :
public int processStream(String uuid, InputStream inputStream) throws Exception {
String filename = StringUtils.cleanPath(uuid);
File file = new File(storageDir.resolve(filename).toString());
if (!file.isFile()){
new FileOutputStream(file).close();
if(!file.isFile()){
log.error("Cannot create new file");
throw new TusPermissionDeniedException("Cannot create new file");
}
}
InputStream storageFile;
try{
storageFile = new FileInputStream(file);
}catch(IOException e){
log.error("Cannot read old file");
throw new TusPermissionDeniedException("Cannot read old file");
}
storageFile = new SequenceInputStream(storageFile, inputStream);
// at this position giving exception
Files.copy(storageFile, storageDir.resolve(filename), StandardCopyOption.REPLACE_EXISTING);
file = new File(storageDir.resolve(filename).toString());
return (int) file.length();
}
The text was updated successfully, but these errors were encountered:
Hi,
I am sending one file from browser and uploading to server, it is chunking and uploading to the server.
But while uploading it is giving exception
you can get the github link for the implementation:
) https://github.com/tus/tus-js-client
Spring server implementation
2) https://github.com/thomasooo/spring-boot-tus
java.nio.file.FileSystemException: storage\5b87e2a903751c247c164465: The process cannot access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86) ~[?:1.8.0_144]
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) ~[?:1.8.0_144]
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) ~[?:1.8.0_144]
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269) ~[?:1.8.0_144]
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108) ~[?:1.8.0_144]
at java.nio.file.Files.deleteIfExists(Files.java:1165) ~[?:1.8.0_144]
at java.nio.file.Files.copy(Files.java:3004) ~[?:1.8.0_144]
at tusserver.storage.services.StorageServiceImpl.processStream(StorageServiceImpl.java:84) ~[classes/:?]
at tusserver.StorageController.processPatch(StorageController.java:186) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE
Code :
public int processStream(String uuid, InputStream inputStream) throws Exception {
String filename = StringUtils.cleanPath(uuid);
File file = new File(storageDir.resolve(filename).toString());
// File fileToBeInstalled = new File(StorageServiceImpl.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
// Files.copy(fileToBeInstalled.toPath(), storageDir.resolve(filename), StandardCopyOption.REPLACE_EXISTING);
// fileToBeInstalled.delete();
storageFile = new SequenceInputStream(storageFile, inputStream);
// at this position giving exception
Files.copy(storageFile, storageDir.resolve(filename), StandardCopyOption.REPLACE_EXISTING);
}
The text was updated successfully, but these errors were encountered: