Skip to content

Commit

Permalink
Removes assertions in IonReaderSystemTextX.stringValue().
Browse files Browse the repository at this point in the history
  • Loading branch information
tgregg committed Jan 25, 2024
1 parent dd2fdbf commit 581f868
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit 581f868

Please sign in to comment.