Merge pull request #197 from span/htmlencoder

Fixes #195 by adding static initialisation of the maps
This commit is contained in:
mayhew64 2016-02-12 13:02:41 -05:00
commit dbb75980c9

View File

@ -119,10 +119,9 @@ public class HtmlEncoder
}; };
/** /**
* <p>Constructor for HtmlEncoder.</p> * Initialises the mappings between entities and characters
*/ */
public HtmlEncoder() static {
{
for (int i = 0; i < entities.length; i++) for (int i = 0; i < entities.length; i++)
e2i.put((String) entities[i][0], (Integer) entities[i][1]); e2i.put((String) entities[i][0], (Integer) entities[i][1]);
for (int i = 0; i < entities.length; i++) for (int i = 0; i < entities.length; i++)