cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: CXF-6138 JAXB unmarshaller Properties get overwriten on a call to initialize()
Date Fri, 12 Dec 2014 19:35:50 GMT
Repository: cxf
Updated Branches:
  refs/heads/master d5f0ace35 -> 3043bfbe0


CXF-6138 JAXB unmarshaller Properties get overwriten on a call to initialize()


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3043bfbe
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3043bfbe
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3043bfbe

Branch: refs/heads/master
Commit: 3043bfbe0534109c056560fcbadb3de50fd58104
Parents: d5f0ace
Author: paul <pkmcculloch@gmail.com>
Authored: Sat Dec 6 22:04:08 2014 +0000
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Dec 12 14:08:49 2014 -0500

----------------------------------------------------------------------
 .../org/apache/cxf/jaxb/JAXBDataBinding.java    |  8 +++-
 .../DataBindingMarshallerPropertiesTest.java    | 39 ++++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3043bfbe/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
index bae0752..38f5cdb 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
@@ -304,8 +304,12 @@ public class JAXBDataBinding extends AbstractInterceptorProvidingDataBinding
 
 
         contextClasses = new LinkedHashSet<Class<?>>();
-        Map<String, Object> unmarshallerProps = new HashMap<String, Object>();
-        this.setUnmarshallerProperties(unmarshallerProps);
+        
+        if (this.getUnmarshallerProperties() == null || this.getUnmarshallerProperties().isEmpty())
{
+            Map<String, Object> unmarshallerProps = new HashMap<String, Object>();
+            this.setUnmarshallerProperties(unmarshallerProps);
+        }
+        
         for (ServiceInfo serviceInfo : service.getServiceInfos()) {
             
             JAXBContextInitializer initializer

http://git-wip-us.apache.org/repos/asf/cxf/blob/3043bfbe/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java
b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java
new file mode 100644
index 0000000..82b594b
--- /dev/null
+++ b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxb;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class DataBindingMarshallerPropertiesTest extends TestBase {
+    @Test 
+    public void testInitializeUnmarshallerProperties() throws Exception {
+        JAXBDataBinding db = new JAXBDataBinding();
+        Map<String, Object> unmarshallerProperties = new HashMap<String, Object>();
+        unmarshallerProperties.put("someproperty", "somevalue");
+        db.setUnmarshallerProperties(unmarshallerProperties);
+        
+        db.initialize(service);
+        
+        assertTrue("somevalue".equals(db.getUnmarshallerProperties().get("someproperty")));
+    }
+}


Mime
View raw message