Buggy code:
public class Config { public static final String DEF_CONFIG_LOC = "config.properties" ; public static final String ATTR_NAME_PREFIX = "sysadmin." ; public static final String ATTR_NAME_WORK_AREA = "workhome" ; public static final String VAL_WORK_AREA_BASE_PREFIX_DEFAULT = "user.home" ; public static final String VAL_WORK_AREA_BASE = ".oimadm" ; public static final String VAL_WORK_AREA_TMP = "tmp" ; public static final String VAL_WORK_AREA_CLASSES = ( ( ( ( ( File . separator ) + ( Config . VAL_WORK_AREA_TMP ) ) + ( File . separator ) ) + "compile" ) + ( File . separator ) ) + "classes" ; public static final String VAL_WORK_AREA_CONF = ( File . separator ) + "conf" ; public static final String VAL_CONF_FILE_ZIP = "configuration.zip" ; public static final String VAL_CONFIG_PROP_FILE_NAME = "config.properties" ; private static final Logger logger = LoggerFactory . getLogger ( Config . class ) ; private Map < String , Properties > oimConnectionConfiguration = new HashMap < String , Properties > ( ) ; private List < String > oimConnectionNames = new ArrayList < > ( ) ; private String workArea = null ; private String configurationLocation = null ; public List < String > getConnectionNames ( ) { } public Config . Configuration getConnectionDetails ( String oimConnectionName ) { } public void load ( ) { } private void processOIM ( Properties configuration ) { } private String setupWorkArea ( ) { } private void validateBaseArea ( String userWorkArea ) { } public String getWorkArea ( ) { } public void saveConfiguration ( Config . Configuration configuration ) { Config . logger . debug ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>save<seq2seq4repair_space>configuration<seq2seq4repair_space>{}" , configuration ) ; Properties configurationFile = new Properties ( ) ; boolean newConfigurationSaved = false ; int counter ; String configurationBeingSaved = configuration . getProperty ( ATTR_CONN_NAME ) ; Config . logger . debug ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>save<seq2seq4repair_space>configuration<seq2seq4repair_space>{}" , configurationBeingSaved ) ; for ( counter = 0 ; counter < ( this . oimConnectionNames . size ( ) ) ; counter ++ ) { Config . logger . trace ( "Processing<seq2seq4repair_space>configuration<seq2seq4repair_space>number<seq2seq4repair_space>{}" , counter ) ; String name = oimConnectionNames . get ( counter ) ; if ( ( name == null ) || ( name . isEmpty ( ) ) ) { Config . logger . trace ( "Skipping<seq2seq4repair_space>configuration<seq2seq4repair_space>at<seq2seq4repair_space>{}<seq2seq4repair_space>since<seq2seq4repair_space>it<seq2seq4repair_space>has<seq2seq4repair_space>null<seq2seq4repair_space>or<seq2seq4repair_space>empty<seq2seq4repair_space>name" , counter ) ; continue ; } Properties configurationDetail = null ; Config . logger . trace ( "Validating<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>configuration<seq2seq4repair_space>being<seq2seq4repair_space>processed<seq2seq4repair_space>{}<seq2seq4repair_space>=<seq2seq4repair_space>configuration<seq2seq4repair_space>being<seq2seq4repair_space>saved<seq2seq4repair_space>{}" , name , configurationBeingSaved ) ; if ( name . equals ( configurationBeingSaved ) ) { Config . logger . trace ( "Selecting<seq2seq4repair_space>new<seq2seq4repair_space>configuration<seq2seq4repair_space>and<seq2seq4repair_space>tracking<seq2seq4repair_space>that<seq2seq4repair_space>given<seq2seq4repair_space>configuration<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>added" ) ; configurationDetail = ( configuration instanceof Config . EditableConfiguration ) ? ( ( Config . EditableConfiguration ) ( configuration ) ) . editableConfiguration : configuration . configuration ; newConfigurationSaved = true ; } else { Config . logger . trace ( "Using<seq2seq4repair_space>existing<seq2seq4repair_space>configuration" ) ; configurationDetail = oimConnectionConfiguration . get ( name ) ; } Config . logger . trace ( "Validating<seq2seq4repair_space>whether<seq2seq4repair_space>we<seq2seq4repair_space>identified<seq2seq4repair_space>applicable<seq2seq4repair_space>configuration" ) ; if ( configurationDetail == null ) throw new NullPointerException ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>locate<seq2seq4repair_space>configuration<seq2seq4repair_space>detail<seq2seq4repair_space>with<seq2seq4repair_space>name<seq2seq4repair_space>" + name ) ) ; Config . logger . trace ( "Adding<seq2seq4repair_space>selected<seq2seq4repair_space>configuration<seq2seq4repair_space>{}<seq2seq4repair_space>in<seq2seq4repair_space>to<seq2seq4repair_space>new<seq2seq4repair_space>configuration<seq2seq4repair_space>file<seq2seq4repair_space>being<seq2seq4repair_space>generated" , configurationDetail ) ; for ( String attributeName : configurationDetail . stringPropertyNames ( ) ) { configurationFile . setProperty ( ( ( ( "sysadmin." + counter ) + "." ) + attributeName ) , configurationDetail . getProperty ( attributeName ) ) ; } } if ( ! newConfigurationSaved ) { Config . logger . trace ( "Adding<seq2seq4repair_space>the<seq2seq4repair_space>new<seq2seq4repair_space>configuration<seq2seq4repair_space>{}<seq2seq4repair_space>to<seq2seq4repair_space>configuration" , configuration ) ; <START_BUG> Properties configurationDetail = configuration . configuration ; <END_BUG> for ( String attributeName : configurationDetail . stringPropertyNames ( ) ) { configurationFile . setProperty ( ( ( ( "sysadmin." + counter ) + "." ) + attributeName ) , configurationDetail . getProperty ( attributeName ) ) ; } } File configurationFileObject = new File ( configurationLocation ) ; if ( ( configurationFileObject . exists ( ) ) && ( configurationFileObject . canWrite ( ) ) ) { try { Config . logger . debug ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>save<seq2seq4repair_space>configuration<seq2seq4repair_space>to<seq2seq4repair_space>{}" , configurationLocation ) ; configurationFile . store ( new FileWriter ( configurationFileObject ) , ( "Saved<seq2seq4repair_space>on<seq2seq4repair_space>" + ( new Date ( ) ) ) ) ; } catch ( Exception exception ) { throw new OIMAdminException ( "Error<seq2seq4repair_space>occurred<seq2seq4repair_space>while<seq2seq4repair_space>saving<seq2seq4repair_space>updated<seq2seq4repair_space>configuration" , exception ) ; } } else { throw new OIMAdminException ( "Error<seq2seq4repair_space>occurred<seq2seq4repair_space>while<seq2seq4repair_space>saving<seq2seq4repair_space>updated<seq2seq4repair_space>configuration" , new IOException ( ( ( "Configuration<seq2seq4repair_space>file<seq2seq4repair_space>" + ( configurationLocation ) ) + "<seq2seq4repair_space>either<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist<seq2seq4repair_space>or<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>writable.<seq2seq4repair_space>Can<seq2seq4repair_space>not<seq2seq4repair_space>save<seq2seq4repair_space>the<seq2seq4repair_space>configuration." ) ) ) ; } Config . logger . debug ( "Saved<seq2seq4repair_space>configuration<seq2seq4repair_space>{}" , configuration ) ; } public enum PLATFORM { WEBSPHERE ( "websphere" ) , JBOSS ( "jboss" ) , UNKNOWN ( "unknown" ) , WEBLOGIC ( "weblogic" ) ; private final String name ; private PLATFORM ( String name ) { } public static Config . PLATFORM fromString ( String platformName ) { } public static List < String > valuesAsString ( ) { } } public static class Configuration { private final Properties configuration ; private final Config config ; private Configuration ( Properties properties , Config config ) { } public String getWorkArea ( ) { } public String getProperty ( String propertyName ) { } public String getProperty ( String propertyName , String defaultValue ) { } public Config getConfig ( ) { } } public static class EditableConfiguration extends Config . Configuration { private final Properties editableConfiguration ; public EditableConfiguration ( Config . Configuration configuration ) { } @ Override public String getProperty ( String propertyName , String defaultValue ) { } public void setProperty ( String propertyName , String value ) { } } }

Fix:
Properties configurationDetail = ( configuration instanceof Config . EditableConfiguration ) ? ( ( Config . EditableConfiguration ) ( configuration ) ) . editableConfiguration : configuration . configuration ;