Author: jkaputin
Date: Thu Sep  7 19:24:50 2006
New Revision: 441346

URL: http://svn.apache.org/viewvc?view=rev&rev=441346
Log:
Improved the way ElementSource is handled by to the 
DOM implementation. Added some error messages. 

Modified:
    
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMElementSource.java
    
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLReader.java
    
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLSource.java
    
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/Messages.properties

Modified: 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMElementSource.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMElementSource.java?view=diff&rev=441346&r1=441345&r2=441346
==============================================================================
--- 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMElementSource.java
 (original)
+++ 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMElementSource.java
 Thu Sep  7 19:24:50 2006
@@ -37,14 +37,17 @@
 
     public void setSource(Object elementSource) throws WSDLException {
 
-        if(elementSource instanceof Element ||
-           elementSource instanceof Document) {
+        if(elementSource instanceof Element) {
             fSource = elementSource;
         }
         else {
-            String sourceClass = elementSource.getClass().getName();
+            String sourceClass = (elementSource != null 
+                                     ? elementSource.getClass().getName()
+                                     : null);
+            String elemSourceClass = this.getClass().getName();
             String msg = fErrorReporter.getFormattedMessage(
-                    "WSDL018", new Object[] {sourceClass});
+                    "WSDL019", new Object[] {sourceClass, elemSourceClass});
+            //TODO throw IllegalArgumentException instead of WSDLException
             throw new WSDLException(WSDLException.PARSER_ERROR, msg);
         }
 

Modified: 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLReader.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLReader.java?view=diff&rev=441346&r1=441345&r2=441346
==============================================================================
--- 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLReader.java
 (original)
+++ 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLReader.java
 Thu Sep  7 19:24:50 2006
@@ -1846,8 +1846,7 @@
                         {
                             String attrValue = domAttr.getValue();
                             //Wrap the domEl in DOMElementSource
-                            DOMElementSource domElSource = new 
DOMElementSource(getErrorReporter());
-                            domElSource.setSource(domEl);
+                            ElementSource domElSource = 
createElementSource(domEl);
                             xmlAttr.init(domElSource, attrType, attrValue);
                             wsdlObj.setExtensionAttribute(attrType, xmlAttr);
                         }

Modified: 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLSource.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLSource.java?view=diff&rev=441346&r1=441345&r2=441346
==============================================================================
--- 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLSource.java
 (original)
+++ 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/DOMWSDLSource.java
 Thu Sep  7 19:24:50 2006
@@ -50,10 +50,13 @@
             fSource = wsdlSource;
         }
         else {
-            String sourceClass = wsdlSource.getClass().getName();
-            String readerClass = "DOMWSDLReader";
+            String sourceClass = (wsdlSource != null
+                                     ? wsdlSource.getClass().getName()
+                                     : null);
+            String wsdlSourceClass = this.getClass().getName();
             String msg = fErrorReporter.getFormattedMessage(
-                    "WSDL017", new Object[] {sourceClass, readerClass});
+                    "WSDL018", new Object[] {sourceClass, wsdlSourceClass});
+            //TODO throw IllegalArgumentException instead of WSDLException.
             throw new WSDLException(WSDLException.PARSER_ERROR, msg);
         }
     }

Modified: 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/Messages.properties
URL: 
http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/Messages.properties?view=diff&rev=441346&r1=441345&r2=441346
==============================================================================
--- 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/Messages.properties
 (original)
+++ 
incubator/woden/branches/WODEN-44/src/org/apache/woden/internal/Messages.properties
 Thu Sep  7 19:24:50 2006
@@ -50,7 +50,9 @@
 WSDL014=No Extension Registry was set on the DescriptionElement so cannot 
handle the extension element "{0}" in the context of "{1}".
 WSDL015=The extension namespace "{0}" in the context of "{1}" does not have a 
Java class registered.
 WSDL016=The Java class "{0}" does not implement the "ComponentExtensions" 
interface.
-WSDL017=The Java class "{0}" representing the WSDL source is not compatible 
with the WSDLReader implementation class "{1}".
+WSDL017=WSDL source represented by the type "{0}" cannot be read by the 
WSDLReader implementation class "{1}".
+WSDL018=WSDL cannot be represented by the type "{0}" in the WSDLSource 
implementation class "{1}".
+WSDL019=A WSDL element cannot be represented by the type "{0}" in the 
ElementSource implementation class "{1}".
 
 # ------------ Parsing errors -------------------
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to