Skip to Content
avatar image
Former Member

java.lang.NumberFormatException: empty String error

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 17, 2007 at 01:41 PM

    Hi Stuart,

    I have answered for your previous query.

    Regards

    Abhilash

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 12:12 PM

    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

    Add comment
    10|10000 characters needed characters exceeded