However, the return statement above makes the input parameter "value" an empty string. How can I retain the value of the parameter "value" for further manipulation?
A Farroll wrote:However, the return statement above makes the input parameter "value" an empty string.
Dave Tolls wrote:Not convinced by this bit of the code (lines 14 - 17 in the above):
If value is empty then it will never reach the if statement as the parseLong will have thrown a NumberFormatException, so no point with the check there at all.
That aside, what is printed out by the println statement in the else block?
A Farroll wrote:Thanks once again Dave. I agree there doesn't seem to be anything changing the value of "value" that is why I found it so confusing. I have spent some time trying to get the contents of "value" parameter to the second try-catch block. How do I do this or amend the try-catch to allow this?
Regards
AJF
Dave Tolls wrote:
A Farroll wrote:Thanks once again Dave. I agree there doesn't seem to be anything changing the value of "value" that is why I found it so confusing. I have spent some time trying to get the contents of "value" parameter to the second try-catch block. How do I do this or amend the try-catch to allow this?
Regards
AJF
So what is it you are actually trying to achieve?
Because it really isn't clear.
"get(ting) the contents of "value" parameter to the second try-catch block" explains nothing.
You could do that by simply sticking it at the beginning of the method and removing everything else.
A Farroll wrote:
Dave Tolls wrote:
A Farroll wrote:Thanks once again Dave. I agree there doesn't seem to be anything changing the value of "value" that is why I found it so confusing. I have spent some time trying to get the contents of "value" parameter to the second try-catch block. How do I do this or amend the try-catch to allow this?
Regards
AJF
So what is it you are actually trying to achieve?
Because it really isn't clear.
"get(ting) the contents of "value" parameter to the second try-catch block" explains nothing.
You could do that by simply sticking it at the beginning of the method and removing everything else.
What I attempting to acheive is amend the If - else statement or\and the second try catch block to process the second "Long retval = Long.parseLong(value)" and "return retval" statements with the original value of the "value" parameter. I have already attempted placing a single "Long retval = Long.parseLong(value)" before the If statement but I kept getting errors with that too.
Thanks
Regards
AJF
Dave Tolls wrote:
You also don't seem to be able to actually describe what you are trying to do.
You seem to be trying to fix a bug by curing the symptoms (the NumberFormatException) rather than the actual cause (the empty String).
A Farroll wrote:... the reason for the integer is because as well as the documents (they are called Contracts) being stored in Notes they are also pushed through to a SQL Server Database and so requires some handling as an integer in SQL Server as well as a Long in Notes - YES I realise this is duplication of data and overly complicated without it being necessary to be but I did not design this application. I am just stuck with maintaining it. I would frankly rebuild it in a less complicated manner.
A Farroll wrote:Dave Toll you were close regarding the doValidation declaration. It is;
public static boolean doValidation(UIInputText field,FacesContext facescontext) {...