package sfBugs;

public class Bug3277814 {

    public void test() {
        String var = "";
        int index = 2;
        if (index == -1) {
            var = String.class.getName();
            if (var.length() == 0) {
                var = null;
            }
        } else {
            var = Integer.class.getName();
            if (var.length() == 0) {
                var = null;
            }
        }
        if (var == null) {// FINBUGS reports on this line NP_GUARANTEED_DEREF
            /*
             * There is a statement or branch that if executed guarantees that a
             * value is null at this point, and that value that is guaranteed to
             * be dereferenced (except on forward paths involving runtime
             * exceptions).
             */
            throw new RuntimeException("NULL");
        }
    }
}

@@ -10,16 +10,121 @@
 fBugs;%0A%0A
+import edu.umd.cs.findbugs.annotations.NoWarning;%0Aimport edu.umd.cs.findbugs.annotations.ExpectWarning;%0A%0A
 public c
@@ -142,16 +142,37 @@
 7814 %7B%0A%0A
+    @NoWarning(%22NP%22)%0A
     publ
@@ -906,16 +906,16 @@
      */%0A
-
         
@@ -970,10 +970,859 @@
 %7D%0A    %7D%0A
+    %0A    @ExpectWarning(%22NP%22)%0A    public void test2() %7B%0A        String var = %22%22;%0A        int index = 2;%0A        if (index == -1) %7B%0A            var = String.class.getName();%0A            if (var.length() == 0) %7B%0A                var = null;%0A            %7D%0A        %7D else %7B%0A            var = Integer.class.getName();%0A            if (var.length() == 0) %7B%0A                var = null;%0A            %7D%0A        %7D%0A        if (var == null) %7B// FINBUGS reports on this line NP_GUARANTEED_DEREF%0A            /*%0A             * There is a statement or branch that if executed guarantees that a%0A             * value is null at this point, and that value that is guaranteed to%0A             * be dereferenced (except on forward paths involving runtime%0A             * exceptions).%0A             */%0A            throw new NullPointerException(%22var is null%22);%0A        %7D%0A    %7D%0A
 %7D%0A

Add expect/no warning annotations