jruaux 2003/02/04 08:54:16
Modified: integration/eclipse/src/java/org/apache/cactus/eclipse/launcher
CactusLaunchShortcut.java WarBuilder.java
Log:
Better error handling (null pointer exception for non-existing resources)
Revision Changes Path
1.2 +3 -3
jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/launcher/CactusLaunchShortcut.java
Index: CactusLaunchShortcut.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/launcher/CactusLaunchShortcut.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CactusLaunchShortcut.java 3 Feb 2003 10:52:44 -0000 1.1
+++ CactusLaunchShortcut.java 4 Feb 2003 16:54:16 -0000 1.2
@@ -283,7 +283,7 @@
String contextURLPath = CactusPreferences.getContextURLPath();
if (contextURLPath.equals(""))
{
- CactusPlugin.throwCoreException(
+ throw CactusPlugin.createCoreException(
"CactusLaunch.message.invalidproperty.contextpath",
null);
}
@@ -293,7 +293,7 @@
catch (MalformedURLException e)
{
CactusPlugin.log(e);
- CactusPlugin.throwCoreException(
+ throw CactusPlugin.createCoreException(
"CactusLaunch.message.war.malformed",
e);
}
1.3 +24 -9
jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/launcher/WarBuilder.java
Index: WarBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/launcher/WarBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WarBuilder.java 4 Feb 2003 09:35:56 -0000 1.2
+++ WarBuilder.java 4 Feb 2003 16:54:16 -0000 1.3
@@ -58,6 +58,7 @@
import java.io.File;
import java.io.IOException;
+import java.net.URL;
import java.util.Vector;
import org.apache.cactus.eclipse.ui.CactusMessages;
@@ -136,7 +137,7 @@
{
this.buildFileLocation = theBuildFileLocation;
this.userClassFilesDir = theClassFilesDir;
- this.userWebXML = theWebXML;
+ this.userWebXML = theWebXML;
this.userJarFilesDir = theJarFilesDir;
this.userWebFilesDir = theWebFilesDir;
}
@@ -150,22 +151,36 @@
throws JavaModelException
{
CactusPlugin thePlugin = CactusPlugin.getDefault();
+ URL buildFileURL = thePlugin.find(new Path(buildFilePath));
+ if (buildFileURL == null)
+ {
+ throw new JavaModelException(
+ CactusPlugin.createCoreException(
+ "CactusLaunch.message.prepare.error.plugin.file",
+ " : " + buildFilePath,
+ null));
+ }
buildFileLocation =
- new File(thePlugin.find(new Path(buildFilePath)).getPath());
+ new File(buildFileURL.getPath());
IPath projectPath = theJavaProject.getProject().getLocation();
IPath classFilesPath =
projectPath.removeLastSegments(1).append(
theJavaProject.getOutputLocation());
userClassFilesDir = classFilesPath.toFile();
userWebXML = projectPath.append(userWebXMLPath).toFile();
-
if (!userWebXML.exists())
{
- userWebXML =
- new File(
- thePlugin.find(new Path(webXMLPath)).getPath());
+ URL webXMLURL = thePlugin.find(new Path(webXMLPath));
+ if (webXMLURL == null)
+ {
+ throw new JavaModelException(
+ CactusPlugin.createCoreException(
+ "CactusLaunch.message.prepare.error.plugin.file",
+ " : " + webXMLPath,
+ null));
+ }
+ userWebXML = new File(webXMLURL.getPath());
}
-
userJarFilesDir = projectPath.append(userJarFilesPath).toFile();
// copy any web folder situated in the user's project
userWebFilesDir = projectPath.append(userWebFilesPath).toFile();
@@ -187,7 +202,7 @@
}
catch (IOException e)
{
- CactusPlugin.throwCoreException(
+ throw CactusPlugin.createCoreException(
"CactusLaunch.message.war.error",
e);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]