cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.NumberFormatException: empty String error

Former Member
0 Kudos

Hi Experts,

My code is as follows:

IPrivateTimesheetView.ICategoriesElement categoryElement;

String wbs ="h";

double d =0;

String Day1 ="";

for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){

wdContext.nodeWorklist().setLeadSelection(i);

categoryElement = wdContext.createCategoriesElement();

wbs = wdContext.currentWorklistElement().getReciever_Wbs_Element();

Day1 = wdContext.currentWorklistElement().getDay1();

if(""!=Day1 && null!=Day1)

d = Double.parseDouble(Day1) ;

categoryElement.setCategoryText(wbs);

categoryElement.setSeries1Value(d);

categoryElement.setSeries2Value(2);

wdContext.nodeCategories().addElement(categoryElement);

wbs = "";

Due to some issue with "Day1 = wdContext.currentWorklistElement().getDay1();" line, I am getting following error:

" java.lang.NumberFormatException: empty String "

Could you please let me know how to sort out the issue?

Regards,

S

Accepted Solutions (1)

Accepted Solutions (1)

former_member182294
Active Contributor
0 Kudos

Hi Stuart,

I have answered for your previous query.

Regards

Abhilash

Answers (1)

Answers (1)

former_member193726
Active Participant
0 Kudos

Hi Stuart,

Try the following,

String Day1 ="";

if(wdContext.currentWorklistElement().getDay1() != null){

Day1 = wdContext.currentWorklistElement().getDay1().trim();

}

if(""!=Day1)

d = Double.parseDouble(Day1) ;

categoryElement.setCategoryText(wbs);

categoryElement.setSeries1Value(d);

categoryElement.setSeries2Value(2);

wdContext.nodeCategories().addElement(categoryElement);

wbs = "";

Hope the trim() method helps.

Regards,

Rekha Malavathu