Example usage for java.lang StringBuffer setLength

List of usage examples for java.lang StringBuffer setLength

Introduction

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

Prototype

@Override
public synchronized void setLength(int newLength) 

Source Link

Usage

From source file:org.ecoinformatics.seek.datasource.darwincore.DarwinCoreDataSource.java

/**
 * Creates a string table from the resultset records
 * /*w  ww .  j a v  a  2  s . c o m*/
 * @param aRS
 *     */
private String createTableFromSQLResults(boolean aIncludeHeader, String aDelim) {
    StringBuffer tableStr = new StringBuffer();
    StringBuffer rowOfData = new StringBuffer();
    String colDelim = "\t";

    if (aIncludeHeader) {
        appendHeaderRow(tableStr, _columns, colDelim, ROWDELIM);
    }

    for (int i = 0; i < _dataVectors.length; i++) {
        rowOfData.setLength(0);

        Enumeration colEnum = _columns.elements();
        Enumeration dataEnum = _dataVectors[i].elements();
        int colInx = 0;
        while (colEnum.hasMoreElements()) {
            DSTableFieldIFace colDef = (DSTableFieldIFace) colEnum.nextElement();
            String eleStr = (String) dataEnum.nextElement();
            if (colInx > 0) {
                rowOfData.append(colDelim);
            }

            rowOfData.append(getValidStringValueForType(eleStr, colDef.getDataType()));
            colInx++;
        }
        tableStr.append(rowOfData);
        tableStr.append(ROWDELIM);
    }
    return tableStr.toString();
}

From source file:com.adito.jdbc.DBUpgrader.java

private void runSQLScript(JDBCConnectionImpl con, File sqlFile)
        throws SQLException, IllegalStateException, IOException {

    InputStream in = null;//ww w  .j ava  2 s  .  c  o m
    try {
        in = new FileInputStream(sqlFile);
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line = null;
        StringBuffer cmdBuffer = new StringBuffer();
        boolean quoted = false;
        char ch;
        while ((line = reader.readLine()) != null) {
            line = line.trim();
            if (!line.equals("") && !line.startsWith("//") && !line.startsWith("--") && !line.startsWith("#")) {
                quoted = false;
                for (int i = 0; i < line.length(); i++) {
                    ch = line.charAt(i);
                    if (ch == '\'') {
                        if (quoted) {
                            if ((i + 1) < line.length() && line.charAt(i + 1) == '\'') {
                                i++;
                                cmdBuffer.append(ch);
                            } else {
                                quoted = false;
                            }
                        } else {
                            quoted = true;
                        }
                        cmdBuffer.append(ch);
                    } else if (ch == ';' && !quoted) {
                        if (cmdBuffer.length() > 0) {
                            executeSQLStatement(con, cmdBuffer.toString());
                            cmdBuffer.setLength(0);
                        }
                    } else {
                        if (i == 0 && ch != ' ' && cmdBuffer.length() > 0 && !quoted) {
                            cmdBuffer.append(' ');
                        }
                        cmdBuffer.append(ch);
                    }
                }
            }
        }
        if (cmdBuffer.length() > 0) {
            executeSQLStatement(con, cmdBuffer.toString());
            cmdBuffer.setLength(0);
        }
    } finally {
        if (in != null) {
            in.close();
        }
    }
}

From source file:com.hangum.tadpole.engine.sql.util.export.SQLExporter.java

