Skip to content
Permalink
Browse files
8265106: IGV: Enforce en-US locale while parsing ideal graph
Co-authored-by: Roberto Castañeda Lozano <rcastanedalo@openjdk.org>
Reviewed-by: thartmann, chagedorn
  • Loading branch information
2 people authored and TobiHartmann committed Apr 21, 2021
1 parent 3de0dcb commit b5c92ca34fd274dc6bb8fc8e5639d30b8a60af73
@@ -34,6 +34,7 @@
import java.nio.channels.ReadableByteChannel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.swing.SwingUtilities;
import javax.xml.parsers.ParserConfigurationException;
@@ -529,6 +530,8 @@ public GraphDocument parse() throws IOException {
}
try {
XMLReader reader = createReader();
// To enforce using English for non-English users, we must use Locale.ROOT rather than Locale.ENGLISH
reader.setProperty("http://apache.org/xml/properties/locale", Locale.ROOT);
reader.setContentHandler(new XMLParser(xmlDocument, monitor));
reader.parse(new InputSource(Channels.newInputStream(channel)));
} catch (SAXException ex) {
@@ -222,4 +222,10 @@ public void testParse() {
testBoth(new GraphDocument(), "<graphDocument></graphDocument>");
}

@Test
public void testParseIncompleteXML() {
// Exception should be swallowed, see catch clause in GraphParser.parse.
testBoth(new GraphDocument(), "<graphDocument>");
}

}

1 comment on commit b5c92ca

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on b5c92ca Apr 21, 2021

Please sign in to comment.