Page 1 of 1

fatal error org.docx4j.XmlUtils

PostPosted: Tue Jun 07, 2016 6:59 pm
by Asura
Code: Select all

   private static StringBuilder replace(String wmlTemplateString, int offset, StringBuilder strB, Map<String, ?> mappings) {
        int startKey = wmlTemplateString.indexOf("${", offset);
        if(startKey == -1) {
            return strB.append(wmlTemplateString.substring(offset));
        } else {
            strB.append(wmlTemplateString.substring(offset, startKey));
            int keyEnd = wmlTemplateString.indexOf(125, startKey);
            String key = wmlTemplateString.substring(startKey + 2, keyEnd);
            String val = mappings.get(key).toString();                                 // realy?!
            if(val == null) {                                                          //  =_=
                log.warn("Invalid key \'" + key + "\' or key not mapped to a value");
                strB.append(key);
            } else {
                strB.append(val);
            }

            return replace(wmlTemplateString, keyEnd + 1, strB, mappings);
        }
    }


Re: fatal error org.docx4j.XmlUtils

PostPosted: Tue Jun 07, 2016 7:14 pm
by jason
See commit https://github.com/plutext/docx4j/commi ... ff2cf8cb97

Present in a recent nightly build...

Re: fatal error org.docx4j.XmlUtils

PostPosted: Tue Jun 07, 2016 7:23 pm
by Asura
That's great.