public static String makeFileUpdateStatment(String tableName, QueryExecuteResultDTO rsDAO,
        List<String> listWhere, int intLimitCnt, int commit) throws Exception {
    String strTmpDir = PublicTadpoleDefine.TEMP_DIR + tableName + System.currentTimeMillis()
            + PublicTadpoleDefine.DIR_SEPARATOR;
    String strFile = tableName + ".sql";
    String strFullPath = strTmpDir + strFile;

    final String UPDATE_STMT = "UPDATE " + tableName + " SET %s WHERE 1=1 %s;"
            + PublicTadpoleDefine.LINE_SEPARATOR;
    Map<Integer, String> mapColumnName = rsDAO.getColumnLabelName();

    // ?? ./*www.  j a va2s . com*/
    StringBuffer sbInsertInto = new StringBuffer();
    int DATA_COUNT = 1000;
    List<Map<Integer, Object>> dataList = rsDAO.getDataList().getData();
    Map<Integer, Integer> mapColumnType = rsDAO.getColumnType();
    String strStatement = "";
    String strWhere = "";
    for (int i = 0; i < dataList.size(); i++) {
        Map<Integer, Object> mapColumns = dataList.get(i);

        strStatement = "";
        strWhere = "";
        for (int j = 1; j < mapColumnName.size(); j++) {
            String strColumnName = mapColumnName.get(j);

            Object strValue = mapColumns.get(j);
            strValue = strValue == null ? "" : strValue;
            if (!RDBTypeToJavaTypeUtils.isNumberType(mapColumnType.get(j))) {
                strValue = StringEscapeUtils.escapeSql(strValue.toString());
                strValue = StringHelper.escapeSQL(strValue.toString());
                strValue = SQLUtil.makeQuote(strValue.toString());
            }

            boolean isWhere = false;
            for (String strTmpColumn : listWhere) {
                if (strColumnName.equals(strTmpColumn)) {
                    isWhere = true;
                    break;
                }
            }
            if (isWhere)
                strWhere += String.format("%s=%s and", strColumnName, strValue);
            else
                strStatement += String.format("%s=%s,", strColumnName, strValue);
        }
        strStatement = StringUtils.removeEnd(strStatement, ",");
        strWhere = StringUtils.removeEnd(strWhere, "and");

        sbInsertInto.append(String.format(UPDATE_STMT, strStatement, strWhere));

        if (intLimitCnt == i) {
            return sbInsertInto.toString();
        }

        if (commit > 0 && (i % commit) == 0) {
            sbInsertInto
                    .append("COMMIT" + PublicTadpoleDefine.SQL_DELIMITER + PublicTadpoleDefine.LINE_SEPARATOR);
        }

        if ((i % DATA_COUNT) == 0) {
            FileUtils.writeStringToFile(new File(strFullPath), sbInsertInto.toString(), true);
            sbInsertInto.setLength(0);
        }
    }
    if (sbInsertInto.length() > 0) {
        if (commit > 0) {
            sbInsertInto
                    .append("COMMIT" + PublicTadpoleDefine.SQL_DELIMITER + PublicTadpoleDefine.LINE_SEPARATOR);
        }

        FileUtils.writeStringToFile(new File(strFullPath), sbInsertInto.toString(), true);
    }

    return strFullPath;
}

From source file:org.geoserver.test.GeoServerAbstractTestSupport.java

/**
 * Convenience method for subclasses to create mock http servlet requests.
 * <p>/*from ww  w  .j ava  2  s.c o m*/
 * Examples of using this method are:
 * <pre>
 * <code>
 *   Map kvp = new HashMap();
 *   kvp.put( "service", "wfs" );
 *   kvp.put( "request", "GetCapabilities" );
 *   
 *   createRequest( "wfs", kvp );
 * </code>
 * </pre>
 * </p>
 * @param path The path for the request, minus any query string parameters.
 * @param kvp The key value pairs to be put in teh query string. 
 * 
 */
protected MockHttpServletRequest createRequest(String path, Map kvp) {
    StringBuffer q = new StringBuffer();
    for (Iterator e = kvp.entrySet().iterator(); e.hasNext();) {
        Map.Entry entry = (Map.Entry) e.next();
        q.append(entry.getKey()).append("=").append(entry.getValue());
        q.append("&");
    }
    q.setLength(q.length() - 1);

    return createRequest(ResponseUtils.appendQueryString(path, q.toString()));
}

From source file:com.tremolosecurity.scale.user.ScaleUser.java

