Sun Identity Manager 8.1 システム管理者ガイド

例外トレースポイントの使用方法

使用するコードに例外トレースポイントを追加する前に、これらのガイドラインをお読みください。

次に、簡易例外トレース文の例を示します。この例では、次の CLASS 変数が宣言されているものとします。

private static final String CLASS = 
"com.waveset.adapter.MyResourceAdapter"; 
protected static Trace _trace = Trace.getTrace();

例 5–4 例外トレースポイントの一例

try {   
   someMethod(); 
}  catch(Exception e) {   
   _trace.throwing(_trace.ALWAYS, CLASS, METHOD, e);   
   throw e; 
}


try {   
   someMethod(); 
}  catch(Exception e) {   
   _trace.throwing(_trace.ALWAYS, CLASS, METHOD, e);   
   WavesetException we = new WavesetException(Some Message, e);   
   throw we; 
}


if (error) {   
  WavesetException e = new WavesetException(Some Error Message.; 
  _trace.throwing(_trace.LEVEL3, CLASS, METHOD, e);   
  throw e;
}

try {
   someMethod();
}  catch(Exception e) {
   _trace.caught(_trace.LEVEL1, CLASS, METHOD, e);
}
// execution continues.
someOtherMethod();