When an invalid source map state is encountered, throw a SourceMapParseException instead of IllegalStateException so that existing error handling properly recognizes this case.
Closes
@@ -243,7 +243,7 @@ public final class SourceMapConsumerV3 implements SourceMapConsumer,
this.content = new StringCharIterator(lineMap);
}
- void build() {
+ void build() throws SourceMapParseException {
int [] temp = new int[MAX_ENTRY_VALUES];
ArrayList<Entry> entries = new ArrayList<>();
while (content.hasNext()) {
@@ -309,7 +309,7 @@ public final class SourceMapConsumerV3 implements SourceMapConsumer,
* @param entryValues The number of entries in the array.
* @return The entry object.
*/
- private Entry decodeEntry(int[] vals, int entryValues) {
+ private Entry decodeEntry(int[] vals, int entryValues) throws SourceMapParseException {
Entry entry;
switch (entryValues) {
// The first values, if present are in the following order:
@@ -363,7 +363,7 @@ public final class SourceMapConsumerV3 implements SourceMapConsumer,
return entry;
default:
- throw new IllegalStateException(
+ throw new SourceMapParseException(
"Unexpected number of values for entry:" + entryValues);
}
}
