You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2011/09/17 12:36:10 UTC
svn commit: r1171942 - in /camel/branches/camel-2.8.x: ./
camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
Author: davsclaus
Date: Sat Sep 17 10:36:10 2011
New Revision: 1171942
URL: http://svn.apache.org/viewvc?rev=1171942&view=rev
Log:
Merged revisions 1171941 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
Modified:
camel/branches/camel-2.8.x/ (props changed)
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 10:36:10 2011
@@ -1 +1 @@
-/camel/trunk:1148706,1148710,1149570,1150651,1151000,1151054,1151087,1151362,1152170,1152755,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163231,1163420,1164544,1164557,1164633,1164972-1165000,1165152,1165157,1165658,1165971,1165987,1167098,1167131,1167448,1167487,1167555,1169610,1169620,1170122,1170226,1170397,1170956,1171396,1171755
+/camel/trunk:1148706,1148710,1149570,1150651,1151000,1151054,1151087,1151362,1152170,1152755,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163231,1163420,1164544,1164557,1164633,1164972-1165000,1165152,1165157,1165658,1165971,1165987,1167098,1167131,1167448,1167487,1167555,1169610,1169620,1170122,1170226,1170397,1170956,1171396,1171755,1171941
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java?rev=1171942&r1=1171941&r2=1171942&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/dataformat/XStreamDataFormat.java Sat Sep 17 10:36:10 2011
@@ -49,7 +49,7 @@ public class XStreamDataFormat extends D
@XmlAttribute
private String encoding;
@XmlAttribute
- private String driver = "xml";
+ private String driver;
@XmlAttribute
private String driverRef;
@XmlJavaTypeAdapter(ConvertersAdapter.class)
@@ -166,13 +166,16 @@ public class XStreamDataFormat extends D
public static class ConvertersAdapter extends XmlAdapter<ConverterList, List<String>> {
@Override
public ConverterList marshal(List<String> v) throws Exception {
+ if (v == null) {
+ return null;
+ }
+
List<ConverterEntry> list = new ArrayList<ConverterEntry>();
for (String str : v) {
ConverterEntry entry = new ConverterEntry();
entry.setClsName(str);
list.add(entry);
}
-
ConverterList converterList = new ConverterList();
converterList.setList(list);
return converterList;
@@ -180,6 +183,10 @@ public class XStreamDataFormat extends D
@Override
public List<String> unmarshal(ConverterList v) throws Exception {
+ if (v == null) {
+ return null;
+ }
+
List<String> list = new ArrayList<String>();
for (ConverterEntry entry : v.getList()) {
list.add(entry.getClsName());
@@ -191,7 +198,7 @@ public class XStreamDataFormat extends D
@XmlAccessorType(XmlAccessType.NONE)
public static class ConverterList {
@XmlElement(name = "converter")
- private List<ConverterEntry> list = new ArrayList<ConverterEntry>();
+ private List<ConverterEntry> list;
public List<ConverterEntry> getList() {
return list;
@@ -222,6 +229,10 @@ public class XStreamDataFormat extends D
@Override
public ImplicitCollectionList marshal(Map<String, String[]> v) throws Exception {
+ if (v == null || v.isEmpty()) {
+ return null;
+ }
+
List<ImplicitCollectionEntry> list = new ArrayList<ImplicitCollectionEntry>();
for (Entry<String, String[]> e : v.entrySet()) {
ImplicitCollectionEntry entry = new ImplicitCollectionEntry(e.getKey(), e.getValue());
@@ -236,6 +247,10 @@ public class XStreamDataFormat extends D
@Override
public Map<String, String[]> unmarshal(ImplicitCollectionList v) throws Exception {
+ if (v == null) {
+ return null;
+ }
+
Map<String, String[]> map = new HashMap<String, String[]>();
for (ImplicitCollectionEntry entry : v.getList()) {
map.put(entry.getClsName(), entry.getFields());
@@ -247,7 +262,7 @@ public class XStreamDataFormat extends D
@XmlAccessorType(XmlAccessType.NONE)
public static class ImplicitCollectionList {
@XmlElement(name = "class")
- private List<ImplicitCollectionEntry> list = new ArrayList<ImplicitCollectionEntry>();
+ private List<ImplicitCollectionEntry> list;
public List<ImplicitCollectionEntry> getList() {
return list;
@@ -302,7 +317,7 @@ public class XStreamDataFormat extends D
@Override
public AliasList marshal(Map<String, String> value) throws Exception {
if (value == null || value.isEmpty()) {
- return new AliasList();
+ return null;
}
List<AliasEntry> ret = new ArrayList<AliasEntry>(value.size());
@@ -316,6 +331,10 @@ public class XStreamDataFormat extends D
@Override
public Map<String, String> unmarshal(AliasList value) throws Exception {
+ if (value == null || value.getList() == null || value.getList().isEmpty()) {
+ return null;
+ }
+
Map<String, String> answer = new HashMap<String, String>();
for (AliasEntry alias : value.getList()) {
answer.put(alias.getName(), alias.getClsName());
@@ -327,7 +346,7 @@ public class XStreamDataFormat extends D
@XmlAccessorType(XmlAccessType.NONE)
public static class AliasList {
@XmlElement(name = "alias")
- private List<AliasEntry> list = new ArrayList<AliasEntry>();
+ private List<AliasEntry> list;
public List<AliasEntry> getList() {
return list;
@@ -383,6 +402,10 @@ public class XStreamDataFormat extends D
@Override
public OmitFieldList marshal(Map<String, String[]> v) throws Exception {
+ if (v == null || v.isEmpty()) {
+ return null;
+ }
+
List<OmitFieldEntry> list = new ArrayList<OmitFieldEntry>();
for (Entry<String, String[]> e : v.entrySet()) {
OmitFieldEntry entry = new OmitFieldEntry(e.getKey(), e.getValue());
@@ -397,6 +420,10 @@ public class XStreamDataFormat extends D
@Override
public Map<String, String[]> unmarshal(OmitFieldList v) throws Exception {
+ if (v == null || v.getList() == null || v.getList().isEmpty()) {
+ return null;
+ }
+
Map<String, String[]> map = new HashMap<String, String[]>();
for (OmitFieldEntry entry : v.getList()) {
map.put(entry.getClsName(), entry.getFields());
@@ -408,7 +435,7 @@ public class XStreamDataFormat extends D
@XmlAccessorType(XmlAccessType.NONE)
public static class OmitFieldList {
@XmlElement(name = "omitField")
- private List<OmitFieldEntry> list = new ArrayList<OmitFieldEntry>();
+ private List<OmitFieldEntry> list;
public List<OmitFieldEntry> getList() {
return list;