Author: boisvert
Date: Mon Apr 23 12:06:02 2007
New Revision: 531563

URL: http://svn.apache.org/viewvc?view=rev&rev=531563
Log:
Fix ODE-114: Unhelpful NPE in bpelc

Modified:
    
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
    
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
    
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
    
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java

Modified: 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java?view=diff&rev=531563&r1=531562&r2=531563
==============================================================================
--- 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
 (original)
+++ 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
 Mon Apr 23 12:06:02 2007
@@ -199,7 +199,7 @@
         if (_wsdlFinder != null) {
             wf = _wsdlFinder;
         } else {
-            wf = new DefaultResourceFinder(_bpelFile.getParentFile());
+            wf = new 
DefaultResourceFinder(_bpelFile.getAbsoluteFile().getParentFile());
         }
 
         CompileListener clistener = new CompileListener() {

Modified: 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java?view=diff&rev=531563&r1=531562&r2=531563
==============================================================================
--- 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
 (original)
+++ 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
 Mon Apr 23 12:06:02 2007
@@ -764,6 +764,9 @@
             if (imprt.getImportType() == null)
                 throw new 
CompilationException(__cmsgs.errUnspecifiedImportType().setSource(imprt));
 
+            if (imprt.getLocation() == null)
+                throw new 
CompilationException(__cmsgs.errMissingImportLocation().setSource(imprt));
+
             if (Import.IMPORTTYPE_WSDL11.equals(imprt.getImportType())) {
                 addWsdlImport(current, imprt.getLocation(), imprt);
             } else if 
(Import.IMPORTTYPE_XMLSCHEMA10.equals(imprt.getImportType())) {

Modified: 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java?view=diff&rev=531563&r1=531562&r2=531563
==============================================================================
--- 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
 (original)
+++ 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
 Mon Apr 23 12:06:02 2007
@@ -85,6 +85,11 @@
         return this.formatCompilationMessage("Must specify an import type.");
     }
 
+    /** Missing import location. */
+    public CompilationMessage errMissingImportLocation() {
+        return this.formatCompilationMessage("Missing import location.");
+    }
+
     /** Attempt to reference undeclared property "{0}". */
     public CompilationMessage errUndeclaredProperty(QName propertyName) {
         return this.formatCompilationMessage("Attempt to reference undeclared 
property \"{0}\".",

Modified: 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java?view=diff&rev=531563&r1=531562&r2=531563
==============================================================================
--- 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
 (original)
+++ 
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
 Mon Apr 23 12:06:02 2007
@@ -52,6 +52,12 @@
      * @param suDir base path for relative URIs.
      */
     public DefaultResourceFinder(File suDir) {
+        if (suDir == null) {
+            throw new IllegalArgumentException("Argument 'suDir' is null");
+        }
+        if (!suDir.exists()) {
+            throw new IllegalArgumentException("Directory does not exist: " + 
suDir);
+        }
         _suDir = suDir;
     }
 


Reply via email to