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

(-)RawDataBlockORIG.java (-1 / +16 lines)
Lines 85-90 Link Here
85
    {
85
    {
86
        _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
86
        _data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
87
        int count = stream.read(_data);
87
        int count = stream.read(_data);
88
        /// XXX Patch 
89
        // The read() of java.io.InputStream does not guarantee to provide
90
        // the full amount of requested bytes. It is necessary to repeat the reading
91
        // until the full block is read or eof occured. 
92
        // The original source worked fine up to the point of reading Excel-files 
93
        // contained in a ZIP-file.
94
        while (count!=-1 && count < POIFSConstants.BIG_BLOCK_SIZE) {
95
        	int k = stream.read(_data, count, POIFSConstants.BIG_BLOCK_SIZE-count);
96
        	if (k==-1) {
97
        		break;
98
        	} else {
99
        		count += k;
100
        	}
101
        }
102
        /// XXX Patch         
88
103
89
        if (count == -1)
104
        if (count == -1)
90
        {
105
        {
Lines 94-100 Link Here
94
        {
109
        {
95
            String type = " byte" + ((count == 1) ? ("")
110
            String type = " byte" + ((count == 1) ? ("")
96
                                                  : ("s"));
111
                                                  : ("s"));
97
112
                                                  
98
            throw new IOException("Unable to read entire block; " + count
113
            throw new IOException("Unable to read entire block; " + count
99
                                  + type + " read; expected "
114
                                  + type + " read; expected "
100
                                  + POIFSConstants.BIG_BLOCK_SIZE + " bytes");
115
                                  + POIFSConstants.BIG_BLOCK_SIZE + " bytes");

Return to bug 24211