Trivial code cleanup
This commit is contained in:
parent
8912fec70e
commit
4d7a3f7e9a
4 changed files with 11 additions and 9 deletions
|
@ -224,7 +224,7 @@ public class FTLUtilities {
|
||||||
|
|
||||||
if ( System.getProperty( "os.name" ).startsWith( "Windows" ) ) {
|
if ( System.getProperty( "os.name" ).startsWith( "Windows" ) ) {
|
||||||
|
|
||||||
for ( File candidateDir : new File[] {datsDir, datsDir.getParentFile()} ) {
|
for ( File candidateDir : new File[] { datsDir, datsDir.getParentFile() } ) {
|
||||||
if ( candidateDir == null ) continue;
|
if ( candidateDir == null ) continue;
|
||||||
|
|
||||||
File exeFile = new File( candidateDir, "FTLGame.exe" );
|
File exeFile = new File( candidateDir, "FTLGame.exe" );
|
||||||
|
@ -236,7 +236,7 @@ public class FTLUtilities {
|
||||||
}
|
}
|
||||||
else if ( System.getProperty( "os.name" ).equals( "Linux" ) ) {
|
else if ( System.getProperty( "os.name" ).equals( "Linux" ) ) {
|
||||||
|
|
||||||
for ( File candidateDir : new File[] {datsDir, datsDir.getParentFile()} ) {
|
for ( File candidateDir : new File[] { datsDir, datsDir.getParentFile() } ) {
|
||||||
if ( candidateDir == null ) continue;
|
if ( candidateDir == null ) continue;
|
||||||
|
|
||||||
File exeFile = new File( candidateDir, "FTL" );
|
File exeFile = new File( candidateDir, "FTL" );
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class SlipstreamConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a copy of an existing SlipstreamConfig object.
|
* Copy constructor.
|
||||||
*/
|
*/
|
||||||
public SlipstreamConfig( SlipstreamConfig srcConfig ) {
|
public SlipstreamConfig( SlipstreamConfig srcConfig ) {
|
||||||
this.configFile = srcConfig.getConfigFile();
|
this.configFile = srcConfig.getConfigFile();
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class URLFetcher {
|
||||||
int responseCode = httpConn.getResponseCode();
|
int responseCode = httpConn.getResponseCode();
|
||||||
|
|
||||||
if ( responseCode == HttpURLConnection.HTTP_NOT_MODIFIED ) {
|
if ( responseCode == HttpURLConnection.HTTP_NOT_MODIFIED ) {
|
||||||
log.debug( String.format( "No need to update \"%s\", the server's copy has not been modified since the previous check.", localFile.getName() ) );
|
log.debug( String.format( "No need to update \"%s\", the server's copy has not been modified since the previous check", localFile.getName() ) );
|
||||||
|
|
||||||
// Update the local file's timestamp as if it had downloaded.
|
// Update the local file's timestamp as if it had downloaded.
|
||||||
localFile.setLastModified( new Date().getTime() );
|
localFile.setLastModified( new Date().getTime() );
|
||||||
|
@ -98,12 +98,12 @@ public class URLFetcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.error( String.format( "Download request failed for \"%s\": HTTP Code %d (%s).", httpConn.getURL(), responseCode, httpConn.getResponseMessage() ) );
|
log.error( String.format( "Download request failed for \"%s\": HTTP Code %d (%s)", httpConn.getURL(), responseCode, httpConn.getResponseMessage() ) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( IOException e ) {
|
catch ( IOException e ) {
|
||||||
log.error( String.format( "Error downloading the latest \"%s\".", localFile.getName() ), e );
|
log.error( String.format( "Error downloading the latest \"%s\"", localFile.getName() ), e );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
try {if ( urlIn != null ) urlIn.close();}
|
try {if ( urlIn != null ) urlIn.close();}
|
||||||
|
@ -123,7 +123,7 @@ public class URLFetcher {
|
||||||
bw.flush();
|
bw.flush();
|
||||||
}
|
}
|
||||||
catch ( IOException e ) {
|
catch ( IOException e ) {
|
||||||
log.error( String.format( "Error writing eTag to \"%s\".", eTagFile.getName() ), e );
|
log.error( String.format( "Error writing eTag to \"%s\"", eTagFile.getName() ), e );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
try {if ( etagOut != null ) etagOut.close();}
|
try {if ( etagOut != null ) etagOut.close();}
|
||||||
|
|
|
@ -16,8 +16,10 @@ import net.vhati.modmanager.ui.Statusbar;
|
||||||
* Then add this mouseListener to a component.
|
* Then add this mouseListener to a component.
|
||||||
*/
|
*/
|
||||||
public class StatusbarMouseListener extends MouseAdapter {
|
public class StatusbarMouseListener extends MouseAdapter {
|
||||||
private Statusbar bar = null;
|
|
||||||
private String text = null;
|
protected Statusbar bar = null;
|
||||||
|
protected String text = null;
|
||||||
|
|
||||||
|
|
||||||
public StatusbarMouseListener( Statusbar bar, String text ) {
|
public StatusbarMouseListener( Statusbar bar, String text ) {
|
||||||
this.bar = bar;
|
this.bar = bar;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue