changeset 4876:64ccf18bbad5

7099658: Properties.loadFromXML fails with ClassCastException Reviewed-by: alanb, mchung
author coffeys
date Thu, 27 Oct 2011 10:32:08 +0100
parents 449113aea001
children 8cd2e3b8127a
files src/share/classes/sun/util/xml/XMLUtils.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/util/xml/XMLUtils.java	Thu Oct 27 17:23:25 2011 +0800
+++ b/src/share/classes/sun/util/xml/XMLUtils.java	Thu Oct 27 10:32:08 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
@@ -76,7 +76,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(