public static boolean isNullCheck(InstructionHandle h, ConstantPoolGen cpg) { if (!(h.getInstruction() instanceof IFNONNULL)) { return false; } h = h.getNext(); final Instruction newInstruction = h.getInstruction(); if (!(newInstruction instanceof NEW)) { return false; } final ObjectType loadClassType = ((NEW) newInstruction).getLoadClassType(cpg); if (!"java.lang.NullPointerException".equals(loadClassType.getClassName())) { return false; } h = h.getNext(); return check(h, NULLCHECK1) || check(h, NULLCHECK2); }
} else if (ins instanceof NEW) { NEW i = (NEW) ins; ObjectType type = i.getLoadClassType(cpg); System.out.println(formatName(ins) + " " + type.toString()); } else if (ins instanceof LoadInstruction) {
public static boolean isNullCheck(InstructionHandle h, ConstantPoolGen cpg) { if (!(h.getInstruction() instanceof IFNONNULL)) { return false; } h = h.getNext(); final Instruction newInstruction = h.getInstruction(); if (!(newInstruction instanceof NEW)) { return false; } final ObjectType loadClassType = ((NEW) newInstruction).getLoadClassType(cpg); if (!"java.lang.NullPointerException".equals(loadClassType.getClassName())) { return false; } h = h.getNext(); return check(h, NULLCHECK1) || check(h, NULLCHECK2); }
} else if (ins instanceof NEW) { NEW i = (NEW) ins; ObjectType type = i.getLoadClassType(cpg); System.out.println(formatName(ins) + " " + type.toString()); } else if (ins instanceof LoadInstruction) {
@Override public void visitNEW(NEW obj) { Taint taint = new Taint(Taint.State.SAFE); ObjectType type = obj.getLoadClassType(cpg); taint.setRealInstanceClass(type); if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { taint.setDebugInfo("new " + type.getClassName() + "()"); } getFrame().pushValue(taint); }
@Override public void visitNEW(NEW obj) { Taint taint = new Taint(Taint.State.SAFE); ObjectType type = obj.getLoadClassType(cpg); taint.setRealInstanceClass(type); if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { taint.setDebugInfo("new " + type.getClassName() + "()"); } getFrame().pushValue(taint); }
String callClass = ((NEW) handles[i].getInstruction()).getLoadClassType(cg.getConstantPool()).getClassName();
&& GenericMethods.isNumber(handles[i + 2].getInstruction()) && (handles[i + 3].getInstruction() instanceof NEWARRAY)) { String newType = ((NEW) handles[i].getInstruction()).getLoadClassType(cg.getConstantPool()).toString(); type = ((NEWARRAY) handles[i + 3].getInstruction()).getType().toString(); logger.debug("Found new array conversion pattern: " + type + "->" + newType + " in " + cg.getClassName() + "." + method.getName());