You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Thorsten H. Riek (JIRA)" <ji...@apache.org> on 2007/10/18 22:29:50 UTC
[jira] Created: (AXIS2-3287) ConverterUtil.convertToArray fails for
boolean.class
ConverterUtil.convertToArray fails for boolean.class
----------------------------------------------------
Key: AXIS2-3287
URL: https://issues.apache.org/jira/browse/AXIS2-3287
Project: Axis 2.0 (Axis2)
Issue Type: Bug
Components: adb, databinding
Affects Versions: 1.3, 1.4
Environment: Maven version: 2.0.7
Java version: 1.6.0_02
OS name: "windows xp" version: "5.1" arch: "x86"
Reporter: Thorsten H. Riek
Priority: Critical
Conversion ConverterUtil.convertToArray fails for
String[] testString = {"true","false"};
Object[] convertedObj = ConverterUtil.convertToArray( boolean.class, testString );
The Result is:
convertedObj[0] --> false
convertedObj[1] --> false
The Problem is the conversion from String to boolean is wrong:
org.apache.axis2.databinding.utils.ConverterUtil.convertToArray
{noformat}
} else if (boolean.class.equals(baseArrayClass)) {
boolean[] array = new boolean[listSize];
for (int i = 0; i < listSize; i++) {
Object o = objectList.get(i);
if (o != null) {
array[i] = Boolean.getBoolean(o.toString());
}
}
returnArray = array;
{noformat}
array[i] = Boolean.getBoolean(o.toString()); is wrong
it should be:
array[i] = Boolean.parse(o.toString());
Here is the modified Testcase to reproduce it:
ConverterUtilTest
{noformat}
/** boolean arrays */
public void testBool() {
List l = new ArrayList();
l.add("true");
l.add("false");
l.add("true");
l.add("false");
Object convertedObj = ConverterUtil.convertToArray(
boolean.class, l);
assertTrue(convertedObj.getClass().isArray());
assertTrue(convertedObj.getClass().equals(boolean[].class));
if (convertedObj.getClass().isArray()) {
Object[] result = l.toArray();
for (int i=0;i<result.length ; i++){
System.out.println(Boolean.parseBoolean((String) result[i])+" == "+((boolean[])convertedObj)[i]);
assertTrue(Boolean.parseBoolean((String)result[i])==((boolean[])convertedObj)[i]);
}
}
}
{noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org
[jira] Resolved: (AXIS2-3287) ConverterUtil.convertToArray fails
for boolean.class
Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AXIS2-3287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Amila Chinthaka Suriarachchi resolved AXIS2-3287.
-------------------------------------------------
Resolution: Fixed
Assignee: Amila Chinthaka Suriarachchi
fixed the issue revision 586305
> ConverterUtil.convertToArray fails for boolean.class
> ----------------------------------------------------
>
> Key: AXIS2-3287
> URL: https://issues.apache.org/jira/browse/AXIS2-3287
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: adb, databinding
> Affects Versions: 1.4, 1.3
> Environment: Maven version: 2.0.7
> Java version: 1.6.0_02
> OS name: "windows xp" version: "5.1" arch: "x86"
> Reporter: Thorsten H. Riek
> Assignee: Amila Chinthaka Suriarachchi
> Priority: Critical
>
> Conversion ConverterUtil.convertToArray fails for
> String[] testString = {"true","false"};
> Object[] convertedObj = ConverterUtil.convertToArray( boolean.class, testString );
> The Result is:
> convertedObj[0] --> false
> convertedObj[1] --> false
> The Problem is the conversion from String to boolean is wrong:
> org.apache.axis2.databinding.utils.ConverterUtil.convertToArray
> // >>-----------------------------------------------------------------
> } else if (boolean.class.equals(baseArrayClass)) {
> boolean[] array = new boolean[listSize];
> for (int i = 0; i < listSize; i++) {
> Object o = objectList.get(i);
> if (o != null) {
> array[i] = Boolean.getBoolean(o.toString());
> }
> }
> returnArray = array;
> }
> // <<-----------------------------------------------------------------
> array[i] = Boolean.getBoolean(o.toString()); is wrong
> it should be:
> array[i] = Boolean.parseBoolean(o.toString());
> Here is the modified Testcase to reproduce it:
> ConverterUtilTest
> // >>-----------------------------------------------------------------
> /** boolean arrays */
> public void testBool() {
> List l = new ArrayList();
> l.add("true");
> l.add("false");
> l.add("true");
> l.add("false");
> Object convertedObj = ConverterUtil.convertToArray(
> boolean.class, l);
> assertTrue(convertedObj.getClass().isArray());
> assertTrue(convertedObj.getClass().equals(boolean[].class));
>
> if (convertedObj.getClass().isArray()) {
> Object[] result = l.toArray();
> for (int i=0;i<result.length ; i++){
> System.out.println(Boolean.parseBoolean((String) result[i])+" == "+((boolean[])convertedObj)[i]);
> assertTrue(Boolean.parseBoolean((String)result[i])==((boolean[])convertedObj)[i]);
> }
> }
> }
> // <<-----------------------------------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org
[jira] Updated: (AXIS2-3287) ConverterUtil.convertToArray fails for
boolean.class
Posted by "Thorsten H. Riek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AXIS2-3287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thorsten H. Riek updated AXIS2-3287:
------------------------------------
Description:
Conversion ConverterUtil.convertToArray fails for
String[] testString = {"true","false"};
Object[] convertedObj = ConverterUtil.convertToArray( boolean.class, testString );
The Result is:
convertedObj[0] --> false
convertedObj[1] --> false
The Problem is the conversion from String to boolean is wrong:
org.apache.axis2.databinding.utils.ConverterUtil.convertToArray
// >>-----------------------------------------------------------------
} else if (boolean.class.equals(baseArrayClass)) {
boolean[] array = new boolean[listSize];
for (int i = 0; i < listSize; i++) {
Object o = objectList.get(i);
if (o != null) {
array[i] = Boolean.getBoolean(o.toString());
}
}
returnArray = array;
}
// <<-----------------------------------------------------------------
array[i] = Boolean.getBoolean(o.toString()); is wrong
it should be:
array[i] = Boolean.parseBoolean(o.toString());
Here is the modified Testcase to reproduce it:
ConverterUtilTest
// >>-----------------------------------------------------------------
/** boolean arrays */
public void testBool() {
List l = new ArrayList();
l.add("true");
l.add("false");
l.add("true");
l.add("false");
Object convertedObj = ConverterUtil.convertToArray(
boolean.class, l);
assertTrue(convertedObj.getClass().isArray());
assertTrue(convertedObj.getClass().equals(boolean[].class));
if (convertedObj.getClass().isArray()) {
Object[] result = l.toArray();
for (int i=0;i<result.length ; i++){
System.out.println(Boolean.parseBoolean((String) result[i])+" == "+((boolean[])convertedObj)[i]);
assertTrue(Boolean.parseBoolean((String)result[i])==((boolean[])convertedObj)[i]);
}
}
}
// <<-----------------------------------------------------------------
was:
Conversion ConverterUtil.convertToArray fails for
String[] testString = {"true","false"};
Object[] convertedObj = ConverterUtil.convertToArray( boolean.class, testString );
The Result is:
convertedObj[0] --> false
convertedObj[1] --> false
The Problem is the conversion from String to boolean is wrong:
org.apache.axis2.databinding.utils.ConverterUtil.convertToArray
{noformat}
} else if (boolean.class.equals(baseArrayClass)) {
boolean[] array = new boolean[listSize];
for (int i = 0; i < listSize; i++) {
Object o = objectList.get(i);
if (o != null) {
array[i] = Boolean.getBoolean(o.toString());
}
}
returnArray = array;
{noformat}
array[i] = Boolean.getBoolean(o.toString()); is wrong
it should be:
array[i] = Boolean.parse(o.toString());
Here is the modified Testcase to reproduce it:
ConverterUtilTest
{noformat}
/** boolean arrays */
public void testBool() {
List l = new ArrayList();
l.add("true");
l.add("false");
l.add("true");
l.add("false");
Object convertedObj = ConverterUtil.convertToArray(
boolean.class, l);
assertTrue(convertedObj.getClass().isArray());
assertTrue(convertedObj.getClass().equals(boolean[].class));
if (convertedObj.getClass().isArray()) {
Object[] result = l.toArray();
for (int i=0;i<result.length ; i++){
System.out.println(Boolean.parseBoolean((String) result[i])+" == "+((boolean[])convertedObj)[i]);
assertTrue(Boolean.parseBoolean((String)result[i])==((boolean[])convertedObj)[i]);
}
}
}
{noformat}
> ConverterUtil.convertToArray fails for boolean.class
> ----------------------------------------------------
>
> Key: AXIS2-3287
> URL: https://issues.apache.org/jira/browse/AXIS2-3287
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: adb, databinding
> Affects Versions: 1.4, 1.3
> Environment: Maven version: 2.0.7
> Java version: 1.6.0_02
> OS name: "windows xp" version: "5.1" arch: "x86"
> Reporter: Thorsten H. Riek
> Priority: Critical
>
> Conversion ConverterUtil.convertToArray fails for
> String[] testString = {"true","false"};
> Object[] convertedObj = ConverterUtil.convertToArray( boolean.class, testString );
> The Result is:
> convertedObj[0] --> false
> convertedObj[1] --> false
> The Problem is the conversion from String to boolean is wrong:
> org.apache.axis2.databinding.utils.ConverterUtil.convertToArray
> // >>-----------------------------------------------------------------
> } else if (boolean.class.equals(baseArrayClass)) {
> boolean[] array = new boolean[listSize];
> for (int i = 0; i < listSize; i++) {
> Object o = objectList.get(i);
> if (o != null) {
> array[i] = Boolean.getBoolean(o.toString());
> }
> }
> returnArray = array;
> }
> // <<-----------------------------------------------------------------
> array[i] = Boolean.getBoolean(o.toString()); is wrong
> it should be:
> array[i] = Boolean.parseBoolean(o.toString());
> Here is the modified Testcase to reproduce it:
> ConverterUtilTest
> // >>-----------------------------------------------------------------
> /** boolean arrays */
> public void testBool() {
> List l = new ArrayList();
> l.add("true");
> l.add("false");
> l.add("true");
> l.add("false");
> Object convertedObj = ConverterUtil.convertToArray(
> boolean.class, l);
> assertTrue(convertedObj.getClass().isArray());
> assertTrue(convertedObj.getClass().equals(boolean[].class));
>
> if (convertedObj.getClass().isArray()) {
> Object[] result = l.toArray();
> for (int i=0;i<result.length ; i++){
> System.out.println(Boolean.parseBoolean((String) result[i])+" == "+((boolean[])convertedObj)[i]);
> assertTrue(Boolean.parseBoolean((String)result[i])==((boolean[])convertedObj)[i]);
> }
> }
> }
> // <<-----------------------------------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org