You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Liaw Mike Djoesman <mi...@summa-tech.com> on 2004/04/06 20:28:50 UTC
[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: mike@summa-tech.com
tel.: (55 11) 3846-1622
cel.: (55 11) 8133-6594
----------------------------------------------------------------------
Re: [commons-validator] ValidatorAction class issue
Posted by David Graham <gr...@yahoo.com>.
We don't need to use those lower level methods for reading anyways. As
Niall asked, please open a bugzilla ticket for this.
Thanks,
David
--- Niall Pemberton <ni...@blueyonder.co.uk> wrote:
> 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" <mi...@summa-tech.com>
> To: <co...@jakarta.apache.org>
> 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: mike@summa-tech.com
> > 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: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [commons-validator] ValidatorAction class issue
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
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" <mi...@summa-tech.com>
To: <co...@jakarta.apache.org>
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: mike@summa-tech.com
> 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: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org