Example usage for java.lang StringBuffer delete

List of usage examples for java.lang StringBuffer delete

Introduction

In this page you can find the example usage for java.lang StringBuffer delete.

Prototype

@Override
public synchronized StringBuffer delete(int start, int end) 

Source Link

Usage

From source file:org.owasp.jbrofuzz.graph.canvas.ResponseHeaderSizeChart.java

private int calculateValue(final File inputFile) {

    if (inputFile.isDirectory()) {
        return -1;
    }//from  w ww.  j  a va2 s  . c o  m

    int headerLength = 0;

    BufferedReader inBuffReader = null;
    try {

        inBuffReader = new BufferedReader(new FileReader(inputFile));

        final StringBuffer one = new StringBuffer();
        int counter = 0;
        int got;
        while (((got = inBuffReader.read()) > 0) && (counter < MAX_CHARS)) {

            one.append((char) got);
            counter++;

        }
        inBuffReader.close();

        one.delete(0, one.indexOf(END_SIGNATURE) + END_SIGNATURE.length());

        headerLength = one.indexOf("\r\n\r\n");

        if (headerLength < 0) {

            headerLength = one.indexOf("\n\n");

        }

    } catch (final IOException e1) {

        return -2;

    } catch (final StringIndexOutOfBoundsException e2) {

        return -3;

    } catch (final NumberFormatException e3) {

        return -4;

    } finally {

        IOUtils.closeQuietly(inBuffReader);

    }

    return headerLength;
}

From source file:org.owasp.jbrofuzz.graph.canvas.ResponseTimeChart.java

private int calculateValue(final File inputFile) {

    if (inputFile.isDirectory()) {
        return -1;
    }/*from  w ww  .jav  a 2 s.  c  om*/

    int responseTime = 0;

    BufferedReader inBuffReader = null;
    try {

        inBuffReader = new BufferedReader(new FileReader(inputFile));

        final StringBuffer one = new StringBuffer(MAX_CHARS);
        int counter = 0;
        int got;
        while (((got = inBuffReader.read()) > 0) && (counter < MAX_CHARS)) {

            one.append((char) got);
            counter++;

        }
        inBuffReader.close();

        one.delete(0, 5);
        one.delete(one.indexOf("\n--"), one.length());

        responseTime = Integer.parseInt(one.toString());

    } catch (final IOException e1) {

        return -2;

    } catch (final StringIndexOutOfBoundsException e2) {

        return -3;

    } catch (final NumberFormatException e3) {

        return -4;

    } finally {

        IOUtils.closeQuietly(inBuffReader);

    }

    return responseTime;
}

From source file:web.CollslideshowController.java

