示例#1
1
  public void unregisterKeyStroke(KeyStroke ks, JComponent c) {

    // component may have already been removed from the hierarchy, we
    // need to look up the container using the componentKeyStrokeMap.

    ComponentKeyStrokePair ckp = new ComponentKeyStrokePair(c, ks);

    Container topContainer = componentKeyStrokeMap.get(ckp);

    if (topContainer == null) { // never heard of this pairing, so bail
      return;
    }

    Hashtable keyMap = containerMap.get(topContainer);
    if (keyMap == null) { // this should never happen, but I'm being safe
      Thread.dumpStack();
      return;
    }

    Object tmp = keyMap.get(ks);
    if (tmp == null) { // this should never happen, but I'm being safe
      Thread.dumpStack();
      return;
    }

    if (tmp instanceof JComponent && tmp == c) {
      keyMap.remove(ks); // remove the KeyStroke from the Map
      // System.out.println("removed a stroke" + ks);
    } else if (tmp
        instanceof Vector) { // this means there is more than one component reg for this key
      Vector v = (Vector) tmp;
      v.removeElement(c);
      if (v.isEmpty()) {
        keyMap.remove(ks); // remove the KeyStroke from the Map
        // System.out.println("removed a ks vector");
      }
    }

    if (keyMap.isEmpty()) { // if no more bindings in this table
      containerMap.remove(topContainer); // remove table to enable GC
      // System.out.println("removed a container");
    }

    componentKeyStrokeMap.remove(ckp);

    // Check for EmbeddedFrame case, they know how to process accelerators even
    // when focus is not in Java
    if (topContainer instanceof EmbeddedFrame) {
      ((EmbeddedFrame) topContainer).unregisterAccelerator(ks);
    }
  }
示例#2
0
  private static String loadString(String key) {
    if (lang == null) {
      String langFile = Config.getInstance().langFileName();
      if (langFile == null) lang = new Hashtable();
      else lang = new StringLoader().hashtableLoader(langFile);
      System.out.print("Loading locale ");
      System.out.println(langFile);
      MS_XMLLANG = (String) lang.get("xmlLang");

      MS_IFACELANG = MS_XMLLANG;
      if (MS_IFACELANG == null) MS_IFACELANG = "en";

      presences = new Hashtable();
      presences.put("online", loadString("online"));
      presences.put("chat", loadString("free for chat"));
      presences.put("away", loadString("away"));
      presences.put("xa", loadString("not available"));
      presences.put("invisible", loadString("invisible"));
      presences.put("dnd", loadString("do not disturb"));
      presences.put("unavailable", loadString("offline"));
    }
    String value = (String) lang.get(key);
    // #if LOCALE_DEBUG
    if (value == null) {
      if (!lang.isEmpty()) {
        System.out.print("Can't find local string for <");
        System.err.print(key);
        System.err.println('>');
      }
    }
    // #endif
    return (value == null) ? key : value;
  }
  /* Returns PSSMs used in this Patser instance, keyed by name
   */
  public Hashtable<String, int[][]> getPssms() throws DataFormatException {
    if (pssms == null || pssms.isEmpty()) {
      pssms = readPssmsFromFileSystem();
    }

    return pssms;
  }
示例#4
0
  public <E extends IEntity> Integer fetchEntitiesCount(
      Class<E> inEntityClass, Hashtable<String, Object> criteria) {

    String entityClsName = inEntityClass.getSimpleName();

    StringBuffer sQuery = new StringBuffer();
    sQuery
        .append("SELECT count(instance) from ")
        .append(entityClsName.toString())
        .append(" instance ");

    if (criteria != null && !criteria.isEmpty()) {
      sQuery.append("where ");
    }

    Iterator<Entry<String, Object>> it = criteria.entrySet().iterator();
    while (it.hasNext()) {
      Entry<String, Object> pairs = it.next();
      sQuery.append("instance.").append(pairs.getKey()).append("=:").append(pairs.getKey());
      //	        it.remove();

      if (it.hasNext()) sQuery.append(" AND ");
    }

    Query query = entityManager.createQuery(sQuery.toString());

    Enumeration<String> keys = criteria.keys();
    while (keys.hasMoreElements()) {
      String key = keys.nextElement();
      query.setParameter(key, criteria.get(key));
    }

    Long count = (Long) query.getSingleResult();
    return Integer.valueOf(count.toString());
  }
  public synchronized void addGroup(String user, String groupname) {
    if (!list.isEmpty()) {
      list.get(user).groups.add(groupname); // add group to user's list of groups they belong to
    }

    if (!group_list.isEmpty()) {
      System.out.println("Group list isn't empty");
      ///// --------GROUP_LIST--------////////
      if (group_list.containsKey(groupname)) { // if the group is already alive and kicking
        System.out.println("Group list contains the group name" + group_list.contains(groupname));
        if (group_list.get(groupname).contains(user)) {
          System.out.println("User already in group...");
          // do nothing, user already part of the group
        } else {
          System.out.println("User isn't in the group and it exists");
          System.out.println("Adding user " + user + " to group " + groupname);
          group_list.get(groupname).add(user); // add user to the list of members of GROUPNAME
        }
      } else {

      }
    }
    //// ---------GROUP_LIST--------/////////

  }
