Buggy code:
public class DBConnection { private RexsterClient client = null ; private Logger logger = null ; private Map < String , String > vertIDCache = null ; private Map < String , String > cardinalityCache = null ; private String dbType = null ; public static RexsterClient createClient ( Configuration configOpts ) { } public static RexsterClient createClient ( Configuration configOpts , int connectionWaitTime ) { } public static Configuration getDefaultConfig ( ) { } public static Configuration getTestConfig ( ) { } public static void closeClient ( RexsterClient client ) { } public DBConnection ( ) { } public DBConnection ( RexsterClient c ) { } private String getDBType ( ) { } public void createIndices ( ) { } private void createTinkerGraphIndices ( ) { } private void createTitanIndices ( ) { } public void addVertexFromJSON ( JSONObject vert ) { String graphType = getDBType ( ) ; String name = vert . optString ( "name" ) ; String id = vert . optString ( "_id" ) ; if ( ( name == null ) || ( name == "" ) ) { name = id ; vert . put ( "name" , name ) ; } Map < String , Object > specialCardProps = new HashMap < String , Object > ( ) ; Set < String > keySet = new HashSet < String > ( ( ( Set < String > ) ( vert . keySet ( ) ) ) ) ; for ( String key : keySet ) { <START_BUG> if ( ! ( findCardinality ( key ) . equalsIgnoreCase ( "SINGLE" ) ) ) { <END_BUG> specialCardProps . put ( key , vert . get ( key ) ) ; vert . remove ( key ) ; } } vert . remove ( "_id" ) ; Map < String , Object > param = new HashMap < String , Object > ( ) ; param . put ( "VERT_PROPS" , vert ) ; try { Long newID = null ; if ( graphType == "TitanGraph" ) newID = ( ( Long ) ( client . execute ( "v<seq2seq4repair_space>=<seq2seq4repair_space>GraphSONUtility.vertexFromJson(VERT_PROPS,<seq2seq4repair_space>new<seq2seq4repair_space>GraphElementFactory(g),<seq2seq4repair_space>GraphSONMode.NORMAL,<seq2seq4repair_space>null);v.getId()" , param ) . get ( 0 ) ) ) ; if ( graphType == "TinkerGraph" ) newID = Long . parseLong ( ( ( String ) ( client . execute ( "v<seq2seq4repair_space>=<seq2seq4repair_space>GraphSONUtility.vertexFromJson(VERT_PROPS,<seq2seq4repair_space>new<seq2seq4repair_space>GraphElementFactory(g),<seq2seq4repair_space>GraphSONMode.NORMAL,<seq2seq4repair_space>null);v.getId()" , param ) . get ( 0 ) ) ) ) ; vertIDCache . put ( name , newID . toString ( ) ) ; for ( String key : specialCardProps . keySet ( ) ) { updateVertProperty ( newID . toString ( ) , key , specialCardProps . get ( key ) ) ; } } catch ( RexProException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } public void addVertexFromMap ( Map < String , Object > vert ) { } public void addEdgeFromJSON ( JSONObject edge ) { } public void commit ( ) { } public boolean execute ( String query , Map < String , Object > params ) { } public boolean execute ( String query ) { } public RexsterClient getClient ( ) { } public Map < String , Object > getVertByID ( String id ) { } public Map < String , Object > findVert ( String name ) throws RexProException , IOException { } public String findVertId ( String name ) { } public List < Map < String , Object > > findAllVertsByType ( String vertexType ) throws RexProException , IOException { } public List < Map < String , Object > > findAllVertsWithProps ( List < Constraint > constraints ) throws RexProException , IOException { } public boolean edgeExists ( String inv_id , String outv_id , String label ) { } public void updateVert ( String id , Map < String , Object > props ) { } public boolean updateVertProperty ( String id , String key , Object val ) { } public String findCardinality ( String key ) { } public boolean removeCachedVertices ( ) { } public boolean removeAllVertices ( ) { } public static Configuration dbConfigFromFile ( String configFilePath ) { } public static Map < String , Object > configMapFromFile ( File configFile ) { } }

Fix:
if ( ( ( findCardinality ( key ) ) != null ) && ( ! ( findCardinality ( key ) . equalsIgnoreCase ( "SINGLE" ) ) ) ) {