Skip to content

Commit

Permalink
Adds suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed Dec 4, 2024
1 parent 96b4f6e commit fece5ce
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/amazon/ion/impl/IonCursorBinary.java
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,7 @@ private void setCheckpointBeforeUnannotatedTypeId() {
*/
private void setMarker(long endIndex, Marker markerToSet) {
if (parent != null && endIndex > parent.endIndex && parent.endIndex > DELIMITED_MARKER) {
throw new IonException(String.format("Value [%s:%s] exceeds the length of its parent container [%s:%s].", peekIndex, endIndex, parent.startIndex, parent.endIndex));
throw new IonException(String.format("Value [%d:%d] exceeds the length of its parent container [%d:%d].", peekIndex, endIndex, parent.startIndex, parent.endIndex));
}
markerToSet.startIndex = peekIndex;
markerToSet.endIndex = endIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;

import static com.amazon.ion.SystemSymbols.ION_SYMBOL_TABLE_SID;
import static com.amazon.ion.SystemSymbols.DEFAULT_MODULE;
Expand Down Expand Up @@ -1378,11 +1377,11 @@ private Event coreNextValue() {
/**
* Utility function to make error cases more concise.
* @param condition the condition under which an IonException should be thrown
* @param lazyErrorMessage the message to use in the exception
* @param errorMessage the message to use in the exception
*/
private void errorIf(boolean condition, Supplier<String> lazyErrorMessage) {
private void errorIf(boolean condition, String errorMessage) {
if (condition) {
throw new IonException(lazyErrorMessage.get());
throw new IonException(errorMessage);
}
}

Expand All @@ -1405,18 +1404,18 @@ void readEncodingDirective() {
if (event == Event.NEEDS_DATA) {
return;
}
errorIf(event == Event.END_CONTAINER, () -> "invalid Ion directive; missing directive keyword");
errorIf(event == Event.END_CONTAINER, "invalid Ion directive; missing directive keyword");
classifyDirective();
break;
case IN_MODULE_DIRECTIVE_SEXP_AWAITING_MODULE_NAME:
event = coreNextValue();
if (event == Event.NEEDS_DATA) {
return;
}
errorIf(event == Event.END_CONTAINER, () -> "invalid module definition; missing module name");
errorIf(getEncodingType() != IonType.SYMBOL, () -> "invalid module definition; module name must be a symbol");
errorIf(event == Event.END_CONTAINER, "invalid module definition; missing module name");
errorIf(getEncodingType() != IonType.SYMBOL, "invalid module definition; module name must be a symbol");
// TODO: Support other module names
errorIf(!DEFAULT_MODULE.equals(getSymbolText()), () -> "IonJava currently supports only the default module");
errorIf(!DEFAULT_MODULE.equals(getSymbolText()), "IonJava currently supports only the default module");
state = State.IN_MODULE_DIRECTIVE_SEXP_BODY;
break;
case IN_MODULE_DIRECTIVE_SEXP_BODY:
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/amazon/ion/impl/macro/SystemMacro.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ enum class SystemMacro(
/**
* ```ion
* (macro set_symbols (symbols*)
* $ion::(
* $ion::(module _
* (symbol_table [(%symbols)])
* (macro_table _)
* ))
Expand All @@ -80,7 +80,7 @@ enum class SystemMacro(
/**
* ```ion
* (macro add_symbols (symbols*)
* $ion::(
* $ion::(module _
* (symbol_table _ [(%symbols)])
* (macro_table _)
* ))
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/amazon/ion/Ion_1_1_RoundTripTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class Ion_1_1_RoundTripTest {
companion object {

@JvmStatic
protected val DEBUG_MODE = true
protected val DEBUG_MODE = false

@JvmStatic
protected val ION = IonSystemBuilder.standard().build() as _Private_IonSystem
Expand Down

0 comments on commit fece5ce

Please sign in to comment.