[hg] main-silver: #208648: When malformed project.xml file, ille...

  • From: Martin Kozeny < >
  • To:
  • Subject: [hg] main-silver: #208648: When malformed project.xml file, ille...
  • Date: Tue, 21 May 2013 14:37:36 -0700

changeset 3e449a3d0d81 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/3e449a3d0d81
description:
        #208648: When malformed project.xml file, illegal argument exception 
is caught.

diffstat:

 
apisupport.ant/src/org/netbeans/modules/apisupport/project/ProjectXMLManager.java
   |  5 +++++
 
apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ModuleList.java
 |  5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diffs (44 lines):

diff --git 
a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ProjectXMLManager.java
 
b/apisupport.ant/src/org/netbeans/modules/apisupport/project/ProjectXMLManager.java
--- 
a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ProjectXMLManager.java
+++ 
b/apisupport.ant/src/org/netbeans/modules/apisupport/project/ProjectXMLManager.java
@@ -973,6 +973,7 @@
      */
     private static Set<ManifestManager.PackageExport> 
findAllPackages(Element parent) {
         Set<ManifestManager.PackageExport> packages = new 
HashSet<ManifestManager.PackageExport>();
+        try {
         for (Element pkgEl : XMLUtil.findSubElements(parent)) {
             if (PACKAGE.equals(pkgEl.getTagName())) {
                 packages.add(new 
ManifestManager.PackageExport(XMLUtil.findText(pkgEl), false));
@@ -980,6 +981,10 @@
                 packages.add(new 
ManifestManager.PackageExport(XMLUtil.findText(pkgEl), true));
             }
         }
+        } catch(IllegalArgumentException e) {
+            LOG.log(Level.WARNING, "Error getting subelements, malformed 
xml");
+            packages = new HashSet<ManifestManager.PackageExport>();
+        }
         return packages;
     }
 
diff --git 
a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ModuleList.java
 
b/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ModuleList.java
--- 
a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ModuleList.java
+++ 
b/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ModuleList.java
@@ -544,6 +544,7 @@
         String module = eval.getProperty("module.jar"); // NOI18N
         // Cf. ParseProjectXml.computeClasspath:
         StringBuilder cpextra = new StringBuilder();
+        try {
         for (Element ext : XMLUtil.findSubElements(data)) {
             if (!ext.getLocalName().equals("class-path-extension")) { // 
NOI18N
                 continue;
@@ -567,6 +568,10 @@
             cpextra.append(File.pathSeparatorChar);
             cpextra.append(binary.getAbsolutePath());
         }
+        } catch(IllegalArgumentException e) {
+            LOG.log(Level.WARNING, "Error getting subelements, malformed 
xml");
+            cpextra = new StringBuilder();
+        }
         File manifest = new File(basedir, "manifest.mf"); // NOI18N
         ManifestManager mm = (manifest.isFile() ? 
             ManifestManager.getInstance(manifest, false) : 
ManifestManager.NULL_INSTANCE);

[hg] main-silver: #208648: When malformed project.xml file, ille...

Martin Kozeny 05/21/2013

Project Features

About this Project

APIsupport was started in November 2009, is owned by Antonin Nebuzelsky, and has 43 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close