public String saveUser(SaveUser toSave) throws Exception {
    TremoloUser user = new TremoloUser();
    user.setUid(this.getLogin());

    for (ScaleAttribute attr : toSave.getAttributes()) {
        Attribute uattr = new Attribute(attr.getName());
        uattr.getValues().add(attr.getValue());
        user.getAttributes().add(uattr);
    }/*  w  ww .  j  a  v  a 2 s.  co  m*/

    WFCall wfcall = new WFCall();
    wfcall.setUidAttributeName(
            this.getScaleConfig().getRawConfig().getServiceConfiguration().getLookupAttributeName());
    wfcall.setUser(user);
    wfcall.setName(this.getScaleConfig().getRawConfig().getWorkflows().getSaveUserProfileWorkflowName());

    // touch to ensure the session is alive
    StringBuffer callURL = new StringBuffer();
    callURL.append(scaleConfig.getRawConfig().getServiceConfiguration().getUnisonURL() + "/services/wf/login");

    HttpGet httpget = new HttpGet(callURL.toString());

    HttpResponse response = scaleSession.getHttp().execute(httpget);
    BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
    String line = null;
    StringBuffer json = new StringBuffer();
    while ((line = in.readLine()) != null) {
        json.append(line);
    }

    httpget.abort();

    Gson gson = new Gson();
    ProvisioningResult pres = gson.fromJson(json.toString(), ProvisioningResult.class);
    if (!pres.isSuccess()) {

        return "Could not connect to Unison";
    }

    // Execute workflow
    callURL.setLength(0);
    callURL.append(
            scaleConfig.getRawConfig().getServiceConfiguration().getUnisonURL() + "/services/wf/execute");
    if (logger.isDebugEnabled())
        logger.debug("URL for wf : '" + callURL.toString() + "'");
    String sjson = gson.toJson(wfcall);
    HttpPost post = new HttpPost(callURL.toString());
    List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
    urlParameters.add(new BasicNameValuePair("wfcall", sjson));
    post.setEntity(new UrlEncodedFormEntity(urlParameters));

    response = scaleSession.getHttp().execute(post);
    in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
    line = null;
    json.setLength(0);
    while ((line = in.readLine()) != null) {
        json.append(line);
    }

    pres = gson.fromJson(json.toString(), ProvisioningResult.class);
    if (!pres.isSuccess()) {
        logger.error("Error : '" + pres.getError().getError() + "'");
        return "There was a problem updating your profile, please contact the system administrator for help";
    }

    return null;

}

From source file:org.eclipse.php.internal.core.format.DefaultIndentationStrategy.java

