You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by br...@apache.org on 2004/04/01 17:52:43 UTC
svn commit: rev 9835 - xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util
Author: brondsem
Date: Thu Apr 1 07:52:42 2004
New Revision: 9835
Modified:
xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util/Project.java
Log:
handle 2-byte and 1-byte EOL
Modified: xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util/Project.java
==============================================================================
--- xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util/Project.java (original)
+++ xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util/Project.java Thu Apr 1 07:52:42 2004
@@ -122,6 +122,7 @@
}
byte[] checkSuccess = new byte[Constants.BUILD_SUCCESS_STRING.length()];
+ // try for 2-byte eol
try {
f.seek((int) f.length() - checkSuccess.length - 2);
f.read(checkSuccess, 0, checkSuccess.length);
@@ -129,15 +130,26 @@
log.debug("couldn't find seek in log file: " + f.toString());
return Constants.STATUS_UNKNOWN;
}
-
- if (Constants.BUILD_SUCCESS_STRING.equals(new String(checkSuccess))) {
+ if (Constants.BUILD_SUCCESS_STRING.equals(new String(checkSuccess)))
return Constants.STATUS_SUCCESS;
- } else if (getLastBuilt().getTime() > (new Date()).getTime() - 60 * 1000) {
- // if date is in last minute, consider it still running
- return Constants.STATUS_RUNNING;
- } else {
- return Constants.STATUS_FAILED;
+ // try for 1-byte eol
+ try {
+ f.seek((int) f.length() - checkSuccess.length - 1);
+ f.read(checkSuccess, 0, checkSuccess.length);
+ } catch (IOException e1) {
+ log.debug("couldn't find seek in log file: " + f.toString());
+ return Constants.STATUS_UNKNOWN;
}
+ if (Constants.BUILD_SUCCESS_STRING.equals(new String(checkSuccess)))
+ return Constants.STATUS_SUCCESS;
+
+
+ // if date is in last minute, consider it still running
+ if (getLastBuilt().getTime() > (new Date()).getTime() - 60 * 1000)
+ return Constants.STATUS_RUNNING;
+
+ // default
+ return Constants.STATUS_FAILED;
}
/**