8265106: IGV: Enforce en-US locale while parsing ideal graph
Co-authored-by: Roberto Castañeda Lozano <rcastanedalo@openjdk.org> Reviewed-by: thartmann, chagedorn
This commit is contained in:
parent
3de0dcba78
commit
b5c92ca34f
@ -34,6 +34,7 @@ import java.nio.channels.Channels;
|
||||
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 class Parser implements GraphParser {
|
||||
}
|
||||
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 class ParserTest {
|
||||
testBoth(new GraphDocument(), "<graphDocument></graphDocument>");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseIncompleteXML() {
|
||||
// Exception should be swallowed, see catch clause in GraphParser.parse.
|
||||
testBoth(new GraphDocument(), "<graphDocument>");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user