Skip to content

Commit 6957f68

Browse files
committed
3.2.2370
1 parent add2876 commit 6957f68

File tree

5 files changed

+34
-34
lines changed

5 files changed

+34
-34
lines changed

androidfsstorage/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ android {
2323
jarJar {
2424
rules = [
2525
'stax-api-1.0.1.jar': 'javax.xml.** com.ithit.webdav.xml.@1',
26-
'webdav-server-3.1.2208.jar': 'javax.xml.stream.** com.ithit.webdav.xml.stream.@1'
26+
'webdav-server-3.2.2370.jar': 'javax.xml.stream.** com.ithit.webdav.xml.stream.@1'
2727
]
2828
}
2929

@@ -38,11 +38,11 @@ dependencies {
3838
compile 'commons-io:commons-io:2.4'
3939
compile 'com.google.code.gson:gson:2.7'
4040
compile 'com.android.support:appcompat-v7:26.+'
41-
compile ('com.ithit.webdav.integration:android-integration:3.1.2208', {
41+
compile ('com.ithit.webdav.integration:android-integration:3.2.2370', {
4242
exclude group: 'org.nanohttpd', module: 'nanohttpd'
4343
})
4444
compile 'com.android.support.constraint:constraint-layout:1.0.2'
4545
jarJar 'stax:stax-api:1.0.1'
46-
jarJar 'com.ithit.webdav:webdav-server:3.1.2208'
46+
jarJar 'com.ithit.webdav:webdav-server:3.2.2370'
4747
testCompile 'junit:junit:4.12'
4848
}

deltav/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.ithit.webdav.samples</groupId>
88
<artifactId>deltav</artifactId>
9-
<version>3.1.2208</version>
9+
<version>3.2.2370</version>
1010
<packaging>war</packaging>
1111

1212
<properties>
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.ithit.webdav.integration</groupId>
2525
<artifactId>servlet-integration</artifactId>
26-
<version>3.1.2208</version>
26+
<version>3.2.2370</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>commons-dbcp</groupId>
@@ -93,7 +93,7 @@
9393
<dependency>
9494
<groupId>com.ithit.webdav</groupId>
9595
<artifactId>webdav-server</artifactId>
96-
<version>3.1.2208</version>
96+
<version>3.2.2370</version>
9797
</dependency>
9898

9999
<dependency>
@@ -133,7 +133,7 @@
133133
<goal>copy-resources</goal>
134134
</goals>
135135
<configuration>
136-
<outputDirectory>${project.build.directory}/deltav-3.1.2208/META-INF</outputDirectory>
136+
<outputDirectory>${project.build.directory}/deltav-3.2.2370/META-INF</outputDirectory>
137137
<overwrite>true</overwrite>
138138
<resources>
139139
<resource>
@@ -212,7 +212,7 @@
212212
<server>filesystem</server>
213213
<port>11021</port>
214214
<path>/</path>
215-
<warSourceDirectory>target/deltav-3.1.2208</warSourceDirectory>
215+
<warSourceDirectory>target/deltav-3.2.2370</warSourceDirectory>
216216
</configuration>
217217
</plugin>
218218
<plugin>

filesystemstorage/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.ithit.webdav.samples</groupId>
88
<artifactId>filesystemstorage</artifactId>
9-
<version>3.1.2208</version>
9+
<version>3.2.2370</version>
1010
<packaging>war</packaging>
1111

1212
<properties>
@@ -36,7 +36,7 @@
3636
<dependency>
3737
<groupId>com.ithit.webdav.integration</groupId>
3838
<artifactId>servlet-integration</artifactId>
39-
<version>3.1.2208</version>
39+
<version>3.2.2370</version>
4040
</dependency>
4141
<dependency>
4242
<groupId>commons-io</groupId>
@@ -112,7 +112,7 @@
112112
<dependency>
113113
<groupId>com.ithit.webdav</groupId>
114114
<artifactId>webdav-server</artifactId>
115-
<version>3.1.2208</version>
115+
<version>3.2.2370</version>
116116
</dependency>
117117
<dependency>
118118
<groupId>net.java.dev.jna</groupId>
@@ -198,7 +198,7 @@
198198
<server>filesystem</server>
199199
<port>11021</port>
200200
<path>/</path>
201-
<warSourceDirectory>target/filesystemstorage-3.1.2208</warSourceDirectory>
201+
<warSourceDirectory>target/filesystemstorage-3.2.2370</warSourceDirectory>
202202
</configuration>
203203
</plugin>
204204
<plugin>

filesystemstorage/src/main/java/com/ithit/webdav/samples/fsstorageservlet/FileImpl.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.ithit.webdav.server.exceptions.ServerException;
99
import com.ithit.webdav.server.resumableupload.ResumableUpload;
1010
import com.ithit.webdav.server.resumableupload.UploadProgress;
11+
import com.sun.nio.file.ExtendedOpenOption;
1112

1213
import java.io.IOException;
1314
import java.io.InputStream;
@@ -243,11 +244,7 @@ public void read(OutputStream out, long startIndex, long count) throws ServerExc
243244
public long write(InputStream content, String contentType, long startIndex, long totalFileLength)
244245
throws LockedException, ServerException, IOException {
245246
ensureHasToken();
246-
Path fullPath = getFullPath();
247-
if (!Files.exists(fullPath)) {
248-
Files.createFile(fullPath);
249-
}
250-
SeekableByteChannel writer = Files.newByteChannel(fullPath, StandardOpenOption.WRITE, StandardOpenOption.CREATE);
247+
SeekableByteChannel writer = Files.newByteChannel(getFullPath(), StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.READ, ExtendedOpenOption.NOSHARE_DELETE);
251248
if (startIndex == 0) {
252249
// If we override the file we must set position to 0 because writer could be at not 0 position.
253250
writer = writer.truncate(0);
@@ -259,22 +256,24 @@ public long write(InputStream content, String contentType, long startIndex, long
259256
byte[] inputBuffer = new byte[bufferSize];
260257
long totalWrittenBytes = startIndex;
261258
int readBytes;
262-
while ((readBytes = content.read(inputBuffer)) > -1) {
263-
ByteBuffer byteBuffer = ByteBuffer.wrap(inputBuffer, 0, readBytes);
264-
try {
259+
try {
260+
while ((readBytes = content.read(inputBuffer)) > -1) {
261+
ByteBuffer byteBuffer;
262+
byteBuffer = ByteBuffer.wrap(inputBuffer, 0, readBytes);
265263
writer.write(byteBuffer);
266-
} catch (Exception e) {
267-
e.printStackTrace();
264+
totalWrittenBytes += readBytes;
265+
}
266+
try {
267+
getEngine().getSearchFacade().getIndexer().indexFile(getName(), decode(getPath()), null, this);
268+
} catch (Exception ex){
269+
getEngine().getLogger().logError("Errors during indexing.", ex);
268270
}
269-
totalWrittenBytes += readBytes;
270-
}
271-
writer.close();
272-
getEngine().getWebSocketServer().notifyRefresh(getParent(getPath()));
273-
try {
274-
getEngine().getSearchFacade().getIndexer().indexFile(getName(), decode(getPath()), null, this);
275271
} catch (Exception ex) {
276-
getEngine().getLogger().logError("Errors during indexing.", ex);
272+
ex.printStackTrace();
273+
} finally {
274+
writer.close();
277275
}
276+
getEngine().getWebSocketServer().notifyRefresh(getParent(getPath()));
278277
return totalWrittenBytes;
279278
}
280279

@@ -307,6 +306,7 @@ public void delete() throws LockedException, MultistatusException, ServerExcepti
307306
try {
308307
Files.delete(getFullPath());
309308
} catch (IOException e) {
309+
getEngine().getLogger().logError("Tried to delete file in use.", e);
310310
throw new ServerException(e);
311311
}
312312
getEngine().getWebSocketServer().notifyRefresh(getParent(getPath()));

oraclestorage/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.ithit.webdav.samples</groupId>
88
<artifactId>oraclestorage</artifactId>
9-
<version>3.1.2208</version>
9+
<version>3.2.2370</version>
1010
<packaging>war</packaging>
1111

1212
<properties>
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.ithit.webdav.integration</groupId>
2525
<artifactId>servlet-integration</artifactId>
26-
<version>3.1.2208</version>
26+
<version>3.2.2370</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>commons-dbcp</groupId>
@@ -93,7 +93,7 @@
9393
<dependency>
9494
<groupId>com.ithit.webdav</groupId>
9595
<artifactId>webdav-server</artifactId>
96-
<version>3.1.2208</version>
96+
<version>3.2.2370</version>
9797
</dependency>
9898

9999
<dependency>
@@ -133,7 +133,7 @@
133133
<goal>copy-resources</goal>
134134
</goals>
135135
<configuration>
136-
<outputDirectory>${project.build.directory}/oraclestorage-3.1.2208/META-INF</outputDirectory>
136+
<outputDirectory>${project.build.directory}/oraclestorage-3.2.2370/META-INF</outputDirectory>
137137
<overwrite>true</overwrite>
138138
<resources>
139139
<resource>
@@ -212,7 +212,7 @@
212212
<server>filesystem</server>
213213
<port>11021</port>
214214
<path>/</path>
215-
<warSourceDirectory>target/oraclestorage-3.1.2208</warSourceDirectory>
215+
<warSourceDirectory>target/oraclestorage-3.2.2370</warSourceDirectory>
216216
</configuration>
217217
</plugin>
218218
<plugin>

0 commit comments

Comments
 (0)