public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    try {//from w ww  . j  av a 2  s. co  m
        ModelAndView m = super.handleRequest(request, response);
    } catch (Exception e) {
        return handleError("error in handleRequest", e);
    }

    if (!WebUtil.isLicenseProfessional(login)) {
        return handleError("Cannot access collabrum features in deluxe version." + login);
    }

    if (getDaoMapper() == null) {
        return handleError("DaoMapper is null in CollslideshowController");
    }

    /** users should be allowed to view the collabrums blobs without the session **/
    String collabrumid = request.getParameter(DbConstants.COLLABRUM_ID);
    if (RegexStrUtil.isNull(collabrumid)) {
        return handleError("request, collabrum is null, for CollslideshowController ");
    }
    if (collabrumid.length() > GlobalConst.collabrumidSize) {
        return handleError("collabrumid.length() > WebConstants.collabrumidSize, for CollslideshowController ");
    }
    collabrumid = RegexStrUtil.goodNameStr(collabrumid);

    String colName = request.getParameter(DbConstants.COL_NAME);
    if (!RegexStrUtil.isNull(colName) && colName.length() > GlobalConst.collabrumNameSize) {
        return handleError("colName.length() > WebConstants.collabrumNameSize, CollslideshowController");
    }
    colName = RegexStrUtil.goodNameStr(colName);

    CollabrumDao collabrumDao = (CollabrumDao) daoMapper.getDao(DbConstants.COLLABRUM);
    if (collabrumDao == null) {
        return handleError("CollabrumDao is null in CollslideshowController collabrum");
    }

    List photos = null;
    try {
        photos = collabrumDao.getBlobsByCategory(collabrumid, DbConstants.PHOTO_CATEGORY,
                DbConstants.BLOB_READ_FROM_SLAVE);
    } catch (BaseDaoException e) {
        return handleError(
                "Exception occured in getStreamBlobs() CollslideshowController collabrumid =" + collabrumid, e);
    }
    if (photos == null) {
        return handleError("photos null, CollslideshowController, collabrumid = " + collabrumid);
    }

    /** 
     * check if this photo exists 
          */
    int photoNum = 0;
    int nextPhotoNum = 0;
    int prevPhotoNum = 0;

    String goPhoto = request.getParameter(DbConstants.GOTO_PHOTO);
    if (!RegexStrUtil.isNull(goPhoto)) {
        String showphoto = request.getParameter(DbConstants.SHOW_PHOTO);
        if (!RegexStrUtil.isNull(showphoto)) {
            photoNum = new Integer(showphoto).intValue();
        }
    } else {
        String photoNumStr = request.getParameter(DbConstants.PHOTO_NUM);
        if (!RegexStrUtil.isNull(photoNumStr)) {
            photoNum = new Integer(photoNumStr).intValue();
        }
    }

    String timerStr = request.getParameter(DbConstants.TIMER);
    if (RegexStrUtil.isNull(timerStr)) {
        timerStr = "0";
    }
    if (photos.size() == 1) {
        photoNum = nextPhotoNum = prevPhotoNum = 0;
    } else {
        if (photoNum >= photos.size()) {
            photoNum = 0;
            nextPhotoNum = photoNum + 1;
            prevPhotoNum = photos.size() - 1;
        } else {
            nextPhotoNum = photoNum + 1;
            if (photoNum != 0) {
                prevPhotoNum = photoNum - 1;
                ;
            } else {
                prevPhotoNum = photos.size() - 1;
            }
        }
    }

    Collabrum cobrand = null;
    CobrandDao cobrandDao = (CobrandDao) getDaoMapper().getDao(DbConstants.COBRAND);
    if (cobrandDao == null) {
        return handleUserpageError("CobrandDao is null, CollslideshowController ");
    }
    try {
        cobrand = cobrandDao.getCollCobrand(collabrumid);
    } catch (Exception e) {
        return handleError("exception getCollCobrand(), CollslideshowController ", e);
    }

    String url = "";
    String fn = request.getParameter(DbConstants.FNDOTX);
    Map myModel = new HashMap();

    if (!RegexStrUtil.isNull(fn)) {
        String beg = request.getParameter("count");
        if (beg != null) {
            int count = new Integer(beg).intValue();
            if ((count > 0) && count <= photos.size()) {
                count--;
                String newBeg = "-1";
                if (count >= 0) {
                    newBeg = new Integer(count).toString();
                }
                StringBuffer myUrl = new StringBuffer("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"");
                myUrl.append(timerStr);
                myUrl.append("; URL=");
                myUrl.append("collslideshow?collabrumid=");
                myUrl.append(collabrumid);
                myUrl.append("&colname=");
                myUrl.append(colName);
                myUrl.append("&photonum=");
                myUrl.append(nextPhotoNum);
                myUrl.append("&timer=");
                myUrl.append(timerStr);
                myUrl.append("&count=");
                myUrl.append(newBeg);
                myUrl.append("&fn.x=");
                myUrl.append(DbConstants.PLAY);
                myUrl.append("\">");
                url = myUrl.toString();
            } else {
                //lastone
                myModel.put("count", null);
            }
        } // beg != null
    } else {
        myModel.put("count", null);
    }

    /**
    * views resolved to the name of the jsp using ViewResolver
    */
    String viewName = DbConstants.COLL_SLIDE_SHOW;
    myModel.put(DbConstants.STREAMS, photos);
    myModel.put(DbConstants.DIR_EXISTS, rbDirectoryExists);
    myModel.put(DbConstants.COL_NAME, colName);
    myModel.put(DbConstants.COLLABRUM_ID, collabrumid);
    myModel.put(DbConstants.USER_PAGE, userpage);
    myModel.put(DbConstants.VISITOR_PAGE, memberUserpage);
    myModel.put(DbConstants.LOGIN_INFO, loginInfo);
    myModel.put(DbConstants.SHARE_INFO, shareInfo);
    myModel.put(DbConstants.BUSINESS_EXISTS, isBizExists(login));

    StringBuffer sb = new StringBuffer();
    sb.append(photoNum);
    myModel.put(DbConstants.PHOTO_NUM, sb.toString());

    sb.delete(0, sb.length());
    sb.append(nextPhotoNum);
    myModel.put(DbConstants.NEXT_NUM, sb.toString());

    sb.delete(0, sb.length());
    sb.append(prevPhotoNum);
    myModel.put(DbConstants.PREV_NUM, sb.toString());

    myModel.put(DbConstants.COBRAND, cobrand);
    myModel.put(DbConstants.TIMER, timerStr);
    myModel.put(DbConstants.URL, url);
    return new ModelAndView(viewName, "model", myModel);
    //myModel.put(DbConstants.FN, fn);
}

