Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003525 [Resin] minor always 05-20-09 09:51 05-20-09 10:06
Reporter ferg View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.1 Product Version
  Product Build
Summary 0003525: UTF8Reader bom
Description (rep by Fiaz Hossain)

his time it seems to be related to UTF8Reader.java. The problem seems to be related to reading two BOM http://en.wikipedia.org/wiki/Byte-order_mark [^] in a row. The problem is that when the back to back sequence is present in the data stream the Form class will get in IOException and abandon further processing. Here is a fix that seems to work. Can you let me know if the change is acceptable and if so can you merge into the tip of the source.

Fix:
==== //tools/Linux/resin/resin-pro-3.1.6/lib-src/patches/com/caucho/vfs/i18n/UTF8Reader.java#1 - /home/fiaz/dev/tools/Linux/resin/resin-pro-3.1.6/lib-src/patches/com/caucho/vfs/i18n/UTF8Reader.java ====
121c121
< return is.read();
---
> return read();


Test case:

package shared.util;

import java.io.*;

import com.caucho.vfs.i18n.UTF8Reader;

public class BOMTest {

    /**
     * @param args
     */
    public static void main(String[] args) {
    // BOM is ef, bb, bf or 239, 187, 191
        byte[] BOM1 = {(byte)0xef, (byte)0xbb, (byte)0xbf, 36};
        byte[] BOM2 = {36, (byte)0xef, (byte)0xbb, (byte)0xbf};
        byte[] BOM3 = {36, (byte)0xef, (byte)0xbb, (byte)0xbf, 36};
        byte[] BOMBOM = {36, (byte)0xef, (byte)0xbb, (byte)0xbf, (byte)0xef, (byte)0xbb, (byte)0xbf, 36};
        
        readData(BOM1);
        readData(BOM2);
        readData(BOM3);
        readData(BOMBOM);
    }

    private static void readData(byte[] bom) {
        UTF8Reader reader = new UTF8Reader();
        Reader r = reader.create(new ByteArrayInputStream(bom), "UTF-8");
        int ch;
        try {
            while ((ch = r.read()) > 0) {
                System.out.println("Got char:" + ch);
        }
        } catch (IOException e) {
            System.out.println("Caught exception:" + e.getMessage());
        }
    }
}

Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0004027)
ferg
05-20-09 10:06

server/1m00
 

- Issue History
Date Modified Username Field Change
05-20-09 09:51 ferg New Issue
05-20-09 10:06 ferg Note Added: 0004027
05-20-09 10:06 ferg Assigned To  => ferg
05-20-09 10:06 ferg Status new => closed
05-20-09 10:06 ferg Resolution open => fixed
05-20-09 10:06 ferg Fixed in Version  => 4.0.1


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker