Code improvements.

This commit is contained in:
MobiusDev
2016-04-24 16:30:15 +00:00
parent 8bd51aba1c
commit 2dd14bef9b
860 changed files with 8865 additions and 17041 deletions

View File

@ -115,11 +115,7 @@ public class CloseShieldedInputStream extends InputStream
@Override
public boolean markSupported()
{
if (_in == null)
{
return false;
}
return _in.markSupported();
return (_in != null) && _in.markSupported();
}
/**

View File

@ -50,16 +50,17 @@ public class ScriptExecutor
public void execSqlBatch(File dir, boolean skipErrors)
{
final File[] files = dir.listFiles(new SQLFilter());
if (files != null)
if (files == null)
{
Arrays.sort(files);
_frame.setProgressIndeterminate(false);
_frame.setProgressMaximum(files.length - 1);
for (int i = 0; i < files.length; i++)
{
_frame.setProgressValue(i);
execSqlFile(files[i], skipErrors);
}
return;
}
Arrays.sort(files);
_frame.setProgressIndeterminate(false);
_frame.setProgressMaximum(files.length - 1);
for (int i = 0; i < files.length; i++)
{
_frame.setProgressValue(i);
execSqlFile(files[i], skipErrors);
}
}
@ -118,8 +119,7 @@ public class ScriptExecutor
"Abort"
};
final int n = JOptionPane.showOptionDialog(null, "MySQL Error: " + e.getMessage(), "Script Error", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
if (n == 1)
if (JOptionPane.showOptionDialog(null, "MySQL Error: " + e.getMessage(), "Script Error", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]) == 1)
{
System.exit(0);
}

View File

@ -153,9 +153,7 @@ public class SpringUtilities
/* Used by makeCompactGrid. */
private static SpringLayout.Constraints getConstraintsForCell(int row, int col, Container parent, int cols)
{
final SpringLayout layout = (SpringLayout) parent.getLayout();
final Component c = parent.getComponent((row * cols) + col);
return layout.getConstraints(c);
return ((SpringLayout) parent.getLayout()).getConstraints(parent.getComponent((row * cols) + col));
}
/**