changeset 4415:78d6e4fd8cbe

7099658: Properties.loadFromXML fails with ClassCastException Reviewed-by: alanb, mchung
author coffeys
date Thu, 27 Oct 2011 22:56:10 +0100
parents ee50c18ede0d
children 07abe3cc996f 9fa99d3b3244
files src/share/classes/java/util/XMLUtils.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/XMLUtils.java	Thu Jun 23 13:00:14 2011 +0100
+++ b/src/share/classes/java/util/XMLUtils.java	Thu Oct 27 22:56:10 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
         } catch (SAXException saxe) {
             throw new InvalidPropertiesFormatException(saxe);
         }
-        Element propertiesElement = (Element)doc.getChildNodes().item(1);
+        Element propertiesElement = doc.getDocumentElement();
         String xmlVersion = propertiesElement.getAttribute("version");
         if (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0)
             throw new InvalidPropertiesFormatException(