You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by Magnus Korvald <ma...@usit.uio.no> on 2009/12/15 17:04:54 UTC

A possible solution to ABDERA-242

Hi,

A while back, I committed a bug report in  JIRA: <URL:  
https://issues.apache.org/jira/browse/ABDERA-242 >.  I now had some time 
to look at the problem and found a possible solution.

I don't know how you would like to have the fix, so I have include the 
"svn diff" below. I can commit this to svn if you would prefer that.

The problem is occuring in the class "AbstractParserOptions".

First the problem is  the key in "entities". For both the upper and the 
lower case letters the key is registeted as lower in 
"initDefaultEntities()". The result is that both "Aring" and "aring" has 
same key "aring". The method "resolveEntity" is also converting the 
lookup key (name) to lower case, so this also has to be changed to get 
the correct transformation.

The same problem is occurring for "AElig" and "Oslash" as well.

Proposed solution (svn diff):

korvald:~/Utvikling/abdera/trunk$ svn diff 
core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java
Index: core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java
===================================================================
--- 
core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java    
(revision 890809)
+++ 
core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java    
(working copy)
@@ -187,8 +187,8 @@
    registerEntity("acirc","\u00C2");
    registerEntity("atilde","\u00C3");
    registerEntity("auml","\u00C4");
-    registerEntity("aring","\u00C5");
-    registerEntity("aelig","\u00C6");
+    registerEntity("Aring","\u00C5");
+    registerEntity("AElig","\u00C6");
    registerEntity("ccedil","\u00C7");
    registerEntity("egrave","\u00C8");
    registerEntity("eacute","\u00C9");
@@ -206,7 +206,7 @@
    registerEntity("otilde","\u00D5");
    registerEntity("ouml","\u00D6");
    registerEntity("times","\u00D7");
-    registerEntity("oslash","\u00D8");
+    registerEntity("Oslash","\u00D8");
    registerEntity("ugrave","\u00D9");
    registerEntity("uacute","\u00DA");
    registerEntity("ucirc","\u00DB");
@@ -401,7 +401,7 @@
  }
 
  public String resolveEntity(String name) {
-    return resolveentities ? entities.get(name.toLowerCase()) : null;
+    return resolveentities ? entities.get(name) : null;
  }
 
  public ParserOptions setResolveEntities(boolean resolve) {

-- 
Regards,

Magnus Korvald