@ Override public void sawOpcode ( int seen ) { try { stack . precomputation ( this ) ; if ( seen == Const . INVOKEVIRTUAL ) { String clsName = getClassConstantOperand ( ) ; if ( "java/util/Properties" . equals ( clsName ) ) { String methodName = getNameConstantOperand ( ) ; if ( "put" . equals ( methodName ) ) { String sig = getSigConstantOperand ( ) ; if ( SignatureBuilder . SIG_TWO_OBJECTS_TO_OBJECT . equals ( sig ) && ( stack . getStackDepth ( ) >= 3 ) ) { OpcodeStack . Item valueItem = stack . getStackItem ( 0 ) ; String valueSig = valueItem . getSignature ( ) ; if ( Values . SIG_JAVA_LANG_STRING . equals ( valueSig ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY . name ( ) , LOW_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this ) ) ; } else if ( Values . SIG_JAVA_LANG_OBJECT . equals ( valueSig ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this ) ) ; } else { bugReporter . reportBug ( new BugInstance ( this , BugType . IPU_IMPROPER_PROPERTIES_USE . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this ) ) ; } } } } } } finally { stack . sawOpcode ( this , seen ) ; } }
implements the visitor to look for calls to java . utils . Properties . put where the value is a non String . Reports both cases where if it is a string at a lower lever .