Author: alex.guizar(a)jboss.com
Date: 2010-08-24 17:38:53 -0400 (Tue, 24 Aug 2010)
New Revision: 6624
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java
Modified:
jbpm3/branches/jbpm-3.2-soa/eclipse/jbpm.code.templates.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BooleanToStringConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ByteToLongConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BytesToByteArrayConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/CharacterToStringConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DateToLongConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DoubleToStringConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToDoubleConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToStringConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/IntegerToLongConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/SerializableToByteArrayConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ShortToLongConverter.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DateInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DoubleInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/JcrNodeInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/LongInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/StringInstance.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java
Log:
JBPM-2069 converters do not handle null values consistently
Modified: jbpm3/branches/jbpm-3.2-soa/eclipse/jbpm.code.templates.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/eclipse/jbpm.code.templates.xml 2010-08-24 18:30:53 UTC
(rev 6623)
+++ jbpm3/branches/jbpm-3.2-soa/eclipse/jbpm.code.templates.xml 2010-08-24 21:38:53 UTC
(rev 6624)
@@ -1,33 +1,15 @@
-<?xml version="1.0" encoding="UTF-8"
standalone="no"?><templates><template autoinsert="true"
context="gettercomment_context" deleted="false"
description="Comment for getter function" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment"
name="gettercomment">/**
+<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
+<templates>
+<template autoinsert="true" context="gettercomment_context"
deleted="false" description="Comment for getter method"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.gettercomment"
name="gettercomment">/**
* @return the ${bare_field_name}
- */</template><template autoinsert="true"
context="settercomment_context" deleted="false"
description="Comment for setter function" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment"
name="settercomment">/**
+ */</template>
+<template autoinsert="true" context="settercomment_context"
deleted="false" description="Comment for setter method"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.settercomment"
name="settercomment">/**
* @param ${param} the ${bare_field_name} to set
- */</template><template autoinsert="true"
context="constructorcomment_context" deleted="false"
description="Comment for created constructors" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment"
name="constructorcomment">/**
+ */</template>
+<template autoinsert="true" context="constructorcomment_context"
deleted="false" description="Comment for created constructors"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment"
name="constructorcomment">/**
* ${tags}
- */</template><template autoinsert="true"
context="filecomment_context" deleted="false"
description="Comment for created JavaScript files" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment"
name="filecomment">/**
- *
- */</template><template autoinsert="false"
context="typecomment_context" deleted="false"
description="Comment for created types" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment"
name="typecomment">/**
- * @author ${user}
- */</template><template autoinsert="false"
context="fieldcomment_context" deleted="false"
description="Comment for vars" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment"
name="fieldcomment"/><template autoinsert="true"
context="methodcomment_context" deleted="false"
description="Comment for non-overriding function" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment"
name="methodcomment">/**
- * ${tags}
- */</template><template autoinsert="false"
context="overridecomment_context" deleted="false"
description="Comment for overriding functions" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment"
name="overridecomment"/><template autoinsert="true"
context="delegatecomment_context" deleted="false"
description="Comment for delegate functions" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment"
name="delegatecomment">/**
- * ${tags}
- * ${see_to_target}
- */</template><template autoinsert="true"
context="newtype_context" deleted="false" description="Newly
created files" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype"
name="newtype">${filecomment}
-${package_declaration}
-
-${typecomment}
-${type_declaration}</template><template autoinsert="true"
context="classbody_context" deleted="false" description="Code in
new class type bodies" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody"
name="classbody">
-</template><template autoinsert="true"
context="catchblock_context" deleted="false" description="Code in
new catch blocks" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock"
name="catchblock">// ${todo} Auto-generated catch block
-${exception_var}.printStackTrace();</template><template
autoinsert="true" context="methodbody_context"
deleted="false" description="Code in created function stubs"
enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody"
name="methodbody">// ${todo} Auto-generated function stub
-${body_statement}</template><template autoinsert="true"
context="constructorbody_context" deleted="false"
description="Code in created constructor stubs" enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody"
name="constructorbody">${body_statement}
-// ${todo} Auto-generated constructor stub</template><template
autoinsert="true" context="getterbody_context"
deleted="false" description="Code in created getters"
enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody"
name="getterbody">return ${field};</template><template
autoinsert="true" context="setterbody_context"
deleted="false" description="Code in created setters"
enabled="true"
id="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody"
name="setterbody">${field} = ${param};</template><template
autoinsert="true" context="gettercomment_context"
deleted="false" description="Comment for getter method"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.gettercomment"
name="gettercomment">/**
- * @return the ${bare_field_name}
- */</template><template autoinsert="true"
context="settercomment_context" deleted="false"
description="Comment for setter method" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.settercomment"
name="settercomment">/**
- * @param ${param} the ${bare_field_name} to set
- */</template><template autoinsert="true"
context="constructorcomment_context" deleted="false"
description="Comment for created constructors" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment"
name="constructorcomment">/**
- * ${tags}
- */</template><template autoinsert="false"
context="filecomment_context" deleted="false"
description="Comment for created Java files" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.filecomment"
name="filecomment">/*
+ */</template>
+<template autoinsert="false" context="filecomment_context"
deleted="false" description="Comment for created Java files"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment"
name="filecomment">/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
@@ -47,22 +29,34 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */</template><template autoinsert="false"
context="typecomment_context" deleted="false"
description="Comment for created types" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.typecomment"
name="typecomment">/**
+ */</template>
+<template autoinsert="false" context="typecomment_context"
deleted="false" description="Comment for created types"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment"
name="typecomment">/**
* @author ${user}
- */</template><template autoinsert="false"
context="fieldcomment_context" deleted="false"
description="Comment for fields" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment"
name="fieldcomment"/><template autoinsert="true"
context="methodcomment_context" deleted="false"
description="Comment for non-overriding methods" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.methodcomment"
name="methodcomment">/**
+ */</template>
+<template autoinsert="false" context="fieldcomment_context"
deleted="false" description="Comment for fields"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment"
name="fieldcomment"/>
+<template autoinsert="true" context="methodcomment_context"
deleted="false" description="Comment for non-overriding methods"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.methodcomment"
name="methodcomment">/**
* ${tags}
- */</template><template autoinsert="false"
context="overridecomment_context" deleted="false"
description="Comment for overriding methods" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.overridecomment"
name="overridecomment"/><template autoinsert="true"
context="delegatecomment_context" deleted="false"
description="Comment for delegate methods" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment"
name="delegatecomment">/**
+ */</template>
+<template autoinsert="false" context="overridecomment_context"
deleted="false" description="Comment for overriding methods"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.overridecomment"
name="overridecomment"/>
+<template autoinsert="true" context="delegatecomment_context"
deleted="false" description="Comment for delegate methods"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment"
name="delegatecomment">/**
* ${tags}
* ${see_to_target}
- */</template><template autoinsert="true"
context="newtype_context" deleted="false" description="Newly
created files" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.newtype"
name="newtype">${filecomment}
+ */</template>
+<template autoinsert="true" context="newtype_context"
deleted="false" description="Newly created files"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype"
name="newtype">${filecomment}
${package_declaration}
${typecomment}
-${type_declaration}</template><template autoinsert="true"
context="classbody_context" deleted="false" description="Code in
new class type bodies" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.classbody"
name="classbody">
-</template><template autoinsert="true"
context="interfacebody_context" deleted="false" description="Code
in new interface type bodies" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.interfacebody"
name="interfacebody">
-</template><template autoinsert="true"
context="enumbody_context" deleted="false" description="Code in
new enum type bodies" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.enumbody"
name="enumbody">
-</template><template autoinsert="true"
context="annotationbody_context" deleted="false"
description="Code in new annotation type bodies" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.annotationbody"
name="annotationbody">
-</template><template autoinsert="true"
context="catchblock_context" deleted="false" description="Code in
new catch blocks" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.catchblock"
name="catchblock">// ${todo} Auto-generated catch block
-${exception_var}.printStackTrace();</template><template
autoinsert="true" context="methodbody_context"
deleted="false" description="Code in created method stubs"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody"
name="methodbody">// ${todo} Auto-generated method stub
-${body_statement}</template><template autoinsert="true"
context="constructorbody_context" deleted="false"
description="Code in created constructor stubs" enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.constructorbody"
name="constructorbody">${body_statement}
-// ${todo} Auto-generated constructor stub</template><template
autoinsert="true" context="getterbody_context"
deleted="false" description="Code in created getters"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody"
name="getterbody">return ${field};</template><template
autoinsert="true" context="setterbody_context"
deleted="false" description="Code in created setters"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody"
name="setterbody">${field} = ${param};</template></templates>
\ No newline at end of file
+${type_declaration}</template>
+<template autoinsert="true" context="classbody_context"
deleted="false" description="Code in new class type bodies"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody"
name="classbody"/>
+<template autoinsert="true" context="interfacebody_context"
deleted="false" description="Code in new interface type bodies"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.interfacebody"
name="interfacebody"/>
+<template autoinsert="true" context="enumbody_context"
deleted="false" description="Code in new enum type bodies"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody"
name="enumbody"/>
+<template autoinsert="true" context="annotationbody_context"
deleted="false" description="Code in new annotation type bodies"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.annotationbody"
name="annotationbody"/>
+<template autoinsert="true" context="catchblock_context"
deleted="false" description="Code in new catch blocks"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock"
name="catchblock">// ${todo} Auto-generated catch block
+${exception_var}.printStackTrace();</template>
+<template autoinsert="true" context="methodbody_context"
deleted="false" description="Code in created method stubs"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody"
name="methodbody">// ${todo} Auto-generated method stub
+${body_statement}</template>
+<template autoinsert="true" context="constructorbody_context"
deleted="false" description="Code in created constructor stubs"
enabled="true"
id="org.eclipse.jdt.ui.text.codetemplates.constructorbody"
name="constructorbody">${body_statement}
+// ${todo} Auto-generated constructor stub</template>
+<template autoinsert="true" context="getterbody_context"
deleted="false" description="Code in created getters"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody"
name="getterbody">return ${field};</template>
+<template autoinsert="true" context="setterbody_context"
deleted="false" description="Code in created setters"
enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody"
name="setterbody">${field} = ${param};</template>
+</templates>
\ No newline at end of file
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableInstance.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableInstance.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/VariableInstance.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -111,8 +111,8 @@
if (converter != null) {
if (!converter.supports(value)) {
- throw new JbpmException("converter '" +
converter.getClass().getName()
- + " does not support values of type " + value.getClass().getName());
+ throw new JbpmException("converter " + converter.getClass().getName()
+ + " does not support value: " + value);
}
value = converter.convert(value);
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BooleanToStringConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BooleanToStringConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BooleanToStringConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,33 +21,27 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class BooleanToStringConverter implements Converter {
-
+
private static final long serialVersionUID = 1L;
-
+
public static final String TRUE_TEXT = "T";
public static final String FALSE_TEXT = "F";
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Boolean.class);
+ return value instanceof Boolean || value == null;
}
public Object convert(Object o) {
- String convertedValue = FALSE_TEXT;
- if (((Boolean)o).booleanValue()) {
- convertedValue = TRUE_TEXT;
- }
- return convertedValue;
+ if (o == null) return null;
+
+ Boolean bool = (Boolean) o;
+ return bool.booleanValue() ? TRUE_TEXT : FALSE_TEXT;
}
public Object revert(Object o) {
- Boolean revertedValue = Boolean.FALSE;
- if (TRUE_TEXT.equals(o)) {
- revertedValue = Boolean.TRUE;
- }
- return revertedValue;
+ return o != null ? TRUE_TEXT.equals(o) ? Boolean.TRUE : Boolean.FALSE : null;
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ByteToLongConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ByteToLongConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ByteToLongConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,22 +21,27 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class ByteToLongConverter implements Converter {
-
+
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Byte.class);
+ return value instanceof Byte || value == null;
}
public Object convert(Object o) {
- return new Long( ((Number)o).longValue() );
+ if (o == null) return null;
+
+ Byte number = (Byte) o;
+ return new Long(number.longValue());
}
public Object revert(Object o) {
- return new Byte(((Long)o).byteValue());
+ if (o == null) return null;
+
+ Long number = (Long) o;
+ return new Byte(number.byteValue());
}
}
\ No newline at end of file
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BytesToByteArrayConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BytesToByteArrayConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/BytesToByteArrayConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -29,16 +29,18 @@
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==byte[].class);
+ return value instanceof byte[] || value == null;
}
public Object convert(Object o) {
- return new ByteArray((byte[]) o);
+ return o != null ? new ByteArray((byte[]) o) : null;
}
public Object revert(Object o) {
- return ((ByteArray)o).getBytes();
+ if (o == null) return null;
+
+ ByteArray byteArray = (ByteArray) o;
+ return byteArray.getBytes();
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/CharacterToStringConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/CharacterToStringConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/CharacterToStringConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,22 +21,24 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class CharacterToStringConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Character.class);
+ return value instanceof Character || value == null;
}
public Object convert(Object o) {
- return o.toString();
+ return o != null ? o.toString() : null;
}
public Object revert(Object o) {
- return new Character(((String)o).charAt(0));
+ if (o == null) return null;
+
+ String str = (String) o;
+ return new Character(str.charAt(0));
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DateToLongConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DateToLongConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DateToLongConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,23 +21,29 @@
*/
package org.jbpm.context.exe.converter;
-import java.util.*;
-import org.jbpm.context.exe.*;
+import java.util.Date;
+import org.jbpm.context.exe.Converter;
+
public class DateToLongConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (Date.class.isAssignableFrom(value.getClass()));
+ return value instanceof Date || value == null;
}
public Object convert(Object o) {
- return new Long(((Date)o).getTime());
+ if (o == null) return null;
+
+ Date date = (Date) o;
+ return new Long(date.getTime());
}
public Object revert(Object o) {
- return new Date(((Long)o).longValue());
+ if (o == null) return null;
+
+ Long number = (Long) o;
+ return new Date(number.longValue());
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DoubleToStringConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DoubleToStringConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/DoubleToStringConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,23 +21,22 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class DoubleToStringConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Double.class);
+ return value instanceof Double || value == null;
}
public Object convert(Object o) {
- return o.toString();
+ return o != null ? o.toString() : null;
}
public Object revert(Object o) {
- return new Double((String)o);
+ return o != null ? new Double((String) o) : null;
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToDoubleConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToDoubleConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToDoubleConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -28,16 +28,21 @@
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Float.class);
+ return value instanceof Float || value == null;
}
public Object convert(Object o) {
- return new Double(((Float)o).doubleValue());
+ if (o == null) return null;
+
+ Float number = (Float) o;
+ return new Double(number.doubleValue());
}
public Object revert(Object o) {
- return new Float(((Double)o).floatValue());
+ if (o == null) return null;
+
+ Double number = (Double) o;
+ return new Float(number.floatValue());
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToStringConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToStringConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/FloatToStringConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,23 +21,22 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class FloatToStringConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Float.class);
+ return value instanceof Float || value == null;
}
public Object convert(Object o) {
- return o.toString();
+ return o != null ? o.toString() : null;
}
public Object revert(Object o) {
- return new Float((String)o);
+ return o != null ? new Float((String) o) : null;
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/IntegerToLongConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/IntegerToLongConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/IntegerToLongConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,22 +21,27 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class IntegerToLongConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (Integer.class.equals(value.getClass()));
+ return value instanceof Integer || value == null;
}
public Object convert(Object o) {
- return new Long( ((Number)o).longValue() );
+ if (o == null) return null;
+
+ Integer number = (Integer) o;
+ return new Long(number.longValue());
}
public Object revert(Object o) {
- return new Integer(((Long)o).intValue());
+ if (o == null) return null;
+
+ Long number = (Long) o;
+ return new Integer(number.intValue());
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/SerializableToByteArrayConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/SerializableToByteArrayConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/SerializableToByteArrayConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -27,6 +27,7 @@
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
import java.io.Serializable;
import org.jbpm.JbpmConfiguration;
@@ -34,32 +35,33 @@
import org.jbpm.bytes.ByteArray;
import org.jbpm.context.exe.Converter;
import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.util.CustomLoaderObjectInputStream;
public class SerializableToByteArrayConverter implements Converter {
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- return value == null || value instanceof Serializable;
+ return value instanceof Serializable || value == null;
}
public Object convert(Object o) {
- byte[] bytes = null;
+ if (o == null) return null;
+
try {
ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
ObjectOutputStream objectStream = new ObjectOutputStream(memoryStream);
objectStream.writeObject(o);
objectStream.flush();
- bytes = memoryStream.toByteArray();
+ return new ByteArray(memoryStream.toByteArray());
}
catch (IOException e) {
throw new JbpmException("failed to serialize: " + o, e);
}
- return new ByteArray(bytes);
}
public Object revert(Object o) {
+ if (o == null) return o;
+
ByteArray byteArray = (ByteArray) o;
InputStream memoryStream = new ByteArrayInputStream(byteArray.getBytes());
try {
@@ -74,12 +76,22 @@
}
}
- public Object revert(Object o, ProcessDefinition processDefinition) {
+ public Object revert(Object o, final ProcessDefinition processDefinition) {
ByteArray byteArray = (ByteArray) o;
InputStream memoryStream = new ByteArrayInputStream(byteArray.getBytes());
try {
- ObjectInputStream objectStream = new CustomLoaderObjectInputStream(memoryStream,
- JbpmConfiguration.getProcessClassLoader(processDefinition));
+ ObjectInputStream objectStream = new ObjectInputStream(memoryStream) {
+ protected Class resolveClass(ObjectStreamClass desc) throws IOException,
+ ClassNotFoundException {
+ try {
+ return super.resolveClass(desc);
+ }
+ catch (ClassNotFoundException e) {
+ return Class.forName(desc.getName(), false,
+ JbpmConfiguration.getProcessClassLoader(processDefinition));
+ }
+ }
+ };
return objectStream.readObject();
}
catch (IOException ex) {
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ShortToLongConverter.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ShortToLongConverter.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/converter/ShortToLongConverter.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,22 +21,27 @@
*/
package org.jbpm.context.exe.converter;
-import org.jbpm.context.exe.*;
+import org.jbpm.context.exe.Converter;
public class ShortToLongConverter implements Converter {
-
+
private static final long serialVersionUID = 1L;
public boolean supports(Object value) {
- if (value==null) return true;
- return (value.getClass()==Short.class);
+ return value instanceof Short || value == null;
}
public Object convert(Object o) {
- return new Long( ((Number)o).longValue() );
+ if (o == null) return null;
+
+ Short number = (Short) o;
+ return new Long(number.longValue());
}
-
+
public Object revert(Object o) {
- return new Short(((Long)o).shortValue());
+ if (o == null) return null;
+
+ Long number = (Long) o;
+ return new Short(number.shortValue());
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/ByteArrayInstance.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -27,15 +27,14 @@
import org.jbpm.context.exe.VariableInstance;
import org.jbpm.context.log.variableinstance.ByteArrayUpdateLog;
-public class ByteArrayInstance extends VariableInstance {
+public class ByteArrayInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
-
- protected ByteArray value = null;
+ protected ByteArray value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (ByteArray.class.isAssignableFrom(value.getClass()));
+ return value instanceof ByteArray || value == null;
}
protected Object getObject() {
@@ -43,14 +42,16 @@
}
protected void setObject(Object value) {
- if (token!=null) token.addLog(new ByteArrayUpdateLog(this, this.value, (ByteArray)
value));
+ if (token != null) {
+ token.addLog(new ByteArrayUpdateLog(this, this.value, (ByteArray) value));
+ }
// delete old value, otherwise it will be unreachable
if (this.value != null) {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
if (jbpmContext != null) {
Session session = jbpmContext.getSession();
if (session != null) session.delete(this.value);
- }
+ }
}
// set new value
this.value = (ByteArray) value;
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DateInstance.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DateInstance.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DateInstance.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,20 +21,19 @@
*/
package org.jbpm.context.exe.variableinstance;
-import java.util.*;
+import java.util.Date;
-import org.jbpm.context.exe.*;
-import org.jbpm.context.log.variableinstance.*;
+import org.jbpm.context.exe.VariableInstance;
+import org.jbpm.context.log.variableinstance.DateUpdateLog;
public class DateInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
-
- protected Date value = null;
+ protected Date value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (Date.class.isAssignableFrom(value.getClass()));
+ return value instanceof Date || value == null;
}
protected Object getObject() {
@@ -42,7 +41,7 @@
}
protected void setObject(Object value) {
- if (token!=null) token.addLog(new DateUpdateLog(this, this.value, (Date) value));
+ if (token != null) token.addLog(new DateUpdateLog(this, this.value, (Date) value));
this.value = (Date) value;
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DoubleInstance.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DoubleInstance.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/DoubleInstance.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,18 +21,17 @@
*/
package org.jbpm.context.exe.variableinstance;
-import org.jbpm.context.exe.*;
-import org.jbpm.context.log.variableinstance.*;
+import org.jbpm.context.exe.VariableInstance;
+import org.jbpm.context.log.variableinstance.DoubleUpdateLog;
public class DoubleInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
-
- protected Double value = null;
+ protected Double value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (Double.class==value.getClass());
+ return value instanceof Double || value == null;
}
protected Object getObject() {
@@ -40,7 +39,7 @@
}
protected void setObject(Object value) {
- if (token!=null) token.addLog(new DoubleUpdateLog(this, this.value, (Double)
value));
+ if (token != null) token.addLog(new DoubleUpdateLog(this, this.value, (Double)
value));
this.value = (Double) value;
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/JcrNodeInstance.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/JcrNodeInstance.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/JcrNodeInstance.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -22,6 +22,7 @@
package org.jbpm.context.exe.variableinstance;
import java.util.Iterator;
+import java.util.Map;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
@@ -31,35 +32,32 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
import org.jbpm.context.exe.VariableInstance;
import org.jbpm.jcr.JcrService;
-import org.jbpm.svc.Service;
import org.jbpm.svc.Services;
public class JcrNodeInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
- String repository;
- String workspace;
- String path;
+ private String repository;
+ private String workspace;
+ private String path;
public boolean isStorable(Object value) {
- if (value == null) return true;
- return Node.class.isAssignableFrom(value.getClass());
+ return value instanceof Node || value == null;
}
protected Object getObject() {
if (path == null) return null;
- // THE NODE REPOSITORY AND WORKSPACE NAME GOT TO CORRESPOND WITH A JBPM
- // SERVICE NAME
JcrService jcrService = findService();
if (jcrService == null) {
- throw new JbpmException("couldn't find jBPM service for JCR repository
'" + repository
- + "', workspace '" + workspace + "'");
+ throw new JbpmException("could not find service for JCR repository '"
+ repository
+ + "' and workspace '" + workspace + "'");
}
try {
return jcrService.getSession().getItem(path);
@@ -85,19 +83,18 @@
* @throws JbpmException if no matching service is found
*/
private JcrService findService() {
- JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
- Services services = jbpmContext.getServices();
+ Services services = JbpmContext.getCurrentJbpmContext().getServices();
+ Map serviceFactories = services.getServiceFactories();
// if there is a service called jcr
- Service service = services.getService("jcr");
- if (service != null) {
+ if (serviceFactories.containsKey("jcr")) {
// use that one
- return (JcrService) service;
+ return (JcrService) services.getService("jcr");
}
- // start matching the JCR workspace name with the jbpm service names
+ // compare the repository and workspace names with the service names
String serviceName = null;
- for (Iterator iter = services.getServiceFactories().keySet().iterator();
iter.hasNext();) {
+ for (Iterator iter = serviceFactories.keySet().iterator(); iter.hasNext();) {
String candidate = (String) iter.next();
if (candidate.startsWith(repository)) {
if (candidate.length() == repository.length()) {
@@ -109,10 +106,6 @@
}
}
}
- if (serviceName == null) {
- throw new JbpmException("could not find JCR service for repository '"
+ repository
- + "' and workspace '" + workspace + '\'');
- }
return (JcrService) services.getService(serviceName);
}
@@ -125,10 +118,8 @@
}
else {
try {
- // node repo and workspace got to correspond with a jbpm service name,
- // as described in findService, unless a global "jcr" service
- // THE NODE REPOSITORY AND WORKSPACE NAME GOT TO CORRESPOND WITH A JBPM
- // SERVICE NAME
+ // repository and workspace have to correspond with a service name,
+ // as described in findService, unless there is a global "jcr" service
Session session = node.getSession();
repository = session.getRepository().getDescriptor(Repository.REP_NAME_DESC);
workspace = session.getWorkspace().getName();
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/LongInstance.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/LongInstance.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/LongInstance.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,26 +21,25 @@
*/
package org.jbpm.context.exe.variableinstance;
-import org.jbpm.context.exe.*;
-import org.jbpm.context.log.variableinstance.*;
+import org.jbpm.context.exe.VariableInstance;
+import org.jbpm.context.log.variableinstance.LongUpdateLog;
public class LongInstance extends VariableInstance {
private static final long serialVersionUID = 1L;
-
- protected Long value = null;
+ protected Long value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (Long.class==value.getClass());
+ return value instanceof Long || value == null;
}
- protected Object getObject() {
+ protected Object getObject() {
return value;
}
- protected void setObject(Object value) {
- if (token!=null) token.addLog(new LongUpdateLog(this, this.value, (Long)value));
+ protected void setObject(Object value) {
+ if (token != null) token.addLog(new LongUpdateLog(this, this.value, (Long) value));
this.value = (Long) value;
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/StringInstance.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/StringInstance.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/context/exe/variableinstance/StringInstance.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -21,18 +21,17 @@
*/
package org.jbpm.context.exe.variableinstance;
-import org.jbpm.context.exe.*;
-import org.jbpm.context.log.variableinstance.*;
+import org.jbpm.context.exe.VariableInstance;
+import org.jbpm.context.log.variableinstance.StringUpdateLog;
public class StringInstance extends VariableInstance {
-
+
private static final long serialVersionUID = 1L;
-
- protected String value = null;
+ protected String value;
+
public boolean isStorable(Object value) {
- if (value==null) return true;
- return (String.class==value.getClass());
+ return value instanceof String || value == null;
}
protected Object getObject() {
@@ -40,7 +39,7 @@
}
protected void setObject(Object value) {
- if (token!=null) token.addLog(new StringUpdateLog(this, this.value, (String)value));
+ if (token != null) token.addLog(new StringUpdateLog(this, this.value, (String)
value));
this.value = (String) value;
}
}
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/CustomLoaderObjectInputStream.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -34,6 +34,7 @@
* manner.
*
* @author Alejandro Guizar
+ * @deprecated no use for this class
*/
public class CustomLoaderObjectInputStream extends ObjectInputStream {
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java 2010-08-24
18:30:53 UTC (rev 6623)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/EqualsUtil.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -33,7 +33,7 @@
* hack to support comparing hibernate proxies against the real objects.
* since it falls back to ==, clients don't need to override hashcode.
* @deprecated hack does not work
- * @see <a
href="https://jira.jboss.org/jira/browse/JBPM-2489f">JBPM-24...
+ * @see <a
href="https://jira.jboss.org/jira/browse/JBPM-2489">JBPM-248...
*/
public static boolean equals(Object thisObject, Object otherObject) {
return thisObject == otherObject || otherObject instanceof HibernateProxy
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java
===================================================================
---
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java
(rev 0)
+++
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java 2010-08-24
21:38:53 UTC (rev 6624)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.jbpm2069;
+
+import java.util.BitSet;
+
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+/**
+ * IntegerToLongConverter not consistent when dealing with null-values
+ *
+ * @see <a
href="https://jira.jboss.org/browse/JBPM-2069">JBPM-2069<...
+ * @author Alejandro Guizar
+ */
+public class JBPM2069Test extends AbstractJbpmTestCase {
+
+ ContextInstance contextInstance;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ProcessDefinition processDefinition =
ProcessDefinition.createNewProcessDefinition();
+ ProcessInstance processInstance = processDefinition.createProcessInstance();
+ contextInstance = processInstance.getContextInstance();
+ }
+
+ public void testIntegerVariable() {
+ contextInstance.setVariable("i", new Integer(Integer.MAX_VALUE));
+ contextInstance.setVariable("i", null);
+
+ assertNull(contextInstance.getVariable("i"));
+ }
+
+ public void testShortVariable() {
+ contextInstance.setVariable("s", new Short(Short.MAX_VALUE));
+ contextInstance.setVariable("s", null);
+
+ assertNull(contextInstance.getVariable("s"));
+ }
+
+ public void testByteVariable() {
+ contextInstance.setVariable("b", new Short(Byte.MAX_VALUE));
+ contextInstance.setVariable("b", null);
+
+ assertNull(contextInstance.getVariable("b"));
+ }
+
+ public void testFloatVariable() {
+ contextInstance.setVariable("f", new Float(Float.MAX_VALUE));
+ contextInstance.setVariable("f", null);
+
+ assertNull(contextInstance.getVariable("f"));
+ }
+
+ public void testBooleanVariable() {
+ contextInstance.setVariable("z", Boolean.TRUE);
+ contextInstance.setVariable("z", null);
+
+ assertNull(contextInstance.getVariable("z"));
+ }
+
+ public void testCharacterVariable() {
+ contextInstance.setVariable("c", new Character(Character.MAX_VALUE));
+ contextInstance.setVariable("c", null);
+
+ assertNull(contextInstance.getVariable("c"));
+ }
+
+ public void testSerializableVariable() {
+ contextInstance.setVariable("l", new BitSet());
+ contextInstance.setVariable("l", null);
+
+ assertNull(contextInstance.getVariable("l"));
+ }
+}
Property changes on:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2069/JBPM2069Test.java
___________________________________________________________________
Name: svn:eol-style
+ native