This may get overlooked sending it to list - you should open a bug to make sure its properly logged against validator
http://jakarta.apache.org/site/bugs.html Niall ----- Original Message ----- From: "Liaw Mike Djoesman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 06, 2004 7:28 PM Subject: [commons-validator] ValidatorAction class issue > Hi, > > I'm currently using commons-validator 1.1.1 in a Java Web Start client bundled with jre 1.4.2. > Whenever using a JNLP file to download the application, commons-validator hangs in > ValidatorAction class and to be more precise, it hangs in readJavascriptFile method. > > Debugging that method I found a while loop that reads a javascript resource based on > InputStream.available() and InputStream.read() methods. > It seems that inside a Web Start environment, available() method always returns a positive > number while read() method is returning a negative number (-1) which leads to a infinite loop. > > That doesn't happen using a regular jar or class file to kick off the application. I > really don't know why this happens in Web Start environment but either way, I've listened > that InputStream.available() is not a very trusted method. Does it make sense? > > I've also downloaded commons-validator 1.1.2 but it has the same issue. > I've also tested Java Web Start bundled with jre 1.5 beta - it does not hang in this > environment. > > Anyway, I'm attaching a patch to work around this issue. > > Mike > > -- > > ---------------------------------------------------------------------- > Liaw Mike Djoesman - Summa Technologies do Brasil Ltda. > email: [EMAIL PROTECTED] > tel.: (55 11) 3846-1622 > cel.: (55 11) 8133-6594 > ---------------------------------------------------------------------- > > ---------------------------------------------------------------------------- ---- > Index: ValidatorAction.java > =================================================================== > RCS file: /db/public/cvsroot/commons-validator/src/share/org/apache/commons/validator/ ValidatorAction.java,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 ValidatorAction.java > --- ValidatorAction.java 6 Apr 2004 16:54:46 -0000 1.1.1.1 > +++ ValidatorAction.java 6 Apr 2004 17:25:36 -0000 > @@ -455,6 +455,10 @@ > String functionPart = new String(buffer,0,bytesRead); > function.append(functionPart); > } > + else if (bufferSize > 0) { > + log.debug(" Unable to load javascript name "+javascriptFileName); > + return null; > + } > bufferSize = is.available(); > } > > > ---------------------------------------------------------------------------- ---- > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