示例#6
0
  public void chargerDepuisBaseDeDonnees() {

    if (clients == null) {
      // return;
      clients = new ArrayList<Client>();
    } else {
      clients.clear();
    }

    HibernateConnection connection = HibernateConnection.getInstance();
    String sql = "from Client ";
    if (!where.isEmpty()) {
      sql += where;
    }

    try {
      Query query =
          connection.getSession().createQuery(sql); // "from Client where utiid = :utiid");
      if (!h.isEmpty()) {
        Set<String> set = h.keySet();
        Iterator<String> itr = set.iterator();
        while (itr.hasNext()) {
          String str = itr.next();
          query.setParameter(str, h.get(str));
        }
      }
      this.clients = query.list();
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
  }
  /**
   * Method called then the download by the ImageDownloader is complete.
   *
   * @param bitmap bitmap that represents the downloaded image.
   * @param url url where the image was downloaded.
   */
  public void onDownloadComplete(Bitmap bitmap, String url) {

    if (bitmap != null) {
      // gets the view where the image will be saved.
      ImageView imgView = (ImageView) findViewById(R.id.imgPreview);
      imgView.setImageBitmap(bitmap);

      // obtains and removes the value from the hash.
      MapTile data = mMapTiles.remove(url);
      // saves the image.
      saveImage(
          mTargetFolder
              + "tile_"
              + data.getGridX()
              + "_"
              + data.getGridY()
              + "_"
              + data.getCenter().getLatitudeE6()
              + "_"
              + data.getCenter().getLongitudE6()
              + "_.png",
          bitmap);

      if (mMapTiles.isEmpty()) {
        Toast.makeText(
                MapCrawler.this,
                "Downloaded " + mImagesToDownload + " image(s)",
                Toast.LENGTH_SHORT)
            .show();
      }
    }
  }
  /**
   * Convert special and extended characters into HTML entitities.
   *
   * @param str input string
   * @return formatted string
   * @see #unhtmlentities(String)
   */
  public static String htmlentities(final String str) {

    if (str == null) {
      return "";
    }
    // initialize html translation maps table the first time is called
    if (htmlentities_map.isEmpty()) {
      initializeEntitiesTables();
    }

    final StringBuilder buf = new StringBuilder(); // the otput string
    // buffer

    for (int i = 0; i < str.length(); ++i) {
      final char ch = str.charAt(i);
      final String entity = htmlentities_map.get(new Integer(ch)); // get
      // equivalent
      // html
      // entity
      if (entity == null) { // if entity has not been found
        if (ch > 128) { // check if is an extended character
          buf.append("&#" + (int) ch + ";"); // convert extended
          // character
        } else {
          buf.append(ch); // append the character as is
        }
      } else {
        buf.append(entity); // append the html entity
      }
    }
    return buf.toString();
  }
  /**
   * Service to update a Bcid's metadata
   *
   * @param doi
   * @param webAddress
   * @param title
   * @param resourceTypeString
   * @param resourceTypesMinusDataset
   * @param identifier
   * @return
   */
  @POST
  @Authenticated
  @Path("/update")
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  @Produces(MediaType.APPLICATION_JSON)
  public Response bcidUpdate(
      @FormParam("doi") String doi,
      @FormParam("webAddress") String webAddress,
      @FormParam("title") String title,
      @FormParam("resourceType") String resourceTypeString,
      @FormParam("resourceTypesMinusDataset") Integer resourceTypesMinusDataset,
      @FormParam("identifier") String identifier) {
    Hashtable<String, String> metadata;
    Hashtable<String, String> update = new Hashtable<String, String>();
    BcidMinter bcidMinter = new BcidMinter();

    if (identifier == null || identifier.isEmpty()) {
      throw new BadRequestException("You must include an identifier.");
    }
    if (!bcidMinter.userOwnsBcid(identifier, user.getUserId())) {
      throw new BadRequestException(
          "Either the identifier doesn't exist or you are not the owner.");
    }

    // get this BCID's metadata
    metadata = bcidMinter.getBcidMetadata(identifier);

    if (resourceTypesMinusDataset != null && resourceTypesMinusDataset > 0) {
      resourceTypeString = new ResourceTypes().get(resourceTypesMinusDataset).string;
    }

    // compare every field and if they don't match, add them to the update hashtable
    if (doi != null && (!metadata.containsKey("doi") || !metadata.get("doi").equals(doi))) {
      update.put("doi", doi);
    }
    if (webAddress != null
        && (!metadata.containsKey("webAddress")
            || !metadata.get("webAddress").equals(webAddress))) {
      update.put("webAddress", webAddress);
    }
    if (title != null && (!metadata.containsKey("title") || !metadata.get("title").equals(title))) {
      update.put("title", title);
    }
    if (resourceTypeString != null
        && (!metadata.containsKey("resourceType")
            || !metadata.get("resourceType").equals(resourceTypeString))) {
      update.put("resourceTypeString", resourceTypeString);
    }

    if (update.isEmpty()) {
      return Response.ok("{\"success\": \"Nothing needed to be updated.\"}").build();
      // try to update the metadata by calling d.updateBcidMetadata
    } else if (bcidMinter.updateBcidMetadata(update, identifier)) {
      return Response.ok("{\"success\": \"BCID successfully updated.\"}").build();
    } else {
      // if we are here, the Bcid wasn't found
      throw new BadRequestException("Bcid wasn't found");
    }
  }
示例#10
0
	public static String DescrSocketError(int ErrorCode)
	{
		if (ErrorMsgMap.isEmpty())
		{
			SetErrorMsg();
		}
		return "" + ErrorMsgMap.get(ErrorCode);
	}
示例#11
0
 private void loadAttributes(Node node, XmlContainer container) throws Exception {
   Hashtable<String, String> attributeProperties = XmlUtils.loadAttributes(node);
   if (!attributeProperties.isEmpty()) {
     for (String entry : attributeProperties.keySet()) {
       container.addStringAttribute(entry, attributeProperties.get(entry));
     }
   }
 }
示例#12
0
文件: Channel.java 项目: prism/Darmok
 /**
  * Simple token replacement for strings.
  *
  * @param replacer Table of keys/values
  * @return String
  */
 protected String getString(String msg, Hashtable<String, String> replacer) {
   if (msg != null && !replacer.isEmpty()) {
     for (Entry<String, String> entry : replacer.entrySet()) {
       msg = msg.replace("%(" + entry.getKey() + ")", entry.getValue());
     }
   }
   return msg;
 }
示例#13
0
	public static String GetParamType(int Field)
	{
		if (FieldTypeMap.isEmpty())
		{
			Init();
		}

		return "" + FieldTypeMap.get(Field);
	}
示例#14
0
	public static String GetParamDescr(String ID)
	{
		if (paramMap.isEmpty())
		{
			SetParamMap();
		}

		return "" + paramMap.get(ID);
	}
示例#15
0
  public void end() {
    // 处理组合单元格
    if (!mergeCells.isEmpty()) {
      Region[] regs = new Region[mergeCells.size()];
      mergeCells.values().toArray(regs);
      int len = regs.length;
      for (int i = 0; i < len; i++) m_sheet.addMergedRegion(regs[i]);
    }

    try {
      flushToFile();
    } catch (Exception e) {
      m_spool.setErrorMsg(e.getMessage());
    } finally {
      if (out != null)
        try {
          out.close();
        } catch (IOException e) {
          Logger.error(e.getMessage(), e);
        }
    }

    StringBuffer msg = new StringBuffer();
    // 最后给出完整的提示
    if (sheetCounter > 1) {
      String filename =
          m_filepath.substring(m_filepath.lastIndexOf(System.getProperty("file.separator")) + 1);
      msg.append(
          nc.ui.ml.NCLangRes.getInstance()
              .getStrByID(
                  "10100108", "UPP10100108-000856") /*@res "\n您要导出的内容太多,为减小内存的使用量,它们被存储到目录 \n"*/);
      msg.append(
          m_filepath.substring(0, m_filepath.lastIndexOf(System.getProperty("file.separator"))));
      msg.append(
          nc.ui.ml.NCLangRes.getInstance()
              .getStrByID("10100108", "UPP10100108-000857") /*@res " 下的多个Excel文件中,分别是:\n"*/);
      msg.append(filename).append(",");
      for (int i = 2; i <= sheetCounter; i++) {
        if (i != sheetCounter) {
          msg.append(filename.substring(0, filename.indexOf('.')) + "-" + i + ".xls").append(",");
        } else {
          msg.append(filename.substring(0, filename.indexOf('.')) + "-" + i + ".xls");
        }
      }
    } else {
      msg.append(
          nc.ui.ml.NCLangRes.getInstance()
                  .getStrByID("10100108", "UPP10100108-000858") /*@res "导出内容被存放在文件 \n"*/
              + m_filepath
              + nc.ui.ml.NCLangRes.getInstance()
                  .getStrByID("10100108", "UPP10100108-000859") /*@res " 中."*/);
    }

    m_spool.setMsg(msg.toString());
    mergeCells = new Hashtable(); // 存放所有组合单元格
    styles = new Hashtable();
  }
示例#16
0
	public static String GetDescr(String ID)
	{
		if (descrMap.isEmpty())
		{
			Init();
		}

		return "" + descrMap.get(ID);
	}
示例#17
0
  public void run() {
    int pagesize = PAGESIZE;
    try {
      while (!m_spool.isHasError() && !m_spool.isEmpty()) {
        if (linecounter >= pagesize) {
          // 处理组合单元格
          if (!mergeCells.isEmpty()) {
            Region[] regs = new Region[mergeCells.size()];
            mergeCells.values().toArray(regs);
            int len = regs.length;
            for (int i = 0; i < len; i++) m_sheet.addMergedRegion(regs[i]);
          }
          try {
            flushToFile();
          } catch (Exception e) {
            Logger.error(e.getMessage(), e);
            m_spool.setErrorMsg(e.getMessage());
          } finally {
            if (out != null)
              try {
                out.close();
              } catch (IOException e) {
                Logger.error(e.getMessage(), e);
              }
          }

          m_workbook = new HSSFWorkbook(); // 创建工作薄
          m_sheet = m_workbook.createSheet(); // 创建表单
          mergeCells = new Hashtable(); // 存放所有组合单元格
          styles = new Hashtable();
          linecounter = 0;
          sheetCounter++;
        }

        PrintCellData[] data = null;
        data = (PrintCellData[]) m_spool.retrieve();
        linecounter = linecounter + data.length; // 其实为单元格数目,非行数

        fileUtil.exportSheet2(m_templateData, data, m_sheet, m_workbook, styles, mergeCells);

        /* 每往Excel写入一行,进度条+1,已导出的行数+1 */
        m_spool.setExportedLineCount(m_spool.getExportedLineCount() + 1);
        stepProgressBar(1);
        setProgressBarHintMsg();
      }
    } catch (Exception e) {
      Logger.error(e.getMessage(), e);
      m_spool.setErrorMsg(e.getMessage());
    } catch (OutOfMemoryError e) {
      Logger.error(e.getMessage(), e);
      m_spool.setErrorMsg(
          nc.ui.ml.NCLangRes.getInstance()
              .getStrByID(
                  "10100108", "UPP10100108-000860") /*@res "内存不足,请修改Java Plugin参数,将内存调整大一些"*/);
    }
  }
示例#18
0
 /**
  * Method to set add a MoodleModule object to the course content object.<br>
  * Only useful in construction of data from the webservice.
  *
  * @return MoodleModule[]
  */
 public MoodleModule[] getMoodleModules() {
   if (modules == null) return null;
   if (modules.isEmpty()) return null;
   MoodleModule[] results = new MoodleModule[modules.size()];
   Enumeration<MoodleModule> elements = modules.elements();
   for (int i = 0; elements.hasMoreElements(); i++) {
     results[i] = elements.nextElement();
   }
   return results;
 }
  private static int getCommand(String s) {
    if (commands.isEmpty() || secrets.isEmpty()) {
      fillCommandList();
    }

    try {
      return commands.get(s);
    } catch (Exception e) {
      System.out.print("Command not found.");
      try {
        if (secrets.get(s) != null) {
          System.out.println(" ;-)");
        }
        return secrets.get(s);
      } catch (Exception e2) {
        System.out.println(" ");
        return -1;
      }
    }
  }
 public synchronized boolean checkUser(String username) {
   if (!list.isEmpty()) {
     if (list.containsKey(username)) {
       return true;
     } else {
       return false;
     }
   } else {
     return false;
   }
 }
示例#21
0
 /**
  * 填充所有标签页的字符
  *
  * @param hashtable 用于显示字符的哈希表。键为标签,值为该标签下的字符序列
  */
 private void fillTabbedPane(Hashtable<String, String> hashtable) {
   if (hashtable.isEmpty()) {
     return;
   }
   Enumeration<String> enumeration = hashtable.keys();
   while (enumeration.hasMoreElements()) {
     String strTitle = enumeration.nextElement();
     String strElement = hashtable.get(strTitle);
     this.fillElements(strElement, strTitle);
   }
 }
示例#22
0
  /**
   * doImport called when "eventSubmit_doBatch_Import" is in the request parameters to run an
   * import.
   */
  public void doBatch_Import(RunData data, Context context) {
    SessionState state =
        ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid());

    Hashtable fTable = new Hashtable();

    if (!securityService.isSuperUser()) {
      addAlert(state, rb.getString("archive.batch.auth"));
      return;
    }

    // String fileName = data.getParameters().getString("import-file");
    FileItem fi = data.getParameters().getFileItem("importFile");
    if (fi == null) {
      addAlert(state, rb.getString("archive.batch.missingname"));
    } else {
      // get content
      String content = fi.getString();

      String[] lines = content.split("\n");
      for (int i = 0; i < lines.length; i++) {
        String lineContent = (String) lines[i];
        String[] lineContents = lineContent.split("\t");
        if (lineContents.length == 2) {
          fTable.put(lineContents[0], lineContents[1]);
        } else {
          addAlert(state, rb.getString("archive.batch.wrongformat"));
        }
      }
    }

    if (!fTable.isEmpty()) {
      Enumeration importFileName = fTable.keys();
      int count = 1;
      while (importFileName.hasMoreElements()) {
        String path = StringUtils.trimToNull((String) importFileName.nextElement());
        String siteCreatorName = StringUtils.trimToNull((String) fTable.get(path));
        if (path != null && siteCreatorName != null) {
          String nSiteId = idManager.createUuid();

          try {
            Object[] params = new Object[] {count, path, nSiteId, siteCreatorName};
            addAlert(state, rb.getFormattedMessage("archive.import1", params));
            addAlert(state, archiveService.merge(path, nSiteId, siteCreatorName));

          } catch (Exception ignore) {
          }
        }

        count++;
      }
    }
  }
