xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r642925 - in /xmlgraphics/commons/trunk: src/java/org/apache/xmlgraphics/fonts/Glyphs.java status.xml
Date Mon, 31 Mar 2008 08:46:15 GMT
Author: jeremias
Date: Mon Mar 31 01:46:14 2008
New Revision: 642925

URL: http://svn.apache.org/viewvc?rev=642925&view=rev
Log:
Handle NumberFormatException if a glyph name starting with "u" is found that is not in the
Adobe glyph list. The glyph will simply be ignored as we cannot associate it with a Unicode
code point.

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java
    xmlgraphics/commons/trunk/status.xml

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java?rev=642925&r1=642924&r2=642925&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java Mon Mar 31
01:46:14 2008
@@ -369,7 +369,11 @@
                     int len = token.length();
                     int pos = 3;
                     while (pos + 4 <= len) {
-                        sb.append(hexToChar(token.substring(pos, pos + 4)));
+                        try {
+                            sb.append(hexToChar(token.substring(pos, pos + 4)));
+                        } catch (NumberFormatException nfe) {
+                            return null;
+                        }
                         pos += 4;
                     }
                 } else if (token.startsWith("u")) {
@@ -377,7 +381,11 @@
                         //TODO: Unicode scalar values greater than FFFF are currently not
supported
                         return null;
                     }
-                    sb.append(hexToChar(token.substring(1, 5)));
+                    try {
+                        sb.append(hexToChar(token.substring(1, 5)));
+                    } catch (NumberFormatException nfe) {
+                        return null;
+                    }
                 } else {
                     //ignore (empty string)
                 }

Modified: xmlgraphics/commons/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/status.xml?rev=642925&r1=642924&r2=642925&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/status.xml (original)
+++ xmlgraphics/commons/trunk/status.xml Mon Mar 31 01:46:14 2008
@@ -41,6 +41,10 @@
   <changes>
     <release version="Trunk" date="n/a">
       <action context="Code" dev="JM" type="fix">
+        Bugfix for unhandled NumberFormatException in Glpyhs when a unknown glyph name starting
+        with "u" is found.
+      </action>
+      <action context="Code" dev="JM" type="fix">
         Bugfix for ImageEncodingHelper which produced false results if an image's sample
model
         used BGR instead of RGB.
       </action>



---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message