Skip to content

Commits on Source 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
......@@ -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"/>
......
csvjdbc (1.0.36+ds-1) unstable; urgency=medium
[ Mechtilde ]
* [cb3d027] Added Headline to debian/maven.rules
* [4ab7972] New upstream version 1.0.36+ds
-- Mechtilde Stehmann <mechtilde@debian.org> Sun, 22 Dec 2019 18:49:34 +0100
csvjdbc (1.0.35+ds-1) unstable; urgency=medium
[ Christopher Hoskin ]
......
#[groupID] [artifactID] [type] [version] [classifier] [scope]
junit junit jar s/4\..*/4.x/ * *
net.sourceforge.csvjdbc csvjdbc jar s/.*/debian/ * *
......@@ -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>
......
......@@ -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
{
......
......@@ -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);
}
......
......@@ -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;
......@@ -218,6 +219,39 @@ public class TestFileSetInputStream
}
}
@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
{
......
column1,column2
abc,def
ghi,jkl
\ No newline at end of file
column1,column2
mno,qrs
tuv,wxy
\ No newline at end of file