package edu.umd.cs.findbugs.detect;


import org.apache.bcel.classfile.CodeException;

import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.Detector;
import edu.umd.cs.findbugs.ba.ClassContext;
import edu.umd.cs.findbugs.visitclass.PreorderVisitor;

public class DontCatchNullPointerException
        extends PreorderVisitor implements Detector {

    private final BugReporter reporter;
    ClassContext classContext;

    public DontCatchNullPointerException(BugReporter reporter) {
        this.reporter = reporter;
    }

    private static final String NullPtrExceptionID =
            "java.lang.NullPointerException";

    @Override
    public void visit(CodeException exc) {
        int type = exc.getCatchType();

        if (type == 0)
            return;

        String name = getConstantPool()
                .constantToString(getConstantPool()
                        .getConstant(type));

        if (name.equals(NullPtrExceptionID)) {
            BugInstance bug = new BugInstance(this,
                    "DCN_NULLPOINTER_EXCEPTION",
                    NORMAL_PRIORITY);
            bug.addClassAndMethod(this);
            bug.addSourceLine(this.classContext, this, exc.getHandlerPC());

            reporter.reportBug(bug);
        }
    }

    @Override
    public void visitClassContext(ClassContext classContext) {
        this.classContext = classContext;
        this.classContext.getJavaClass().accept(this);
    }

    @Override
    public void report() {
    }
}

@@ -111,59 +111,43 @@
 ugs.
-BugInstance;%0Aimport edu.umd.cs.findbugs.BugReporter
+internalAnnotations.DottedClassName
 ;%0Aim
@@ -171,24 +171,27 @@
 indbugs.
-Detector
+BugInstance
 ;%0Aimport
@@ -215,23 +215,19 @@
 ugs.
-ba.ClassContext
+BugReporter
 ;%0Aim
@@ -255,31 +255,29 @@
 ugs.
-visitclass.PreorderVisi
+BytecodeScanningDetec
 tor;
@@ -341,35 +341,24 @@
 nds 
-PreorderVisitor implements 
+BytecodeScanning
 Dete
@@ -408,39 +408,8 @@
 ter;
-%0A    ClassContext classContext;
 %0A%0A  
@@ -508,24 +508,45 @@
 ter;%0A    %7D%0A%0A
+    @DottedClassName%0A
     private 
@@ -566,33 +566,41 @@
 String N
-ullPtrExceptionID
+ULLPOINTER_EXCEPTION_FQCN
  =%0A     
@@ -949,25 +949,33 @@
 ls(N
-ullPtrExceptionID
+ULLPOINTER_EXCEPTION_FQCN
 )) %7B
@@ -1185,22 +1185,20 @@
 rceLine(
-this.c
+getC
 lassCont
@@ -1200,16 +1200,18 @@
 sContext
+()
 , this, 
@@ -1288,236 +1288,7 @@
    %7D
-%0A%0A    @Override%0A    public void visitClassContext(ClassContext classContext) %7B%0A        this.classContext = classContext;%0A        this.classContext.getJavaClass().accept(this);%0A    %7D%0A%0A    @Override%0A    public void report() %7B%0A    %7D
 %0A%7D%0A

Use BytecodeScanningDetector as base class