Skip to content

Commit 3909b1b

Browse files
committed
Fix compatibility with java 9+
1 parent 7f22e43 commit 3909b1b

File tree

4 files changed

+17
-26
lines changed

4 files changed

+17
-26
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/org/utplsql/api/ResourceUtil.java

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.utplsql.api;
22

3-
import com.sun.nio.zipfs.ZipPath;
43
import org.utplsql.api.reporter.CoverageHTMLReporter;
54

65
import java.io.IOException;
@@ -9,10 +8,7 @@
98
import java.nio.file.*;
109
import java.util.ArrayList;
1110
import java.util.Collections;
12-
import java.util.Enumeration;
1311
import java.util.List;
14-
import java.util.zip.ZipEntry;
15-
import java.util.zip.ZipFile;
1612

1713
/**
1814
* Helper class for dealing with Resources
@@ -61,26 +57,10 @@ public static List<Path> getListOfChildren(Path resourceAsPath, boolean filesOnl
6157

6258
final List<Path> result = new ArrayList<>();
6359

64-
if (resourcePath instanceof ZipPath) {
65-
try (ZipFile zf = new ZipFile(resourcePath.getFileSystem().toString())) {
60+
Files.walk(resourcePath)
61+
.filter(p -> !filesOnly || p.toFile().isFile())
62+
.forEach(p -> result.add(p.subpath(relativeStartIndex, p.getNameCount())));
6663

67-
for (Enumeration list = zf.entries(); list.hasMoreElements(); ) {
68-
ZipEntry entry = (ZipEntry) list.nextElement();
69-
// Get entry-path with root element so we can compare it
70-
Path entryPath = resourcePath.getRoot().resolve(resourcePath.getFileSystem().getPath(entry.toString()));
71-
72-
if (entryPath.startsWith(resourcePath) && (!filesOnly || !entry.isDirectory())) {
73-
result.add(entryPath.subpath(relativeStartIndex, entryPath.getNameCount()));
74-
}
75-
}
76-
}
77-
resourcePath.getFileSystem().close();
78-
} else {
79-
Files.walk(resourcePath)
80-
.filter(p -> !filesOnly || p.toFile().isFile())
81-
.forEach(p -> result.add(p.subpath(relativeStartIndex, p.getNameCount())));
82-
83-
}
8464

8565
return result;
8666
}

src/main/java/org/utplsql/api/reporter/Reporter.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.utplsql.api.compatibility.CompatibilityProxy;
1111
import org.utplsql.api.outputBuffer.OutputBuffer;
1212

13-
import javax.xml.bind.DatatypeConverter;
1413
import java.sql.Connection;
1514
import java.sql.SQLException;
1615

@@ -114,4 +113,17 @@ public Datum toDatum(Connection c) throws SQLException {
114113
public OutputBuffer getOutputBuffer() {
115114
return outputBuffer;
116115
}
116+
117+
private static class DatatypeConverter {
118+
private static final char[] hexCode = "0123456789ABCDEF".toCharArray();
119+
120+
static String printHexBinary(byte[] data) {
121+
StringBuilder r = new StringBuilder(data.length * 2);
122+
for (byte b : data) {
123+
r.append(hexCode[(b >> 4) & 0xF]);
124+
r.append(hexCode[(b & 0xF)]);
125+
}
126+
return r.toString();
127+
}
128+
}
117129
}

src/test/java/org/utplsql/api/OptionalFeaturesIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.utplsql.api;
22

33
import org.junit.jupiter.api.Test;
4-
import org.omg.CORBA.DynAnyPackage.Invalid;
54
import org.utplsql.api.compatibility.CompatibilityProxy;
65
import org.utplsql.api.compatibility.OptionalFeatures;
76
import org.utplsql.api.exception.InvalidVersionException;

0 commit comments

Comments
 (0)