示例#23
0
 // olga: propagate value of OUTPUT parameters of rule r1 to INPUT parameters of rule r2
 void propagateOutParamToInParamOfRule(Hashtable<String, String> outPars, Rule r) {
   if (outPars != null && !outPars.isEmpty()) {
     VarTuple vars = (VarTuple) r.getAttrContext().getVariables();
     for (int i = 0; i < vars.getNumberOfEntries(); i++) {
       VarMember var = vars.getVarMemberAt(i);
       String outVal = outPars.get(var.getName());
       if (outVal != null && var.isInputParameter()) {
         var.setExprAsText(outVal);
       }
     }
   }
 }
 public static DataSource lookupDataSource(
     String dataSourceName, final Hashtable<Object, Object> jndiProperties) {
   try {
     if (jndiProperties == null || jndiProperties.isEmpty()) {
       return (DataSource) InitialContext.doLookup(dataSourceName);
     }
     final InitialContext context = new InitialContext(jndiProperties);
     return (DataSource) context.doLookup(dataSourceName);
   } catch (Exception e) {
     throw new RuntimeException("Error in looking up data source: " + e.getMessage(), e);
   }
 }
示例#25
0
  private void condenseConstants(ParseNode r) {
    if (r.value != null) return;

    Hashtable h = (Hashtable) variables.get(r);

    if (h.isEmpty()) {
      r.value = new Double(r.eval());
      return;
    } // end if

    if (r.children != null)
      for (int i = 0; i < r.children.length; i++) condenseConstants(r.children[i]);
  } // end condenseConstants
  public synchronized void removeMemberFromGroup(String username, String groupName) {
    if (!group_list.isEmpty()) {
      if (group_list
          .get(groupName)
          .contains(username)) { // if list of members of GROUPNAME contains USERNAME
        group_list.get(groupName).remove(username); // remove the USERNAME from the list
      }
    }

    if (!list.isEmpty()) {
      list.get(username).removeGroup(groupName); // remove groupname from user's list as well
    }
  }
