When using FFDCSupport aspect you can control the data gathered. Twotemplate
methods getSourceId and getProbeId are provided to you for this purpose. For
example, you may want to limit the length of the source ID strings. In Figure 7,
aspect Example_7 illustrates how to override the getSourceId method and return a
short name.
Youcan use FFDC to control how your classes are introspected by implementing
the introspectSelf method. Class Person in Figure 8 illustrates how you can hide
a sensitive field (in this example a password is hidden).
import com.ibm.websphere.ffdc.FFDCSupport;
public aspect Example_6 extends FFDCSupport {
protected pointcut ffdcScope () : within(com.foo.*);
public pointcut ffdcCall () : call(* com.ibm.websphere.ffdc..*(..));
declare warning : ffdcCall() && ffdcScope() :
"Don't call FFDC directly. Use FFDCSupport aspect.";
public pointcut dumpException () : call(void Throwable.printStackTrace(..));
declare warning : dumpException() && ffdcScope() :
"Don't dump exceptions to console. Use FFDCSupport aspect.";
}
Figure12. Warn user about calling FFDC directly or dumping stack traces
import com.ibm.websphere.ffdc.FFDCSupport;
import org.aspectj.lang.JoinPoint;
public aspect Example_7 extends FFDCSupport {
protected pointcut ffdcScope () :
within(com.foo.*);
protected String getSourceId (JoinPoint.StaticPart ejp) {
String name = ejp.getSignature().getName();
return name;
}
}
Figure13. Override default source ID generation to create short name
private class Person {
private String userid = "USER";
private String password = "PASSW0RD";
public String[] introspectSelf () {
String[] self = { "userid=" + userid, "password=XXXXXXXX" };
return self;
}
}
Hide password field of Person class from introspection.
Figure14. How to hide a sensitive field in this case a password
192 WebSphereAdapters: WebSphereAdapter Toolkit User Guide