Skip to content

throw loader exception on repeated string in StringPool.readFrom#88

Open
aizu-m wants to merge 1 commit into
apache:trunkfrom
aizu-m:xsb-stringpool-readfrom-repeat
Open

throw loader exception on repeated string in StringPool.readFrom#88
aizu-m wants to merge 1 commit into
apache:trunkfrom
aizu-m:xsb-stringpool-readfrom-repeat

Conversation

@aizu-m

@aizu-m aizu-m commented Jul 19, 2026

Copy link
Copy Markdown

Fed a hand-corrupted .xsb at the schema loader to watch where it fell over:

java.lang.IllegalStateException
    at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$StringPool.readFrom(SchemaTypeSystemImpl.java:728)
    at org.apache.xmlbeans.impl.schema.XsbReader.<init>(XsbReader.java:103)
    at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.resolveHandle(SchemaTypeSystemImpl.java:954)

readFrom fills the string pool by reading each entry and checking its assigned code equals the running index i. codeForString hands back the earlier code for a repeated string, so a pool that lists the same string twice makes code != i and trips a bare IllegalStateException with no message. readFrom only wraps IOException, so it leaks out as an undocumented runtime exception rather than the SchemaTypeLoaderException the loader is meant to raise; crackPointer catches only IOException too and sees the same thing while cracking a pointer file.

Threw SchemaTypeLoaderException the way stringForCode and the rest of the pool already report trouble. The size/emptiness check above it is a real internal invariant, so I left it. Valid files read back unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant