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/10/22 10:34:45 UTC
svn commit: r1187671 -
/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
Author: davsclaus
Date: Sat Oct 22 08:34:45 2011
New Revision: 1187671
URL: http://svn.apache.org/viewvc?rev=1187671&view=rev
Log:
CAMEL-4573: Fixed thread safety issue in bindy fixed length marshaller. Thanks to Surya for the patch.
Modified:
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java?rev=1187671&r1=1187670&r2=1187671&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java Sat Oct 22 08:34:45 2011
@@ -52,8 +52,6 @@ public class BindyFixedLengthFactory ext
private Map<Integer, DataField> dataFields = new LinkedHashMap<Integer, DataField>();
private Map<Integer, Field> annotatedFields = new LinkedHashMap<Integer, Field>();
- private Map<Integer, List<String>> results;
-
private int numberOptionalFields;
private int numberMandatoryFields;
private int totalFields;
@@ -251,7 +249,7 @@ public class BindyFixedLengthFactory ext
public String unbind(Map<String, Object> model) throws Exception {
StringBuilder buffer = new StringBuilder();
- results = new HashMap<Integer, List<String>>();
+ Map<Integer, List<String>> results = new HashMap<Integer, List<String>>();
for (Class clazz : models) {
@@ -267,7 +265,7 @@ public class BindyFixedLengthFactory ext
// Generate Fixed Length table
// containing the positions of the fields
- generateFixedLengthPositionMap(clazz, obj);
+ generateFixedLengthPositionMap(clazz, obj, results);
}
}
@@ -292,8 +290,7 @@ public class BindyFixedLengthFactory ext
* Generate a table containing the data formatted and sorted with their position/offset
* The result is placed in the Map<Integer, List> results
*/
-
- private void generateFixedLengthPositionMap(Class clazz, Object obj) throws Exception {
+ private void generateFixedLengthPositionMap(Class clazz, Object obj, Map<Integer, List<String>> results) throws Exception {
String result = "";