diff --git a/README.md b/README.md index df4de2899..267ca745c 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ If you want to take a look at the current beta version, go ahead and download [C - *NEW:* No Metadata at all. Encrypted files can be decrypted even on completely shuffled file systems (if their contents are undamaged). ## Dependencies -- Java 8 (for UI only - runs headless on Java 7) +- Java 8 - Maven - Awesome 3rd party open source libraries (Apache Commons, Apache Jackrabbit, Jetty, Jackson, ...) diff --git a/main/core/pom.xml b/main/core/pom.xml index aa9d801c4..8d9e47899 100644 --- a/main/core/pom.xml +++ b/main/core/pom.xml @@ -63,18 +63,4 @@ commons-collections4 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - diff --git a/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/EncryptedDir.java b/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/EncryptedDir.java index 9c500d56f..2624ca4fd 100644 --- a/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/EncryptedDir.java +++ b/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/EncryptedDir.java @@ -139,8 +139,8 @@ public class EncryptedDir extends AbstractEncryptedNode { if (Files.exists(path)) { try { final BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class); - properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, attrs.creationTime().toMillis())); - properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, attrs.lastModifiedTime().toMillis())); + properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, FileTimeUtils.toRfc1123String(attrs.creationTime()))); + properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, FileTimeUtils.toRfc1123String(attrs.lastModifiedTime()))); } catch (IOException e) { LOG.error("Error determining metadata " + path.toString(), e); // don't add any further properties diff --git a/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/EncryptedFile.java b/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/EncryptedFile.java index 0d834b8b7..ece0f5b83 100644 --- a/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/EncryptedFile.java +++ b/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/EncryptedFile.java @@ -96,8 +96,8 @@ public class EncryptedFile extends AbstractEncryptedNode { properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, contentLength)); final BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class); - properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, attrs.creationTime().toMillis())); - properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, attrs.lastModifiedTime().toMillis())); + properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, FileTimeUtils.toRfc1123String(attrs.creationTime()))); + properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, FileTimeUtils.toRfc1123String(attrs.lastModifiedTime()))); } catch (IOException e) { LOG.error("Error determining metadata " + path.toString(), e); throw new IORuntimeException(e); diff --git a/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/FileTimeUtils.java b/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/FileTimeUtils.java new file mode 100644 index 000000000..43e8b97d3 --- /dev/null +++ b/main/core/src/main/java/org/cryptomator/webdav/jackrabbit/resources/FileTimeUtils.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2014 Sebastian Stenzel + * This file is licensed under the terms of the MIT license. + * See the LICENSE.txt file for more info. + * + * Contributors: + * Sebastian Stenzel - initial API and implementation + ******************************************************************************/ +package org.cryptomator.webdav.jackrabbit.resources; + +import java.nio.file.attribute.FileTime; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; + +public final class FileTimeUtils { + + private FileTimeUtils() { + throw new IllegalStateException("not instantiable"); + } + + public static String toRfc1123String(FileTime time) { + final Temporal date = OffsetDateTime.ofInstant(time.toInstant(), ZoneId.systemDefault()); + return DateTimeFormatter.RFC_1123_DATE_TIME.format(date); + } + +} diff --git a/main/crypto-aes/pom.xml b/main/crypto-aes/pom.xml index 43fc78669..28353ef82 100644 --- a/main/crypto-aes/pom.xml +++ b/main/crypto-aes/pom.xml @@ -48,18 +48,4 @@ jackson-databind - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - diff --git a/main/crypto-api/pom.xml b/main/crypto-api/pom.xml index d6a342c35..6ddff5e71 100644 --- a/main/crypto-api/pom.xml +++ b/main/crypto-api/pom.xml @@ -23,18 +23,4 @@ commons-io - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - \ No newline at end of file diff --git a/main/pom.xml b/main/pom.xml index a40f61dbe..e2304fee8 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -141,5 +141,19 @@ core ui + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + + + diff --git a/main/ui/pom.xml b/main/ui/pom.xml index cbaccf9b7..4eb801f68 100644 --- a/main/ui/pom.xml +++ b/main/ui/pom.xml @@ -60,16 +60,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - - - maven-assembly-plugin diff --git a/main/ui/src/main/java/org/cryptomator/ui/InitializeController.java b/main/ui/src/main/java/org/cryptomator/ui/InitializeController.java index 3d62314f1..0e1e677b7 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/InitializeController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/InitializeController.java @@ -152,7 +152,7 @@ public class InitializeController implements Initializable { IOUtils.closeQuietly(masterKeyOutputStream); } } - + private boolean isDirectoryEmpty() { try { final DirectoryStream dirContents = Files.newDirectoryStream(directory.getPath()); @@ -162,22 +162,22 @@ public class InitializeController implements Initializable { throw new IllegalStateException(e); } } - + private boolean shouldEncryptExistingFiles() { final Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(localization.getString("initialize.alert.directoryIsNotEmpty.title")); - alert.setHeaderText(localization.getString("initialize.alert.directoryIsNotEmpty.header")); + alert.setHeaderText(null); alert.setContentText(localization.getString("initialize.alert.directoryIsNotEmpty.content")); final Optional result = alert.showAndWait(); return ButtonType.OK.equals(result.get()); } - + private void encryptExistingContents() throws IOException { final FileVisitor visitor = new EncryptingFileVisitor(directory.getPath(), directory.getCryptor(), this::shouldEncryptExistingFile); Files.walkFileTree(directory.getPath(), visitor); } - + private boolean shouldEncryptExistingFile(Path path) { final String name = path.getFileName().toString(); return !directory.getPath().equals(path) && !name.endsWith(Aes256Cryptor.BASIC_FILE_EXT) && !name.endsWith(Aes256Cryptor.METADATA_FILE_EXT) && !name.endsWith(Aes256Cryptor.MASTERKEY_FILE_EXT); diff --git a/main/ui/src/main/resources/localization.properties b/main/ui/src/main/resources/localization.properties index e631f86e8..7bf687998 100644 --- a/main/ui/src/main/resources/localization.properties +++ b/main/ui/src/main/resources/localization.properties @@ -19,8 +19,7 @@ initialize.label.username=Username initialize.label.password=Password initialize.label.retypePassword=Retype password initialize.button.ok=Create vault -initialize.alert.directoryIsNotEmpty.title=Confirm -initialize.alert.directoryIsNotEmpty.header=The chosen directory is not empty. +initialize.alert.directoryIsNotEmpty.title=The chosen directory is not empty initialize.alert.directoryIsNotEmpty.content=All existing files inside this directory will get encrypted. Continue?