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

Setting charset on an empty XML doc throws and index out of bounds exception #2266

Closed
jhy opened this issue Jan 28, 2025 · 0 comments
Closed
Assignees
Labels
bug A confirmed bug, that we should fix fixed An {bug|improvement} that has been {fixed|implemented}
Milestone

Comments

@jhy
Copy link
Owner

jhy commented Jan 28, 2025

Document xml = new Document(Parser.NamespaceXml, "https://example.com"); // no child nodes yet
xml.outputSettings().syntax(Syntax.xml);
xml.charset(StandardCharsets.UTF_8);
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
	at java.base/java.util.Objects.checkIndex(Objects.java:361)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	at org.jsoup.nodes.Document.ensureMetaCharsetElement(Document.java:366)
	at org.jsoup.nodes.Document.charset(Document.java:274)
	at suds.Feed.generateFeed(Feed.java:35)
	at suds.Suds.processEverything(Suds.java:120)
	... 1 more
@jhy jhy added the bug A confirmed bug, that we should fix label Jan 28, 2025
@jhy jhy added this to the 1.19.1 milestone Jan 28, 2025
@jhy jhy self-assigned this Jan 28, 2025
@jhy jhy closed this as completed in 5d31cac Jan 28, 2025
@jhy jhy added the fixed An {bug|improvement} that has been {fixed|implemented} label Jan 28, 2025
Repository owner deleted a comment from cassiork Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A confirmed bug, that we should fix fixed An {bug|improvement} that has been {fixed|implemented}
Projects
None yet
Development

No branches or pull requests

1 participant