Used commercial ESB and BPMs for a couple of years, recently had a chance to evaluate some open source ESBs.
WSO2: not easy to use, had difficulty even making the sample projects to work. No DataMapper tool, which is a big no-no to my projects.
Mulesoft ESB: Nice documentation, instructions easy to follow, sample projects can be built and run in a couple of minutes, nice DataMapper tool in the 3.4 version. Have not had a chance to build a relatively complex application using this. Not sure whether the community edition is good enough to be used in the Production.
Friday, November 15, 2013
Monday, September 2, 2013
String getBytes could lead to difficult bugs
If you execute the following function, what do you think should be the size of the 'def' byte array?
The logic is really simple: an input as byte array that have two elements, then create a string out of this with 'UTF-8' encoding, then create another byte array using this string with the same UTF-8 encoding.
public static void testStringUTF8() {
byte[] abc = new byte[2];
abc[0] = 31;
abc[1] = -117;
try {
String stringAbc = new String(abc, "UTF-8");
byte[] def = stringAbc.getBytes("UTF-8");
if (def != null) {
System.out.println("size of output byte array:" + def.length); //print the array size
}
System.out.println(def[1]); //print the second element of the output byte array
System.out.println(abc[1]); //print the second element of the input byte array
} catch (Exception e) {
e.printStackTrace();
}
}
---------------
The logic is really simple: an input as byte array that have two elements, then create a string out of this with 'UTF-8' encoding, then create another byte array using this string with the same UTF-8 encoding.
public static void testStringUTF8() {
byte[] abc = new byte[2];
abc[0] = 31;
abc[1] = -117;
try {
String stringAbc = new String(abc, "UTF-8");
byte[] def = stringAbc.getBytes("UTF-8");
if (def != null) {
System.out.println("size of output byte array:" + def.length); //print the array size
}
System.out.println(def[1]); //print the second element of the output byte array
System.out.println(abc[1]); //print the second element of the input byte array
} catch (Exception e) {
e.printStackTrace();
}
}
---------------
Subscribe to:
Posts (Atom)