Buggy code:
public class ClusterSpecFactory { private enum MAPREDUCE_VERSION { V1 , V2 ; } private enum HDP_VERSION { V1 , V2_0 , V2_1 , V2_2 , UNKNOWN ; } private static final Logger logger = Logger . getLogger ( ClusterSpecFactory . class ) ; private static final String HDFS_TEMPLATE_SPEC = "hdfs-template-spec.json" ; private static final String HDFS_MAPRED_TEMPLATE_SPEC = "hdfs-mapred-template-spec.json" ; private static final String HDFS_YARN_TEMPLATE_SPEC = "hdfs-yarn-template-spec.json" ; private static final String HDFS_HBASE_TEMPLATE_SPEC = "hdfs-hbase-template-spec.json" ; private static final String HDFS_MAPRED_MAPR_TEMPLATE_SPEC = "hdfs-mapred-mapr-template-spec.json" ; private static final String HDFS_HBASE_MAPR_TEMPLATE_SPEC = "hdfs-hbase-mapr-template-spec.json" ; private static final String HDFS_GPHD_TEMPLATE_SPEC = "hdfs-gphd-template-spec.json" ; private static final String HDFS_MAPRED_GPHD_TEMPLATE_SPEC = "hdfs-mapred-gphd-template-spec.json" ; private static final String HDFS_HBASE_GPHD_TEMPLATE_SPEC = "hdfs-hbase-gphd-template-spec.json" ; private static final String CM_HDFS_MAPRED_TEMPLATE_SPEC = "cm-hdfs-mapred-template-spec.json" ; private static final String CM_HDFS_YARN_TEMPLATE_SPEC = "cm-hdfs-yarn-template-spec.json" ; private static final String CM_HBASE_TEMPLATE_SPEC = "cm-hbase-template-spec.json" ; private static final String AM_HDFS_V1_TEMPLATE_SPEC = "am-hdfs-v1-template-spec.json" ; private static final String AM_HDFS_V2_TEMPLATE_SPEC = "am-hdfs-v2-template-spec.json" ; private static final String AM_HDFS_MAPRED_TEMPLATE_SPEC = "am-hdfs-mapred-template-spec.json" ; private static final String AM_HDP_2_0_HDFS_YARN_TEMPLATE_SPEC = "am-hdp-2-0-hdfs-yarn-template-spec.json" ; private static final String AM_HDP_2_1_HDFS_YARN_TEMPLATE_SPEC = "am-hdp-2-1-hdfs-yarn-template-spec.json" ; private static final String AM_HDP_2_2_HDFS_YARN_TEMPLATE_SPEC = "am-hdp-2-2-hdfs-yarn-template-spec.json" ; private static final String AM_HDP_CUSTOMIZED_HDFS_YARN_TEMPLATE_SPEC = "am-hdp-customized-hdfs-yarn-template-spec.json" ; private static final String AM_HDP_V1_HBASE_TEMPLATE_SPEC = "am-hdp-1-hbase-template-spec.json" ; private static final String AM_HDP_2_0_HBASE_TEMPLATE_SPEC = "am-hdp-2-0-hbase-template-spec.json" ; private static final String AM_HDP_2_1_HBASE_TEMPLATE_SPEC = "am-hdp-2-1-hbase-template-spec.json" ; private static final String AM_HDP_2_2_HBASE_TEMPLATE_SPEC = "am-hdp-2-2-hbase-template-spec.json" ; private static final String AM_HDP_CUSTOMIZED_HBASE_TEMPLATE_SPEC = "am-hdp-customized-hbase-template-spec.json" ; private static final String AM_HDFS_PURE_HBASE_TEMPLATE_SPEC = "am-hdfs-pure-hbase-template-spec.json" ; private static File locateSpecFile ( String filename , String appManagerType ) { File specFile = new File ( filename ) ; if ( specFile . exists ( ) ) { return specFile ; } String homeDir = System . getProperties ( ) . getProperty ( "serengeti.home.dir" ) ; if ( ( homeDir != null ) && ( ! ( homeDir . trim ( ) . isEmpty ( ) ) ) ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( homeDir ) . append ( File . separator ) . append ( "conf" ) . append ( File . separator ) . append ( appManagerType ) . append ( File . separator ) . append ( "spec-templates" ) . append ( File . separator ) . append ( filename ) ; specFile = new File ( builder . toString ( ) ) ; if ( ! ( specFile . exists ( ) ) ) { ClusterSpecFactory . logger . warn ( ( "template<seq2seq4repair_space>cluster<seq2seq4repair_space>file<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist:<seq2seq4repair_space>" + builder ) ) ; } else { return specFile ; } } URL filePath = ConfigurationUtils . locate ( filename ) ; if ( filePath != null ) { specFile = ConfigurationUtils . fileFromURL ( filePath ) ; } <START_BUG> AuAssert . check ( specFile . exists ( ) ) ; <END_BUG> return specFile ; } public static ClusterCreate loadFromFile ( File file ) throws FileNotFoundException { } public static ClusterCreate createDefaultSpec ( ClusterType type , String vendor , String distroVersion , String appManagerType ) throws FileNotFoundException { } private static ClusterSpecFactory . MAPREDUCE_VERSION getDefaultMapReduceVersion ( String vendor , String distroVersion ) { } private static ClusterSpecFactory . HDP_VERSION getDefaultHdfsVersion ( String vendor , String distroVersion ) { } public static ClusterCreate getCustomizedSpec ( ClusterCreate spec , String appManagerType ) throws FileNotFoundException { } }

Fix:
AuAssert . check ( specFile . exists ( ) , ( "spec<seq2seq4repair_space>file<seq2seq4repair_space>not<seq2seq4repair_space>found:<seq2seq4repair_space>" + ( specFile . getAbsolutePath ( ) ) ) ) ;