An unknown exception occured executing Validator ---root cause:0

Bharadwaj Jannu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2013

I wrote the following code:

-------------------------------------------------------------------------------------------------------------------------------------

Object PackageNumber = issue.getCustomFieldValue(cfm.getCustomFieldObjectByName("Package Number"));

String partsCol[] = PackageNumber.toString().split(".");

System.out.println(partsCol[0]);

-------------------------------------------------------------------------------------------------------------------------------------

Here I'm getting the error to access partsCol[0]

2 answers

1 accepted

0 votes
Answer accepted
Bharadwaj Jannu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2013

I got the solution with little modification

String partsCol[] = PackageNumber.toString().split(".");

is changed to

String partsCol[] = PackageNumber.toString().split("\\.");

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 27, 2013

At a guess, I'd say your custom field value does not have any . in it.

Bharadwaj Jannu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2013

Thanks Nic,

the custom field value contains "." in it.

But java split do not considering the "." as a regular expression,instead I tried using escape sequence as "\\." and I got it.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 27, 2013

Ahh, well done. I keep forgetting split uses regex - it would have been splitting on everything...

Suggest an answer

Log in or Sign up to answer