private static boolean indentMultiLineCase(IStructuredDocument document, int lineNumber, int offset,
        boolean enterKeyPressed, StringBuffer result, String blanks, String commandText,
        IndentationObject indentationObject) {
    // LineState lineState = new LineState();
    try {/*from   w  w  w .j  ava  2s .co  m*/
        IRegion region = document.getLineInformationOfOffset(offset);
        String content = document.get(offset, region.getOffset() + region.getLength() - offset);
        PHPHeuristicScanner scanner = PHPHeuristicScanner.createHeuristicScanner(document, offset, true);
        if (enterKeyPressed && content.trim().startsWith("//")) { //$NON-NLS-1$
            // https://bugs.eclipse.org/bugs/show_bug.cgi?id=457701
            return true;
        } else if (IndentationUtils.inBracelessBlock(scanner, document, offset)) {
            // lineState.inBracelessBlock = true;
            if (!"{".equals(commandText)) { //$NON-NLS-1$
                indent(document, result, indentationObject.getIndentationChar(),
                        indentationObject.getIndentationSize());
            }
            return true;
        } else if (content.trim().startsWith(BLANK + PHPHeuristicScanner.LBRACE)) {
            // lineState.inBracelessBlock = true;
            int token = scanner.previousToken(offset - 1, PHPHeuristicScanner.UNBOUND);
            if (token == PHPHeuristicScanner.TokenRPAREN) {

                int peer = scanner.findOpeningPeer(scanner.getPosition(), PHPHeuristicScanner.UNBOUND,
                        PHPHeuristicScanner.LPAREN, PHPHeuristicScanner.RPAREN);
                if (peer != PHPHeuristicScanner.NOT_FOUND) {

                    String newblanks = FormatterUtils.getLineBlanks(document,
                            document.getLineInformationOfOffset(peer));
                    StringBuilder newBuffer = new StringBuilder(newblanks);
                    // IRegion region = document
                    // .getLineInformationOfOffset(offset);

                    result.setLength(result.length() - blanks.length());
                    result.append(newBuffer.toString());
                    return true;
                }
            }

        } else if (inMultiLine(scanner, document, lineNumber, offset)) {
            // lineState.inBracelessBlock = true;
            int parenPeer = scanner.findOpeningPeer(offset - 1, PHPHeuristicScanner.UNBOUND,
                    PHPHeuristicScanner.LPAREN, PHPHeuristicScanner.RPAREN);
            int bound = parenPeer != -1 ? parenPeer : PHPHeuristicScanner.UNBOUND;

            int bracketPeer = scanner.findOpeningPeer(offset - 1, bound, PHPHeuristicScanner.LBRACKET,
                    PHPHeuristicScanner.RBRACKET);

            int peer = Math.max(parenPeer, bracketPeer);

            if (peer != PHPHeuristicScanner.NOT_FOUND) {

                // search for assignment (i.e. "=>")
                int position = peer - 1;
                int token = scanner.previousToken(position, PHPHeuristicScanner.UNBOUND);
                // scan tokens backwards until reaching a PHP token
                while (token > 100 || token == PHPHeuristicScanner.TokenOTHER) {
                    position--;
                    token = scanner.previousToken(position, PHPHeuristicScanner.UNBOUND);
                }

                position--;
                boolean isAssignment = scanner.previousToken(position,
                        PHPHeuristicScanner.UNBOUND) == PHPHeuristicScanner.TokenGREATERTHAN
                        && scanner.previousToken(position - 1,
                                PHPHeuristicScanner.UNBOUND) == PHPHeuristicScanner.TokenEQUAL;

                token = scanner.previousToken(peer - 1, PHPHeuristicScanner.UNBOUND);

                boolean isArray = token == Symbols.TokenARRAY || peer == bracketPeer;

                String newblanks = FormatterUtils.getLineBlanks(document,
                        document.getLineInformationOfOffset(peer));
                StringBuffer newBuffer = new StringBuffer(newblanks);
                pairArrayParen = false;

                if (isArray) {
                    String trimed = document.get(offset, region.getOffset() + region.getLength() - offset)
                            .trim();
                    if (enterKeyPressed || !(trimed.startsWith(BLANK + PHPHeuristicScanner.RPAREN)
                            || trimed.startsWith(BLANK + PHPHeuristicScanner.RBRACKET))) {
                        int arrayBracket = scanner.nextToken(offset, region.getOffset() + region.getLength());
                        if (enterKeyPressed && (arrayBracket == PHPHeuristicScanner.TokenRPAREN
                                || arrayBracket == PHPHeuristicScanner.TokenRBRACKET)) {
                            int prev = scanner.previousToken(offset - 1, PHPHeuristicScanner.UNBOUND);
                            if (isAssignment && ((arrayBracket == PHPHeuristicScanner.TokenRPAREN
                                    && prev != PHPHeuristicScanner.TokenLPAREN)
                                    || (arrayBracket == PHPHeuristicScanner.TokenRBRACKET
                                            && prev != PHPHeuristicScanner.TokenLBRACKET))) {
                                // no additional indentation
                            } else {
                                indent(document, newBuffer, indentationObject.getIndentationArrayInitSize(),
                                        indentationObject.getIndentationChar(),
                                        indentationObject.getIndentationSize());
                                pairArrayParen = true;
                            }
                        } else {
                            indent(document, newBuffer, indentationObject.getIndentationArrayInitSize(),
                                    indentationObject.getIndentationChar(),
                                    indentationObject.getIndentationSize());
                        }
                    }
                } else {
                    indent(document, newBuffer, indentationObject.getIndentationWrappedLineSize(),
                            indentationObject.getIndentationChar(), indentationObject.getIndentationSize());
                }

                result.setLength(result.length() - blanks.length());
                result.append(newBuffer.toString());
                if (pairArrayParen) {
                    pairArrayOffset = offset + result.length();
                    result.append(Util.getLineSeparator(null, null));
                    result.append(blanks);
                }
                return true;
            }
        } else {
            int baseLine = inMultiLineString(document, offset, lineNumber, enterKeyPressed);
            if (baseLine >= 0) {
                String newblanks = FormatterUtils.getLineBlanks(document,
                        document.getLineInformation(baseLine));
                StringBuffer newBuffer = new StringBuffer(newblanks);
                indent(document, newBuffer, indentationObject.getIndentationWrappedLineSize(),
                        indentationObject.getIndentationChar(), indentationObject.getIndentationSize());
                result.setLength(result.length() - blanks.length());
                result.append(newBuffer.toString());
                return true;
            }
        }
    } catch (final BadLocationException e) {
    }
    return false;
}