示例#27
0
 /**
  * called to let us know we have processed all the META-INF entries, and if we re-read one of
  * them, don't re-process it. Also gets rid of any data structures we needed when parsing META-INF
  * entries.
  */
 void doneWithMeta() {
   parsingMeta = false;
   anyToVerify = !sigFileSigners.isEmpty();
   baos = null;
   sigFileData = null;
   pendingBlocks = null;
   signerCache = null;
   manDig = null;
   // MANIFEST.MF is always treated as signed and verified,
   // move its signers from sigFileSigners to verifiedSigners.
   if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) {
     verifiedSigners.put(JarFile.MANIFEST_NAME, sigFileSigners.remove(JarFile.MANIFEST_NAME));
   }
 }
 /**
  * Checks if the XML-RPC response is an GreenPepper server Exception. If so an
  * GreenPepperServerException will be thrown with the error id found.
  *
  * @param xmlRpcResponse
  * @throws GreenPepperServerException
  */
 public static void checkForErrors(Object xmlRpcResponse) throws GreenPepperServerException {
   if (xmlRpcResponse instanceof Vector) {
     Vector temp = (Vector) xmlRpcResponse;
     if (!temp.isEmpty()) {
       checkErrors(temp.elementAt(0));
     }
   } else if (xmlRpcResponse instanceof Hashtable) {
     Hashtable<String, ?> table = (Hashtable<String, ?>) xmlRpcResponse;
     if (!table.isEmpty()) {
       checkForErrors(table.get(GreenPepperServerErrorKey.ERROR));
     }
   } else {
     checkErrors(xmlRpcResponse);
   }
 }