From source file:be.ibridge.kettle.trans.step.textfileinput.TextFileInput.java

public static final ArrayList convertLineToStrings(LogWriter log, String line, TextFileInputMeta inf)
        throws KettleException {
    ArrayList strings = new ArrayList();
    int fieldnr;//  w ww. j a va 2  s  . c  o  m
    String pol; // piece of line

    try {
        if (line == null)
            return null;

        if (inf.getFileType().equalsIgnoreCase("CSV")) {
            // Split string in pieces, only for CSV!

            fieldnr = 0;
            int pos = 0;
            int length = line.length();
            boolean dencl = false;

            while (pos < length) {
                int from = pos;
                int next;
                int len_encl = (inf.getEnclosure() == null ? 0 : inf.getEnclosure().length());
                int len_esc = (inf.getEscapeCharacter() == null ? 0 : inf.getEscapeCharacter().length());

                boolean encl_found;
                boolean contains_escaped_enclosures = false;
                boolean contains_escaped_separators = false;

                // Is the field beginning with an enclosure?
                // "aa;aa";123;"aaa-aaa";000;...
                if (len_encl > 0
                        && line.substring(from, from + len_encl).equalsIgnoreCase(inf.getEnclosure())) {
                    if (log.isRowLevel())
                        log.logRowlevel("convert line to row",
                                "encl substring=[" + line.substring(from, from + len_encl) + "]");
                    encl_found = true;
                    int p = from + len_encl;

                    boolean is_enclosure = len_encl > 0 && p + len_encl < length
                            && line.substring(p, p + len_encl).equalsIgnoreCase(inf.getEnclosure());
                    boolean is_escape = len_esc > 0 && p + len_esc < length
                            && line.substring(p, p + len_esc).equalsIgnoreCase(inf.getEscapeCharacter());

                    boolean enclosure_after = false;

                    // Is it really an enclosure? See if it's not repeated twice or escaped!
                    if ((is_enclosure || is_escape) && p < length - 1) {
                        String strnext = line.substring(p + len_encl, p + 2 * len_encl);
                        if (strnext.equalsIgnoreCase(inf.getEnclosure())) {
                            p++;
                            enclosure_after = true;
                            dencl = true;

                            // Remember to replace them later on!
                            if (is_escape)
                                contains_escaped_enclosures = true;
                        }
                    }

                    // Look for a closing enclosure!
                    while ((!is_enclosure || enclosure_after) && p < line.length()) {
                        p++;
                        enclosure_after = false;
                        is_enclosure = len_encl > 0 && p + len_encl < length
                                && line.substring(p, p + len_encl).equals(inf.getEnclosure());
                        is_escape = len_esc > 0 && p + len_esc < length
                                && line.substring(p, p + len_esc).equals(inf.getEscapeCharacter());

                        // Is it really an enclosure? See if it's not repeated twice or escaped!
                        if ((is_enclosure || is_escape) && p < length - 1) // Is
                        {
                            String strnext = line.substring(p + len_encl, p + 2 * len_encl);
                            if (strnext.equals(inf.getEnclosure())) {
                                p++;
                                enclosure_after = true;
                                dencl = true;

                                // Remember to replace them later on!
                                if (is_escape)
                                    contains_escaped_enclosures = true; // remember
                            }
                        }
                    }

                    if (p >= length)
                        next = p;
                    else
                        next = p + len_encl;

                    if (log.isRowLevel())
                        log.logRowlevel("convert line to row", "End of enclosure @ position " + p);
                } else {
                    encl_found = false;
                    boolean found = false;
                    int startpoint = from;
                    int tries = 1;
                    do {
                        next = line.indexOf(inf.getSeparator(), startpoint);

                        // See if this position is preceded by an escape character.
                        if (len_esc > 0 && next - len_esc > 0) {
                            String before = line.substring(next - len_esc, next);

                            if (inf.getEscapeCharacter().equals(before)) {
                                // take the next separator, this one is escaped...
                                startpoint = next + 1;
                                tries++;
                                contains_escaped_separators = true;
                            } else {
                                found = true;
                            }
                        } else {
                            found = true;
                        }
                    } while (!found && next >= 0);
                }
                if (next == -1)
                    next = length;

                if (encl_found) {
                    pol = line.substring(from + len_encl, next - len_encl);
                    if (log.isRowLevel())
                        log.logRowlevel("convert line to row", "Enclosed field found: [" + pol + "]");
                } else {
                    pol = line.substring(from, next);
                    if (log.isRowLevel())
                        log.logRowlevel("convert line to row", "Normal field found: [" + pol + "]");
                }

                if (dencl) {
                    StringBuffer sbpol = new StringBuffer(pol);
                    int idx = sbpol.indexOf(inf.getEnclosure() + inf.getEnclosure());
                    while (idx >= 0) {
                        sbpol.delete(idx, idx + inf.getEnclosure().length());
                        idx = sbpol.indexOf(inf.getEnclosure() + inf.getEnclosure());
                    }
                    pol = sbpol.toString();
                }

                //   replace the escaped enclosures with enclosures... 
                if (contains_escaped_enclosures) {
                    String replace = inf.getEscapeCharacter() + inf.getEnclosure();
                    String replaceWith = inf.getEnclosure();

                    pol = Const.replace(pol, replace, replaceWith);
                }

                //replace the escaped separators with separators... 
                if (contains_escaped_separators) {
                    String replace = inf.getEscapeCharacter() + inf.getSeparator();
                    String replaceWith = inf.getSeparator();

                    pol = Const.replace(pol, replace, replaceWith);
                }

                // Now add pol to the strings found!
                strings.add(pol);

                pos = next + 1;
                fieldnr++;
            }
            if (pos == length) {
                if (log.isRowLevel())
                    log.logRowlevel("convert line to row", "End of line empty field found: []");
                strings.add("");
            }
        } else {
            // Fixed file format: Simply get the strings at the required positions...
            for (int i = 0; i < inf.getInputFields().length; i++) {
                TextFileInputField field = inf.getInputFields()[i];

                int length = line.length();

                if (field.getPosition() + field.getLength() <= length) {
                    strings.add(line.substring(field.getPosition(), field.getPosition() + field.getLength()));
                } else {
                    if (field.getPosition() < length) {
                        strings.add(line.substring(field.getPosition()));
                    } else {
                        strings.add("");
                    }
                }
            }
        }
    } catch (Exception e) {
        throw new KettleException("Error converting line : " + e.toString(), e);
    }

    return strings;
}