From source file:com.tremolosecurity.provisioning.core.providers.BasicDB.java

private void many2manySyncGroups(User user, boolean addOnly, User foundUser, int userIDnum, Connection con,
        StringBuffer b, Map<String, Object> request) throws SQLException, Exception {

    int approvalID = 0;

    if (request.containsKey("APPROVAL_ID")) {
        approvalID = (Integer) request.get("APPROVAL_ID");
    }//from   w  ww .ja  va  2s .co  m

    Workflow workflow = (Workflow) request.get("WORKFLOW");

    b.setLength(0);
    b.append("SELECT ");
    this.getFieldName(this.groupPrimaryKey, b).append(" FROM ");
    this.getFieldName(this.groupTable, b).append(" WHERE ");
    this.getFieldName(this.groupName, b).append(" = ?");
    PreparedStatement getGroupID = con.prepareStatement(b.toString());

    b.setLength(0);
    b.append("INSERT INTO ").append(this.groupLinkTable).append(" (");
    this.getFieldName(this.groupGroupKey, b).append(",");
    this.getFieldName(this.groupUserKey, b).append(") VALUES (?,?)");
    PreparedStatement addGroup = con.prepareStatement(b.toString());

    b.setLength(0);
    b.append("DELETE FROM ").append(this.groupLinkTable).append(" WHERE ");
    this.getFieldName(this.groupGroupKey, b).append("=? AND ");
    this.getFieldName(this.groupUserKey, b).append("=?");
    PreparedStatement delGroup = con.prepareStatement(b.toString());

    for (String groupName : user.getGroups()) {
        if (!foundUser.getGroups().contains(groupName)) {
            getGroupID.setString(1, groupName);
            ResultSet rs = getGroupID.executeQuery();
            if (!rs.next()) {
                throw new Exception("Group " + groupName + " does not exist");
            }

            int groupID = rs.getInt(this.groupPrimaryKey);
            addGroup.setInt(1, groupID);
            addGroup.setInt(2, userIDnum);
            addGroup.executeUpdate();
            this.cfgMgr.getProvisioningEngine().logAction(this.name, false, ActionType.Add, approvalID,
                    workflow, "group", groupName);
        }
    }

    if (!addOnly) {
        for (String groupName : foundUser.getGroups()) {
            if (!user.getGroups().contains(groupName)) {
                getGroupID.setString(1, groupName);
                ResultSet rs = getGroupID.executeQuery();
                if (!rs.next()) {
                    throw new Exception("Group " + groupName + " does not exist");
                }
                int groupID = rs.getInt(this.groupPrimaryKey);

                delGroup.setInt(1, groupID);
                delGroup.setInt(2, userIDnum);
                delGroup.executeUpdate();
                this.cfgMgr.getProvisioningEngine().logAction(this.name, false, ActionType.Delete, approvalID,
                        workflow, "group", groupName);
            }
        }
    }
}

From source file:org.eclipse.wb.tests.designer.core.model.ObjectInfoTest.java

