Example usage for java.lang InstantiationException printStackTrace

List of usage examples for java.lang InstantiationException printStackTrace

Introduction

In this page you can find the example usage for java.lang InstantiationException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:iristk.util.Record.java

public Record deepClone() {
    try {/*from   ww w .j a v  a2  s  .co  m*/
        Constructor<?> constructor = getClass().getDeclaredConstructor();
        constructor.setAccessible(true);
        Record clone = (Record) constructor.newInstance(null);
        for (String field : this.getFields()) {
            Object value = get(field);
            if (value != null) {
                if (value instanceof Record)
                    clone.put(field, ((Record) value).deepClone());
                else
                    clone.put(field, value);
            }
        }
        return clone;
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.intel.moe.frameworks.inapppurchase.android.util.IabHelper.java

/**
 * Asynchronous wrapper for inventory query. This will perform an inventory
 * query as described in {@link #queryInventory}, but will do so asynchronously
 * and call back the specified listener upon completion. This method is safe to
 * call from a UI thread./*from w w  w.  j  a  v  a2 s  . c om*/
 *
 * @param querySkuDetails as in {@link #queryInventory}
 * @param moreSkus as in {@link #queryInventory}
 * @param listener The listener to notify when the refresh operation completes.
 */
public void queryInventoryAsync(final boolean querySkuDetails, final List<String> moreSkus,
        final QueryInventoryFinishedListener listener) {
    Object handler = null;
    try {
        handler = Class.forName("android.os.Handler").getConstructor().newInstance();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    checkNotDisposed();
    checkSetupDone("queryInventory");
    flagStartAsync("refresh inventory");
    final Object finalHandler = handler;
    (new Thread(new Runnable() {
        public void run() {
            IabResult result = new IabResult(BILLING_RESPONSE_RESULT_OK, "Inventory refresh successful.");
            Inventory inv = null;
            try {
                inv = queryInventory(querySkuDetails, moreSkus);
            } catch (IabException ex) {
                result = ex.getResult();
            }

            flagEndAsync();

            final IabResult result_f = result;
            final Inventory inv_f = inv;
            if (!mDisposed && listener != null) {
                Class[] paramTypes = new Class[] { Runnable.class };
                try {
                    Method method = finalHandler.getClass().getMethod("post", paramTypes);

                    Object[] args = new Object[] { new Runnable() {
                        public void run() {
                            listener.onQueryInventoryFinished(result_f, inv_f);
                        }
                    } };

                    method.invoke(finalHandler, args);
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
        }
    })).start();
}

From source file:com.intel.moe.frameworks.inapppurchase.android.util.IabHelper.java

void consumeAsyncInternal(final List<Purchase> purchases, final OnConsumeFinishedListener singleListener,
        final OnConsumeMultiFinishedListener multiListener) {
    Object handler = null;/*from w  w w .  ja  v  a  2 s. c om*/
    try {
        handler = Class.forName("android.os.Handler").getConstructor().newInstance();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    flagStartAsync("consume");
    final Object finalHandler = handler;
    (new Thread(new Runnable() {
        public void run() {
            final List<IabResult> results = new ArrayList<IabResult>();
            for (Purchase purchase : purchases) {
                try {
                    consume(purchase);
                    results.add(new IabResult(BILLING_RESPONSE_RESULT_OK,
                            "Successful consume of sku " + purchase.getSku()));
                } catch (IabException ex) {
                    results.add(ex.getResult());
                }
            }

            flagEndAsync();
            if (!mDisposed && singleListener != null) {
                Class[] paramTypes = new Class[] { Runnable.class };
                try {
                    Method method = finalHandler.getClass().getMethod("post", paramTypes);

                    Object[] args = new Object[] { new Runnable() {
                        public void run() {
                            singleListener.onConsumeFinished(purchases.get(0), results.get(0));
                        }
                    } };

                    method.invoke(finalHandler, args);
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
            if (!mDisposed && multiListener != null) {
                Class[] paramTypes = new Class[] { Runnable.class };
                try {
                    Method method = finalHandler.getClass().getMethod("post", paramTypes);

                    Object[] args = new Object[] { new Runnable() {
                        public void run() {
                            multiListener.onConsumeMultiFinished(purchases, results);
                        }
                    } };

                    method.invoke(finalHandler, args);
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
        }
    })).start();
}

From source file:org.dataconservancy.dcs.access.server.MediciServiceImpl.java

public void init() throws ServletException {
    this.abdera = new Abdera();
    this.seadbuilder = new SeadXstreamStaxModelBuilder();
    this.util = new MediciUtil();
    String path = getServletContext().getRealPath("/sead_access/");

    try {//from w  w  w.  ja va 2  s .  c o  m
        this.provDao = new ProvenanceDAOJdbcImpl(path + "/Config.properties");
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:skoa.helpers.ConfiguracionGraficas.java

private void listarDGs() {
    File archivo = new File(ruta_lista2); //lista de Dgs.
    if (archivo.exists()) {
        //Si el archivo ya existe, se borra para pedir a la BD la lista actual.
        archivo.delete();//from  w w  w  .j a  v a2  s  .c om
    } else {
        try {
            archivo.createNewFile();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    //En vez de sacarla de un archivo, se debera sacar de la base de datos.
    Connection con;
    try {
        Class.forName("com.mysql.jdbc.Driver").newInstance();
        con = DriverManager.getConnection(url, user, pass);
        Statement st = con.createStatement();
        String accion = "select DG,DF into outfile '" + ruta_lista + "' from Dirs;";
        System.out.println(accion);

        st.executeQuery(accion);
        st.close();
        con.close();
    } catch (InstantiationException e1) {
        e1.printStackTrace();
    } catch (IllegalAccessException e1) {
        e1.printStackTrace();
    } catch (ClassNotFoundException e1) {
        e1.printStackTrace();
    } catch (SQLException e) {
        e.printStackTrace();
        //Warning en caso de que la BD no existiera.
        JOptionPane.showMessageDialog(new JFrame("AVISO"), "No existe la base de datos.", "AVISO", 2);
    }
    //Volvemos a abrir el fichero porque se ha creado nuevo.
    archivo = new File(ruta_lista2); //lista de Dgs.
    FileReader fr = null;
    BufferedReader linea = null;
    String line;
    try {
        fr = new FileReader(archivo);
        linea = new BufferedReader(fr);
        Vector<String> lista = new Vector<String>();
        lista.add("");
        while ((line = linea.readLine()) != null)
            lista.add(line); //Ordenar las DGs alfabeticamente
        Collections.sort(lista); //...
        //Como estn las DGs con sus correspondientes DFs, se ven juntas. Aadimos un espacio.
        Vector<String> lista2 = new Vector<String>();
        lista2.add(""); //Cabecera de la lista desplegable
        String aux = "";
        for (int i = 1; i < lista.size(); i++) {//empieza desde 1, porque en la posicion 0 esta "".
            aux = lista.elementAt(i).substring(0, 6) + "  " + lista.elementAt(i).substring(6);
            aux = aux.replaceAll("-", "/");
            lista2.add(aux);
        }
        //---------------------------
        listado = new JComboBox(lista2);
        listado.setEditable(true);
        listado.setSelectedIndex(0);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            if (null != fr)
                fr.close(); //Se cierra si todo va bien.
        } catch (Exception e2) { //Sino salta una excepcion.
            e2.printStackTrace();
        }
    }
    archivo.delete();
}

From source file:metabest.transformations.MetaModel2Use.java

private void serializeConstraints(BufferedWriter bw, List<AnnotatedElement> aes, Fragment baseFragment,
        int minDefaultRefs, int maxDefaultRefs, boolean addAttributes, boolean addReferences,
        boolean addContainees, boolean makeUnreachable) throws IOException {

    bw.write("\n\nconstraints\n");

    // serialize class constraints
    for (AnnotatedElement ae : aes) {
        try {/*www.j  a  va2 s. c om*/
            this.serializeElementConstraints(bw, ae);
        } catch (InstantiationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    // serialize default USE containment logics preventive constraints
    //serializeSelfReferenceConstraints(bw, mm.getClasses());
    serializeClassContainmentConstraints(bw, mm.getClasses());
    //serializeRefBoundsConstraints(bw, mm.getClasses(), minDefaultRefs, maxDefaultRefs);

    if (baseFragment != null) {
        //System.out.println("yo");
        serializeBaseFragmentConstraint(bw, baseFragment, addAttributes, addReferences, addContainees,
                makeUnreachable);
    }

    //serializeGeometryConstraints(bw, mm.getClasses());

}

From source file:org.kuali.kfs.module.purap.service.impl.PurapAccountingServiceImpl.java

/**
 * @see org.kuali.kfs.module.purap.service.PurapAccountingService#generateAccountDistributionForProration(java.util.List,
 *      org.kuali.rice.core.api.util.type.KualiDecimal, java.lang.Integer)
 *//*from  ww w.j  ava  2 s. c om*/
@Override
public List<PurApAccountingLine> generateAccountDistributionForProration(List<SourceAccountingLine> accounts,
        KualiDecimal totalAmount, Integer percentScale, Class clazz) {
    String methodName = "generateAccountDistributionForProration()";
    if (LOG.isDebugEnabled()) {
        LOG.debug(methodName + " started");
    }
    List<PurApAccountingLine> newAccounts = new ArrayList();

    if (totalAmount.isZero()) {
        throwRuntimeException(methodName,
                "Purchasing/Accounts Payable account distribution for proration does not allow zero dollar total.");
    }

    BigDecimal percentTotal = BigDecimal.ZERO;
    BigDecimal totalAmountBigDecimal = totalAmount.bigDecimalValue();
    for (SourceAccountingLine accountingLine : accounts) {
        KualiDecimal amt = KualiDecimal.ZERO;
        if (ObjectUtils.isNotNull(accountingLine.getAmount())) {
            amt = accountingLine.getAmount();
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug(methodName + " " + accountingLine.getAccountNumber() + " " + amt + "/"
                    + totalAmountBigDecimal);
        }
        BigDecimal pct = amt.bigDecimalValue().divide(totalAmountBigDecimal, percentScale,
                BIG_DECIMAL_ROUNDING_MODE);
        pct = pct.stripTrailingZeros().multiply(ONE_HUNDRED);

        if (LOG.isDebugEnabled()) {
            LOG.debug(methodName + " pct = " + pct + "  (trailing zeros removed)");
        }

        BigDecimal lowestPossible = this.getLowestPossibleRoundUpNumber();
        if (lowestPossible.compareTo(pct) <= 0) {
            PurApAccountingLine newAccountingLine;
            newAccountingLine = null;

            try {
                newAccountingLine = (PurApAccountingLine) clazz.newInstance();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }

            ObjectPopulationUtils.populateFromBaseClass(AccountingLineBase.class, accountingLine,
                    newAccountingLine, PurapConstants.KNOWN_UNCOPYABLE_FIELDS);
            newAccountingLine.setAccountLinePercent(pct);
            if (LOG.isDebugEnabled()) {
                LOG.debug(methodName + " adding " + newAccountingLine.getAccountLinePercent());
            }
            newAccounts.add(newAccountingLine);
            percentTotal = percentTotal.add(newAccountingLine.getAccountLinePercent());
            if (LOG.isDebugEnabled()) {
                LOG.debug(methodName + " total = " + percentTotal);
            }
        }
    }

    if ((percentTotal.compareTo(BigDecimal.ZERO)) == 0) {
        /*
         * This means there are so many accounts or so strange a distribution that we can't round properly... not sure of viable
         * solution
         */
        throwRuntimeException(methodName, "Can't round properly due to number of accounts");
    }

    // Now deal with rounding
    if ((ONE_HUNDRED.compareTo(percentTotal)) < 0) {
        /*
         * The total percent is greater than one hundred Here we find the account that occurs latest in our list with a percent
         * that is higher than the difference and we subtract off the difference
         */
        BigDecimal difference = percentTotal.subtract(ONE_HUNDRED);
        if (LOG.isDebugEnabled()) {
            LOG.debug(methodName + " Rounding up by " + difference);
        }

        boolean foundAccountToUse = false;
        int currentNbr = newAccounts.size() - 1;
        while (currentNbr >= 0) {
            PurApAccountingLine potentialSlushAccount = newAccounts.get(currentNbr);

            BigDecimal linePercent = BigDecimal.ZERO;
            if (ObjectUtils.isNotNull(potentialSlushAccount.getAccountLinePercent())) {
                linePercent = potentialSlushAccount.getAccountLinePercent();
            }

            if ((difference.compareTo(linePercent)) < 0) {
                // the difference amount is less than the current accounts percent... use this account
                // the 'potentialSlushAccount' technically is now the true 'Slush Account'
                potentialSlushAccount.setAccountLinePercent(linePercent.subtract(difference).movePointLeft(2)
                        .stripTrailingZeros().movePointRight(2));
                foundAccountToUse = true;
                break;
            }
            currentNbr--;
        }

        if (!foundAccountToUse) {
            /*
             * We could not find any account in our list where the percent of that account was greater than that of the
             * difference... doing so on just any account could result in a negative percent value
             */
            throwRuntimeException(methodName, "Can't round properly due to math calculation error");
        }

    } else if ((ONE_HUNDRED.compareTo(percentTotal)) > 0) {
        /*
         * The total percent is less than one hundred Here we find the last account in our list and add the remaining required
         * percent to its already calculated percent
         */
        BigDecimal difference = ONE_HUNDRED.subtract(percentTotal);
        if (LOG.isDebugEnabled()) {
            LOG.debug(methodName + " Rounding down by " + difference);
        }
        PurApAccountingLine slushAccount = newAccounts.get(newAccounts.size() - 1);

        BigDecimal slushLinePercent = BigDecimal.ZERO;
        if (ObjectUtils.isNotNull(slushAccount.getAccountLinePercent())) {
            slushLinePercent = slushAccount.getAccountLinePercent();
        }

        slushAccount.setAccountLinePercent(
                slushLinePercent.add(difference).movePointLeft(2).stripTrailingZeros().movePointRight(2));
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug(methodName + " ended");
    }
    return newAccounts;
}

From source file:org.apache.hadoop.hive.service.HSSessionItem.java

public String getPBTableModifiedTime(String DBName, String tableName) throws HiveServerException {
    l4j.info("get PB Table Modified Time of " + DBName + "::" + tableName);
    String modified_time = null;/*from   w  w w  .  j av a  2s.  c o m*/

    conf = SessionState.get().getConf();
    String url = conf.get("hive.metastore.pbjar.url", "jdbc:postgresql://10.136.130.102:5432/pbjar");
    String user = conf.get("hive.metastore.user", "tdw");
    String passwd = conf.get("hive.metastore.passwd", "tdw");
    String protoVersion = conf.get("hive.protobuf.version", "2.3.0");

    String driver = "org.postgresql.Driver";
    ResultSet rs = null;
    Connection connect = null;
    PreparedStatement ps = null;
    try {
        Class.forName(driver).newInstance();
    } catch (InstantiationException e2) {
        e2.printStackTrace();
    } catch (IllegalAccessException e2) {
        e2.printStackTrace();
    } catch (ClassNotFoundException e2) {
        e2.printStackTrace();
    }
    try {
        connect = DriverManager.getConnection(url, user, passwd);
        try {
            String processName = java.lang.management.ManagementFactory.getRuntimeMXBean().getName();
            String processID = processName.substring(0, processName.indexOf('@'));
            String appinfo = "getPBTableModifiedTime_" + processID + "_" + SessionState.get().getSessionName();
            connect.setClientInfo("ApplicationName", appinfo);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } catch (SQLException e2) {
        e2.printStackTrace();
    }
    try {
        ps = connect.prepareStatement("SELECT to_char(modified_time,'yyyymmddhh24miss') as modified_time "
                + " FROM pb_proto_jar WHERE db_name=? and tbl_name=? and protobuf_version=? order by modified_time desc limit 1");
    } catch (SQLException e1) {
        e1.printStackTrace();
    }
    try {
        ps.setString(1, DBName.toLowerCase());
    } catch (SQLException e1) {
        e1.printStackTrace();
    }
    try {
        ps.setString(2, tableName.toLowerCase());
        ps.setString(3, protoVersion);
    } catch (SQLException e1) {
        e1.printStackTrace();
    }
    try {
        l4j.info("select modifiedtime from tpg");
        rs = ps.executeQuery();
    } catch (SQLException e1) {
        e1.printStackTrace();
    }
    try {
        if (rs.next()) {
            modified_time = rs.getString("modified_time");
        } else {
            l4j.info("Can not find the modified_time of " + DBName + "::" + tableName + " in the tPG.");
        }
    } catch (SQLException e1) {
        e1.printStackTrace();
    }
    try {
        rs.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    try {
        ps.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return modified_time;
}

From source file:org.kuali.ole.module.purap.service.impl.PurapAccountingServiceImpl.java

/**
 * @see org.kuali.ole.module.purap.service.PurapAccountingService#generateAccountDistributionForProration(java.util.List,
 *      org.kuali.rice.kns.util.KualiDecimal, java.lang.Integer)
 *///w ww  . j a v  a2 s .  c  om
@Override
public List<PurApAccountingLine> generateAccountDistributionForProration(List<SourceAccountingLine> accounts,
        KualiDecimal totalAmount, Integer percentScale, Class clazz) {
    String methodName = "generateAccountDistributionForProration()";
    if (LOG.isDebugEnabled()) {
        LOG.debug(methodName + " started");
    }
    List<PurApAccountingLine> newAccounts = new ArrayList();

    if (totalAmount.isZero()) {
        throwRuntimeException(methodName,
                "Purchasing/Accounts Payable account distribution for proration does not allow zero dollar total.");
    }

    BigDecimal percentTotal = BigDecimal.ZERO;
    BigDecimal totalAmountBigDecimal = totalAmount.bigDecimalValue();
    for (SourceAccountingLine accountingLine : accounts) {
        KualiDecimal amt = KualiDecimal.ZERO;
        if (ObjectUtils.isNotNull(accountingLine.getAmount())) {
            amt = accountingLine.getAmount();
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug(methodName + " " + accountingLine.getAccountNumber() + " " + amt + "/"
                    + totalAmountBigDecimal);
        }
        BigDecimal pct = amt.bigDecimalValue().divide(totalAmountBigDecimal, percentScale,
                BIG_DECIMAL_ROUNDING_MODE);
        pct = pct.stripTrailingZeros().multiply(ONE_HUNDRED);

        if (LOG.isDebugEnabled()) {
            LOG.debug(methodName + " pct = " + pct + "  (trailing zeros removed)");
        }

        BigDecimal lowestPossible = this.getLowestPossibleRoundUpNumber();
        if (lowestPossible.compareTo(pct) <= 0) {
            PurApAccountingLine newAccountingLine;
            newAccountingLine = null;

            try {
                newAccountingLine = (PurApAccountingLine) clazz.newInstance();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }

            PurApObjectUtils.populateFromBaseClass(AccountingLineBase.class, accountingLine, newAccountingLine);
            newAccountingLine.setAccountLinePercent(pct);
            if (LOG.isDebugEnabled()) {
                LOG.debug(methodName + " adding " + newAccountingLine.getAccountLinePercent());
            }
            newAccounts.add(newAccountingLine);
            percentTotal = percentTotal.add(newAccountingLine.getAccountLinePercent());
            if (LOG.isDebugEnabled()) {
                LOG.debug(methodName + " total = " + percentTotal);
            }
        }
    }

    if ((percentTotal.compareTo(BigDecimal.ZERO)) == 0) {
        /*
         * This means there are so many accounts or so strange a distribution that we can't round properly... not sure of viable
         * solution
         */
        throwRuntimeException(methodName, "Can't round properly due to number of accounts");
    }

    // Now deal with rounding
    if ((ONE_HUNDRED.compareTo(percentTotal)) < 0) {
        /*
         * The total percent is greater than one hundred Here we find the account that occurs latest in our list with a percent
         * that is higher than the difference and we subtract off the difference
         */
        BigDecimal difference = percentTotal.subtract(ONE_HUNDRED);
        if (LOG.isDebugEnabled()) {
            LOG.debug(methodName + " Rounding up by " + difference);
        }

        boolean foundAccountToUse = false;
        int currentNbr = newAccounts.size() - 1;
        while (currentNbr >= 0) {
            PurApAccountingLine potentialSlushAccount = newAccounts.get(currentNbr);

            BigDecimal linePercent = BigDecimal.ZERO;
            if (ObjectUtils.isNotNull(potentialSlushAccount.getAccountLinePercent())) {
                linePercent = potentialSlushAccount.getAccountLinePercent();
            }

            if ((difference.compareTo(linePercent)) < 0) {
                // the difference amount is less than the current accounts percent... use this account
                // the 'potentialSlushAccount' technically is now the true 'Slush Account'
                potentialSlushAccount.setAccountLinePercent(linePercent.subtract(difference).movePointLeft(2)
                        .stripTrailingZeros().movePointRight(2));
                foundAccountToUse = true;
                break;
            }
            currentNbr--;
        }

        if (!foundAccountToUse) {
            /*
             * We could not find any account in our list where the percent of that account was greater than that of the
             * difference... doing so on just any account could result in a negative percent value
             */
            throwRuntimeException(methodName, "Can't round properly due to math calculation error");
        }

    } else if ((ONE_HUNDRED.compareTo(percentTotal)) > 0) {
        /*
         * The total percent is less than one hundred Here we find the last account in our list and add the remaining required
         * percent to its already calculated percent
         */
        BigDecimal difference = ONE_HUNDRED.subtract(percentTotal);
        if (LOG.isDebugEnabled()) {
            LOG.debug(methodName + " Rounding down by " + difference);
        }
        PurApAccountingLine slushAccount = newAccounts.get(newAccounts.size() - 1);

        BigDecimal slushLinePercent = BigDecimal.ZERO;
        if (ObjectUtils.isNotNull(slushAccount.getAccountLinePercent())) {
            slushLinePercent = slushAccount.getAccountLinePercent();
        }

        slushAccount.setAccountLinePercent(
                slushLinePercent.add(difference).movePointLeft(2).stripTrailingZeros().movePointRight(2));
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug(methodName + " ended");
    }
    return newAccounts;
}

From source file:com.mysql.stresstool.StressTool.java

@Deprecated
void createTestTables() {

    if (this.droptable && this.truncate) {
        this.truncate = false;
        System.out.println(/*from w ww  . ja  v a  2 s.c o  m*/
                "****============================================================================*******");
        System.out.println(
                "It is not advisable to do drop and truncate at the same time \nTRUNCATE will be resetted to false");
        System.out.println(
                "****============================================================================*******");
    }
    printReport();

    System.out.println(" output log = ");

    System.out.println(" STARTING ON = " + TimeTools.GetCurrent());

    if (dbType.equals("MySQL")) {
        RunnableQueryInsertInterface qth = null;
        try {
            qth = (RunnableQueryInsertInterface) Class.forName(insertDefaultClass).newInstance();
            HashMap connMapcoordinates = new HashMap();
            connMapcoordinates.put("jdbcUrl", connUrl);
            connMapcoordinates.put("dbType", dbType);
            connMapcoordinates.put("connectstring", connectString);
            connMapcoordinates.put("database", databaseDefault);
            qth.setJdbcUrl(connMapcoordinates);
            qth.setJdbcUrl(connMapcoordinates);
            qth.setSleepFor(sleepWrite);
            qth.setRepeatNumber(repeatNumber);
            qth.setDoLog(dolog);
            qth.setOperationShort(operationShort);
            qth.setDbType(dbType);
            qth.setDoDelete(doDelete);
            qth.setIgnoreBinlog(ignoreBinlog);
            qth.setEngine(tableEngine);
            qth.setIBatchInsert(iBatchInsert);
            qth.setUseBatchInsert(doBatch);
            qth.setDoSimplePk(doSimplePk);
            if (stressSettings.get("actionClass") != null) {
                qth.setClassConfiguration(stressSettings.get("actionClass"));
            }

            qth.createSchema(this);
            //            createMysql();
        } catch (InstantiationException e) {
            System.out.println(
                    "ERROR === CLASS defined in configuration invalid or not correctly loaded \n CLASS = "
                            + insertDefaultClass);
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            System.out.println(
                    "ERROR === CLASS defined in configuration invalid or not correctly loaded \n CLASS = "
                            + insertDefaultClass);
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            System.out.println(
                    "ERROR === CLASS defined in configuration invalid or not correctly loaded \n CLASS = "
                            + insertDefaultClass);
            e.printStackTrace();
        }
    } else
        createOracle();

}