From source file:com.upyun.sdk.UpYunClient.java

public void uploadFile(String fileName, FileInputStream instream, Integer fileLength) throws UpYunExcetion {
    StringBuffer url = new StringBuffer();
    for (String str : fileName.split("/")) {
        if (str == null || str.length() == 0) {
            continue;
        }//from  w  w w  .  ja v a 2s  . c  o m
        url.append(fileName + "/");
    }
    url = url.delete(url.length() - 1, url.length());
    sign.setUri(url.toString());
    sign.setContentLength(fileLength);
    sign.setMethod(HttpMethod.PUT.name());
    String url2 = autoUrl + sign.getUri();
    Map<String, String> headers = sign.getHeaders();
    headers.put("mkdir", "true");

    HttpResponse httpResponse = HttpClientUtils.putByHttp(url2, headers, instream, fileLength);
    if (httpResponse.getStatusLine().getStatusCode() != 200) {
        throw new UpYunExcetion(httpResponse.getStatusLine().getStatusCode(),
                httpResponse.getStatusLine().getReasonPhrase());
    }
}

From source file:gtu._work.ui.LoadJspFetchJavascriptUI.java

private String writeScript(File file) throws IOException {
    StringBuffer sb = new StringBuffer(FileUtils.readFileToString(file, "utf8"));
    StringBuffer sb2 = new StringBuffer();
    for (;;) {/*  w w  w.  j  av  a 2s  .  c  o m*/
        Matcher m1 = javascriptStart.matcher(sb.toString());
        Matcher m2 = javascriptEnd.matcher(sb.toString());
        if (m1.find() && m2.find()) {
            sb2.append(sb.substring(m1.start(), m2.end()) + "\n\n");
            sb.delete(m1.start(), m2.end());
        } else {
            break;
        }
    }
    return sb2.toString();
}

From source file:jt56.comm.code.util.CreateBean.java

public String getColumnSplit(List<ColumnData> columnList) throws SQLException {
    StringBuffer commonColumns = new StringBuffer();
    for (ColumnData data : columnList) {
        commonColumns.append(data.getColumnName() + "|");
    }/*from  w ww  . j  a  v a2  s .c o m*/
    return commonColumns.delete(commonColumns.length() - 1, commonColumns.length()).toString();
}