public void test_moveChild() throws Exception {
    ObjectInfo parent = new TestObjectInfo("parent");
    ObjectInfo child_1 = new TestObjectInfo("child_1");
    ObjectInfo child_2 = new TestObjectInfo("child_2");
    ObjectInfo child_3 = new TestObjectInfo("child_3");
    ///*from   w w  w  . j av  a  2  s.c  o  m*/
    parent.addChild(child_1);
    parent.addChild(child_2);
    parent.addChild(child_3);
    // add listener
    final StringBuffer buffer = new StringBuffer();
    parent.addBroadcastListener(new ObjectEventListener() {
        @Override
        public void childMoveBefore(ObjectInfo _parent, ObjectInfo _child, ObjectInfo _nextChild) {
            buffer.append("childMoveBefore " + _parent + " " + _child + " " + _nextChild + "\n");
        }

        @Override
        public void childMoveAfter(ObjectInfo _parent, ObjectInfo _child, ObjectInfo _nextChild, int oldIndex,
                int newIndex) {
            buffer.append("childMoveAfter " + _parent + " " + _child + " " + _nextChild + "\n");
        }
    });
    // move with reference
    {
        buffer.setLength(0);
        parent.moveChild(child_3, child_1);
        assertTrue(ArrayUtils.isEquals(new Object[] { child_3, child_1, child_2 },
                parent.getChildren().toArray()));
        assertEquals(
                getSourceDQ("childMoveBefore parent child_3 child_1", "childMoveAfter parent child_3 child_1"),
                buffer.toString());
    }
    // move as last
    {
        buffer.setLength(0);
        parent.moveChild(child_1, null);
        assertTrue(ArrayUtils.isEquals(new Object[] { child_3, child_2, child_1 },
                parent.getChildren().toArray()));
        assertEquals(getSourceDQ("childMoveBefore parent child_1 null", "childMoveAfter parent child_1 null"),
                buffer.toString());
    }
}

From source file:org.ecoinformatics.seek.datasource.darwincore.DarwinCoreDataSource.java

/**
 * Creates a string table from the resultset records
 * //from  w w w  .j av  a  2 s.  co m
 * @param aRS
 *     */
private String createTableFromResultset(String delim, ResultsetTypeRecord[] records) {
    StringBuffer tableStr = new StringBuffer();
    StringBuffer rowOfData = new StringBuffer();
    DSTableIFace tableSchema = (DSTableIFace) _resultsetSchemaDef.getTables().elementAt(0);
    Vector columns = tableSchema.getFields();

    appendHeaderRow(tableStr, columns, delim, ROWDELIM);

    for (int i = 0; i < records.length; i++) {
        rowOfData.setLength(0);

        //
        // Note: this code assumes all the columns are returned for every
        // record.
        // It also assumes they are in the same order as in the metadata.
        Enumeration colEnum = columns.elements();
        int colInx = 0;
        while (colEnum.hasMoreElements()) {
            DSTableFieldIFace colDef = (DSTableFieldIFace) colEnum.nextElement();
            ResultsetTypeRecordReturnField field = records[i].getReturnField(colInx);
            String eleStr = field.get_value();
            if (colInx > 0) {
                rowOfData.append(delim);
            }
            rowOfData.append(getValidStringValueForType(eleStr, colDef.getDataType()));
            colInx++;
        }
        tableStr.append(rowOfData);
        tableStr.append(ROWDELIM);
    }
    return tableStr.toString();
}

From source file:de.helmholtz_muenchen.ibis.ngs.fastqc.FastQCNodeModel.java

