// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.lang.reflect.*;

import org.aspectj.lang.annotation.*;

@Aspect
public class NullCatcher {
    @Pointcut("execution(* *.getString())")
    public void getStringHandler() {}
    @AfterReturning(pointcut = "getStringHandler()", returning = "o")
    public void checkIfNull(String o) {
        if(o == null) {
            System.out.println("Ooops we got a null");
        }
    }
}
