Try/Catch

Discussions

General J2EE: Try/Catch

  1. Try/Catch (7 messages)

    try
    {
       something;
    }
    Catch(SomeException e)
    {
       if(e==null)
        do this ;
       else
        do that;
        
    }

    My question is can there be anytime ,any Exception object null???? Before extracting data from Exception object Should we check for Null???

    Threaded Messages (7)

  2. Try/Catch[ Go to top ]

    Hi

    The java language will always pass the exception that was instantiated in the throw statement that raised the exception. So you don't have to check if the exception object is null.
  3. Try/Catch[ Go to top ]

    Even if I was new to Java, it would make no sense to me. A null exception would mean nothing was thrown... so there's nothing to catch ;)

    Regards,
    Martin
  4. Try/Catch[ Go to top ]

    One last thing... try not to post this kind of questions in the J2EE forum, please...
  5. Try/Catch[ Go to top ]

    Thanks for confirmation. When u see this kind of things in some existing framework which is being used in some vast and live system its neccessary to take suggestions from experts so i did the same by posting the question.Otherwise my views were also the same so please dont mind it because those people who wrote that framwork were experts/experienced programmer so no harm in giving thoughts or raising why.
  6. Try/Catch[ Go to top ]

    There're a lot of Java experts' forums out there...
  7. Try/Catch[ Go to top ]

    Hi... I'm curious to know which framework this code has been picked from. Hope it's not Struts or Maverick, coz I hold them in high esteem.

    -Parag
  8. Try/Catch[ Go to top ]

    Yeah, I'd like to know that too. JBoss, perhaps? ;)