xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Bohm" <de...@fireflydesign.com>
Subject GVTACIImpl bugs?
Date Sat, 16 Dec 2000 05:11:45 GMT
Hi,

In GVTACIImpl.java:

    private void buildAttributeTables() {
 allAttributes = new HashSet();
 mapList = new ArrayList(simpleString.length());
 charInRun = new int[simpleString.length()];
 for (int i = 0; i < charInRun.length; ++i) {
     charInRun[i] = SINGLETON;
     /*
      * XXX TODO: loosen assumption, initially each character has its own
      * attribute map.
      */
     mapList.set(i, new HashMap());
 }
    }

    private void buildAttributeTables(AttributedCharacterIterator aci) {
 allAttributes = aci.getAllAttributeKeys();
 int length = aci.getEndIndex() - aci.getBeginIndex();
        mapList = new ArrayList(length);
 charInRun = new int[length];
      char  c = aci.first();
        char chars[] = new char[length];
 for (int i = 0; i < length; ++i) {
     chars[i] = c;
     charInRun[i] = SINGLETON;
     /*
             * XXX TODO:loosen assumption, initially each character
      * has its own attribute map.
             */
     mapList.set(i, new HashMap(aci.getAttributes()));
     c = aci.next();
 }
 simpleString = new String(chars);
    }

Both of the methods above create an mapList = ArrayList with an intitial
capacity and then try to use mapList.set(i, value).  This fails since the
size of the ArrayList is zero.  I think both of those occurances should be
changed to mapList.add(value):

    private void buildAttributeTables() {
 allAttributes = new HashSet();
 mapList = new ArrayList(simpleString.length());
 charInRun = new int[simpleString.length()];
 for (int i = 0; i < charInRun.length; ++i) {
     charInRun[i] = SINGLETON;
     /*
      * XXX TODO: loosen assumption, initially each character has its own
      * attribute map.
      */
     mapList.add(new HashMap());
 }
    }

    private void buildAttributeTables(AttributedCharacterIterator aci) {
 allAttributes = aci.getAllAttributeKeys();
 int length = aci.getEndIndex() - aci.getBeginIndex();
        mapList = new ArrayList(length);
 charInRun = new int[length];
      char  c = aci.first();
        char chars[] = new char[length];
 for (int i = 0; i < length; ++i) {
     chars[i] = c;
     charInRun[i] = SINGLETON;
     /*
             * XXX TODO:loosen assumption, initially each character
      * has its own attribute map.
             */
     mapList.add(new HashMap(aci.getAttributes()));
     c = aci.next();
 }
 simpleString = new String(chars);
    }

Does that look correct?  What is the procedure for getting fixes into the
release?

Thanks,
  Denis



Mime
View raw message