commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <grahamdavid1...@yahoo.com>
Subject Re: cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator ValidatorAction.java
Date Tue, 13 Apr 2004 12:53:16 GMT
Sorry I forgot to make the change on the branch too.  Thanks for
remembering :-).

David

--- rleland@apache.org wrote:
> rleland     2004/04/12 22:49:22
> 
>   Modified:    validator/src/share/org/apache/commons/validator Tag:
>                         VALIDATOR_1_1_2_BRANCH ValidatorAction.java
>   Log:
>   PR: 28257 Backported patch David made to use reader instead of
> InputStream
>    to work around bug in JWS 1.4 under JRE prior to 1.3.1_05
>   
>   Revision  Changes    Path
>   No                   revision
>   No                   revision
>   1.20.2.1  +16 -19   
>
jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorAction.java
>   
>   Index: ValidatorAction.java
>   ===================================================================
>   RCS file:
>
/home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorAction.java,v
>   retrieving revision 1.20
>   retrieving revision 1.20.2.1
>   diff -u -r1.20 -r1.20.2.1
>   --- ValidatorAction.java	21 Feb 2004 17:10:29 -0000	1.20
>   +++ ValidatorAction.java	13 Apr 2004 05:49:22 -0000	1.20.2.1
>   @@ -21,8 +21,10 @@
>    
>    package org.apache.commons.validator;
>    
>   +import java.io.BufferedReader;
>    import java.io.IOException;
>    import java.io.InputStream;
>   +import java.io.InputStreamReader;
>    import java.io.Serializable;
>    import java.lang.reflect.InvocationTargetException;
>    import java.lang.reflect.Method;
>   @@ -428,32 +430,27 @@
>                return null;
>            }
>    
>   -        StringBuffer function = new StringBuffer();
>   +        StringBuffer buffer = new StringBuffer();
>   +        BufferedReader reader = new BufferedReader(new
> InputStreamReader(is));
>            try {
>   -            int bufferSize = is.available();
>   -            int bytesRead;
>   -            while (bufferSize > 0) {
>   -                byte[] buffer = new byte[bufferSize];
>   -                bytesRead = is.read(buffer, 0, bufferSize);
>   -                if (bytesRead > 0) {
>   -                    String functionPart = new
> String(buffer,0,bytesRead);
>   -                    function.append(functionPart);
>   -                }
>   -                bufferSize = is.available();
>   +            String line = null;
>   +            while ((line = reader.readLine()) != null) {
>   +                buffer.append(line + "\n");
>                }
>    
>            } catch(IOException e) {
>   -            log.error("readJavascriptFile()", e);
>   +            log.error("Error reading javascript file.", e);
>    
>            } finally {
>                try {
>   -                is.close();
>   +                reader.close();
>                } catch(IOException e) {
>   -                log.error("readJavascriptFile()", e);
>   +                log.error("Error closing stream to javascript file.",
> e);
>                }
>            }
>   -        String strFunction = function.toString();
>   -        return strFunction.equals("") ? null : strFunction;
>   +        
>   +        String function = buffer.toString();
>   +        return function.equals("") ? null : function;
>        }
>    
>        /**
>   
>   
>   
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message