From source file:org.eclipse.jubula.client.core.persistence.NodePM.java

/**
 * /*from   w  w  w. jav  a 2  s  .  co m*/
 * @param tsGuid The GUID of the reused test suite.
 * @param parentProjectIds All returned test cases will have one of these as
 *                         their project parent ID.
 * @param s The session into which the test cases will be loaded.
 * @return list of test suites.
 */
@SuppressWarnings("unchecked")
private static synchronized List<IRefTestSuitePO> getRefTestSuitesFor(String tsGuid,
        List<Long> parentProjectIds, EntityManager s) {

    StringBuffer queryBuffer = new StringBuffer(
            "select ref from RefTestSuitePO as ref where ref.testSuiteGuid = :tsGuid and ("); //$NON-NLS-1$

    for (long id : parentProjectIds) {
        queryBuffer.append("ref.hbmParentProjectId = " + id + " or "); //$NON-NLS-1$ //$NON-NLS-2$
    }
    // Remove the last " or ", and close the statement
    queryBuffer.delete(queryBuffer.length() - 4, queryBuffer.length());
    queryBuffer.append(")"); //$NON-NLS-1$
    Query q = s.createQuery(queryBuffer.toString());
    q.setParameter("tsGuid", tsGuid); //$NON-NLS-1$
    List<IRefTestSuitePO> execTcList = q.getResultList();
    return execTcList;
}

From source file:web.SlideshowController.java

