public File getReadableDirectory() { try { return (readableRootDirectory == null) ? null : new File(readableRootDirectory).getCanonicalFile(); } catch (IOException e) { Logger.logError(e); return null; } }
public JarRoot(IRepository repository, File rootPath) { super(repository, rootPath); String jarPath = null; URL jarUrl = null; try { jarPath = "jar:" + rootPath.toURI().toString(); jarUrl = new URL(jarPath + "!/"); } catch (MalformedURLException e) { Logger.logError(e); } this.jarPath = jarPath; this.jarUrl = jarUrl; }
public void onRoundStarted(RoundStartedEvent event) { for (IBattleListener listener : listeners) { try { listener.onRoundStarted(event); } catch (Throwable ex) { logError("onRoundStarted " + listener.getClass(), ex); } } }
@Override public List<File> getDevelDirectories() { List<File> develDirectories = new ArrayList<File>(); for (String path : properties.getOptionsEnabledDevelopmentPaths()) { try { develDirectories.add(new File(path).getCanonicalFile()); } catch (IOException e) { Logger.logError(e); } } return develDirectories; }
public void onBattleResumed(BattleResumedEvent event) { for (IBattleListener listener : listeners) { try { listener.onBattleResumed(event); } catch (Throwable ex) { logError("onBattleResumed " + listener.getClass(), ex); } } }
public void onTurnStarted(TurnStartedEvent event) { for (IBattleListener listener : listeners) { try { listener.onTurnStarted(event); } catch (Throwable ex) { logError("onTurnStarted " + listener.getClass(), ex); } } }
private void processCommand() { Command command = pendingCommands.poll(); while (command != null) { try { command.execute(); } catch (Exception e) { logError(e); } command = pendingCommands.poll(); } }
public void onBattlePaused(BattlePausedEvent event) { for (IBattleListener listener : listeners) { try { listener.onBattlePaused(event); } catch (Throwable ex) { logError("onBattlePaused " + listener.getClass(), ex); } } }
public void onRoundEnded(RoundEndedEvent event) { for (IBattleListener listener : listeners) { try { listener.onRoundEnded(event); } catch (Throwable ex) { logError("onRoundEnded " + listener.getClass(), ex); } } }
public void onBattleCompleted(BattleCompletedEvent event) { for (IBattleListener listener : listeners) { try { listener.onBattleCompleted(event); } catch (Throwable ex) { logError("onBattleCompleted " + listener.getClass(), ex); } } }
private void cleanup() { cleanupStreams(); if (tempFile != null && tempFile.exists()) { if (tempFile.delete() == false) { Logger.logError("Could not delete temp file"); } tempFile = null; } recordInfo = null; }
public File getWritableDirectory() { try { return (writableRootDirectory == null) ? null : new File(writableRootDirectory, robotProxy.getStatics().getShortClassName() + ".data").getCanonicalFile(); } catch (IOException e) { Logger.logError(e); return null; } }
private static void deleteFile(String filename) { Logger.logMessage("Deleting " + filename + "..."); try { recursivelyDelete(new File(filename)); } catch (IOException ex) { Logger.logError(ex.getMessage()); } }
private void save() { FileOutputStream fos = null; try { fos = new FileOutputStream(new File(getRobotsDirectory(), DATABASE_FILENAME)); repository.save(fos); } catch (IOException e) { Logger.logError("Can't save robot database", e); } finally { FileUtil.cleanupStream(fos); } }
/** * {@inheritDoc} */ public void setVisible(boolean visible) { IWindowManagerBase windowManager = ContainerBase.getComponent(IWindowManagerBase.class); if (windowManager != null) { windowManager.setVisibleForRobotEngine(visible); } else { Logger.logError( "setVisible: No window manager was found.\n" + "Perhaps you are missing the robocode.ui-1.x.x.x-jar file or the GUI has been disabled?"); } }
public void saveCompilerProperties() { FileOutputStream out = null; try { out = new FileOutputStream(FileUtil.getCompilerConfigFile()); getCompilerProperties().store(out, "Robocode Compiler Properties"); } catch (IOException e) { Logger.logError(e); } finally { FileUtil.cleanupStream(out); } }
public synchronized void resumeBattle() { if (--pauseCount < 0) { pauseCount = 0; logError("SYSTEM: pause game bug!"); } else if (pauseCount == 0) { if (battle != null && battle.isRunning()) { battle.resume(); } else { battleEventDispatcher.onBattleResumed(new BattleResumedEvent()); } } }