public HtmlCharacterEntityReferences() {
      Properties entityReferences = new Properties();

      // Load reference definition file
      InputStream is = HtmlCharacterEntityReferences.class.getResourceAsStream(PROPERTIES_FILE);
      if (is == null) {
         throw new IllegalStateException(
               "Cannot find reference definition file [HtmlCharacterEntityReferences.properties] as class path resource");
      }
      try {
         try {
            entityReferences.load(is);
         }
         finally {
            is.close();
         }
      }
      catch (IOException ex) {
         throw new IllegalStateException(
               "Failed to parse reference definition file [HtmlCharacterEntityReferences.properties]: " + ex.getMessage());
      }

      // Parse reference definition properties
      Enumeration<?> keys = entityReferences.propertyNames();
      while (keys.hasMoreElements()) {
         String key = (String) keys.nextElement();
         int referredChar = Integer.parseInt(key);
         Assert.isTrue((referredChar < 1000 || (referredChar >= 8000 && referredChar < 10000)),
               "Invalid reference to special HTML entity: " + referredChar);
         int index = (referredChar < 1000 ? referredChar : referredChar - 7000);
         String reference = entityReferences.getProperty(key);
         this.characterToEntityReferenceMap[index] = REFERENCE_START + reference + REFERENCE_END;
         this.entityReferenceToCharacterMap.put(reference, new Character((char) referredChar));
      }
   }