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

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

I got the solution with little modification

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

is changed to

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

0 vote

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

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.

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

Mission-critical battery manufacturer fulfills FAA software requirements with Commit Policy Plugin

EaglePicher Technologies is a leading manufacturer of battery systems for diverse industries like defense, aviation, space or medical. As they operate in highly regulated industries, keeping a clear ...

131 views 0 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you