jBPM的type问题,big bug!
这个问题,似乎将变量按二进制存储更好些,这样就不会涉及编码格式问题。
另外一种方法是使用统一的编码格式,改写后的org.jbpm.delegation.serializerSerializableSerializer如下:
public class SerializableSerializer implements Serializer {
public String serialize(Object object) {
String serialized = null;
if (object != null) {
if (!(object instanceof Serializable)) {
throw new IllegalArgumentException("object '" + object + "' (" +
object.getClass().getName() +
") cannot be serialized with " +
this.getClass().getName());
}
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(object);
oos.flush();
baos.flush();
serialized = baos.toString(“ISO-8859-1“);//修改
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(
"couldn't serialize state definition");[来源www.iocblog.net]
}
}
return serialized;
}[来源www.iocblog.net]
public Object deserialize(String text) {
Object object = null;
if (text != null) {
try {
ByteArrayInputStream bais = new ByteArrayInputStream(text.
getBytes(“ISO-8859-1“)); //修改
ObjectInputStream ois = new ObjectInputStream(bais);
object = ois.readObject();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(
"couldn't deserialize object from inputstream");
}
}
return object;
}
}
文章整理:iocblog
版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。