Trivial code cleanup

This commit is contained in:
Vhati 2017-12-07 14:16:15 -05:00
parent 2ed948468b
commit e5cee05775

View file

@ -277,14 +277,14 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
appConfig.writeConfig(); appConfig.writeConfig();
} }
catch ( IOException f ) { catch ( IOException f ) {
log.error( String.format( "Error writing config to \"%s\".", appConfig.getConfigFile().getName() ), f ); log.error( String.format( "Error writing config to \"%s\"", appConfig.getConfigFile().getName() ), f );
} }
try { try {
JacksonCatalogWriter.write( localModDB.getCollatedModInfo(), metadataFile ); JacksonCatalogWriter.write( localModDB.getCollatedModInfo(), metadataFile );
} }
catch ( IOException f ) { catch ( IOException f ) {
log.error( String.format( "Error writing metadata from local mods to \"%s\".", metadataFile.getName() ), f ); log.error( String.format( "Error writing metadata from local mods to \"%s\"", metadataFile.getName() ), f );
} }
System.gc(); System.gc();
@ -463,7 +463,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
bw.flush(); bw.flush();
} }
catch ( IOException e ) { catch ( IOException e ) {
log.error( String.format( "Error writing \"%s\".", modsTableStateFile.getName() ), e ); log.error( String.format( "Error writing \"%s\"", modsTableStateFile.getName() ), e );
} }
finally { finally {
try {if ( bw != null ) bw.close();} try {if ( bw != null ) bw.close();}
@ -567,7 +567,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
infoArea.setCaretPosition( 0 ); infoArea.setCaretPosition( 0 );
} }
catch ( Exception e ) { catch ( Exception e ) {
log.error( "Error filling info text area.", e ); log.error( "Error filling info text area", e );
} }
} }
@ -608,7 +608,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
epochTime = ModUtilities.getModFileTime( modFileInfo.getFile() ); epochTime = ModUtilities.getModFileTime( modFileInfo.getFile() );
} }
catch ( IOException e ) { catch ( IOException e ) {
log.error( String.format( "Error while getting modified time of mod file contents for \"%s\".", modFileInfo.getFile() ), e ); log.error( String.format( "Error while getting modified time of mod file contents for \"%s\"", modFileInfo.getFile() ), e );
} }
if ( epochTime != -1 ) { if ( epochTime != -1 ) {
modDate = new Date( epochTime ); modDate = new Date( epochTime );
@ -677,7 +677,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
exeArgs = new String[] {"-applaunch", FTLUtilities.STEAM_APPID_FTL}; exeArgs = new String[] {"-applaunch", FTLUtilities.STEAM_APPID_FTL};
if ( exeFile == null ) { if ( exeFile == null ) {
log.warn( "Steam executable could not be found. FTL will be launched directly." ); log.warn( "Steam executable could not be found; FTL will be launched directly" );
} }
} }
if ( exeFile == null ) { if ( exeFile == null ) {
@ -685,7 +685,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
exeArgs = new String[0]; exeArgs = new String[0];
if ( exeFile == null ) { if ( exeFile == null ) {
log.warn( "FTL executable could not be found." ); log.warn( "FTL executable could not be found" );
} }
} }
@ -739,13 +739,14 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
} }
else if ( source == modsFolderBtn ) { else if ( source == modsFolderBtn ) {
try { try {
if ( Desktop.isDesktopSupported() ) if ( Desktop.isDesktopSupported() ) {
Desktop.getDesktop().open( modsDir.getCanonicalFile() ); Desktop.getDesktop().open( modsDir.getCanonicalFile() );
else } else {
log.error( "Opening the mods/ folder is not possible on your OS." ); log.error( "Opening the mods/ folder is not possible on your OS" );
}
} }
catch ( IOException f ) { catch ( IOException f ) {
log.error( "Error opening mods/ folder.", f ); log.error( "Error opening mods/ folder", f );
} }
} }
else if ( source == updateBtn ) { else if ( source == updateBtn ) {
@ -977,7 +978,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
FTLUtilities.launchExe( exeFile, exeArgs ); FTLUtilities.launchExe( exeFile, exeArgs );
} }
catch ( Exception e ) { catch ( Exception e ) {
log.error( "Error launching FTL.", e ); log.error( "Error launching FTL", e );
} }
exitApp(); exitApp();
} }