Advertisement

07.23.2008 at 12:14PM PDT, ID: 23589777
[x]
Attachment Details

Method calls within Exceptions

Asked by lcor in Java Servlets, Java Programming Language, New to Java Programming

Tags: Sun, JDK, 1.5x higher

Here's a question about exception handling with a servlet.

I have to catch a certain type of exception based on some type of action but the logging class I have to use (not System.out ; it's proprietary and mandatory).  The mandatory logging method (someclass.logging) throws it's own special exception (i.e., loggingException).  The compiler complains that it must be caught but how do you catch within a catch?

catch (someException e) {

      someclass.logging ("message");

}

Catching within a catch looks really messy.

catch (someException e) {
     try {
          someclass.logging ("message");
    }  catch (loggingException le) {}
}

This is done with the doGet method of a servlet so my options are limited.  Any ideas?Start Free Trial
 
Loading Advertisement...
 
[+][-]07.23.2008 at 12:18PM PDT, ID: 22072824

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.23.2008 at 03:56PM PDT, ID: 22074710

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Servlets, Java Programming Language, New to Java Programming
Tags: Sun, JDK, 1.5x higher
Sign Up Now!
Solution Provided By: objects
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.25.2008 at 01:23AM PDT, ID: 22086771

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628