修改严重代码
This commit is contained in:
parent
428f63be82
commit
15f56c9d26
|
@ -59,7 +59,7 @@ public class BattlesRunner {
|
|||
initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
private static void initialize() {
|
||||
if (engine == null) {
|
||||
engine = new RobocodeEngine();
|
||||
engine.addBattleListener(new BattleObserver());
|
||||
|
@ -228,7 +228,7 @@ public class BattlesRunner {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBattleCompleted(final BattleCompletedEvent event) {
|
||||
public static void onBattleCompleted(final BattleCompletedEvent event) {
|
||||
lastResults = RobotResults.convertResults(event.getSortedResults());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,25 +100,25 @@ public class BotsDownload {
|
|||
// delete previous files
|
||||
if (generalbotsfile.length() != 0) {
|
||||
file = new File(generalbotsfile);
|
||||
if (file.exists() && !file.delete()) {
|
||||
if (file.exists() &&&& !file.delete()) {
|
||||
Logger.logError("Can't delete file: " + file);
|
||||
}
|
||||
}
|
||||
if (minibotsfile.length() != 0) {
|
||||
file = new File(minibotsfile);
|
||||
if (file.exists() && !file.delete()) {
|
||||
if (file.exists() &&&& !file.delete()) {
|
||||
Logger.logError("Can't delete file: " + file);
|
||||
}
|
||||
}
|
||||
if (microbotsfile.length() != 0) {
|
||||
file = new File(microbotsfile);
|
||||
if (file.exists() && !file.delete()) {
|
||||
if (file.exists() &&&& !file.delete()) {
|
||||
Logger.logError("Can't delete file: " + file);
|
||||
}
|
||||
}
|
||||
if (nanobotsfile.length() != 0) {
|
||||
file = new File(nanobotsfile);
|
||||
if (file.exists() && !file.delete()) {
|
||||
if (file.exists() &&&& !file.delete()) {
|
||||
Logger.logError("Can't delete file: " + file);
|
||||
}
|
||||
}
|
||||
|
@ -128,17 +128,17 @@ public class BotsDownload {
|
|||
}
|
||||
boolean downloaded = true;
|
||||
|
||||
if (generalBots.length() != 0 && generalbotsfile.length() != 0) {
|
||||
downloaded = downloadRatingsFile(generalBots, generalbotsfile) & downloaded;
|
||||
if (generalBots.length() != 0 &&&& generalbotsfile.length() != 0) {
|
||||
downloaded = downloadRatingsFile(generalBots, generalbotsfile) && downloaded;
|
||||
}
|
||||
if (miniBots.length() != 0 && minibotsfile.length() != 0) {
|
||||
downloaded = downloadRatingsFile(miniBots, minibotsfile) & downloaded;
|
||||
if (miniBots.length() != 0 &&&& minibotsfile.length() != 0) {
|
||||
downloaded = downloadRatingsFile(miniBots, minibotsfile) && downloaded;
|
||||
}
|
||||
if (microBots.length() != 0 && microbotsfile.length() != 0) {
|
||||
downloaded = downloadRatingsFile(microBots, microbotsfile) & downloaded;
|
||||
if (microBots.length() != 0 &&&& microbotsfile.length() != 0) {
|
||||
downloaded = downloadRatingsFile(microBots, microbotsfile) && downloaded;
|
||||
}
|
||||
if (nanoBots.length() != 0 && nanobotsfile.length() != 0) {
|
||||
downloaded = downloadRatingsFile(nanoBots, nanobotsfile) & downloaded;
|
||||
if (nanoBots.length() != 0 &&&& nanobotsfile.length() != 0) {
|
||||
downloaded = downloadRatingsFile(nanoBots, nanobotsfile) && downloaded;
|
||||
}
|
||||
return downloaded;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class BotsDownload {
|
|||
|
||||
final File dir = new File(participantsfile).getParentFile();
|
||||
|
||||
if (!dir.exists() && !dir.mkdirs()) {
|
||||
if (!dir.exists() &&&& !dir.mkdirs()) {
|
||||
Logger.logError("Can't create directory: " + dir);
|
||||
}
|
||||
|
||||
|
@ -332,10 +332,10 @@ public class BotsDownload {
|
|||
String sessionId = null;
|
||||
|
||||
if (id.indexOf("://") == -1) {
|
||||
url = "http://robocoderepository.com/Controller.jsp?submitAction=downloadClass&id=" + id;
|
||||
url = "http://robocoderepository.com/Controller.jsp?submitAction=downloadClass&&id=" + id;
|
||||
|
||||
sessionId = FileTransfer.getSessionId(
|
||||
"http://robocoderepository.com/BotSearch.jsp?botName=''&authorName=''&uploadDate=");
|
||||
"http://robocoderepository.com/BotSearch.jsp?botName=''&&authorName=''&&uploadDate=");
|
||||
} else {
|
||||
url = id;
|
||||
}
|
||||
|
@ -420,13 +420,13 @@ public class BotsDownload {
|
|||
PrintStream outtxt = null;
|
||||
|
||||
try {
|
||||
URL url = new URL(ratingsurl + "?version=1&game=" + competition);
|
||||
URL url = new URL(ratingsurl + "?version=1&&game=" + competition);
|
||||
|
||||
HttpURLConnection conn = FileTransfer.connectToHttpInputConnection(url);
|
||||
|
||||
final File dir = new File(file).getParentFile();
|
||||
|
||||
if (!dir.exists() && !dir.mkdirs()) {
|
||||
if (!dir.exists() &&&& !dir.mkdirs()) {
|
||||
Logger.logError("Can't create directory: " + dir);
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,7 @@ public class BotsDownload {
|
|||
return;
|
||||
}
|
||||
|
||||
String data = "version=1&game=" + game + "&name=" + bot.trim() + "&dummy=NA";
|
||||
String data = "version=1&&game=" + game + "&&name=" + bot.trim() + "&&dummy=NA";
|
||||
|
||||
OutputStream out = null;
|
||||
OutputStreamWriter outputStreamWriter = null;
|
||||
|
@ -614,7 +614,6 @@ public class BotsDownload {
|
|||
if (robot.matches("[\\w\\.]+[ ][\\w\\.-]+")) {
|
||||
if (link.startsWith("http")) {
|
||||
try {
|
||||
new URL(link);
|
||||
matches = true;
|
||||
} catch (MalformedURLException e) {
|
||||
matches = false;
|
||||
|
|
|
@ -355,7 +355,7 @@ public class FileTransfer {
|
|||
try {
|
||||
in.close();
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.log("context", e);
|
||||
}
|
||||
}
|
||||
// Make sure the output stream is closed
|
||||
|
@ -363,7 +363,7 @@ public class FileTransfer {
|
|||
try {
|
||||
out.close();
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.log("context", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -489,14 +489,14 @@ public class FileTransfer {
|
|||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.log("context", e);
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.log("context", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,8 +181,8 @@ public class ResultsUpload {
|
|||
|
||||
String data = "game=" + game + commonData;
|
||||
|
||||
if (matchtype.equals("GENERAL") || matchtype.equals("SERVER")) {
|
||||
errorsfound = errorsfound | senddata(game, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||
if (matchtype.equals("GENERAL") |||| matchtype.equals("SERVER")) {
|
||||
errorsfound = errorsfound || senddata(game, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||
}
|
||||
|
||||
if (sizesfile.length() != 0) { // upload also related competitions
|
||||
|
@ -190,18 +190,18 @@ public class ResultsUpload {
|
|||
&& size.checkCompetitorsForSize(first[0], second[0], 1500)) {
|
||||
data = "game=" + minibots + commonData;
|
||||
errorsfound = errorsfound
|
||||
| senddata(minibots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||
|| senddata(minibots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||
}
|
||||
if (microbots.length() != 0 && !matchtype.equals("NANO")
|
||||
&& size.checkCompetitorsForSize(first[0], second[0], 750)) {
|
||||
data = "game=" + microbots + commonData;
|
||||
errorsfound = errorsfound
|
||||
| senddata(microbots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||
|| senddata(microbots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||
}
|
||||
if (nanobots.length() != 0 && size.checkCompetitorsForSize(first[0], second[0], 250)) {
|
||||
data = "game=" + nanobots + commonData;
|
||||
errorsfound = errorsfound
|
||||
| senddata(nanobots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||
|| senddata(nanobots, data, outtxt, true, results, i, battlesnum, prioritybattles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class PropertiesUtil {
|
|||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.log("context", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public final class PropertiesUtil {
|
|||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.log("context", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue