jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1832517 - /jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/io/DocViewFormatTest.java
Date Wed, 30 May 2018 07:15:02 GMT
Author: reschke
Date: Wed May 30 07:15:01 2018
New Revision: 1832517

URL: http://svn.apache.org/viewvc?rev=1832517&view=rev
Log:
JCRVLT-294: DocViewFormatTest fails on Windows

Modified:
    jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/io/DocViewFormatTest.java

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/io/DocViewFormatTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/io/DocViewFormatTest.java?rev=1832517&r1=1832516&r2=1832517&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/io/DocViewFormatTest.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/fs/io/DocViewFormatTest.java
Wed May 30 07:15:01 2018
@@ -25,13 +25,13 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.Arrays;
+import java.util.Calendar;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 import java.util.regex.Pattern;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.util.ISO8601;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -44,7 +44,8 @@ public class DocViewFormatTest {
     @Before
     public void setup() throws IOException {
         String tempDir = System.getProperty("java.io.tmpdir");
-        dir = new File(tempDir + File.separator + "DocViewFormatTest" + new Date().toString());
+        dir = new File(tempDir + File.separator + "DocViewFormatTest-"
+                + ISO8601.format(Calendar.getInstance()).replace(":", "").replace(".", "").replace("-",
""));
         assert dir.mkdir();
         docViewFile = new File(dir.getPath() + File.separator + "malformed.xml");
         assert docViewFile.createNewFile();
@@ -59,12 +60,14 @@ public class DocViewFormatTest {
 
     @After
     public void tearDown() {
-        if (!docViewFile.delete()) {
-            docViewFile.deleteOnExit();
-            dir.deleteOnExit();
-        } else {
-            if (!dir.delete()) {
+        if (docViewFile != null) {
+            if (!docViewFile.delete()) {
+                docViewFile.deleteOnExit();
                 dir.deleteOnExit();
+            } else {
+                if (!dir.delete()) {
+                    dir.deleteOnExit();
+                }
             }
         }
     }



Mime
View raw message