Skip to content

Commit 700eaf9

Browse files
committed
Merge with xerial/master
2 parents 8c9c6a1 + 27cbdc0 commit 700eaf9

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
= SQLite JDBC Driver
2-
:project-version: 3.47.0.0
2+
:project-version: 3.47.1.0
33

44
image:https://img.shields.io/github/actions/workflow/status/willena/sqlite-jdbc-crypt/ci.yml?branch=master[GitHub Workflow Status (branch),link=https://github.com/willena/sqlite-jdbc/actions/workflows/ci.yml?query=branch%3Amaster]
55
image:https://maven-badges.herokuapp.com/maven-central/io.github.willena/sqlite-jdbc/badge.svg[Maven Central,link=https://maven-badges.herokuapp.com/maven-central/io.github.willena/sqlite-jdbc/]

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=3.47.0
2-
artifactVersion=3.47.0.0
3-
sqliteMCVersion=1.9.0
1+
version=3.47.1
2+
artifactVersion=3.47.1.0-SNAPSHOT
3+
sqliteMCVersion=1.9.1

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>io.github.willena</groupId>
66
<artifactId>sqlite-jdbc</artifactId>
7-
<version>3.47.0.0</version>
7+
<version>3.47.1.0-SNAPSHOT</version>
88
<name>SQLite JDBC</name>
99
<description>SQLite JDBC library with encryption and authentication support</description>
1010
<url>https://github.com/Willena/sqlite-jdbc-crypt</url>
@@ -197,7 +197,7 @@
197197
<plugin>
198198
<groupId>org.codehaus.mojo</groupId>
199199
<artifactId>versions-maven-plugin</artifactId>
200-
<version>2.17.1</version>
200+
<version>2.18.0</version>
201201
</plugin>
202202

203203
<plugin>

src/main/java/org/sqlite/ExtendedCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static String removeQuotation(String s) {
5454
if (s == null) return s;
5555

5656
if ((s.startsWith("\"") && s.endsWith("\"")) || (s.startsWith("'") && s.endsWith("'")))
57-
return s.substring(1, s.length() - 1);
57+
return (s.length() >= 2) ? s.substring(1, s.length() - 1) : s;
5858
else return s;
5959
}
6060

src/test/java/org/sqlite/ExtendedCommandTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
import static org.assertj.core.api.Assertions.assertThat;
1313

1414
import java.sql.SQLException;
15+
import java.util.stream.Stream;
1516
import org.junit.jupiter.api.Test;
17+
import org.junit.jupiter.params.ParameterizedTest;
18+
import org.junit.jupiter.params.provider.Arguments;
19+
import org.junit.jupiter.params.provider.MethodSource;
1620
import org.sqlite.ExtendedCommand.BackupCommand;
1721
import org.sqlite.ExtendedCommand.RestoreCommand;
1822
import org.sqlite.ExtendedCommand.SQLExtension;
@@ -69,4 +73,22 @@ public void parseRestoreCmd() throws SQLException {
6973
assertThat(b.targetDB).isEqualTo("main");
7074
assertThat(b.srcFile).isEqualTo("target/sample.db");
7175
}
76+
77+
@ParameterizedTest
78+
@MethodSource
79+
public void removeQuotation(String input, String expected) throws SQLException {
80+
assertThat(ExtendedCommand.removeQuotation(input)).isEqualTo(expected);
81+
}
82+
83+
private static Stream<Arguments> removeQuotation() {
84+
return Stream.of(
85+
Arguments.of(null, null), // Null String
86+
Arguments.of("'", "'"), // String with one single quotation only
87+
Arguments.of("\"", "\""), // String with one double quotation only
88+
Arguments.of("'Test\"", "'Test\""), // String with two mismatch quotations
89+
Arguments.of("'Test'", "Test"), // String with two matching single quotations
90+
Arguments.of("\"Test\"", "Test"), // String with two matching double quotations
91+
Arguments.of("'Te's\"t'", "Te's\"t") // String with more than two quotations
92+
);
93+
}
7294
}

0 commit comments

Comments
 (0)