Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes assertions in IonReaderSystemTextX.stringValue(). #703

Merged
merged 1 commit into from
Jan 25, 2024
Merged
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
2 changes: 0 additions & 2 deletions src/main/java/com/amazon/ion/impl/IonReaderTextSystemX.java
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,7 @@ public final String stringValue()
load_or_cast_cached_value(AS_TYPE.string_value);
String text = _v.getString();
if (text == null) {
assert _value_type == IonType.SYMBOL;
int sid = _v.getInt();
assert sid > 0;
throw new UnknownSymbolException(sid);
}
return text;
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/com/amazon/ion/streaming/ReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.amazon.ion.ReaderMaker;
import com.amazon.ion.SymbolTable;
import com.amazon.ion.SymbolToken;
import com.amazon.ion.UnknownSymbolException;
import com.amazon.ion.junit.Injected.Inject;
import com.amazon.ion.junit.IonAssert;
import java.io.IOException;
Expand Down Expand Up @@ -193,6 +194,14 @@ public void testStringValueOnNonText()
}
}

@Test
public void testStringValueOnSymbolWithUndefinedText()
{
read("$0");
assertEquals(IonType.SYMBOL, in.next());
assertThrows(UnknownSymbolException.class, () -> in.stringValue());
}

@Test
public void testSymbolValue()
throws Exception
Expand Down
Loading