Skip to content

Commit 886f06d

Browse files
committed
fixes #1566
1 parent c1c38fe commit 886f06d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/java/net/sf/jsqlparser/expression/StringValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public StringValue() {
3131

3232
public StringValue(String escapedValue) {
3333
// removing "'" at the start and at the end
34-
if (escapedValue.startsWith("'") && escapedValue.endsWith("'")) {
34+
if (escapedValue.length() >= 2 && escapedValue.startsWith("'") && escapedValue.endsWith("'")) {
3535
value = escapedValue.substring(1, escapedValue.length() - 1);
3636
return;
3737
}

src/test/java/net/sf/jsqlparser/expression/StringValueTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,10 @@ private void checkStringValue(String original, String expectedValue, String expe
5757
assertEquals(expectedValue, v.getValue());
5858
assertEquals(expectedPrefix, v.getPrefix());
5959
}
60+
61+
@Test
62+
public void testIssue1566EmptyStringValue() {
63+
StringValue v = new StringValue("'");
64+
assertEquals("'", v.getValue());
65+
}
6066
}

0 commit comments

Comments
 (0)