/**
 * {@inheritDoc}/* w  ww  .  j  a  v a 2 s  .c o  m*/
 */
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec)
        throws Exception {

    //Check input table integrity
    CompatibilityChecker.inDataCheck(inData);

    /** Get the input columns **/
    String readsFile1 = inData[0].iterator().next().getCell(0).toString();
    String outfile1 = this.getSettingsFileName(readsFile1);
    String outfileMerged = outfile1;

    File lockFile = new File(readsFile1.substring(0, readsFile1.lastIndexOf(".")) + ".FastQC"
            + SuccessfulRunChecker.LOCK_ENDING);

    /**Prepare Command**/
    ArrayList<String> command = new ArrayList<String>();
    command.add("java");
    String jarCall = "-jar " + IO.getScriptPath() + "libs/FastQC.jar ";
    String path2mergeScript = "sh " + IO.getScriptPath() + "scripts/bash/mergeFsettings.sh";
    command.add(jarCall + readsFile1);

    /**Execute for first file**/
    String[] com = command.toArray(new String[command.size()]);
    StringBuffer sysErr = new StringBuffer(50);

    super.executeCommand(new String[] { StringUtils.join(com, " ") }, outfile1, exec, null, lockFile, null,
            null, null, sysErr, null);

    //Show FastQC Output
    LOGGER.info(sysErr);

    /**If Paired-End data**/
    String readsFile2 = "";
    if (readType.equals("paired-end")) {
        readsFile2 = inData[0].iterator().next().getCell(1).toString();
        if (!readsFile2.equals("") && !readsFile2.equals(readsFile1)) {

            String outfile2 = this.getSettingsFileName(readsFile2); // override this path
            String readFile1Path = IO.removeZipExtension(readsFile1);
            String readFile2Name = IO.removeZipExtension(new File(readsFile2).getName());

            outfileMerged = readFile1Path.substring(0, readFile1Path.lastIndexOf(".")) + "_"
                    + readFile2Name.substring(0, readFile2Name.lastIndexOf(".")) + "_fastqc.filterSettings";

            //Set new lock file for reverse read
            lockFile = new File(readsFile2.substring(0, readsFile2.lastIndexOf(".")) + ".FastQC"
                    + SuccessfulRunChecker.LOCK_ENDING);

            //Replace readsFile1 with readsFile2 and execute again
            com[com.length - 1] = jarCall + readsFile2;
            //Clear StringBuffer
            sysErr.setLength(0);
            sysErr.append("\n");
            super.executeCommand(new String[] { StringUtils.join(com, " ") }, outfile2, exec, null, lockFile,
                    null, null, null, sysErr, null);
            //             //Show FastQC Output
            LOGGER.info(sysErr);
            //Clear StringBuffer
            sysErr.setLength(0);
            sysErr.append("\n");

            /** merge the two filter settings files */
            ArrayList<String> commandMerge = new ArrayList<String>();
            //              commandMerge.add("sh");
            commandMerge.add(path2mergeScript);
            commandMerge.add(outfile1);
            commandMerge.add(outfile2);
            commandMerge.add(outfileMerged);

            //No HTE, Merge is performed each time => strange null pointer exception
            //              Executor.executeCommand(new String[]{StringUtils.join(commandMerge, " ")},exec,LOGGER,sysErr,sysErr);

            //Set new lock file for merging
            lockFile = new File(outfileMerged + SuccessfulRunChecker.LOCK_ENDING);
            super.executeCommand(new String[] { StringUtils.join(commandMerge, " ") }, outfileMerged, exec,
                    null, lockFile, null, null, null, sysErr, null);

            //              //Show FastQC Output
            LOGGER.info(sysErr);
        }
    }

    BufferedDataContainer cont;
    FileCell[] c;

    if (readType.equals("single-end")) {
        cont = exec.createDataContainer(createSpecs());
        c = new FileCell[] { FileCellFactory.create(readsFile1), FileCellFactory.create(outfileMerged) };

    } else {
        cont = exec.createDataContainer(createSpecs());
        c = new FileCell[] { FileCellFactory.create(readsFile1), FileCellFactory.create(readsFile2),
                FileCellFactory.create(outfileMerged) };
    }

    cont.addRowToTable(new DefaultRow("Row0", c));
    cont.close();
    BufferedDataTable outTable = cont.getTable();

    /**Push FlowVars**/
    //       String secFile = "";
    //       if(readsFile1.substring(readsFile1.length()-3,readsFile1.length()).equals("bam")) {
    //          secFile = "true";
    //       }else {
    //          secFile = "false";
    //       }
    //       pushFlowVariableString("isBAM", secFile);

    /**Delete FastQC zip files**/
    deleteZipFiles(readsFile1, readsFile2);

    return new BufferedDataTable[] { outTable };
}