// recv grader_log
currentJob.log = recvBytes();
if (currentJob.getUserid() == null || currentJob.getTask() == null)
throw new AgentException(
"!currentJob.userid == null || currentJob.task == null: doGrade");
// store grader-generated files to the server
// delete previous
clearGradeResultFile(currentJob.getContestId(), currentJob.getUserid(), currentJob
.getTask());
// save csv and log as file
TempFile tmpfilelog = TempFile.createFromByteArray(currentJob.log);
saveGradeResultFile(currentJob.getContestId(),
currentJob.getUserid(),
currentJob.getTask(),
tmpfilelog,
currentJob.getTask() + ".grader.log");
TempFile tmpfilecsv = TempFile.createFromByteArray(currentJob.output);
saveGradeResultFile(currentJob.getContestId(),
currentJob.getUserid(),
currentJob.getTask(),
tmpfilecsv,
currentJob.getTask() + ".grader.csv");
// retreive filelist and recv files
byte[] abyFilelist = recvBytes();
String strFilelist = new String(abyFilelist);
StringTokenizer tFile = new StringTokenizer(strFilelist, "\n");
try {
String strFilename = null;
while (tFile.hasMoreTokens() && !(strFilename = tFile.nextToken().trim()).equals("")) {
TempFile tmpFile = recvFile();
saveGradeResultFile(currentJob.getContestId(), currentJob.getUserid(), currentJob
.getTask(), tmpFile, strFilename);
}
} catch (NoSuchElementException e) {
throw new AgentException("!NoSuchElementException: doGrade");
}
}