List of usage examples for java.lang StringBuilder charAt
char charAt(int index);
From source file:mergedoc.core.Comment.java
/** * ????????????//from www . j a v a2s. c o m * ????????? * <p> * @param lineValue * @param resultBuf ????? * @param width ?? */ private void wrap(String lineValue, StringBuilder resultBuf, int width) { final int minWidth = width - 10; final int maxWidth = width + 10; final int ADJUST_SKIP_WIDTH = width + 4; final int lastPos = lineValue.length() - 1; final String PUNCTS = "??)}"; final String PARTICLES = "???????"; StringBuilder buf = new StringBuilder(); int bufLen = 0; for (int pos = 0; pos < lastPos; pos++) { if (bufLen == 0) { String after = lineValue.substring(pos, lastPos); int afterLen = after.getBytes().length; if (afterLen <= ADJUST_SKIP_WIDTH) { buf.append(after); break; } } char c = lineValue.charAt(pos); int cLen = String.valueOf(c).getBytes().length; bufLen += cLen; boolean isChangeLine = false; if (bufLen > minWidth) { // ??????????? if (c == ' ') { isChangeLine = true; buf.append('\n'); } else if (PUNCTS.indexOf(c) != -1 || PARTICLES.indexOf(c) != -1) { char next = lineValue.charAt(pos + 1); if (PUNCTS.indexOf(next) == -1 && next != ' ' && next != '.') { isChangeLine = true; buf.append(c); buf.append('\n'); } } else if (bufLen > width) { // ?????? // ??????????? if (c == '<' || cLen > 1) { isChangeLine = true; buf.append('\n'); buf.append(c); } else if (bufLen > maxWidth) { // ?????? // ???? for (int bPos = buf.length() - 1; bPos > 0; bPos--) { char bc = buf.charAt(bPos); if (bc == ' ') { buf.replace(bPos, bPos + 1, "\n"); bufLen = buf.substring(bPos + 1).getBytes().length; break; } else { int bcLen = String.valueOf(bc).getBytes().length; if (bcLen > 1) { buf.insert(bPos + 1, '\n'); bufLen = buf.substring(bPos + 2).getBytes().length; break; } } } } } } if (isChangeLine) { resultBuf.append(buf); buf = new StringBuilder(); bufLen = 0; } else { buf.append(c); } } buf.append(lineValue.charAt(lastPos)); resultBuf.append(buf); resultBuf.append('\n'); }
From source file:meff.Function.java
private Map<String, String> compile() { class Compiler { private Map<String, StringBuilder> functions; private String currentFunctionName; private StringBuilder currentFunction; Compiler(String functionName) { functions = new HashMap<>(); currentFunctionName = functionName; currentFunction = new StringBuilder(); functions.put(currentFunctionName, currentFunction); }/*from w ww.j ava2s . c o m*/ void compileLine(StringBuilder line) { // Manage score value features { Matcher m = Pattern.compile("(score_\\w+)(>=|>|<=|<|==)(-?\\d+)").matcher(line); while (m.find()) { int offset = m.start(); String beginning = m.group(1); String operator = m.group(2); String end = m.group(3); StringBuilder newScore = new StringBuilder(); switch (operator) { case ">=": newScore.append(beginning).append("_min=").append(end); break; case ">": newScore.append(beginning).append("_min=").append(Integer.parseInt(end) + 1); break; case "<=": newScore.append(beginning).append("=").append(end); break; case "<": newScore.append(beginning).append("=").append(Integer.parseInt(end) - 1); break; case "==": newScore.append(beginning).append("_min=").append(end).append(",").append(beginning) .append("=").append(end); break; } line.replace(offset, offset + m.group().length(), newScore.toString()); m.reset(); // Need to reset the matcher, so it updates the length of the text } } currentFunction.append(line).append("\n"); } Map<String, String> getOutput() { Map<String, String> outputMap = new HashMap<>(functions.size()); for (Map.Entry<String, StringBuilder> entry : functions.entrySet()) { outputMap.put(entry.getKey() + ".mcfunction", entry.getValue().toString()); } return outputMap; } } Compiler compiler = new Compiler(getName()); boolean comment = false; StringBuilder sb = new StringBuilder(); for (String line : data.lines) { line = line.trim(); if (line.startsWith("#") || line.startsWith("//")) { continue; } if (line.isEmpty()) { continue; } int si = 0; // start index int bci = -1; // block comment index int bcei = -1; // block comment end index int prevBci = -1; int prevBcei = -1; while ((!comment && (bci = line.indexOf("/*", si)) > -1) || (comment && (bcei = line.indexOf("*/", si)) > -1)) { if (comment) { if (line.charAt(bcei - 1) == '\\') { si = bcei + 2; bcei = prevBcei; continue; } comment = false; si = bcei + 2; } else { if (line.charAt(bci - 1) == '\\') { sb.append(line.substring(si, bci - 1)).append("/*"); si = bci + 2; bci = prevBci; continue; } sb.append(line.substring(si, bci)); comment = true; si = bci + 2; } prevBci = bci; prevBcei = bcei; } if (comment) { continue; } if (line.endsWith("\\")) { line = line.substring(si, line.length() - 1); sb.append(line); } else { sb.append(line.substring(si)); compiler.compileLine(sb); sb.delete(0, sb.length()); } } return compiler.getOutput(); }
From source file:com.jaeksoft.searchlib.parser.HtmlParser.java
private void getBodyTextContent(ParserResultItem result, StringBuilder sb, HtmlNodeAbstract<?> node, boolean bAddBlock, String[] directFields, int recursion, Set<Object> nodeExclusionsSet) { if (recursion == 0) { Logging.warn("Max recursion reached (getBodyTextContent)"); return;//from w w w. j ava 2 s. c o m } if (nodeExclusionsSet != null) if (nodeExclusionsSet.contains(node.node)) return; recursion--; if (node.isComment()) return; String nodeName = node.getNodeName(); if ("script".equalsIgnoreCase(nodeName)) return; if ("style".equalsIgnoreCase(nodeName)) return; if ("object".equalsIgnoreCase(nodeName)) return; if ("title".equalsIgnoreCase(nodeName)) return; if ("oss".equalsIgnoreCase(nodeName)) { if ("yes".equalsIgnoreCase(node.getAttribute("ignore"))) return; } boolean bEnterDirectField = false; String classNameAttribute = node.getAttribute("class"); if (classNameAttribute != null) { String[] classNames = org.apache.commons.lang.StringUtils.split(classNameAttribute); if (classNames != null) { for (String className : classNames) { if (OPENSEARCHSERVER_IGNORE.equalsIgnoreCase(className)) return; if (className.startsWith(OPENSEARCHSERVER_FIELD)) { String directField = classNameAttribute.substring(OPENSEARCHSERVER_FIELD_LENGTH); if (directField.length() > 0) { directFields = directField.split("\\."); bEnterDirectField = directFields.length > 0; } } } } } if (node.isTextNode()) { String text = node.getText(); text = text.replaceAll("\\r", " "); text = text.replaceAll("\\n", " "); text = StringUtils.replaceConsecutiveSpaces(text, " "); text = text.trim(); if (text.length() > 0) { text = StringEscapeUtils.unescapeHtml4(text); if (sb.length() > 0) sb.append(' '); sb.append(text); } } List<HtmlNodeAbstract<?>> children = node.getChildNodes(); if (children != null) for (HtmlNodeAbstract<?> htmlNode : children) getBodyTextContent(result, sb, htmlNode, bAddBlock, directFields, recursion, nodeExclusionsSet); if (bAddBlock && nodeName != null && sb.length() > 0) { String currentTag = nodeName.toLowerCase(); boolean bForSentence = sb.charAt(sb.length() - 1) != '.' && sentenceTagSet.contains(currentTag); if (bForSentence || bEnterDirectField) { if (directFields != null) result.addDirectFields(directFields, sb.toString()); else addFieldBody(result, currentTag, sb.toString()); sb.setLength(0); } } }
From source file:com.ecyrd.jspwiki.parser.JSPWikiMarkupParser.java
private Element handleOpenbracket() throws IOException { StringBuilder sb = new StringBuilder(40); int pos = getPosition(); int ch = nextToken(); boolean isPlugin = false; if (ch == '[') { if (m_wysiwygEditorMode) { sb.append('['); }//from www . j a v a 2 s . com sb.append((char) ch); while ((ch = nextToken()) == '[') { sb.append((char) ch); } } if (ch == '{') { isPlugin = true; } pushBack(ch); if (sb.length() > 0) { m_plainTextBuf.append(sb); return m_currentElement; } // // Find end of hyperlink // ch = nextToken(); int nesting = 1; // Check for nested plugins while (ch != -1) { int ch2 = nextToken(); pushBack(ch2); if (isPlugin) { if (ch == '[' && ch2 == '{') { nesting++; } else if (nesting == 0 && ch == ']' && sb.charAt(sb.length() - 1) == '}') { break; } else if (ch == '}' && ch2 == ']') { // NB: This will be decremented once at the end nesting--; } } else { if (ch == ']') { break; } } sb.append((char) ch); ch = nextToken(); } // // If the link is never finished, do some tricks to display the rest of the line // unchanged. // if (ch == -1) { log.debug("Warning: unterminated link detected!"); m_isEscaping = true; m_plainTextBuf.append(sb); flushPlainText(); m_isEscaping = false; return m_currentElement; } return handleHyperlinks(sb.toString(), pos); }
From source file:org.jresponder.util.TokenUtil.java
public String[] generateTokens(int aTokenCount, int aTokenLength) { StringBuilder myPasswordBuilder; String[] myPasswordArray = new String[aTokenCount]; int c1;//from w w w . j a v a 2 s .co m int c2; int c3; long sum = 0; int myNChars; long myRandomNumber; int myPasswordIndex; double myThreshold; SecureRandom myRandom = new SecureRandom(); // random seed by current time /*======================================================================*/ /* generate the number of passwords requested */ /*======================================================================*/ for (myPasswordIndex = 0; myPasswordIndex < aTokenCount; myPasswordIndex++) { myPasswordBuilder = new StringBuilder(aTokenLength); /*==============================================================*/ /* Pick a random starting point */ /*==============================================================*/ myThreshold = myRandom.nextDouble(); // random number [0,1] myRandomNumber = (long) (myThreshold * sigma); // weight by sum of frequencies /*==============================================================*/ /* Find the first random pronounceable triplet */ /*==============================================================*/ sum = 0; for (c1 = 0; c1 < 26; c1++) { for (c2 = 0; c2 < 26; c2++) { for (c3 = 0; c3 < 26; c3++) { sum += (long) (TRIPLET_FREQUENCY[c1][c2][c3]); if (sum > myRandomNumber) { myPasswordBuilder.append(alphabet.charAt(c1)); myPasswordBuilder.append(alphabet.charAt(c2)); myPasswordBuilder.append(alphabet.charAt(c3)); c1 = 26; // Found start - break all 3 loops c2 = 26; c3 = 26; } } } } /*==============================================================*/ /* Now continue based upon the last two characters so far */ /*==============================================================*/ myNChars = 3; while (myNChars < aTokenLength) { c1 = alphabet.indexOf(myPasswordBuilder.charAt(myNChars - 2)); c2 = alphabet.indexOf(myPasswordBuilder.charAt(myNChars - 1)); sum = 0; for (c3 = 0; c3 < 26; c3++) { sum += (long) (TRIPLET_FREQUENCY[c1][c2][c3]); } if (sum == 0) { break; } myThreshold = myRandom.nextDouble(); myRandomNumber = (long) (myThreshold * sum); sum = 0; for (c3 = 0; c3 < 26; c3++) { sum += (long) (TRIPLET_FREQUENCY[c1][c2][c3]); if (sum > myRandomNumber) { myPasswordBuilder.append(alphabet.charAt(c3)); break; } } myNChars++; } myPasswordArray[myPasswordIndex] = myPasswordBuilder.toString(); } return (myPasswordArray); }
From source file:org.eclipse.dataset.AbstractDataset.java
/** * recursive method to print blocks/* w w w . j a v a2 s. c o m*/ */ private void printBlocks(final StringBuilder out, final StringBuilder lead, final int level, final int[] pos) { if (out.length() > 0) { char last = out.charAt(out.length() - 1); if (last != BLOCK_OPEN) { out.append(lead); } } final int end = getRank() - 1; if (level != end) { out.append(BLOCK_OPEN); int length = shape[level]; // first sub-block pos[level] = 0; StringBuilder newlead = new StringBuilder(lead); newlead.append(SPACE); printBlocks(out, newlead, level + 1, pos); if (length < 2) { // escape out.append(BLOCK_CLOSE); return; } out.append(SEPARATOR + NEWLINE); for (int i = level + 1; i < end; i++) { out.append(NEWLINE); } // middle sub-blocks if (length < MAX_SUBBLOCKS) { for (int x = 1; x < length - 1; x++) { pos[level] = x; printBlocks(out, newlead, level + 1, pos); if (end <= level + 1) { out.append(SEPARATOR + NEWLINE); } else { out.append(SEPARATOR + NEWLINE + NEWLINE); } } } else { final int excess = length - MAX_SUBBLOCKS; int xmax = (length - excess) / 2; for (int x = 1; x < xmax; x++) { pos[level] = x; printBlocks(out, newlead, level + 1, pos); if (end <= level + 1) { out.append(SEPARATOR + NEWLINE); } else { out.append(SEPARATOR + NEWLINE + NEWLINE); } } out.append(newlead); out.append(ELLIPSIS + SEPARATOR + NEWLINE); xmax = (length + excess) / 2; for (int x = xmax; x < length - 1; x++) { pos[level] = x; printBlocks(out, newlead, level + 1, pos); if (end <= level + 1) { out.append(SEPARATOR + NEWLINE); } else { out.append(SEPARATOR + NEWLINE + NEWLINE); } } } // last sub-block pos[level] = length - 1; printBlocks(out, newlead, level + 1, pos); out.append(BLOCK_CLOSE); } else { out.append(makeLine(end, pos)); } }
From source file:ffx.potential.parsers.PDBFilter.java
/** * <p>/*from w w w . j av a 2s .c om*/ * writeFileWithHeader</p> * * @param saveFile a {@link java.io.File} object. * @param header a {@link java.lang.StringBuilder} object. * @param append a boolean. * @return a boolean. */ public boolean writeFileWithHeader(File saveFile, StringBuilder header, boolean append) { FileWriter fw; BufferedWriter bw; if (header.charAt(header.length() - 1) != '\n') { header.append("\n"); } try { File newFile = saveFile; activeMolecularAssembly.setFile(newFile); activeMolecularAssembly.setName(newFile.getName()); if (!listMode) { fw = new FileWriter(newFile, append); bw = new BufferedWriter(fw); bw.write(header.toString()); bw.close(); } else { listOutput.add(header.toString()); } } catch (Exception e) { String message = "Exception writing to file: " + saveFile.toString(); logger.log(Level.WARNING, message, e); return false; } return writeFile(saveFile, true); }
From source file:org.exist.http.SOAPServer.java
/** * Creates an XQuery to call an XQWS function from a SOAP Request * /*from w ww . j av a 2s. com*/ * @param broker The Database Broker to use * @param xqwsFileUri The XmldbURI of the XQWS file * @param xqwsNamespace The namespace of the xqws * @param xqwsCollectionUri The XmldbUri of the collection where the XQWS resides * @param xqwsSOAPFunction The Node from the SOAP request for the Function call from the Http Request * @param xqwsDescription The internal description of the XQWS * @param request The Http Servlet Request * @param response The Http Servlet Response * * @return The compiled XQuery * @throws PermissionDeniedException */ private CompiledXQuery XQueryExecuteXQWSFunction(DBBroker broker, Node xqwsSOAPFunction, XQWSDescription xqwsDescription, HttpServletRequest request, HttpServletResponse response) throws XPathException, PermissionDeniedException { final StringBuilder query = new StringBuilder(); query.append("xquery version \"1.0\";").append(SEPERATOR); query.append(SEPERATOR); query.append("import module namespace ").append(xqwsDescription.getNamespace().getLocalName()).append("=\"") .append(xqwsDescription.getNamespace().getNamespaceURI()).append("\" at \"") .append(xqwsDescription.getFileURI().toString()).append("\";").append(SEPERATOR); query.append(SEPERATOR); //add the function call to the xquery String functionName = xqwsSOAPFunction.getLocalName(); if (functionName == null) { functionName = xqwsSOAPFunction.getNodeName(); } query.append(xqwsDescription.getNamespace().getLocalName()).append(":").append(functionName).append("("); //add the arguments for the function call if any final NodeList xqwsSOAPFunctionParams = xqwsSOAPFunction.getChildNodes(); final Node nInternalFunction = xqwsDescription.getFunction(functionName); final NodeList nlInternalFunctionParams = xqwsDescription.getFunctionParameters(nInternalFunction); int j = 0; for (int i = 0; i < xqwsSOAPFunctionParams.getLength(); i++) { final Node nSOAPFunctionParam = xqwsSOAPFunctionParams.item(i); if (nSOAPFunctionParam.getNodeType() == Node.ELEMENT_NODE) { // Did we reached the length? if (j == nlInternalFunctionParams.getLength()) { throw new XPathException("Too many input parameters for " + functionName + ": expected=" + xqwsSOAPFunctionParams.getLength()); } query.append(writeXQueryFunctionParameter( xqwsDescription.getFunctionParameterType(nlInternalFunctionParams.item(j)), xqwsDescription.getFunctionParameterCardinality(nlInternalFunctionParams.item(j)), nSOAPFunctionParam)); query.append(","); //add function seperator j++; } } /* if(j!=xqwsSOAPFunctionParams.getLength()) { throw new XPathException("Input parameters number mismatch for "+functionName+": expected="+xqwsSOAPFunctionParams.getLength()+" got="+j); } */ //remove last superflurous seperator if (query.charAt(query.length() - 1) == ',') { query.deleteCharAt(query.length() - 1); } query.append(")"); //compile the query return compileXQuery(broker, new StringSource(query.toString()), new XmldbURI[] { xqwsDescription.getCollectionURI() }, xqwsDescription.getCollectionURI(), request, response); }
From source file:no.kantega.publishing.common.util.MultimediaTagCreator.java
private static String createImgTag(Multimedia mm, String align, int resizeWidth, int resizeHeight, Cropping cropping, String cssClass, boolean skipImageMap, String url, String altname) { StringBuilder tag = new StringBuilder(); tag.append("<img "); String author = defaultIfBlank(mm.getAuthor(), Aksess.getMultimediaDefaultCopyright()); String copyright = ""; if (isNotBlank(altname) && isNotBlank(author)) { copyright = " - © " + author; }/* w w w .j av a 2s . c o m*/ String title = Aksess.getMultimediaTitleFormat(); title = StringHelper.replace(title, "$ALT", altname); title = StringHelper.replace(title, "$TITLE", mm.getName()); title = StringHelper.replace(title, "$COPYRIGHT", copyright); // title attribut - dvs mouseover tag.append("title=\"").append(title); tag.append("\" "); // alt attribut - det som skal vises for screen readers etc String altString = Aksess.getMultimediaAltFormat(); altString = StringHelper.replace(altString, "$ALT", altname); altString = StringHelper.replace(altString, "$TITLE", mm.getName()); altString = StringHelper.replace(altString, "$COPYRIGHT", copyright); tag.append("alt=\"").append(altString); tag.append("\" "); int width = mm.getWidth(); int height = mm.getHeight(); if (resizeWidth != -1 || resizeHeight != -1) { StringBuilder urlBuilder = new StringBuilder(url); boolean containsq = url.contains("?"); if (resizeWidth != -1) { urlBuilder.append(!containsq ? "?" : "&"); urlBuilder.append("width=").append(resizeWidth); containsq = true; } if (resizeHeight != -1) { urlBuilder.append(!containsq ? "?" : "&"); urlBuilder.append("height=").append(resizeHeight); } if (cropping != Cropping.CONTAIN) { urlBuilder.append("&cropping=").append(cropping.getTypeAsString()); } url = urlBuilder.toString(); } else { // Image will not be resised, specify dimensions in tag if (width > 0) { tag.append(" width=").append(width); } if (height > 0) { tag.append(" height=").append(height); } } if (cssClass != null && cssClass.length() > 0) { tag.append(" class=\"").append(cssClass).append("\""); } if (align != null && align.length() > 0) { tag.append(" align=").append(align); } tag.append(" src=\"").append(url).append("\""); if (!skipImageMap && mm.hasImageMap()) { try { MultimediaImageMap mim = MultimediaImageMapAO.loadImageMap(mm.getId()); if (mim.getCoordUrlMap().length > 0) { Date dt = new Date(); String mapId = "imagemap" + mm.getId() + dt.getTime(); // Avslutter bildet med referanse til bildekart tag.append(" usemap=\"#").append(mapId).append("\">"); tag.append("<map id=\"").append(mapId).append("\" name=\"").append(mapId).append("\">"); for (int i = 0; i < mim.getCoordUrlMap().length; i++) { String mapURL = mim.getCoordUrlMap()[i].getUrl(); if (mapURL.startsWith("/")) { mapURL = Aksess.getContextPath() + mapURL; } // Henter eventuelle resizede koordinater String coord = mim.getCoordUrlMap()[i].getResizedCoord(resizeWidth, width, resizeHeight, height); if (coord != null) { String target = ""; if (mim.getCoordUrlMap()[i].isOpenInNewWindow()) { target = " onclick=\"window.open(this.href); return false\""; } tag.append("<area shape=\"rect\" coords=\"").append(coord).append("\" href=\"") .append(mapURL).append("\" title=\"") .append(mim.getCoordUrlMap()[i].getAltName()).append("\" alt=\"") .append(mim.getCoordUrlMap()[i].getAltName()).append("\"").append(target) .append(">"); } } tag.append("</map>"); } } catch (SystemException e) { log.error("Error creating image map", e); } } // Legg til > p slutten hvis ikke avsluttet if (tag.charAt(tag.length() - 1) != '>') { tag.append(">"); } return tag.toString(); }
From source file:com.wabacus.WabacusFacade.java
public static String getSelectBoxDataList(HttpServletRequest request, HttpServletResponse response) { ReportRequest rrequest = null;//w w w. j av a 2 s . co m StringBuilder resultBuf = new StringBuilder(); try { rrequest = new ReportRequest(request, -1); WabacusResponse wresponse = new WabacusResponse(response); rrequest.setWResponse(wresponse); rrequest.initGetSelectBoxDataList(); resultBuf.append("pageid:\"").append(rrequest.getPagebean().getId()).append("\","); String selectboxParams = rrequest.getStringAttribute("SELECTBOXIDS_AND_PARENTVALUES", ""); if (selectboxParams.equals("")) return ""; List<Map<String, String>> lstParams = EditableReportAssistant.getInstance() .parseSaveDataStringToList(selectboxParams); Map<String, ReportBean> mHasInitReportBeans = new HashMap<String, ReportBean>(); String realInputboxidTmp, inputboxidTmp; AbsSelectBox childSelectBoxTmp; ReportBean rbeanTmp; for (Map<String, String> mSelectBoxParamsTmp : lstParams) { realInputboxidTmp = mSelectBoxParamsTmp.get("conditionSelectboxIds"); if (!Tools.isEmpty(realInputboxidTmp)) { List<String> lstSelectboxIds = Tools.parseStringToList(realInputboxidTmp, ";", false); for (String selectboxidTmp : lstSelectboxIds) { rbeanTmp = getReportBeanByInputboxid(rrequest, selectboxidTmp, mHasInitReportBeans); if (rbeanTmp == null) continue; childSelectBoxTmp = rbeanTmp.getChildSelectBoxInConditionById(selectboxidTmp); if (childSelectBoxTmp == null) { throw new WabacusRuntimeException("" + rbeanTmp.getPath() + "?id" + selectboxidTmp + "?"); } List<Map<String, String>> lstOptionsResult = childSelectBoxTmp.getOptionsList(rrequest, getMParentValuesOfConditionBox(rrequest, rbeanTmp, childSelectBoxTmp)); resultBuf.append(assembleOptionsResult(selectboxidTmp, lstOptionsResult)); } } else { realInputboxidTmp = mSelectBoxParamsTmp.get("wx_inputboxid");//?ID if (Tools.isEmpty(realInputboxidTmp)) continue; inputboxidTmp = realInputboxidTmp; int idx = inputboxidTmp.lastIndexOf("__"); if (idx > 0) inputboxidTmp = inputboxidTmp.substring(0, idx); rbeanTmp = getReportBeanByInputboxid(rrequest, realInputboxidTmp, mHasInitReportBeans); if (rbeanTmp == null) continue; childSelectBoxTmp = rbeanTmp.getChildSelectBoxInColById(inputboxidTmp); if (childSelectBoxTmp == null) { throw new WabacusRuntimeException("" + rbeanTmp.getPath() + "?id" + inputboxidTmp + "?"); } mSelectBoxParamsTmp.remove("wx_inputboxid"); List<Map<String, String>> lstOptionsResult = childSelectBoxTmp.getOptionsList(rrequest, mSelectBoxParamsTmp); resultBuf.append(assembleOptionsResult(realInputboxidTmp, lstOptionsResult)); } } } catch (Exception e) { throw new WabacusRuntimeException("?", e); } finally { if (rrequest != null) rrequest.destroy(false); } if (resultBuf.length() > 0 && resultBuf.charAt(resultBuf.length() - 1) == ',') resultBuf.deleteCharAt(resultBuf.length() - 1); return resultBuf.length() > 0 ? "{" + resultBuf.toString() + "}" : ""; }