cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r763340 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/
Date Wed, 08 Apr 2009 18:26:08 GMT
Author: dkulp
Date: Wed Apr  8 18:26:08 2009
New Revision: 763340

URL: http://svn.apache.org/viewvc?rev=763340&view=rev
Log:
More fixes for getting jaxb to report line numbers

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java?rev=763340&r1=763339&r2=763340&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java Wed Apr  8 18:26:08
2009
@@ -105,7 +105,16 @@
                     synchronized (schemaElem.getOwnerDocument()) {
                         for (Object prefix : def.getNamespaces().keySet()) {
                             String ns = (String)def.getNamespaces().get(prefix);
-                            if (!"".equals(prefix) && !schemaElem.hasAttribute("xmlns:"
+ prefix)) {
+                            if ("".equals(prefix)) {
+                                if (!schemaElem.hasAttribute("xmlns")) {
+                                    Attr attr = 
+                                        schemaElem.getOwnerDocument()
+                                            .createAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,

+                                                               "xmlns");
+                                    attr.setValue(ns);
+                                    schemaElem.setAttributeNodeNS(attr);
+                                }
+                            } else if (!schemaElem.hasAttribute("xmlns:" + prefix)) {
                                 String namespace = javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
                                 Attr attr = 
                                     schemaElem.getOwnerDocument().createAttributeNS(namespace,


Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java?rev=763340&r1=763339&r2=763340&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBBindErrorListener.java
Wed Apr  8 18:26:08 2009
@@ -43,18 +43,21 @@
     }
 
     public void fatalError(org.xml.sax.SAXParseException exception) {
-        throw new ToolException(prefix + exception.getLocalizedMessage(), exception);
+        throw new ToolException(prefix + exception.getLocalizedMessage()
+                                + " of schema " + exception.getSystemId(), exception);
     }
 
     public void info(org.xml.sax.SAXParseException exception) {
         if (this.isVerbose) {
-            System.out.println("JAXB Info: " + exception.toString());
+            System.out.println("JAXB Info: " + exception.toString() 
+                               + " in schema " + exception.getSystemId());
         }
     }
 
     public void warning(org.xml.sax.SAXParseException exception) {
         if (this.isVerbose) {
-            System.err.println("JAXB parsing schema warning " + exception.toString());
+            System.err.println("JAXB parsing schema warning " + exception.toString()
+                               + " in schema " + exception.getSystemId());
         }
     }
 }

Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=763340&r1=763339&r2=763340&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Wed Apr  8 18:26:08 2009
@@ -99,16 +99,20 @@
 
     public class LocationFilterReader extends StreamReaderDelegate implements XMLStreamReader
{
         boolean isImport;
-        int locIdx;
+        int locIdx = -1;
         LocationFilterReader(XMLStreamReader read) {
             super(read);
         }
+
         public int next() throws XMLStreamException {
             int i = super.next();
             if (i == XMLStreamReader.START_ELEMENT) {
-                isImport = super.getName().equals(WSDLConstants.QNAME_SCHEMA_IMPORT);
+                QName qn = super.getName();
+                isImport = qn.equals(WSDLConstants.QNAME_SCHEMA_IMPORT);
                 if (isImport) {
                     findLocation();
+                } else {
+                    locIdx = -1;
                 }
             } else {
                 isImport = false;
@@ -123,6 +127,8 @@
                 isImport = super.getName().equals(WSDLConstants.QNAME_SCHEMA_IMPORT);
                 if (isImport) {
                     findLocation();
+                } else {
+                    locIdx = -1;
                 }
             } else {
                 isImport = false;
@@ -361,7 +367,6 @@
                 ids.add(key);
             }
         }
-                
         for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
             if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schema.getTargetNamespace())) {
                 continue;
@@ -410,6 +415,7 @@
                     InputSource is = new InputSource(key);
                     opts.addGrammar(is);
                     schemaCompiler.parseSchema(key, reader);
+                    reader.close();
                 } catch (RuntimeException ex) {
                     throw ex;
                 } catch (Exception ex) {



Mime
View raw message