Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/ion-test-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ jobs:
ion-test-driver:
runs-on: macos-10.15
steps:
- name: env
run: env

- name: Checkout ion-java
uses: actions/checkout@master
with:
Expand All @@ -16,8 +19,8 @@ jobs:
- name: Checkout ion-test-driver
uses: actions/checkout@master
with:
repository: amzn/ion-test-driver
ref: master
repository: cheqianh/ion-test-driver
ref: fix
path: ion-test-driver

- name: Set up python3 env
Expand All @@ -26,6 +29,9 @@ jobs:
- name: Pip install
run: pip3 install -r ion-test-driver/requirements.txt && pip3 install -e ion-test-driver

- name: install whl from testpypi
run: pip3 install -i https://test.pypi.org/simple/ amazon.ion==0.7.95

- name: Get main branch HEAD sha
run: cd ion-java && echo `git rev-parse --short=7 HEAD` && echo "main=`git rev-parse --short=7 HEAD`" >> $GITHUB_ENV

Expand Down
7 changes: 6 additions & 1 deletion src/com/amazon/ion/impl/IonTokenConstsX.java
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,12 @@ public static int decodeSid(CharSequence sidToken)
assert length > 1;

String digits = sidToken.subSequence(1, length).toString();
return Integer.parseInt(digits);

try {
return Integer.parseInt(digits);
} catch (Exception e) {
throw new IonException(String.format("Unable to parse SID %s", digits), e);
}
}

static public int keyword(CharSequence word, int start_word, int end_word)
Expand Down
11 changes: 11 additions & 0 deletions test/com/amazon/ion/LoaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ public void testIgnoreHeaderSymbol()
checkInt(123, value);
}

@Test
public void testLargeSidSymbol()
{
String text = "$11111111111111";

// it's supposed to throw an IonException since sid is greater than INT_MAX.
try {
IonSymbol value = (IonSymbol) loadOneValue(text);
Assert.fail("Expected IonException to be thrown.");
} catch (IonException ignore) { /* expected to reach here */ }
}

private static class FailingInputStream extends InputStream
{
Expand Down