forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject svn commit: rev 9835 - xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util
Date Thu, 01 Apr 2004 15:52:43 GMT
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;
 	}
 
 	/**

Mime
View raw message