public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    try {/*w w  w .  j a  va 2s . c  o  m*/
        ModelAndView m = super.handleRequest(request, response);
    } catch (Exception e) {
        return handleError("error in handleRequest");
    }

    String member = request.getParameter(DbConstants.MEMBER);
    if (RegexStrUtil.isNull(member)) {
        return handleError("member or photNumStr is null. Forwarding to " + member + "SlideshowController");
    }
    member = RegexStrUtil.goodId(member);

    Hdlogin memberInfo = null;
    MemberDao memberDao = (MemberDao) daoMapper.getDao(DbConstants.MEMBER);
    if (memberDao == null) {
        return handleError("MemberDao is null, SlideshowController, login, " + login);
    }

    try {
        memberInfo = memberDao.getMemberInfo(member);
    } catch (BaseDaoException e) {
        return handleError("getMemberInfo(member) exception in SlideshowController, member=" + member, e);
    }

    if (memberInfo == null) {
        return handleError("memberInfo is null, in SlideshowController" + member);
    }

    /**
     *   start the slide show
     */
    if (getDaoMapper() == null) {
        return handleError("DaoMapper is null in SlideshowController, member " + member);
    }
    CarryonDao carryonDao = (CarryonDao) getDaoMapper().getDao(DbConstants.CARRYON);
    if (carryonDao == null) {
        return handleError("carryonDao is null, SlideshowController for member " + member);
    }

    /**
     *  retrieve the update blob stream and other blobs
     */
    List carryon = null;
    List tagList = null;
    HashSet tagSet = null;
    try {
        carryon = carryonDao.getCarryonByCategory(memberInfo.getValue(DbConstants.LOGIN_ID),
                DbConstants.PHOTO_CATEGORY, DbConstants.READ_FROM_SLAVE);
        tagList = carryonDao.getTags(memberInfo.getValue(DbConstants.LOGIN_ID), DbConstants.READ_FROM_SLAVE);
        tagSet = carryonDao.getUniqueTags(tagList);
    } catch (BaseDaoException e) {
        return handleError("Exception occurred in getCarryonByCategory() member, " + member, e);
    }
    if (carryon == null) {
        return handleError("carryon is null for SlideshowController, member = " + member);
    }

    /** 
     * check if this photo exists 
          */
    int photoNum = 0;
    int nextPhotoNum = 0;
    int prevPhotoNum = 0;

    String goPhoto = request.getParameter(DbConstants.GOTO_PHOTO);
    if (!RegexStrUtil.isNull(goPhoto)) {
        String showphoto = request.getParameter(DbConstants.SHOW_PHOTO);
        if (!RegexStrUtil.isNull(showphoto)) {
            photoNum = new Integer(showphoto).intValue();
        }
    } else {
        String photoNumStr = request.getParameter(DbConstants.PHOTO_NUM);
        if (!RegexStrUtil.isNull(photoNumStr)) {
            photoNum = new Integer(photoNumStr).intValue();
        }
    }

    String timerStr = request.getParameter(DbConstants.TIMER);
    if (RegexStrUtil.isNull(timerStr)) {
        timerStr = "0";
    }

    String fn = request.getParameter(DbConstants.FNDOTX);
    if (carryon.size() == 1) {
        photoNum = nextPhotoNum = prevPhotoNum = 0;
    } else {
        if (photoNum >= carryon.size()) {
            photoNum = 0;
            nextPhotoNum = photoNum + 1;
            prevPhotoNum = carryon.size() - 1;
        } else {
            nextPhotoNum = photoNum + 1;
            if (photoNum != 0) {
                prevPhotoNum = photoNum - 1;
                ;
            } else {
                prevPhotoNum = carryon.size() - 1;
            }
        }
    }

    CobrandDao cobrandDao = (CobrandDao) getDaoMapper().getDao(DbConstants.COBRAND);
    if (cobrandDao == null) {
        return handleUserpageError("CobrandDao is null, SlideshowController");
    }

    Userpage cobrand = cobrandDao.getUserCobrand(memberInfo.getValue(DbConstants.LOGIN_ID));
    String url = "";
    Map myModel = new HashMap();

    if (!RegexStrUtil.isNull(fn)) {
        String beg = request.getParameter("count");
        if (beg != null) {
            int count = new Integer(beg).intValue();
            if ((count > 0) && count <= carryon.size()) {
                count--;
                String newBeg = "-1";
                if (count >= 0) {
                    newBeg = new Integer(count).toString();
                }
                StringBuffer myUrl = new StringBuffer("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"");
                myUrl.append(timerStr);
                myUrl.append("; URL=");
                myUrl.append("slideshow?member=");
                myUrl.append(member);
                myUrl.append("&photonum=");
                myUrl.append(nextPhotoNum);
                myUrl.append("&timer=");
                myUrl.append(timerStr);
                myUrl.append("&count=");
                myUrl.append(newBeg);
                myUrl.append("&fn.x=");
                myUrl.append(DbConstants.PLAY);
                myUrl.append("\">");
                url = myUrl.toString();
            } else {
                //lastone
                myModel.put("count", null);
            }
        } // beg != null
    } else {
        myModel.put("count", null);
    }

    /**
    * editphotos or editfiles - views resolved to the name of the jsp using ViewResolver
    */
    String viewName = DbConstants.SLIDE_SHOW;
    myModel.put(viewName, carryon);
    myModel.put(DbConstants.DIR_EXISTS, rbDirectoryExists);
    myModel.put(DbConstants.USER_PAGE, userpage);
    myModel.put(DbConstants.VISITOR_PAGE, memberUserpage);
    myModel.put(DbConstants.LOGIN_INFO, loginInfo);
    myModel.put(DbConstants.SHARE_INFO, shareInfo);
    if (tagSet != null) {
        myModel.put(DbConstants.USER_TAGS, RegexStrUtil.goodText(tagSet.toString()));
    }

    StringBuffer sb = new StringBuffer();
    sb.append(photoNum);
    myModel.put(DbConstants.PHOTO_NUM, sb.toString());

    sb.delete(0, sb.length());
    sb.append(nextPhotoNum);
    myModel.put(DbConstants.NEXT_NUM, sb.toString());

    sb.delete(0, sb.length());
    sb.append(prevPhotoNum);
    myModel.put(DbConstants.PREV_NUM, sb.toString());

    myModel.put(DbConstants.COBRAND, cobrand);
    myModel.put(DbConstants.TIMER, timerStr);

    myModel.put(DbConstants.URL, url);
    return new ModelAndView(viewName, "model", myModel);
    //myModel.put(DbConstants.FN, fn);
}

From source file:org.kuali.coeus.propdev.impl.person.creditsplit.CalculateCreditSplitEvent.java

@Override
protected void logEvent() {
    StringBuffer logMessage = new StringBuffer(StringUtils.substringAfterLast(this.getClass().getName(), "."));
    logMessage.append(" with ");

    for (ProposalPerson person : ((ProposalDevelopmentDocument) getDocument()).getDevelopmentProposal()
            .getProposalPersons()) {//from  w  w w.j  a  va  2 s .co m
        logMessage.append(person.toString());
        logMessage.append(", ");
    }

    if (logMessage.substring(logMessage.length() - 2).equals(", ")) {
        logMessage.delete(logMessage.length() - 2, logMessage.length());
    }

    LOG.debug(logMessage);

}