Buggy code:
public class CukesHooks extends BaseSpec implements ICucumberFormatter , ICucumberReporter { private final Logger logger = LoggerFactory . getLogger ( this . getClass ( ) . getCanonicalName ( ) ) ; Background background ; Feature feature ; Scenario scenario ; ScenarioOutline scenarioOutline ; String connectorToRun ; static boolean preload = false ; public CukesHooks ( ) { } public CukesHooks ( Common spec ) { } @ Override public void syntaxError ( String state , String event , List < String > legalEvents , String uri , Integer line ) { } @ Override public void uri ( String uri ) { } @ Override public void examples ( Examples examples ) { } @ Override public void startOfScenarioLifeCycle ( Scenario scenario ) { } @ Override public void done ( ) { } @ Override public void close ( ) { } @ Override public void eof ( ) { } @ Override public void background ( Background background ) { } @ Override public void feature ( Feature feature ) { if ( CukesHooks . preload ) { return ; } logger . info ( "Starting<seq2seq4repair_space>running<seq2seq4repair_space>feature<seq2seq4repair_space>{}" , feature . getName ( ) ) ; this . feature = feature ; connectorToRun = ThreadProperty . get ( "class" ) ; if ( connectorToRun . contains ( "ConnectorTest" ) ) { String pathJar = System . getProperty ( "connectorJar" ) ; System . out . println ( ( "PathJar<seq2seq4repair_space>:<seq2seq4repair_space>" + pathJar ) ) ; URL myJarFile = null ; try { myJarFile = new URL ( ( "file:////" + pathJar ) ) ; } catch ( MalformedURLException e1 ) { System . out . println ( "1" ) ; e1 . printStackTrace ( ) ; } URLClassLoader cl = URLClassLoader . newInstance ( new URL [ ] { myJarFile } , this . getClass ( ) . getClassLoader ( ) ) ; @ SuppressWarnings ( "rawtypes" ) Class Connector = null ; String connectorMainClass = System . getProperty ( "connectorMainClass" ) ; try { Connector = cl . loadClass ( connectorMainClass ) ; } catch ( ClassNotFoundException e2 ) { System . out . println ( "2" ) ; e2 . printStackTrace ( ) ; } IConnector connector = null ; <START_BUG> if ( Connector . isInstance ( IConnector . class ) ) { <END_BUG> try { connector = ( ( IConnector ) ( Connector . newInstance ( ) ) ) ; } catch ( InstantiationException | IllegalAccessException e ) { System . out . println ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } } else { Constructor < ? > constructor = null ; try { constructor = Connector . getConstructor ( new Class [ ] { IConnectorApp . class } ) ; } catch ( NoSuchMethodException | SecurityException e1 ) { e1 . printStackTrace ( ) ; } try { connector = ( ( IConnector ) ( constructor . newInstance ( new Object [ ] { null } ) ) ) ; } catch ( InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { e . printStackTrace ( ) ; } } ClusterName clusterName = null ; Map < String , String > cluster_options = new HashMap < > ( ) ; Map < String , String > connector_options = new HashMap < > ( ) ; try { clusterName = getCluster ( ) ; cluster_options = getClusterOptions ( ) ; connector_options = getConnectorOptions ( ) ; } catch ( SAXException | IOException | ParserConfigurationException e1 ) { commonspec . getLogger ( ) . error ( e1 . getMessage ( ) ) ; } try { connector . init ( null ) ; } catch ( InitializationException e1 ) { commonspec . getLogger ( ) . error ( e1 . getMessage ( ) ) ; } ConnectorClusterConfig config = new ConnectorClusterConfig ( clusterName , connector_options , cluster_options ) ; try { connector . connect ( null , config ) ; } catch ( ConnectionException e ) { System . out . println ( e . getMessage ( ) ) ; commonspec . getLogger ( ) . error ( e . getMessage ( ) ) ; } commonspec . setIConnector ( connector ) ; String preloading = System . getProperty ( "preloadData" , "False" ) ; commonspec . getLogger ( ) . info ( preloading ) ; if ( preloading . equals ( "True" ) ) { CukesHooks . preload = true ; try { commonspec . getLogger ( ) . info ( "Preloading<seq2seq4repair_space>the<seq2seq4repair_space>neccessary<seq2seq4repair_space>data" ) ; new CucumberRunner ( this . getClass ( ) , "BeforeFeatureStep" ) . runCukes ( ) ; commonspec . getLogger ( ) . info ( "Finished<seq2seq4repair_space>preloading<seq2seq4repair_space>the<seq2seq4repair_space>neccessary<seq2seq4repair_space>data" ) ; CukesHooks . preload = false ; } catch ( ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException | IOException e ) { commonspec . getExceptions ( ) . add ( e ) ; } } } } @ Override public void scenario ( Scenario scenario ) { } @ Override public void scenarioOutline ( ScenarioOutline scenarioOutline ) { } @ Override public void step ( Step step ) { } @ Override public void endOfScenarioLifeCycle ( Scenario scenario ) { } @ Override public void before ( Match match , Result result ) { } @ Override public void result ( Result result ) { } @ Override public void after ( Match match , Result result ) { } @ Override public void match ( Match match ) { } @ Override public void embedding ( String mimeType , byte [ ] data ) { } @ Override public void write ( String text ) { } private Map < String , String > getClusterOptions ( ) throws IOException , ParserConfigurationException , SAXException { } private Map < String , String > getConnectorOptions ( ) throws IOException , ParserConfigurationException , SAXException { } private ClusterName getCluster ( ) throws IOException , ParserConfigurationException , SAXException { } }

Fix:
if ( IConnector . class . isAssignableFrom ( Connector ) ) {