修改严重代码

This commit is contained in:
zhoudaxia 2016-09-02 00:30:59 +08:00
parent 15f56c9d26
commit ce72ad8a55
53 changed files with 100 additions and 100 deletions

View File

@ -259,7 +259,7 @@ public class RobotFileSystemManager {
updateDataFilesFromJar(); updateDataFilesFromJar();
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
} }

View File

@ -120,7 +120,7 @@ public class Corners extends Robot {
/** /**
* onDeath: We died. Decide whether to try a different corner next game. * onDeath: We died. Decide whether to try a different corner next game.
*/ */
public void onDeath(DeathEvent e) { public static void onDeath(DeathEvent e) {
// Well, others should never be 0, but better safe than sorry. // Well, others should never be 0, but better safe than sorry.
if (others == 0) { if (others == 0) {
return; return;

View File

@ -30,7 +30,7 @@ import java.io.PrintStream;
public class SittingDuck extends AdvancedRobot { public class SittingDuck extends AdvancedRobot {
static boolean incrementedBattles = false; static boolean incrementedBattles = false;
public void run() { public static void run() {
setBodyColor(Color.yellow); setBodyColor(Color.yellow);
setGunColor(Color.yellow); setGunColor(Color.yellow);
@ -85,7 +85,7 @@ public class SittingDuck extends AdvancedRobot {
} }
} catch (IOException e) { } catch (IOException e) {
out.println("IOException trying to write: "); out.println("IOException trying to write: ");
e.printStackTrace(out); LOGGER.log("context", e);
} finally { } finally {
if (w != null) { if (w != null) {
w.close(); w.close();

View File

@ -68,7 +68,7 @@ public class TrackFire extends Robot {
// Generates another scan event if we see a robot. // Generates another scan event if we see a robot.
// We only need to call this if the gun (and therefore radar) // We only need to call this if the gun (and therefore radar)
// are not turning. Otherwise, scan is called automatically. // are not turning. Otherwise, scan is called automatically.
if (bearingFromGun == 0) { if (bearingFromGun) {
scan(); scan();
} }
} }

View File

@ -76,7 +76,7 @@ public class MyFirstLeader extends TeamRobot {
broadcastMessage(new Point(enemyX, enemyY)); broadcastMessage(new Point(enemyX, enemyY));
} catch (IOException ex) { } catch (IOException ex) {
out.println("Unable to send order: "); out.println("Unable to send order: ");
ex.printStackTrace(out); LOGGER.log("context", ex);
} }
} }

View File

@ -130,7 +130,7 @@ public class SoundManager implements ISoundManager {
for (Mixer.Info mi : AudioSystem.getMixerInfo()) { for (Mixer.Info mi : AudioSystem.getMixerInfo()) {
Mixer m = AudioSystem.getMixer(mi); Mixer m = AudioSystem.getMixer(mi);
if (m.getClass().getSimpleName().equals(mixerClassName)) { if (mixerClassName instanceof m) {
return m; return m;
} }
m.close(); m.close();
@ -172,7 +172,7 @@ public class SoundManager implements ISoundManager {
float min = volCtrl.getMinimum() / 4; float min = volCtrl.getMinimum() / 4;
if (volume != 1) { if (volume) {
volCtrl.setValue(min * (1 - volume)); volCtrl.setValue(min * (1 - volume));
} }
} }

View File

@ -56,7 +56,7 @@ public class AwtAttack extends AdvancedRobot {
javax.swing.SwingUtilities.invokeLater(doHack); javax.swing.SwingUtilities.invokeLater(doHack);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swalow security exception // swalow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
@ -72,12 +72,12 @@ public class AwtAttack extends AdvancedRobot {
fs.close(); fs.close();
out.println("Hacked!!!"); out.println("Hacked!!!");
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swalow security exception // swalow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }

View File

@ -41,7 +41,7 @@ public class ConstructorAwtAttack extends robocode.AdvancedRobot {
javax.swing.SwingUtilities.invokeLater(doHack); javax.swing.SwingUtilities.invokeLater(doHack);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swallow security exception // swallow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
@ -57,12 +57,12 @@ public class ConstructorAwtAttack extends robocode.AdvancedRobot {
fs.close(); fs.close();
out.println("Hacked!!!"); out.println("Hacked!!!");
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swallow security exception // swallow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
} }

View File

@ -37,7 +37,7 @@ public class ConstructorReflectionAttack extends robocode.AdvancedRobot {
PrintStream ps = new PrintStream(baos); PrintStream ps = new PrintStream(baos);
e.printStackTrace(ps); LOGGER.log("context", e);
ps.flush(); ps.flush();
} }
} }

View File

@ -39,7 +39,7 @@ public class ConstructorSocketAttack extends AdvancedRobot {
PrintStream ps = new PrintStream(baos); PrintStream ps = new PrintStream(baos);
e.printStackTrace(ps); LOGGER.log("context", e);
ps.flush(); ps.flush();
} finally { } finally {
if (server != null) { if (server != null) {

View File

@ -26,7 +26,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot {
t.start(); t.start();
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swallow security exception // swallow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
@ -41,7 +41,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot {
t.start(); t.start();
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swallow security exception // swallow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
@ -54,7 +54,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot {
runAttack2(); runAttack2();
try { try {
this.wait();
} catch (InterruptedException e) {} } catch (InterruptedException e) {}
} }
} }

View File

@ -49,12 +49,12 @@ public class FileAttack extends AdvancedRobot {
System.out.print(fs.read()); System.out.print(fs.read());
fs.close(); fs.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swalow security exception // swalow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
@ -69,12 +69,12 @@ public class FileAttack extends AdvancedRobot {
fs.write(0xD0); fs.write(0xD0);
fs.close(); fs.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swalow security exception // swalow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }

View File

@ -27,7 +27,7 @@ public class FileOutputStreamAttack extends AdvancedRobot {
fis = new FileOutputStream(file); fis = new FileOutputStream(file);
fis.write(1); fis.write(1);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} finally { } finally {
if (fis != null) { if (fis != null) {
try { try {

View File

@ -39,13 +39,13 @@ public class FileWriteSize extends AdvancedRobot {
rfos.write(buf); rfos.write(buf);
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} finally { } finally {
if (rfos != null) { if (rfos != null) {
try { try {
rfos.close(); rfos.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
if (file != null) { if (file != null) {

View File

@ -34,7 +34,7 @@ public class HttpAttack extends AdvancedRobot {
is.read(); is.read();
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
} }

View File

@ -39,7 +39,7 @@ public class IncludeNamespaceAttack extends AdvancedRobot {
HiddenAccess.createRules(10, 10, 10, 10, 1, false, 100); HiddenAccess.createRules(10, 10, 10, 10, 1, false, 100);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// Swallow security exception // Swallow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
} }

View File

@ -28,7 +28,7 @@ public class ReflectionAttack extends robocode.AdvancedRobot {
method.invoke(obj, new Object[] { "Hello World" }); method.invoke(obj, new Object[] { "Hello World" });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
} }

View File

@ -66,14 +66,14 @@ public class SkipTurns extends AdvancedRobot {
synchronized (w) { synchronized (w) {
try { try {
if (skipped > 3) { while (skipped > 3) {
w.wait(3000); w.wait(3000);
} else { } else {
w.wait(130); w.wait(130);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
// eat interrupt // eat interrupt
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
} }

View File

@ -32,7 +32,7 @@ public class SocketAttack extends AdvancedRobot {
os.write(1); os.write(1);
is.read(); is.read();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(out); LOGGER.log("context", e);
} finally { } finally {
if (server != null) { if (server != null) {
try { try {

View File

@ -44,7 +44,7 @@ public class ThreadAttack extends AdvancedRobot {
t.start(); t.start();
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swallow security exception // swallow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
@ -59,7 +59,7 @@ public class ThreadAttack extends AdvancedRobot {
t.start(); t.start();
} catch (RuntimeException e) { } catch (RuntimeException e) {
// swallow security exception // swallow security exception
e.printStackTrace(out); LOGGER.log("context", e);
} }
} }
@ -78,7 +78,7 @@ public class ThreadAttack extends AdvancedRobot {
runAttack2(); runAttack2();
try { try {
this.wait();
} catch (InterruptedException e) { } catch (InterruptedException e) {
out.println("Interrupted id:" + id); out.println("Interrupted id:" + id);
} }

View File

@ -52,7 +52,7 @@ public class ThreadGroupAttack extends Robot {
} }
}).start(); }).start();
} catch (RuntimeException t) { } catch (RuntimeException t) {
t.printStackTrace(out); LOGGER.log("context", t);
} }
} }

View File

@ -56,7 +56,7 @@ public class WatchBullets extends AdvancedRobot {
// Generates another scan event if we see a robot. // Generates another scan event if we see a robot.
// We only need to call this if the gun (and therefore radar) // We only need to call this if the gun (and therefore radar)
// are not turning. Otherwise, scan is called automatically. // are not turning. Otherwise, scan is called automatically.
if (bearingFromGun == 0) { if (!bearingFromGun) {
scan(); scan();
} }
} }

View File

@ -23,7 +23,7 @@ public class Assert extends org.junit.Assert {
try { try {
assertNear(v1, v2); assertNear(v1, v2);
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
ex.printStackTrace(System.err); LOGGER.log("context", ex);
} }
} }
@ -31,7 +31,7 @@ public class Assert extends org.junit.Assert {
try { try {
org.junit.Assert.assertThat(t, tMatcher); org.junit.Assert.assertThat(t, tMatcher);
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
ex.printStackTrace(System.err); LOGGER.log("context", ex);
} }
} }

View File

@ -34,12 +34,12 @@ public abstract class RobocodeTestBed extends BattleAdaptor {
protected static int messages = 0; protected static int messages = 0;
protected static String robotsPath; protected static String robotsPath;
public static boolean isDumpingPositions = false; public static final boolean isDumpingPositions = false;
public static boolean isDumpingTurns = false; public static final boolean isDumpingTurns = false;
public static boolean isDumpingOutput = true; public static final boolean isDumpingOutput = true;
public static boolean isDumpingErrors = true; public static final boolean isDumpingErrors = true;
public static boolean isDumpingMessages = true; public static final boolean isDumpingMessages = true;
public static boolean hasJavaNetURLPermission = isClassAvailable("java.net.URLPermission"); public static final boolean hasJavaNetURLPermission = isClassAvailable("java.net.URLPermission");
private static boolean isClassAvailable(String name) { private static boolean isClassAvailable(String name) {
try { try {
@ -65,7 +65,7 @@ public abstract class RobocodeTestBed extends BattleAdaptor {
throw new Error("Unknown directory: " + currentDirAbsolutePath); throw new Error("Unknown directory: " + currentDirAbsolutePath);
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(Logger.realErr); LOGGER.log("context", e);
} }
System.setProperty("ROBOTPATH", robotsPath + "/target/classes"); System.setProperty("ROBOTPATH", robotsPath + "/target/classes");
@ -156,7 +156,7 @@ public abstract class RobocodeTestBed extends BattleAdaptor {
} }
@Before @Before
public void setup() { public static void setup() {
engine.addBattleListener(this); engine.addBattleListener(this);
if (isDeterministic()) { if (isDeterministic()) {
RandomFactory.resetDeterministic(0); RandomFactory.resetDeterministic(0);

View File

@ -56,9 +56,9 @@ public class TestAcceleration extends RobocodeTestBed {
Assert.assertNear(1, caveat2.getVelocity()); Assert.assertNear(1, caveat2.getVelocity());
Assert.assertNear(1, caveat3.getVelocity()); Assert.assertNear(1, caveat3.getVelocity());
Assert.assertNear(1 - 1, distance(0, caveat1)); Assert.assertNear(0, distance(0, caveat1));
Assert.assertNear(1 - 1, distance(1, caveat2)); Assert.assertNear(0, distance(1, caveat2));
Assert.assertNear(1 - 1, distance(2, caveat3)); Assert.assertNear(0, distance(2, caveat3));
break; break;
case 2: case 2:

View File

@ -35,7 +35,7 @@ public class CompilerPreferencesDialog extends JDialog {
private CompilerProperties compilerProperties; private CompilerProperties compilerProperties;
private JButton okButton; private JButton okButton;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private class EventHandler implements ActionListener { private class EventHandler implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@ -56,7 +56,8 @@ public class CompoundUndoManager extends UndoManagerWithActions {
String insertedText = event.getDocument().getText(event.getOffset(), event.getLength()); String insertedText = event.getDocument().getText(event.getOffset(), event.getLength());
isEndCompoundEdit = insertedText.contains("\n"); isEndCompoundEdit = insertedText.contains("\n");
} catch (BadLocationException e) { } catch (BadLocationException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
} }

View File

@ -56,7 +56,7 @@ public class EditorPane extends JTextPane {
private final CompoundUndoManager undoManager = new CompoundUndoManager(); private final CompoundUndoManager undoManager = new CompoundUndoManager();
private final TextTool textTool = new TextTool(); private final transient TextTool textTool = new TextTool();
private JViewport viewport; private JViewport viewport;
@ -68,7 +68,7 @@ public class EditorPane extends JTextPane {
DefaultCaret caret = (DefaultCaret) getCaret(); DefaultCaret caret = (DefaultCaret) getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
new LineNumberArea(this);
LineHighlighter.install(this); LineHighlighter.install(this);
@ -272,7 +272,7 @@ public class EditorPane extends JTextPane {
textTool.insertString(selectionStart, newText.toString()); textTool.insertString(selectionStart, newText.toString());
undoManager.markCompoundStart(); undoManager.markCompoundStart();
} catch (BadLocationException e) { } catch (BadLocationException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
// Compute the new selection // Compute the new selection
@ -326,7 +326,7 @@ public class EditorPane extends JTextPane {
try { try {
return getDocument().getText(start, end - start); return getDocument().getText(start, end - start);
} catch (BadLocationException e) { } catch (BadLocationException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
return null; return null;
} }
@ -339,7 +339,7 @@ public class EditorPane extends JTextPane {
try { try {
getDocument().insertString(offset, str, a); getDocument().insertString(offset, str, a);
} catch (BadLocationException e) { } catch (BadLocationException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
} }

View File

@ -140,7 +140,7 @@ public class EditorPanel extends JPanel {
rn++; rn++;
} }
} catch (BadLocationException e) { } catch (BadLocationException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
return rn; return rn;
} }
@ -149,7 +149,7 @@ public class EditorPanel extends JPanel {
try { try {
return pos - Utilities.getRowStart(editor, pos) + 1; return pos - Utilities.getRowStart(editor, pos) + 1;
} catch (BadLocationException e) { } catch (BadLocationException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
return -1; return -1;
} }

View File

@ -78,7 +78,7 @@ public class EditorThemeConfigDialog extends JDialog {
private ColorAndStyle annotationTextColorAndStyle; private ColorAndStyle annotationTextColorAndStyle;
private ColorAndStyle commentTextColorAndStyle; private ColorAndStyle commentTextColorAndStyle;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
public EditorThemeConfigDialog(JFrame owner) { public EditorThemeConfigDialog(JFrame owner) {
super(owner, true); super(owner, true);

View File

@ -762,7 +762,7 @@ public class JavaDocument extends StyledDocument {
performSyntaxHighlighting(force); performSyntaxHighlighting(force);
updateSyntaxHighlightingEDTidle = true; updateSyntaxHighlightingEDTidle = true;
} catch (BadLocationException e) { } catch (BadLocationException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
} }
}); });

View File

@ -121,7 +121,7 @@ public final class LineHighlighter {
}; };
private static EditorThemePropertyChangeAdapter editorThemePropertyChangeListener = new EditorThemePropertyChangeAdapter() { private static EditorThemePropertyChangeAdapter editorThemePropertyChangeListener = new EditorThemePropertyChangeAdapter() {
public void onHighlightedLineColorChanged(Color newColor) { public void static onHighlightedLineColorChanged(Color newColor) {
if (!color.equals(newColor)) { if (!color.equals(newColor)) {
color = newColor; color = newColor;
} }

View File

@ -31,7 +31,7 @@ import net.sf.robocode.ui.editor.theme.EditorThemePropertyChangeAdapter;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class LineNumberArea extends JTextArea { public class LineNumberArea extends JTextArea {
private final DocumentListener documentListener = new TextDocumentListener(); private final transient DocumentListener documentListener = new TextDocumentListener();
public LineNumberArea(JTextComponent textComponent) { public LineNumberArea(JTextComponent textComponent) {
super("1"); super("1");

View File

@ -55,7 +55,7 @@ public class RobocodeEditor extends JFrame implements Runnable, IRobocodeEditor
private FindReplaceDialog findReplaceDialog; private FindReplaceDialog findReplaceDialog;
private ReplaceAction replaceAction; private ReplaceAction replaceAction;
final EventHandler eventHandler = new EventHandler(); final transient EventHandler eventHandler = new EventHandler();
class EventHandler implements ComponentListener { class EventHandler implements ComponentListener {
public void componentMoved(ComponentEvent e) {} public void componentMoved(ComponentEvent e) {}

View File

@ -30,7 +30,7 @@ import java.awt.event.KeyEvent;
public class RobocodeEditorMenuBar extends JMenuBar { public class RobocodeEditorMenuBar extends JMenuBar {
private final RobocodeEditor editor; private final RobocodeEditor editor;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private class EventHandler implements ActionListener { private class EventHandler implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@ -26,8 +26,8 @@ import javax.swing.undo.UndoManager;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class UndoManagerWithActions extends UndoManager { public class UndoManagerWithActions extends UndoManager {
private Action undoAction = new UndoAction(); private transient Action undoAction = new UndoAction();
private Action redoAction = new RedoAction(); private transient Action redoAction = new RedoAction();
public UndoManagerWithActions() { public UndoManagerWithActions() {
super(); super();

View File

@ -68,7 +68,7 @@ public class BattleView extends Canvas {
private final int groundTileWidth = 64; private final int groundTileWidth = 64;
private final int groundTileHeight = 64; private final int groundTileHeight = 64;
private Image groundImage; private transient Image groundImage;
// Draw option related things // Draw option related things
private boolean drawRobotName; private boolean drawRobotName;
@ -80,7 +80,7 @@ public class BattleView extends Canvas {
private int numBuffers = 2; // defaults to double buffering private int numBuffers = 2; // defaults to double buffering
private RenderingHints renderingHints; private transient RenderingHints renderingHints;
// Fonts and the like // Fonts and the like
private Font smallFont; private Font smallFont;
@ -90,7 +90,7 @@ public class BattleView extends Canvas {
private final ISettingsManager properties; private final ISettingsManager properties;
private final IWindowManagerExt windowManager; private final IWindowManagerExt windowManager;
private BufferStrategy bufferStrategy; private transient BufferStrategy bufferStrategy;
private final GeneralPath robocodeTextPath = new RobocodeLogo().getRobocodeText(); private final GeneralPath robocodeTextPath = new RobocodeLogo().getRobocodeText();
@ -106,7 +106,6 @@ public class BattleView extends Canvas {
battleField = new BattleField(800, 600); battleField = new BattleField(800, 600);
new BattleObserver(windowManager);
properties.addPropertyListener(new ISettingsListener() { properties.addPropertyListener(new ISettingsListener() {
public void settingChanged(String property) { public void settingChanged(String property) {

View File

@ -33,7 +33,7 @@ import net.sf.robocode.io.FileUtil;
*/ */
public class ScreenshotUtil { public class ScreenshotUtil {
private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH.mm.ss.SSS"); private final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH.mm.ss.SSS");
public static void saveScreenshot(BufferedImage screenshot, String format, float compressionQuality) { public static void saveScreenshot(BufferedImage screenshot, String format, float compressionQuality) {
FileImageOutputStream output = null; FileImageOutputStream output = null;
@ -67,7 +67,7 @@ public class ScreenshotUtil {
writer.write(null, image, iwp); writer.write(null, image, iwp);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOGGER.log("context", e);
} finally { } finally {
if (writer != null) { if (writer != null) {
writer.dispose(); writer.dispose();
@ -76,7 +76,7 @@ public class ScreenshotUtil {
try { try {
output.close(); output.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOGGER.log("context", e);
} }
} }
} }

View File

@ -33,7 +33,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class AvailableRobotsPanel extends JPanel { public class AvailableRobotsPanel extends JPanel {
private final List<ItemWrapper> availableRobots = new CopyOnWriteArrayList<ItemWrapper>(); private final transient List<ItemWrapper> availableRobots = new CopyOnWriteArrayList<ItemWrapper>();
private List<IRobotSpecItem> robotList = new CopyOnWriteArrayList<IRobotSpecItem>(); private List<IRobotSpecItem> robotList = new CopyOnWriteArrayList<IRobotSpecItem>();
private final List<String> availablePackages = new CopyOnWriteArrayList<String>(); private final List<String> availablePackages = new CopyOnWriteArrayList<String>();
@ -53,7 +53,7 @@ public class AvailableRobotsPanel extends JPanel {
private final String title; private final String title;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
public AvailableRobotsPanel(JButton actionButton, String title, JList actionList, public AvailableRobotsPanel(JButton actionButton, String title, JList actionList,
RobotSelectionPanel robotSelectionPanel) { RobotSelectionPanel robotSelectionPanel) {

View File

@ -26,7 +26,7 @@ import java.awt.event.ComponentListener;
public abstract class BaseScoreDialog extends JDialog { public abstract class BaseScoreDialog extends JDialog {
protected final IWindowManagerExt windowManager; protected final IWindowManagerExt windowManager;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
protected JPanel contentPane; protected JPanel contentPane;
protected JScrollPane scrollPane; protected JScrollPane scrollPane;
protected JTable table; protected JTable table;

View File

@ -32,7 +32,7 @@ import java.io.StringWriter;
public class BattleDialog extends JFrame { public class BattleDialog extends JFrame {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final BattleObserver battleObserver = new BattleObserver(); private final transient BattleObserver battleObserver = new BattleObserver();
private ConsoleScrollPane consoleScrollPane; private ConsoleScrollPane consoleScrollPane;
private ConsoleScrollPane turnSnapshotScrollPane; private ConsoleScrollPane turnSnapshotScrollPane;

View File

@ -29,7 +29,7 @@ public class ConsoleDialog extends JDialog {
private JMenu editMenu; private JMenu editMenu;
private JMenuItem editCopyMenuItem; private JMenuItem editCopyMenuItem;
private JMenuBar consoleDialogMenuBar; private JMenuBar consoleDialogMenuBar;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private class EventHandler implements ActionListener { private class EventHandler implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@ -172,7 +172,7 @@ public class MenuBar extends JMenuBar {
public void menuCanceled(MenuEvent e) {} public void menuCanceled(MenuEvent e) {}
} }
public final MenuBar.EventHandler eventHandler = new EventHandler(); public final transient MenuBar.EventHandler eventHandler = new EventHandler();
private RobocodeFrame robocodeFrame; private RobocodeFrame robocodeFrame;
private final ISettingsManager properties; private final ISettingsManager properties;

View File

@ -27,7 +27,7 @@ public class NewBattleDialog extends JDialog implements WizardListener {
private final static int MAX_ROBOTS = 256; // 64; private final static int MAX_ROBOTS = 256; // 64;
private final static int MIN_ROBOTS = 1; private final static int MIN_ROBOTS = 1;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private ISettingsManager settingsManager; private ISettingsManager settingsManager;
private BattleProperties battleProperties; private BattleProperties battleProperties;

View File

@ -38,7 +38,7 @@ public class NewBattleRulesTab extends JPanel {
private ISettingsManager settingsManager; private ISettingsManager settingsManager;
private BattleProperties battleProperties; private BattleProperties battleProperties;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private SizeButton[] predefinedSizeButtons = { private SizeButton[] predefinedSizeButtons = {
new SizeButton(400, 400), new SizeButton(600, 400), new SizeButton(600, 600), new SizeButton(800, 600), new SizeButton(400, 400), new SizeButton(600, 400), new SizeButton(600, 600), new SizeButton(800, 600),

View File

@ -34,7 +34,7 @@ public class RcSplashScreen extends JWindow {
private JLabel splashLabel; private JLabel splashLabel;
private JPanel splashPanel; private JPanel splashPanel;
private JPanel splashScreenContentPane; private JPanel splashScreenContentPane;
private Image splashImage; private transient Image splashImage;
private final String version; private final String version;
private final transient WindowListener eventHandler = new WindowAdapter() { private final transient WindowListener eventHandler = new WindowAdapter() {

View File

@ -54,8 +54,8 @@ public class RobocodeFrame extends JFrame {
private static final Cursor BUSY_CURSOR = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); private static final Cursor BUSY_CURSOR = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
private static final Cursor DEFAULT_CURSOR = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); private static final Cursor DEFAULT_CURSOR = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private BattleObserver battleObserver; private transient BattleObserver battleObserver;
private final InteractiveHandler interactiveHandler; private final InteractiveHandler interactiveHandler;
@ -93,7 +93,7 @@ public class RobocodeFrame extends JFrame {
private final BattleView battleView; private final BattleView battleView;
private final MenuBar menuBar; private final MenuBar menuBar;
final List<RobotButton> robotButtons = new ArrayList<RobotButton>(); private final List<RobotButton> robotButtons = new ArrayList<RobotButton>();
public RobocodeFrame(ISettingsManager properties, public RobocodeFrame(ISettingsManager properties,
IWindowManager windowManager, IWindowManager windowManager,
@ -724,7 +724,7 @@ public class RobocodeFrame extends JFrame {
public void windowClosed(WindowEvent e) { public void windowClosed(WindowEvent e) {
if (exitOnClose) { if (exitOnClose) {
System.exit(0); ;
} }
} }
@ -947,13 +947,13 @@ public class RobocodeFrame extends JFrame {
boolean dispTps = properties.getOptionsViewTPS(); boolean dispTps = properties.getOptionsViewTPS();
boolean dispFps = properties.getOptionsViewFPS(); boolean dispFps = properties.getOptionsViewFPS();
if (dispTps | dispFps) { if (dispTps || dispFps) {
title.append(", "); title.append(", ");
if (dispTps) { if (dispTps) {
title.append(tps).append(" TPS"); title.append(tps).append(" TPS");
} }
if (dispTps & dispFps) { if (dispTps && dispFps) {
title.append(", "); title.append(", ");
} }
if (dispFps) { if (dispFps) {

View File

@ -39,7 +39,7 @@ public class RobotButton extends JButton implements ActionListener {
private final IWindowManagerExt windowManager; private final IWindowManagerExt windowManager;
private final IBattleManager battleManager; private final IBattleManager battleManager;
private final BattleObserver battleObserver = new BattleObserver(); private final transient BattleObserver battleObserver = new BattleObserver();
private final IRobotDialogManager dialogManager; private final IRobotDialogManager dialogManager;
private RobotDialog robotDialog; private RobotDialog robotDialog;
private String name; private String name;

View File

@ -39,7 +39,7 @@ public class RobotDescriptionPanel extends JPanel {
private final static String BLANK_STRING = " "; private final static String BLANK_STRING = " ";
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private class EventHandler implements ActionListener { private class EventHandler implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@ -51,7 +51,7 @@ public class RobotDialog extends JFrame {
private boolean grayGreenButton; private boolean grayGreenButton;
private final Map<String, String> debugProperties = new HashMap<String, String>(); private final Map<String, String> debugProperties = new HashMap<String, String>();
private final BattleObserver battleObserver = new BattleObserver(); private final transient BattleObserver battleObserver = new BattleObserver();
private final IWindowManager windowManager; private final IWindowManager windowManager;
private final IBattleManager battleManager; private final IBattleManager battleManager;

View File

@ -43,11 +43,11 @@ public class RobotExtractor extends JDialog implements WizardListener {
private RobotSelectionPanel robotSelectionPanel; private RobotSelectionPanel robotSelectionPanel;
public byte buf[] = new byte[4096]; public byte buf[] = new byte[4096];
private StringWriter output; private transient StringWriter output;
private final IWindowManager windowManager; private final IWindowManager windowManager;
private final IRepositoryManager repositoryManager; private final IRepositoryManager repositoryManager;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
class EventHandler implements ActionListener { class EventHandler implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

View File

@ -23,7 +23,7 @@ import java.awt.event.ActionListener;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class WizardController extends JPanel implements ChangeListener { public class WizardController extends JPanel implements ChangeListener {
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private JButton backButton; private JButton backButton;
private JButton nextButton; private JButton nextButton;

View File

@ -51,7 +51,7 @@ public class RobotPackager extends JDialog implements WizardListener {
private final IRepositoryManager repositoryManager; private final IRepositoryManager repositoryManager;
private final IWindowManager windowManager; private final IWindowManager windowManager;
private final EventHandler eventHandler = new EventHandler(); private final transient EventHandler eventHandler = new EventHandler();
private class EventHandler implements ActionListener { private class EventHandler implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {