Bug Fix # 131969 NoClassDefFoundError: javax/ejb/CreateException
authorSandip V. Chitale <sandipchitale@netbeans.org>
Fri, 04 Apr 2008 10:20:42 -0700
changeset 3022a11aa85bd591
parent 3021 9c2279c69e92
child 3023 89f141eb13d1
Bug Fix # 131969 NoClassDefFoundError: javax/ejb/CreateException

Incorporate review feedback.
Close JarFile in finally block.
Log exceptions.
visualweb.insync/src/org/netbeans/modules/visualweb/insync/ModelSet.java
     1.1 --- a/visualweb.insync/src/org/netbeans/modules/visualweb/insync/ModelSet.java	Thu Apr 03 17:03:48 2008 -0700
     1.2 +++ b/visualweb.insync/src/org/netbeans/modules/visualweb/insync/ModelSet.java	Fri Apr 04 10:20:42 2008 -0700
     1.3 @@ -92,6 +92,7 @@
     1.4  import org.openide.loaders.DataLoaderPool;
     1.5  import org.openide.loaders.OperationEvent;
     1.6  import org.openide.loaders.OperationListener;
     1.7 +import org.openide.util.Exceptions;
     1.8  import org.openide.util.Lookup;
     1.9  import org.openide.util.NbBundle;
    1.10  import org.openide.util.WeakListeners;
    1.11 @@ -460,7 +461,7 @@
    1.12                  FileObject ejbClientsSubDir = projectLibDir.getFileObject(EJB_DATA_SUB_DIR);
    1.13                  hasEjbClients = (ejbClientsSubDir != null && hasJarFiles(ejbClientsSubDir));
    1.14              } catch (IOException e) {
    1.15 -                // not found - ignore
    1.16 +                ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
    1.17              }
    1.18              
    1.19              //"classpath/packaged" gives us all the jars excluding app server jars in case of maven project
    1.20 @@ -487,14 +488,18 @@
    1.21                              if (file.isFile() && file.getName().endsWith(".jar")) {
    1.22                                  try {
    1.23                                      JarFile jarFile = new JarFile(file);
    1.24 -                                    // Found one of the ejb20 classes - use this jar file
    1.25 -                                    if (jarFile.getEntry("javax/ejb/CreateException.class") != null) {
    1.26 -                                        // We need to keep this jar in designtime classpath
    1.27 -                                        continue;                                            
    1.28 +                                    try {
    1.29 +                                        // Found one of the ejb20 classes - use this jar file
    1.30 +                                        if (jarFile.getEntry("javax/ejb/CreateException.class") != null) {
    1.31 +                                            // We need to keep this jar in designtime classpath
    1.32 +                                            continue;                                            
    1.33 +                                        }
    1.34 +                                    } finally {
    1.35 +                                        jarFile.close();
    1.36                                      }
    1.37                                  } catch (IOException e) {
    1.38 -                                    // corrupt .jar file
    1.39 -                                }
    1.40 +                                    ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
    1.41 +                                } 
    1.42                              }
    1.43                          }
    1.44                          // Is this a URL from J2ee Classpath