cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1091255 - in /cxf/branches/2.3.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
Date Mon, 11 Apr 2011 23:15:49 GMT
Author: dkulp
Date: Mon Apr 11 23:15:49 2011
New Revision: 1091255

URL: http://svn.apache.org/viewvc?rev=1091255&view=rev
Log:
Merged revisions 1091253 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1091253 | dkulp | 2011-04-11 19:13:14 -0400 (Mon, 11 Apr 2011) | 2 lines
  
  [CXF-3453] Create a complete hack to ignore validation errors that would
  occur with wsu:ID attributes when security is enabled.
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java?rev=1091255&r1=1091254&r2=1091255&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
Mon Apr 11 23:15:49 2011
@@ -27,6 +27,7 @@ import java.util.logging.Logger;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.PropertyException;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEvent;
 import javax.xml.bind.ValidationEventHandler;
 import javax.xml.namespace.QName;
 
@@ -56,6 +57,24 @@ public class DataReaderImpl<T> extends J
     public Object read(T input) {
         return read(null, input);
     }
+    
+    private static class WSUIDValidationHandler implements ValidationEventHandler {
+        ValidationEventHandler origHandler;
+        WSUIDValidationHandler(ValidationEventHandler o) {
+            origHandler = o;
+        }
+        
+        public boolean handleEvent(ValidationEvent event) {
+            String msg = event.getMessage();
+            if (msg.startsWith("cvc-type.3.1.1: ") && msg.contains(":Id")) {
+                return true;
+            }
+            if (origHandler != null) {
+                return origHandler.handleEvent(event);
+            }
+            return false;
+        }
+    }
     public void setProperty(String prop, Object value) {
         if (prop.equals(JAXBDataBinding.UNWRAP_JAXB_ELEMENT)) {
             unwrapJAXBElement = Boolean.TRUE.equals(value);
@@ -84,7 +103,7 @@ public class DataReaderImpl<T> extends J
                 um.setListener(databinding.getUnmarshallerListener());
             }
             if (setEventHandler) {
-                um.setEventHandler(veventHandler);
+                um.setEventHandler(new WSUIDValidationHandler(veventHandler));
             }
             if (databinding.getUnmarshallerProperties() != null) {
                 for (Map.Entry<String, Object> propEntry 



Mime
View raw message