Buggy code:
public MappingTool ( JDBCConfiguration conf , String action , boolean meta ) { } public String getAction ( ) { } public boolean isMetaDataAction ( ) { } public String getSchemaAction ( ) { } public void setSchemaAction ( String schemaAction ) { } public boolean getReadSchema ( ) { } public void setReadSchema ( boolean readSchema ) { } public boolean getSequences ( ) { } public void setSequences ( boolean seqs ) { } public boolean getIndexes ( ) { } public void setIndexes ( boolean indexes ) { } public boolean getForeignKeys ( ) { } public void setForeignKeys ( boolean fks ) { } public boolean getPrimaryKeys ( ) { } public void setPrimaryKeys ( boolean pks ) { } public boolean getDropUnusedComponents ( ) { } public void setDropUnusedComponents ( boolean dropUnused ) { } public void setIgnoreErrors ( boolean ignoreErrors ) { } public boolean getIgnoreErrors ( ) { } private SchemaTool newSchemaTool ( String action ) { } public void setSchemaTool ( SchemaTool tool ) { } public Writer getSchemaWriter ( ) { } public void setSchemaWriter ( Writer schemaWriter ) { } public Writer getMappingWriter ( ) { } public void setMappingWriter ( Writer mappingWriter ) { } public File getMetaDataFile ( ) { } public void setMetaDataFile ( File file ) { } public MappingRepository getRepository ( ) { } public void setRepository ( MappingRepository repos ) { } public SchemaGroup getSchemaGroup ( ) { } public void setSchemaGroup ( SchemaGroup schema ) { } public void clear ( ) { } public void record ( ) { } private void record ( MappingTool . Flags flags ) { } private void dropUnusedSchemaComponents ( ClassMapping [ ] mappings ) { } private void addSequenceComponents ( ClassMapping [ ] mappings ) { } private void addSequenceComponents ( ClassMapping mapping , SchemaGroup group ) { } public void run ( Class < ? > cls ) { } private void add ( Class < ? > cls ) { } private static ClassMapping getMapping ( MappingRepository repos , Class < ? > cls , boolean validate ) { } private void addMeta ( Class < ? > cls ) { } private void refresh ( Class < ? > cls ) { } private void validate ( Class < ? > cls ) { } private void buildSchema ( Class < ? > cls ) { } private void drop ( Class < ? > cls ) { } public static void main ( String [ ] arguments ) throws IOException , SQLException { } public static boolean run ( JDBCConfiguration conf , String [ ] args , Options opts ) throws IOException , SQLException { } public static boolean run ( JDBCConfiguration conf , String [ ] args , MappingTool . Flags flags , ClassLoader loader ) throws IOException , SQLException { if ( ( flags . action ) == null ) { if ( conf . getMappingDefaultsInstance ( ) . defaultMissingInfo ( ) ) flags . action = MappingTool . ACTION_BUILD_SCHEMA ; else flags . action = MappingTool . ACTION_REFRESH ; } Log log = conf . getLog ( LOG_TOOL ) ; Collection < Class < ? > > classes = null ; if ( ( args . length ) == 0 ) { if ( MappingTool . ACTION_IMPORT . equals ( flags . action ) ) return false ; log . info ( MappingTool . _loc . get ( "running-all-classes" ) ) ; classes = conf . getMappingRepositoryInstance ( ) . loadPersistentTypes ( true , loader ) ; } else { classes = new HashSet < Class < ? > > ( ) ; ClassArgParser classParser = conf . getMetaDataRepositoryInstance ( ) . getMetaDataFactory ( ) . newClassArgParser ( ) ; classParser . setClassLoader ( loader ) ; Class < ? > [ ] parsed ; <START_BUG> for ( int i = 0 ; ( args != null ) && ( i < ( args . length ) ) ; i ++ ) { <END_BUG> parsed = classParser . parseTypes ( args [ i ] ) ; classes . addAll ( Arrays . asList ( parsed ) ) ; } } Class < ? > [ ] act = ( ( Class [ ] ) ( classes . toArray ( new Class [ classes . size ( ) ] ) ) ) ; if ( MappingTool . ACTION_EXPORT . equals ( flags . action ) ) { MappingTool . ImportExport [ ] instances = MappingTool . newImportExports ( ) ; for ( int i = 0 ; i < ( instances . length ) ; i ++ ) { if ( instances [ i ] . exportMappings ( conf , act , flags . meta , log , flags . mappingWriter ) ) return true ; } return false ; } if ( MappingTool . ACTION_IMPORT . equals ( flags . action ) ) { MappingTool . ImportExport [ ] instances = MappingTool . newImportExports ( ) ; for ( int i = 0 ; i < ( instances . length ) ; i ++ ) { if ( instances [ i ] . importMappings ( conf , act , args , flags . meta , log , loader ) ) return true ; } return false ; } MappingTool tool ; try { tool = new MappingTool ( conf , flags . action , flags . meta ) ; } catch ( IllegalArgumentException iae ) { return false ; } tool . setIgnoreErrors ( flags . ignoreErrors ) ; tool . setMetaDataFile ( flags . metaDataFile ) ; tool . setMappingWriter ( flags . mappingWriter ) ; tool . setSchemaAction ( flags . schemaAction ) ; tool . setSchemaWriter ( flags . schemaWriter ) ; tool . setReadSchema ( ( ( flags . readSchema ) && ( ! ( MappingTool . ACTION_VALIDATE . equals ( flags . action ) ) ) ) ) ;

Fix:
for ( int i = 0 ; i < ( args . length ) ; i ++ ) {