commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "emman sun (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FILEUPLOAD-187) MultipartStream throw ArrayIndexOutOfBoundsException
Date Tue, 23 Nov 2010 14:04:16 GMT

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934837#action_12934837
] 

emman sun commented on FILEUPLOAD-187:
--------------------------------------

from the code from MultipartStream.java

        private int makeAvailable() throws IOException {
            if (pos != -1) {
                return 0;
            }

            // Move the data to the beginning of the buffer.
            total += tail - head - pad;
            System.arraycopy(buffer, tail - pad, buffer, 0, pad);   /////////////////////////
this line throwed the exception, but 0 <= tail <= bufSize, 0<=pad<=keepRegion,
seems impossible

            // Refill buffer with new data.
            head = 0;
            tail = pad;

            for (;;) {
                int bytesRead = input.read(buffer, tail, bufSize - tail);
                if (bytesRead == -1) {
                    // The last pad amount is left in the buffer.
                    // Boundary can't be in there so signal an error
                    // condition.
                    final String msg = "Stream ended unexpectedly";
                    throw new MalformedStreamException(msg);
                }
                if (notifier != null) {
                    notifier.noteBytesRead(bytesRead);
                }
                tail += bytesRead;

                findSeparator();
                int av = available();

                if (av > 0 || pos != -1) {
                    return av;
                }
            }
        }

> MultipartStream throw ArrayIndexOutOfBoundsException
> ----------------------------------------------------
>
>                 Key: FILEUPLOAD-187
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-187
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>         Environment: OC4J 10.1.3.3, myfaces 1.1.4, tomahawk-1.1.3, facelets 1.1.11, jdk
1.5.0_6
>            Reporter: emman sun
>
> sometimes we encounter ArrayIndexOutOfBoundsException.
> Request headers:
>   ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
>   ACCEPT-ENCODING:gzip, deflate
>   ACCEPT-LANGUAGE:en-us
>   CACHE-CONTROL:no-cache
>   CONNECTION:Keep-Alive
>   CONTENT-LENGTH:46041
>   CONTENT-TYPE:multipart/form-data; boundary=---------------------------7da2661d340152
> Caused by: java.lang.ArrayIndexOutOfBoundsException
> 	at java.lang.System.arraycopy(Native Method)
> 	at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:969)
> 	at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:886)
> 	at java.io.InputStream.read(InputStream.java:89)
> 	at org.apache.commons.fileupload.util.Streams.copy(Streams.java:96)
> 	at org.apache.commons.fileupload.util.Streams.copy(Streams.java:66)
> 	at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:366)
> 	at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:310)
> 	at org.apache.myfaces.webapp.filter.MultipartRequestWrapper.parseRequest(MultipartRequestWrapper.java:82)
> 	at org.apache.myfaces.webapp.filter.MultipartRequestWrapper.getParameter(MultipartRequestWrapper.java:163)
> 	at org.apache.myfaces.context.servlet.RequestParameterMap.getAttribute(RequestParameterMap.java:39)
> 	at org.apache.myfaces.context.servlet.AbstractAttributeMap.get(AbstractAttributeMap.java:87)
> 	at com.sun.facelets.tag.ui.UIDebug.debugRequest(UIDebug.java:119)
> 	at com.sun.facelets.FaceletViewHandler.restoreView(FaceletViewHandler.java:312)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:141)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
> 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
> 	at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
> 	at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97)
> 	at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
> 	at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
> 	at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
> 	at com.cargosmart.webapp.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:57)
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> 	at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
> 	at com.cargosmart.webapp.filter.CargoSmartFilter.doFilter(CargoSmartFilter.java:180)
> 	at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
> 	at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
> 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> 	at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
> 	at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
> 	at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
> 	... 6 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message