Problem created, problem solved

Many thanks to Emanuele for submitting the code.

This is how you create the problem:

   Long.parseLong(Long.toString(id.longValue()));



And this is how you’re going to solve it:

   try {
           mId = Long.parseLong(Long.toString(id.longValue()));
           log.debug("id: " + id.longValue());
       } catch (NullPointerException npEx) {
           log.debug("NullPointerException npEx :: " + npEx.getMessage());
           return ActionSupport.ERROR;
       } catch (NumberFormatException nfEx) {
           log.debug("NumberFormatException nfEx :: " + nfEx.getMessage());
           return ActionSupport.ERROR;
       } catch (Exception gnEx) {
           log.debug("Exception gnEx :: " + gnEx.getMessage());
           return ActionSupport.ERROR;
       }

Someone said “If you are not part of the solution then you are part of the problem”.
The guy who has wrote this chunk of code, eventually is part of both.

Advertisements

4 responses to “Problem created, problem solved

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s