Mechtilde Stehmann pushed to branch upstream at Debian Java Maintainers / 
csvjdbc


Commits:
4ab79722 by Mechtilde at 2019-12-22T17:35:07Z
New upstream version 1.0.36+ds
- - - - -


8 changed files:

- .travis.yml
- build/build.xml
- pom.xml
- src/main/java/org/relique/io/FileSetInputStream.java
- src/main/java/org/relique/jdbc/csv/CsvConnection.java
- src/test/java/org/relique/jdbc/csv/TestFileSetInputStream.java
- + src/testdata/petr-333-444.csv
- + src/testdata/petr-555-666.csv


Changes:

=====================================
.travis.yml
=====================================
@@ -1,2 +1,4 @@
 language: java
-install: mvn install -DskipTests=true -Dgpg.skip=true
+jdk:
+  - openjdk8
+install: mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true


=====================================
build/build.xml
=====================================
@@ -36,7 +36,7 @@
   <!-- =================================================================== -->
   <property name="TALK" value="false" />
   <property name="name" value="csvjdbc"/>
-  <property name="rel" value="1.0-35"/>
+  <property name="rel" value="1.0-36"/>
   <property name="rel.name" value="${name}-${rel}"/>
   <property name="build.dir" value="../build"/>
   <property name="src.dir" value="../src"/>


=====================================
pom.xml
=====================================
@@ -3,7 +3,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>net.sourceforge.csvjdbc</groupId>
   <artifactId>csvjdbc</artifactId>
-  <version>1.0.35</version>
+  <version>1.0.36</version>
   <packaging>jar</packaging>
   <name>CsvJdbc</name>
   <description>a Java JDBC driver for reading comma-separated-value 
files</description>
@@ -18,7 +18,7 @@
 
   <scm>
     <connection>scm:git:ssh://git.code.sf.net/p/csvjdbc/code</connection>
-    <tag>csvjdbc-1.0.35</tag>
+    <tag>csvjdbc-1.0.36</tag>
     <url>http://sourceforge.net/p/csvjdbc/_list/git</url>
   </scm>
 
@@ -72,7 +72,12 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
-        <version>2.9.1</version>
+        <version>3.1.1</version>
+        <configuration>
+          <additionalOptions>
+            <additionalOption>-Xdoclint:none</additionalOption>
+          </additionalOptions>
+        </configuration>
         <executions>
           <execution>
             <id>attach-javadocs</id>


=====================================
src/main/java/org/relique/io/FileSetInputStream.java
=====================================
@@ -222,6 +222,13 @@ public class FileSetInputStream extends InputStream
                                doingTail = true;
                                return readFromTail();
                        }
+                       if (lookahead == -1 && ch != '\n' && ch != -1)
+                       {
+                               // If last line of file does not end with a 
newline,
+                               // then add a newline, so prepended fields for 
the
+                               // next file begin on a new line.
+                               lookahead = '\n';
+                       }
                }
                else
                {


=====================================
src/main/java/org/relique/jdbc/csv/CsvConnection.java
=====================================
@@ -305,6 +305,14 @@ public class CsvConnection implements Connection
                if (info.getProperty(CsvDriver.SEPARATOR) != null)
                {
                        separator = info.getProperty(CsvDriver.SEPARATOR);
+
+                       // Tab character is a commonly used separator.
+                       // Accept tab expanded to two characters '\\' and '\t'. 
This
+                       // occurs if user types properties into a GUI text 
field,
+                       // instead of writing them as Java source code.
+                       if (separator.equals("\\t"))
+                               separator = "\t";
+
                        if (separator.length() == 0)
                                throw new 
SQLException(CsvResources.getString("invalid") + " " + CsvDriver.SEPARATOR + ": 
" + separator);
                }


=====================================
src/test/java/org/relique/jdbc/csv/TestFileSetInputStream.java
=====================================
@@ -19,6 +19,7 @@
 
 package org.relique.jdbc.csv;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -217,6 +218,39 @@ public class TestFileSetInputStream
                                inputTest.close();
                }
        }
+
+       @Test
+       public void testGlueAsLeadingLastLineNoNewline() throws IOException
+       {
+               BufferedReader inputTest = null;
+
+               try
+               {
+                       String separator = ",";
+
+                       // Test CSV files with no '\n' on last line
+                       inputTest = new BufferedReader(new InputStreamReader(
+                               new FileSetInputStream(filePath,
+                                               
"petr-([0-9]{3})-([0-9]{3}).csv", new String[] {
+                                                               "part1", 
"part2" }, separator, true, true, null, 0)));
+
+                       String lineTest = inputTest.readLine();
+                       while (lineTest != null)
+                       {
+                               // Files have no special characters, so we can 
simply split on separator
+                               String []columns = lineTest.split(separator);
+                               // CSV file contains two columns, plus two 
extra columns from filename
+                               int expectedColumns = 4;
+                               assertEquals("Expected number of columns", 
expectedColumns, columns.length);
+                               lineTest = inputTest.readLine();
+                       }
+               }
+               finally
+               {
+                       if (inputTest != null)
+                               inputTest.close();
+               }
+       }
        
        @Test
        public void testFileSetInputStreamClose() throws IOException


=====================================
src/testdata/petr-333-444.csv
=====================================
@@ -0,0 +1,3 @@
+column1,column2
+abc,def
+ghi,jkl
\ No newline at end of file


=====================================
src/testdata/petr-555-666.csv
=====================================
@@ -0,0 +1,3 @@
+column1,column2
+mno,qrs
+tuv,wxy
\ No newline at end of file



View it on GitLab: 
https://salsa.debian.org/java-team/csvjdbc/commit/4ab797223e0856aea04a828994f19152801e1041

-- 
View it on GitLab: 
https://salsa.debian.org/java-team/csvjdbc/commit/4ab797223e0856aea04a828994f19152801e1041
You're receiving this email because of your account on salsa.debian.org.


_______________________________________________
pkg-java-commits mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to