Ignore:
Timestamp:
11/21/06 13:35:34 (6 years ago)
Author:
sys
Message:

bug dans le reader qui dupliquait la déclaration xml + suppr rewindDeclaration non utilisé et manifestement bugué

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Res_Piccolo/com/bluecast/xml/XMLStreamReader.java

    r7316 r7396  
    6868     *            XML declaration. True will dish out the entire document. 
    6969     */ 
    70     public XMLStreamReader (InputStream in, boolean rewindDeclaration) throws IOException 
     70    public XMLStreamReader (InputStream in) throws IOException 
    7171    { 
    72         this(in, null, rewindDeclaration); 
     72        this(in, null); 
    7373    } 
    7474 
     
    7676     * Creates an XMLStreamReader while specifying a character encoding. 
    7777     */ 
    78     public XMLStreamReader (InputStream in, String encoding, 
    79                             boolean rewindDeclaration) throws IOException 
     78    public XMLStreamReader (InputStream in, String encoding) throws IOException 
    8079    { 
    81         reset(in, encoding, rewindDeclaration); 
     80        reset(in, encoding); 
    8281    } 
    8382 
     
    8584     * Reuses this XMLStreamReader for a different InputStream. 
    8685     */ 
    87     public void reset (InputStream in, String encoding, 
    88                        boolean rewindDeclaration) throws IOException { 
     86    public void reset (InputStream in, String encoding) throws IOException { 
    8987        super.resetInput(); 
    9088        this.in = in; 
    9189        eofReached = false; 
    92         this.rewindDeclaration = rewindDeclaration; 
    9390        useDeclaredEncoding = false; 
    9491        bbufPos = bbufEnd = 0; 
     
    675672         
    676673        int bbufPosTemp = bbufPos + decodeResult[0]; 
    677         cbufEnd = decodeResult[1]; 
     674        int cbufEndTemp = decodeResult[1]; 
    678675         
    679         while(r == -2 && ! eofReached && cbufEnd < cbuf.length) { 
     676        while(r == -2 && ! eofReached && cbufEndTemp < cbuf.length) { 
    680677            fillByteBuffer(); 
    681678            r = decoder.decodeXMLDecl(bbuf, bbufPosTemp, bbufEnd - bbufPosTemp, 
    682                     cbuf, cbufPos+cbufEnd, cbuf.length-cbufEnd, 
     679                    cbuf, cbufPos+cbufEndTemp, cbuf.length-cbufEndTemp, 
    683680                    decodeResult); 
    684681            bbufPosTemp += decodeResult[0]; 
    685                     cbufEnd += decodeResult[1]; 
    686         } 
    687  
    688         int numCharsParsed = parseXMLDeclaration(cbuf,0,cbufEnd); 
     682                    cbufEndTemp += decodeResult[1]; 
     683        } 
     684 
     685        parseXMLDeclaration(cbuf,0,cbufEndTemp); 
    689686 
    690687        //if (numCharsParsed > 0) { 
     
    694691 
    695692            // Skip the XML declaration unless told otherwise 
    696             if (!rewindDeclaration) 
    697                 cbufPos += numCharsParsed; 
     693            //if (!rewindDeclaration) 
     694            //    cbufPos += numCharsParsed; 
    698695 
    699696            // If another encoding was specified, use it instead of the guess. 
     
    702699                && !declaredEncoding.equalsIgnoreCase(encoding)) { 
    703700 
    704                 cbufPos = cbufEnd = 0; 
     701                cbufPos = cbufEndTemp = 0; 
     702                bbufPos = initialBBufPos; 
    705703                decoder.reset(); 
    706  
    707  
    708                 if (rewindDeclaration) 
    709                     bbufPos = initialBBufPos; 
    710                 else 
    711                     bbufPos = numCharsParsed*minBytesPerChar; 
    712704 
    713705                setEncoding(declaredEncoding); 
Note: See TracChangeset for help on using the changeset viewer.