Changeset 3078


Ignore:
Timestamp:
Jan 22, 2007, 2:51:17 PM (15 years ago)
Author:
Nicklas Nordborg
Message:

References #459: Better error message if plugin jar can't be found

Throw InvalidDataException? instead of IOException to make the web application display a simple
error message instead of a complete stack trace.

Location:
trunk/src/core/net/sf/basedb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/PluginDefinition.java

    r3074 r3078  
    3939import net.sf.basedb.util.JarClassLoader;
    4040
    41 import java.io.IOException;
    4241import java.util.Collection;
    4342import java.util.Collections;
     
    981980      return (Plugin)c.newInstance();
    982981    }
    983     catch (IOException ioex)
    984     {
    985       throw new BaseException(ioex);
     982    catch (BaseException bex)
     983    {
     984      throw bex;
    986985    }
    987986    catch (Exception ex)
  • trunk/src/core/net/sf/basedb/util/JarClassLoader.java

    r3052 r3078  
    3737import java.net.MalformedURLException;
    3838
     39import net.sf.basedb.core.InvalidDataException;
     40
    3941/**
    4042  A class loader implementation that loads classes from JAR files.
     
    134136    Create a new JAR file class loader.
    135137    @param jarPath The path to the JAR file
    136     @throws IOException If the JAR file can't be loaded
     138    @throws InvalidDataException If the JAR file can't be loaded
     139    @throws IOException If there is another IO-related error
    137140  */
    138141  private JarClassLoader(String jarPath)
     
    141144    super(Thread.currentThread().getContextClassLoader());
    142145    mainJarFile = new File(jarPath);
    143     if (!mainJarFile.exists()) throw new IOException("Couldn't find jar-file: \"" + jarPath + "\"");
     146    if (!mainJarFile.exists()) throw new InvalidDataException("JAR file not found: " + jarPath);
    144147    classPath = new HashMap<String, File>();
    145148    loadJarFile(mainJarFile, true);
Note: See TracChangeset for help on using the changeset viewer.