Trivial code cleanup

This commit is contained in:
Vhati 2017-11-26 11:48:38 -05:00
parent d934740377
commit 0621f680f8
12 changed files with 158 additions and 152 deletions

View file

@ -87,11 +87,11 @@ public class DatExtractDialog extends ProgressDialog {
@Override
public void run() {
FTLDat.AbstractPack srcP = null;
FTLDat.AbstractPack dstP = null;
InputStream is = null;
int progress = 0;
try {
if ( !extractDir.exists() ) extractDir.mkdirs();
@ -117,19 +117,19 @@ public class DatExtractDialog extends ProgressDialog {
}
setTaskOutcomeLater( true, null );
}
catch ( Exception ex ) {
log.error( "Error extracting dats.", ex );
setTaskOutcomeLater( false, ex );
catch ( Exception e ) {
log.error( "Error extracting dats.", e );
setTaskOutcomeLater( false, e );
}
finally {
try {if ( is != null ) is.close();}
catch ( IOException ex ) {}
catch ( IOException e ) {}
try {if ( srcP != null ) srcP.close();}
catch ( IOException ex ) {}
catch ( IOException e ) {}
try {if ( dstP != null ) dstP.close();}
catch ( IOException ex ) {}
catch ( IOException e ) {}
}
}
}

View file

@ -608,7 +608,8 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
long epochTime = -1;
try {
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 );
}
if ( epochTime != -1 ) {
@ -987,7 +988,8 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
log.info( "Running FTL..." );
try {
FTLUtilities.launchExe( exeFile, exeArgs );
} catch ( Exception e ) {
}
catch ( Exception e ) {
log.error( "Error launching FTL.", e );
}
exitApp();

View file

@ -126,7 +126,7 @@ public class ModXMLSandbox extends JFrame implements ActionListener {
messageArea.setFont( sandboxFont );
messageArea.setEditable( false );
messageArea.addMouseListener( new ClipboardMenuMouseListener() );
messageArea.setText( "This is a scratchpad to tinker with advanced mod syntax.\n1) Open XML from data.dat to fill the 'main' tab. (ctrl-o)\n2) Write some <mod:command> tags in the 'append' tab. (alt-1,2,3)\n3) Click Patch to see what would happen. (ctrl-p)\nUndo is available. (ctrl-z/ctrl-y)" );
messageArea.setText( "This is a sandbox to tinker with advanced mod syntax.\n1) Open XML from data.dat to fill the 'main' tab. (ctrl-o)\n2) Write some <mod:command> tags in the 'append' tab. (alt-1,2,3)\n3) Click Patch to see what would happen. (ctrl-p)\nUndo/redo is available. (ctrl-z/ctrl-y)" );
messageScroll = new JScrollPane( messageArea );
JPanel ctrlPanel = new JPanel();

View file

@ -55,11 +55,13 @@ public class ChecklistTablePanel<T> extends JPanel {
// Reset on first click and when no longer on that row.
if ( e.getClickCount() == 1 ) prevRow = -1;
if ( thisRow != prevRow || thisRow == -1 ) {
streak = 1;
prevRow = thisRow;
return;
} else {
}
else {
streak++;
}
if ( streak % 2 != 0 ) return; // Respond only to click pairs.

View file

@ -109,7 +109,9 @@ public class TreeState {
public boolean accept( TreeNodeState nodeState ) {
Object nodeObject = nodeState.getUserObject();
if ( objectClass != null && nodeObject != null ) {
return ( objectClass.isAssignableFrom( nodeObject.getClass() ) );
@SuppressWarnings("unchecked")
boolean result = objectClass.isAssignableFrom( nodeObject.getClass() );
return result;
}
else if ( o != null ) {
return ( o.equals( nodeState.getUserObject() ) );