]> jaekl.net Git - squelch.git/commitdiff
Update to build in a modern environment master
authorChris Jaekl <chris@jaekl.net>
Thu, 20 Jun 2024 01:51:47 +0000 (21:51 -0400)
committerChris Jaekl <chris@jaekl.net>
Thu, 20 Jun 2024 01:51:47 +0000 (21:51 -0400)
This requires moving the minimum JDK version to 1.8, because
support for building 1.7-compatible classes seems to have been
dropped sometime between JDK17 and JDK20.

I also re-implemented DatatypeConverter.printHexString(), because
javax.xml.bind was removed from the JDK in JDK11.

.classpath
pom.xml
src/main/java/net/jaekl/squelch/stmt/Tabular.java
src/main/java/net/jaekl/squelch/util/DatatypeConverter.java [new file with mode: 0644]
src/test/java/net/jaekl/squelch/util/DatatypeConverterTest.java [new file with mode: 0644]

index 217e069d4b795ace4dfc7bd353345cea0fccee94..c2e1fb9f61dc4ebe2c51c5b5eac5480fa3071dfb 100644 (file)
@@ -1,12 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
-  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
-  <classpathentry kind="var" path="M2_REPO/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/jline/jline/2.14.1/jline-2.14.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/4.0/junit-4.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/postgresql/postgresql/9.4.1208.jre7/postgresql-9.4.1208.jre7.jar"/>
-</classpath>
\ No newline at end of file
+       <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
+       <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+               <attributes>
+                       <attribute name="module" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="var" path="M2_REPO/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar"/>
+       <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar"/>
+       <classpathentry kind="var" path="M2_REPO/jline/jline/2.14.1/jline-2.14.1.jar"/>
+       <classpathentry kind="var" path="M2_REPO/junit/junit/4.0/junit-4.0.jar"/>
+       <classpathentry kind="var" path="M2_REPO/org/postgresql/postgresql/9.4.1208.jre7/postgresql-9.4.1208.jre7.jar"/>
+       <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/pom.xml b/pom.xml
index 399bea92ec26fcc9d2e214e37573fa6f79adaa39..489922492450de94b3cc6ec06ca20fac0c587dae 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -43,8 +43,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
         <configuration>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
         <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
       <plugin>
         </configuration>
       </plugin>
       <plugin>
index 6a060f1a2b0e94c46e77b159289f278272caa1b7..6cab5c608c6180c2e3fabdc02566cb3dacd54174 100644 (file)
@@ -9,11 +9,10 @@ import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.sql.Types;
 
 import java.sql.SQLFeatureNotSupportedException;
 import java.sql.Types;
 
-import javax.xml.bind.DatatypeConverter;
-
 import net.jaekl.squelch.db.DbDriver;
 import net.jaekl.squelch.sql.Column;
 import net.jaekl.squelch.sql.Row;
 import net.jaekl.squelch.db.DbDriver;
 import net.jaekl.squelch.sql.Column;
 import net.jaekl.squelch.sql.Row;
+import net.jaekl.squelch.util.DatatypeConverter;;
 
 // Copyright (C) 2016 by Chris Jaekl
 //
 
 // Copyright (C) 2016 by Chris Jaekl
 //
diff --git a/src/main/java/net/jaekl/squelch/util/DatatypeConverter.java b/src/main/java/net/jaekl/squelch/util/DatatypeConverter.java
new file mode 100644 (file)
index 0000000..422d189
--- /dev/null
@@ -0,0 +1,13 @@
+package net.jaekl.squelch.util;
+
+public class DatatypeConverter {
+       public static String printHexBinary(byte[] content) {
+               StringBuilder sb = new StringBuilder();
+
+               for (int i = 0; i < content.length; ++i) {
+                       sb.append(String.format("%02x", content[i]));
+               }
+
+               return sb.toString();
+       }
+}
diff --git a/src/test/java/net/jaekl/squelch/util/DatatypeConverterTest.java b/src/test/java/net/jaekl/squelch/util/DatatypeConverterTest.java
new file mode 100644 (file)
index 0000000..a528c33
--- /dev/null
@@ -0,0 +1,22 @@
+package net.jaekl.squelch.util;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class DatatypeConverterTest {
+       @Test
+       public void testPrintHexBinary() {
+               String[][] data = {
+                               { "Hello, World", "48656c6c6f2c20576f726c64" },
+                               { "日本語がわかりますか?", "e697a5e69cace8aa9ee3818ce3828fe3818be3828ae381bee38199e3818befbc9f" },
+               };
+
+               for (int i = 0; i < data.length; ++i) {
+                       byte[] input = data[i][0].getBytes();
+                       String expected = data[i][1];
+
+                       assertEquals(expected, DatatypeConverter.printHexBinary(input));
+               }
+       }
+}
+