示例#29
0
  public int[] getHeaderList() {
    synchronized (headers) {
      if (headers.isEmpty()) {
        return null;
      }
      Enumeration keys = headers.keys();
      int[] ids = new int[headers.size()];
      int i = 0;

      while (keys.hasMoreElements()) {
        Object obj = keys.nextElement();
        ids[i++] = ((Integer) obj).intValue();
      }
      return ids;
    }
  }
  /**
   * Convert HTML entities to special and extended unicode characters equivalents.
   *
   * @param str input string
   * @return formatted string
   * @see #htmlentities(String)
   */
  public static String unhtmlentities(final String str) {
    if (str == null) {
      return null;
    }

    // initialize html translation maps table the first time is called
    if (htmlentities_map.isEmpty()) {
      initializeEntitiesTables();
    }

    final StringBuilder buf = new StringBuilder();

    for (int i = 0; i < str.length(); ++i) {
      final char ch = str.charAt(i);
      if (ch == '&') {
        final int semi = str.indexOf(';', i + 1);
        if (semi == -1 || semi - i > 7) {
          buf.append(ch);
          continue;
        }
        final String entity = str.substring(i, semi + 1);
        Integer iso;
        if (entity.charAt(1) == ' ') {
          buf.append(ch);
          continue;
        }
        if (entity.charAt(1) == '#') {
          if (entity.charAt(2) == 'x') {
            iso = new Integer(Integer.parseInt(entity.substring(3, entity.length() - 1), 16));
          } else {
            iso = new Integer(entity.substring(2, entity.length() - 1));
          }
        } else {
          iso = unhtmlentities_map.get(entity);
        }
        if (iso == null) {
          buf.append(entity);
        } else {
          buf.append((char) iso.intValue());
        }
        i = semi;
      } else {
        buf.append(ch);
      }
    }
    return buf.toString();
  }