View | Details | Raw Unified | Return to bug 44494
Collapse All | Expand All

(-)connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java (-1 / +1 lines)
Lines 478-484 Link Here
478
            tmp=new char[newSize];
478
            tmp=new char[newSize];
479
        }
479
        }
480
        
480
        
481
        System.arraycopy(buff, start, tmp, start, end-start);
481
        System.arraycopy(buff, 0, tmp, 0, end);
482
        buff = tmp;
482
        buff = tmp;
483
        tmp = null;
483
        tmp = null;
484
    }
484
    }
(-)connectors/util/java/org/apache/tomcat/util/buf/B2CConverter.java (-8 / +11 lines)
Lines 82-98 Link Here
82
    {
82
    {
83
        // Set the ByteChunk as input to the Intermediate reader
83
        // Set the ByteChunk as input to the Intermediate reader
84
        iis.setByteChunk( bb );
84
        iis.setByteChunk( bb );
85
        convert(cb, limit);
86
    }
87
88
    private void convert(CharChunk cb, int limit)
89
        throws IOException
90
    {
91
        try {
85
        try {
92
            // read from the reader
86
            // read from the reader
93
            int count = 0;
87
            int bbLengthBeforeRead  = 0;
94
            while( limit > 0 ) { 
88
            while( limit > 0 ) { 
95
                int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE; 
89
                int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE; 
90
                bbLengthBeforeRead = bb.getLength();
96
                int cnt=conv.read( result, 0, size );
91
                int cnt=conv.read( result, 0, size );
97
                if( cnt <= 0 ) {
92
                if( cnt <= 0 ) {
98
                    // End of stream ! - we may be in a bad state
93
                    // End of stream ! - we may be in a bad state
Lines 106-112 Link Here
106
101
107
                // XXX go directly
102
                // XXX go directly
108
                cb.append( result, 0, cnt );
103
                cb.append( result, 0, cnt );
109
                limit -= cnt;
104
                limit = limit - (bbLengthBeforeRead - bb.getLength());
110
            }
105
            }
111
        } catch( IOException ex) {
106
        } catch( IOException ex) {
112
            if( debug>0)
107
            if( debug>0)
Lines 222-227 Link Here
222
    /** Reset the buffer
217
    /** Reset the buffer
223
     */
218
     */
224
    public  final void recycle() {
219
    public  final void recycle() {
220
        try {
221
            // Must clear super's buffer.
222
            while (ready()) {
223
                // InputStreamReader#skip(long) will allocate buffer to skip.
224
                read();
225
            }
226
        } catch(IOException ioe){
227
        }
225
    }
228
    }
226
}
229
}
227
230

Return to bug 44494