IDEMPIERE-455 Discover and fix FindBugs problems / DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE

This commit is contained in:
Richard Morales 2013-04-09 15:49:25 -05:00
parent b0cacd74e0
commit e4476ec95c
46 changed files with 101 additions and 101 deletions

View File

@ -638,7 +638,7 @@ public class CalloutInvoice extends CalloutEngine
// Repeat Discount calc
if (PriceList.intValue() != 0)
{
Discount = new BigDecimal ((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0);
Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0);
if (Discount.scale () > 2)
Discount = Discount.setScale (2, BigDecimal.ROUND_HALF_UP);
// mTab.setValue ("Discount", Discount);

View File

@ -1111,7 +1111,7 @@ public class CalloutOrder extends CalloutEngine
if (mField.getColumnName().equals("Discount"))
{
if ( PriceList.doubleValue() != 0 )
PriceActual = new BigDecimal ((100.0 - Discount.doubleValue()) / 100.0 * PriceList.doubleValue());
PriceActual = BigDecimal.valueOf((100.0 - Discount.doubleValue()) / 100.0 * PriceList.doubleValue());
if (PriceActual.scale() > StdPrecision)
PriceActual = PriceActual.setScale(StdPrecision, BigDecimal.ROUND_HALF_UP);
PriceEntered = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
@ -1127,7 +1127,7 @@ public class CalloutOrder extends CalloutEngine
if (PriceList.intValue() == 0)
Discount = Env.ZERO;
else
Discount = new BigDecimal ((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0);
Discount = BigDecimal.valueOf((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0);
if (Discount.scale() > 2)
Discount = Discount.setScale(2, BigDecimal.ROUND_HALF_UP);
mTab.setValue("Discount", Discount);
@ -1155,7 +1155,7 @@ public class CalloutOrder extends CalloutEngine
// Repeat Discount calc
if (PriceList.intValue() != 0)
{
Discount = new BigDecimal ((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0);
Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0);
if (Discount.scale () > 2)
Discount = Discount.setScale (2, BigDecimal.ROUND_HALF_UP);
mTab.setValue ("Discount", Discount);

View File

@ -222,12 +222,12 @@ public class SalesOrderRateInquiryProcess extends SvrProcess
}
MShipperPackaging sp = new MShipperPackaging(ctx, M_ShipperPackaging_ID, trxName);
BigDecimal WeightPerPackage = sp.getWeight().multiply(isPound ? new BigDecimal(2.20462) : BigDecimal.ONE);
BigDecimal WeightPerPackage = sp.getWeight().multiply(isPound ? BigDecimal.valueOf(2.20462) : BigDecimal.ONE);
if (WeightPerPackage == null || WeightPerPackage.compareTo(BigDecimal.ZERO) == 0)
{
BigDecimal defaultWeightPerPackage = new BigDecimal(MSysConfig.getDoubleValue(MSysConfig.SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE, 30));
WeightPerPackage = defaultWeightPerPackage.multiply(isPound ? new BigDecimal(2.20462) : BigDecimal.ONE);
BigDecimal defaultWeightPerPackage = BigDecimal.valueOf(MSysConfig.getDoubleValue(MSysConfig.SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE, 30));
WeightPerPackage = defaultWeightPerPackage.multiply(isPound ? BigDecimal.valueOf(2.20462) : BigDecimal.ONE);
}
BigDecimal CODAmount = m_order.getGrandTotal();

View File

@ -97,9 +97,9 @@ class Base
listThreads();
//
System.out.println("API Test");
System.out.println("64.72=" + MConversionRate.convert(ctx, new BigDecimal(100.0), 116, 100,0,0));
System.out.println("64.72=" + MConversionRate.convert(ctx, BigDecimal.valueOf(100.0), 116, 100,0,0));
System.out.println("0.647169=" + MConversionRate.getRate(116, 100, null, 0,0,0));
System.out.println("12.5=" + MUOMConversion.convert(101, 102, new BigDecimal(100.0), true));
System.out.println("12.5=" + MUOMConversion.convert(101, 102, BigDecimal.valueOf(100.0), true));
} // Base

View File

@ -594,7 +594,7 @@ public class Doc_AllocationHdr extends Doc
Doc_Invoice docInvoice = (Doc_Invoice)Doc.get(as,
MInvoice.Table_ID, invoice.getC_Invoice_ID(), getTrxName());
docInvoice.loadDocumentDetails();
allocationAccounted = docInvoice.createFactCash(as, fact, new BigDecimal(percent));
allocationAccounted = docInvoice.createFactCash(as, fact, BigDecimal.valueOf(percent));
if (log.isLoggable(Level.CONFIG)) log.config("Allocation Accounted=" + allocationAccounted);
// Cash Based Commitment Release
@ -604,7 +604,7 @@ public class Doc_AllocationHdr extends Doc
for (int i = 0; i < lines.length; i++)
{
Fact factC = Doc_Order.getCommitmentRelease(as, this,
lines[i].getQtyInvoiced(), lines[i].getC_InvoiceLine_ID(), new BigDecimal(percent));
lines[i].getQtyInvoiced(), lines[i].getC_InvoiceLine_ID(), BigDecimal.valueOf(percent));
if (factC == null)
return null;
m_facts.add(factC);
@ -780,7 +780,7 @@ public class Doc_AllocationHdr extends Doc
// percent of total payment
double multiplier = allocationSource.doubleValue() / invoiceSource.doubleValue();
// Reduce Orig Invoice Accounted
invoiceAccounted = invoiceAccounted.multiply(new BigDecimal(multiplier));
invoiceAccounted = invoiceAccounted.multiply(BigDecimal.valueOf(multiplier));
// Difference based on percentage of Orig Invoice
acctDifference = invoiceAccounted.subtract(allocationAccounted); // gain is negative
// ignore Tolerance

View File

@ -105,7 +105,7 @@ public class Doc_Requisition extends Doc
*/
public BigDecimal getBalance ()
{
BigDecimal retValue = new BigDecimal (0.0);
BigDecimal retValue = BigDecimal.valueOf(0.0);
return retValue;
} // getBalance

View File

@ -486,7 +486,7 @@ public final class ImpFormatRow
return "0";
BigDecimal bd = new BigDecimal(sb.toString());
if (m_divideBy100) // assumed two decimal scale
bd = bd.divide(new BigDecimal(100.0), 2, BigDecimal.ROUND_HALF_UP);
bd = bd.divide(BigDecimal.valueOf(100.0), 2, BigDecimal.ROUND_HALF_UP);
return bd.toString();
} // parseNumber

View File

@ -250,7 +250,7 @@ public class CalloutEngine implements Callout
BigDecimal rate1 = (BigDecimal)value;
BigDecimal rate2 = Env.ZERO;
BigDecimal one = new BigDecimal(1.0);
BigDecimal one = BigDecimal.valueOf(1.0);
if (rate1.doubleValue() != 0.0) // no divide by zero
rate2 = one.divide(rate1, 12, BigDecimal.ROUND_HALF_UP);

View File

@ -334,7 +334,7 @@ public class MConversionRate extends X_C_Conversion_Rate
{
super.setMultiplyRate(MultiplyRate);
double dd = 1 / MultiplyRate.doubleValue();
super.setDivideRate(new BigDecimal(dd));
super.setDivideRate(BigDecimal.valueOf(dd));
}
} // setMultiplyRate
@ -356,7 +356,7 @@ public class MConversionRate extends X_C_Conversion_Rate
{
super.setDivideRate(DivideRate);
double dd = 1 / DivideRate.doubleValue();
super.setMultiplyRate(new BigDecimal(dd));
super.setMultiplyRate(BigDecimal.valueOf(dd));
}
} // setDivideRate

View File

@ -1482,7 +1482,7 @@ public class MCost extends X_M_Cost
//amount must follow the sign of qty
if (amt.signum() != 0 && amt.signum() != qty.signum())
{
amt = amt.multiply(new BigDecimal(-1.00d));
amt = amt.multiply(BigDecimal.valueOf(-1.00d));
}
if (getCurrentQty().add(qty).signum() < 0)

View File

@ -337,7 +337,7 @@ public class MDepreciation extends X_A_Depreciation
BigDecimal coef_sl = BigDecimal.ONE.divide(new BigDecimal(A_Life_Year), getPrecision() + 2, RoundingMode.DOWN);
/** Degressive damping coefficient for one year = one-year linear depreciation * coeficient K */
//BigDecimal coef_ad1 = coef_sl.multiply(coef_K); //commented by @win
BigDecimal coef_ad1 = coef_sl.multiply(new BigDecimal(2.0)); //added by @win
BigDecimal coef_ad1 = coef_sl.multiply(BigDecimal.valueOf(2.0)); //added by @win
/** AD2 */
//~ BigDecimal DUR = BD_100.multiply(

View File

@ -195,57 +195,57 @@ public class MGoal extends X_PA_Goal
if (MeasureScope.equals(MEASURESCOPE_Year))
{
if (MeasureDisplay.equals(MEASUREDISPLAY_Quarter))
Multiplier = new BigDecimal(1.0/4.0);
Multiplier = BigDecimal.valueOf(1.0/4.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Month))
Multiplier = new BigDecimal(1.0/12.0);
Multiplier = BigDecimal.valueOf(1.0/12.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Week))
Multiplier = new BigDecimal(1.0/52.0);
Multiplier = BigDecimal.valueOf(1.0/52.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Day))
Multiplier = new BigDecimal(1.0/364.0);
Multiplier = BigDecimal.valueOf(1.0/364.0);
}
else if (MeasureScope.equals(MEASURESCOPE_Quarter))
{
if (MeasureDisplay.equals(MEASUREDISPLAY_Year))
Multiplier = new BigDecimal(4.0);
Multiplier = BigDecimal.valueOf(4.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Month))
Multiplier = new BigDecimal(1.0/3.0);
Multiplier = BigDecimal.valueOf(1.0/3.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Week))
Multiplier = new BigDecimal(1.0/13.0);
Multiplier = BigDecimal.valueOf(1.0/13.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Day))
Multiplier = new BigDecimal(1.0/91.0);
Multiplier = BigDecimal.valueOf(1.0/91.0);
}
else if (MeasureScope.equals(MEASURESCOPE_Month))
{
if (MeasureDisplay.equals(MEASUREDISPLAY_Year))
Multiplier = new BigDecimal(12.0);
Multiplier = BigDecimal.valueOf(12.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Quarter))
Multiplier = new BigDecimal(3.0);
Multiplier = BigDecimal.valueOf(3.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Week))
Multiplier = new BigDecimal(1.0/4.0);
Multiplier = BigDecimal.valueOf(1.0/4.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Day))
Multiplier = new BigDecimal(1.0/30.0);
Multiplier = BigDecimal.valueOf(1.0/30.0);
}
else if (MeasureScope.equals(MEASURESCOPE_Week))
{
if (MeasureDisplay.equals(MEASUREDISPLAY_Year))
Multiplier = new BigDecimal(52.0);
Multiplier = BigDecimal.valueOf(52.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Quarter))
Multiplier = new BigDecimal(13.0);
Multiplier = BigDecimal.valueOf(13.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Month))
Multiplier = new BigDecimal(4.0);
Multiplier = BigDecimal.valueOf(4.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Day))
Multiplier = new BigDecimal(1.0/7.0);
Multiplier = BigDecimal.valueOf(1.0/7.0);
}
else if (MeasureScope.equals(MEASURESCOPE_Day))
{
if (MeasureDisplay.equals(MEASUREDISPLAY_Year))
Multiplier = new BigDecimal(364.0);
Multiplier = BigDecimal.valueOf(364.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Quarter))
Multiplier = new BigDecimal(91.0);
Multiplier = BigDecimal.valueOf(91.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Month))
Multiplier = new BigDecimal(30.0);
Multiplier = BigDecimal.valueOf(30.0);
else if (MeasureDisplay.equals(MEASUREDISPLAY_Week))
Multiplier = new BigDecimal(7.0);
Multiplier = BigDecimal.valueOf(7.0);
}
return Multiplier;
} // getMultiplier

View File

@ -210,9 +210,9 @@ public class MJournalLine extends X_GL_JournalLine
}
if (rateDR != 0)
setCurrencyRate(new BigDecimal(rateDR));
setCurrencyRate(BigDecimal.valueOf(rateDR));
if (rateCR != 0)
setCurrencyRate(new BigDecimal(rateCR));
setCurrencyRate(BigDecimal.valueOf(rateCR));
} // setAmtAcct

View File

@ -131,7 +131,7 @@ public class MLandedCostAllocation extends X_C_LandedCostAllocation
*/
public void setAmt (double Amt, int precision)
{
BigDecimal bd = new BigDecimal(Amt);
BigDecimal bd = BigDecimal.valueOf(Amt);
if (bd.scale() > precision)
bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP);
super.setAmt(bd);

View File

@ -799,7 +799,7 @@ public class MProductPricing
{
BigDecimal Discount = Env.ZERO;
if (m_PriceList.intValue() != 0)
Discount = new BigDecimal ((m_PriceList.doubleValue() - m_PriceStd.doubleValue())
Discount = BigDecimal.valueOf((m_PriceList.doubleValue() - m_PriceStd.doubleValue())
/ m_PriceList.doubleValue() * 100.0);
if (Discount.scale() > 2)
Discount = Discount.setScale(2, BigDecimal.ROUND_HALF_UP);

View File

@ -48,7 +48,7 @@ public class MResourceAssignment extends X_S_ResourceAssignment
if (S_ResourceAssignment_ID == 0)
{
setAssignDateFrom(new Timestamp(System.currentTimeMillis()));
setQty(new BigDecimal(1.0));
setQty(BigDecimal.valueOf(1.0));
setName(".");
setIsConfirmed(false);
}

View File

@ -909,7 +909,7 @@ public abstract class PO
long mili = ts.getTime();
int nano = ts.getNanos();
double doublets = Double.parseDouble(Long.toString(mili) + "." + Integer.toString(nano));
BigDecimal bdtimestamp = new BigDecimal(doublets);
BigDecimal bdtimestamp = BigDecimal.valueOf(doublets);
set_Value("ProcessedOn", bdtimestamp);
}
}

View File

@ -238,7 +238,7 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat
{
BigDecimal retValue = super.getHdrStroke();
if (retValue == null || Env.ZERO.compareTo(retValue) <= 0)
retValue = new BigDecimal (2.0);
retValue = BigDecimal.valueOf(2.0);
return retValue;
} // getHdrStroke
@ -486,7 +486,7 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat
{
BigDecimal retValue = super.getLineStroke();
if (retValue == null || Env.ZERO.compareTo(retValue) <= 0)
retValue = new BigDecimal (1.0);
retValue = BigDecimal.valueOf(1.0);
return retValue;
} // getLineStroke
@ -498,7 +498,7 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat
{
BigDecimal retValue = super.getLineStroke();
if (retValue == null || Env.ZERO.compareTo(retValue) <= 0)
retValue = new BigDecimal (1.0);
retValue = BigDecimal.valueOf(1.0);
return retValue;
} // getVLineStroke

View File

@ -126,7 +126,7 @@ public class PrintDataElement implements Serializable
if (m_value instanceof BigDecimal)
return (BigDecimal)m_value;
if (m_value instanceof Number)
return new BigDecimal(((Number)m_value).doubleValue());
return BigDecimal.valueOf(((Number)m_value).doubleValue());
// Boolean - return 1 for true 0 for false
if (m_value instanceof Boolean)

View File

@ -148,7 +148,7 @@ public class PrintDataFunction
return variance;
}
// Standard Deviation
BigDecimal deviation = new BigDecimal(Math.sqrt(variance.doubleValue()));
BigDecimal deviation = BigDecimal.valueOf(Math.sqrt(variance.doubleValue()));
if (deviation.scale() > 4)
deviation = deviation.setScale(4, BigDecimal.ROUND_HALF_UP);
return deviation;

View File

@ -76,7 +76,7 @@ public class RModelData
private ArrayList<Boolean> m_groupRowsIndicator = null;
/** Constant 1 */
private static final BigDecimal ONE = new BigDecimal(1.0);
private static final BigDecimal ONE = BigDecimal.valueOf(1.0);
/** Logger */
private static CLogger log = CLogger.getCLogger(RModelData.class);

View File

@ -475,7 +475,7 @@ boolean jedinceBezBroja) {
amount = amount.replaceAll (",", "");
Double iznos = Double.parseDouble(amount);
sb.append (slovimaUValuti (new BigDecimal(Double.valueOf(iznos))));
sb.append (slovimaUValuti (BigDecimal.valueOf(Double.valueOf(iznos))));
return sb.toString ();
} // getAmtInWords

View File

@ -1777,11 +1777,11 @@ public final class Env
*/
/** Big Decimal 0 */
static final public BigDecimal ZERO = new BigDecimal(0.0);
static final public BigDecimal ZERO = BigDecimal.valueOf(0.0);
/** Big Decimal 1 */
static final public BigDecimal ONE = new BigDecimal(1.0);
static final public BigDecimal ONE = BigDecimal.valueOf(1.0);
/** Big Decimal 100 */
static final public BigDecimal ONEHUNDRED = new BigDecimal(100.0);
static final public BigDecimal ONEHUNDRED = BigDecimal.valueOf(100.0);
/** New Line */
public static final String NL = System.getProperty("line.separator");

View File

@ -375,7 +375,7 @@ public final class WebUtil
if (oo instanceof BigDecimal)
return (BigDecimal)oo;
else if (oo instanceof Number)
return new BigDecimal (((Number)oo).doubleValue());
return BigDecimal.valueOf(((Number)oo).doubleValue());
return new BigDecimal (oo.toString());
}
catch (Exception e)

View File

@ -534,7 +534,7 @@ public class GLJournalGenerate extends SvrProcess
sourceAmt = sourceAmt.multiply(amtMultiplier, MathContext.UNLIMITED);
if (roundFactor < 0) {
BigDecimal divisor = new BigDecimal(Math.pow(10, -roundFactor));
BigDecimal divisor = BigDecimal.valueOf(Math.pow(10, -roundFactor));
sourceAmt = sourceAmt.divide(divisor, MathContext.UNLIMITED);
sourceAmt = sourceAmt.setScale(0, BigDecimal.ROUND_HALF_UP);
sourceAmt = sourceAmt.multiply(divisor, MathContext.UNLIMITED);

View File

@ -28,26 +28,26 @@ public class CalloutA_Depreciation_Workfile extends CalloutEngine
BigDecimal uselife = null;
if (MDepreciationWorkfile.COLUMNNAME_UseLifeYears.equals(mField.getColumnName()))
{
uselife = new BigDecimal(value.toString()).multiply(new BigDecimal(12.0));
uselife = new BigDecimal(value.toString()).multiply(BigDecimal.valueOf(12.0));
mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeYears_F, value);
mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeMonths, uselife);
mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeMonths_F, uselife);
} else if (MDepreciationWorkfile.COLUMNNAME_UseLifeMonths.equals(mField.getColumnName()))
{
uselife = new BigDecimal(value.toString()).divide(new BigDecimal(12.0));
uselife = new BigDecimal(value.toString()).divide(BigDecimal.valueOf(12.0));
mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeYears, uselife);
mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeYears_F, uselife);
mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeMonths_F, value);
} else if (MDepreciationWorkfile.COLUMNNAME_UseLifeYears_F.equals(mField.getColumnName()))
{
uselife = new BigDecimal(value.toString()).multiply(new BigDecimal(12.0));
uselife = new BigDecimal(value.toString()).multiply(BigDecimal.valueOf(12.0));
mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeMonths_F, uselife);
} else if (MDepreciationWorkfile.COLUMNNAME_UseLifeMonths_F.equals(mField.getColumnName()))
{
uselife = new BigDecimal(value.toString()).divide(new BigDecimal(12.0));
uselife = new BigDecimal(value.toString()).divide(BigDecimal.valueOf(12.0));
mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeYears_F, uselife);
}

View File

@ -710,12 +710,12 @@ public final class AMenu extends CFrame
memoryBar.setMaximum((int)total);
memoryBar.setValue((int)used);
String msg = MessageFormat.format("{0,number,integer} MB - {1,number,integer}%",
new Object[] {new BigDecimal(total / 1024), new BigDecimal(percent)});
new Object[] {BigDecimal.valueOf(total / 1024), BigDecimal.valueOf(percent)});
memoryBar.setString(msg);
//
// msg = MessageFormat.format("Total Memory {0,number,integer} kB - Free {1,number,integer} kB",
msg = Msg.getMsg(m_ctx, "MemoryInfo",
new Object[] {new BigDecimal(total), new BigDecimal(free)});
new Object[] {BigDecimal.valueOf(total), BigDecimal.valueOf(free)});
memoryBar.setToolTipText(msg);
// progressBar.repaint();

View File

@ -394,7 +394,7 @@ public class VAllocation extends Allocation
private void setAllocateButton() {
if (totalDiff.compareTo(new BigDecimal(0.0)) == 0 ^ m_C_Charge_ID > 0 )
if (totalDiff.compareTo(BigDecimal.valueOf(0.0)) == 0 ^ m_C_Charge_ID > 0 )
{
allocateButton.setEnabled(true);
// chargePick.setValue(m_C_Charge_ID);
@ -404,7 +404,7 @@ public class VAllocation extends Allocation
allocateButton.setEnabled(false);
}
if ( totalDiff.compareTo(new BigDecimal(0.0)) == 0 )
if ( totalDiff.compareTo(BigDecimal.valueOf(0.0)) == 0 )
{
chargePick.setValue(null);
m_C_Charge_ID = 0;

View File

@ -320,7 +320,7 @@ implements FormPanel, ActionListener, TableModelListener, VetoableChangeListener
public void calculateSelection()
{
m_noSelected = 0;
BigDecimal selectedAmt = new BigDecimal(0.0);
BigDecimal selectedAmt = BigDecimal.valueOf(0.0);
int rows = miniTable.getRowCount();
for (int i = 0; i < rows; i++)

View File

@ -442,7 +442,7 @@ public class VMatch extends Match
}
// Display To be Matched Qty
m_xMatched = new BigDecimal (qty);
m_xMatched = BigDecimal.valueOf(qty);
xMatched.setValue(m_xMatched);
xMatchedTo.setValue(Env.ZERO);
difference.setValue(m_xMatched);
@ -494,7 +494,7 @@ public class VMatch extends Match
}
}
// update quantities
m_xMatchedTo = new BigDecimal(qty);
m_xMatchedTo = BigDecimal.valueOf(qty);
xMatchedTo.setValue(m_xMatchedTo);
difference.setValue(m_xMatched.subtract(m_xMatchedTo));
bProcess.setEnabled(noRows != 0);

View File

@ -282,7 +282,7 @@ public class InvoiceHistory extends CDialog
double priceList = rs.getDouble(3);
double priceActual = rs.getDouble(2);
if (priceList != 0) {
discountBD = new BigDecimal((priceList - priceActual)/priceList * 100);
discountBD = BigDecimal.valueOf((priceList - priceActual)/priceList * 100);
// Rounding:
int precision = MPriceList.getStandardPrecision(Env.getCtx(), rs.getInt(9));
if (discountBD.scale() > precision)

View File

@ -96,7 +96,7 @@ public final class Calculator extends CDialog
//
m_number = number;
if (m_number == null)
m_number = new BigDecimal(0.0);
m_number = BigDecimal.valueOf(0.0);
//
try
{
@ -433,7 +433,7 @@ public final class Calculator extends CDialog
// nothing or zero
if (m_display == null || m_display.equals("") || m_display.equals("0"))
{
m_number = new BigDecimal(0.0);
m_number = BigDecimal.valueOf(0.0);
return m_number;
}
@ -448,7 +448,7 @@ public final class Calculator extends CDialog
token += st.nextToken();
else
{
m_number = new BigDecimal(0.0);
m_number = BigDecimal.valueOf(0.0);
return m_number;
}
}
@ -462,7 +462,7 @@ public final class Calculator extends CDialog
catch (ParseException pe1)
{
log.log(Level.SEVERE, "Calculator.evaluate - token: " + token, pe1);
m_number = new BigDecimal(0.0);
m_number = BigDecimal.valueOf(0.0);
return m_number;
}
BigDecimal firstNo = new BigDecimal(firstNumber.toString());
@ -485,7 +485,7 @@ public final class Calculator extends CDialog
char op = token.charAt(0);
if (op == '%') {
firstNo = firstNo.divide(new BigDecimal(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
firstNo = firstNo.divide(BigDecimal.valueOf(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
m_number = firstNo;
}
@ -502,7 +502,7 @@ public final class Calculator extends CDialog
catch (ParseException pe2)
{
log.log(Level.SEVERE, "Calculator.evaluate - token: " + token, pe2);
m_number = new BigDecimal(0.0);
m_number = BigDecimal.valueOf(0.0);
return m_number;
}
BigDecimal secondNo = new BigDecimal(secondNumber.toString());
@ -523,7 +523,7 @@ public final class Calculator extends CDialog
// Percent operation
if (op2 == '%')
secondNo = secondNo.divide(new BigDecimal(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
secondNo = secondNo.divide(BigDecimal.valueOf(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
switch (op)
{

View File

@ -220,14 +220,14 @@ public final class MDocNumber extends PlainDocument
else
{
String value = getText();
BigDecimal percentValue = new BigDecimal(0.0);
BigDecimal percentValue = BigDecimal.valueOf(0.0);
try
{
if (value != null && value.length() > 0)
{
Number number = m_format.parse(value);
percentValue = new BigDecimal (number.toString());
percentValue = percentValue.divide(new BigDecimal(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
percentValue = percentValue.divide(BigDecimal.valueOf(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
m_tc.setText(m_format.format(percentValue));
}
}

View File

@ -340,7 +340,7 @@ public class VColor extends CButton
setColor (cc.getTextureTaintColor(), true);
// URL url = cc.getTextureURL();
// m_mTab.setValue("AD_Image_ID");
m_mTab.setValue("ImageAlpha", new BigDecimal(cc.getTextureCompositeAlpha()));
m_mTab.setValue("ImageAlpha", BigDecimal.valueOf(cc.getTextureCompositeAlpha()));
}
m_cc = cc;
} // actionPerformed

View File

@ -667,12 +667,12 @@ public final class VNumber extends JComponent
if (bd.doubleValue() < m_minValue)
{
error = oo + " < " + m_minValue;
oo = new BigDecimal(m_minValue);
oo = BigDecimal.valueOf(m_minValue);
}
else if (bd.doubleValue() > m_maxValue)
{
error = oo + " > " + m_maxValue;
oo = new BigDecimal(m_maxValue);
oo = BigDecimal.valueOf(m_maxValue);
}
}
if (error != null)
@ -717,7 +717,7 @@ public final class VNumber extends JComponent
DecimalFormat format, int displayType, String title, char operator)
{
if (log.isLoggable(Level.CONFIG)) log.config("Value=" + value);
BigDecimal startValue = new BigDecimal(0.0);
BigDecimal startValue = BigDecimal.valueOf(0.0);
try
{
if (value != null && value.length() > 0)

View File

@ -485,7 +485,7 @@ public class WAllocation extends Allocation
} // vetoableChange
private void setAllocateButton() {
if (totalDiff.compareTo(new BigDecimal(0.0)) == 0 ^ m_C_Charge_ID > 0 )
if (totalDiff.compareTo(BigDecimal.valueOf(0.0)) == 0 ^ m_C_Charge_ID > 0 )
{
allocateButton.setEnabled(true);
// chargePick.setValue(m_C_Charge_ID);
@ -495,7 +495,7 @@ public class WAllocation extends Allocation
allocateButton.setEnabled(false);
}
if ( totalDiff.compareTo(new BigDecimal(0.0)) == 0 )
if ( totalDiff.compareTo(BigDecimal.valueOf(0.0)) == 0 )
{
chargePick.setValue(null);
m_C_Charge_ID = 0;

View File

@ -334,7 +334,7 @@ implements IFormController, EventListener<Event>, WTableModelListener, ValueChan
public void calculateSelection()
{
m_noSelected = 0;
BigDecimal selectedAmt = new BigDecimal(0.0);
BigDecimal selectedAmt = BigDecimal.valueOf(0.0);
int rows = miniTable.getRowCount();
for (int i = 0; i < rows; i++)

View File

@ -472,7 +472,7 @@ public class WMatch extends Match
xMatchedToTable = (WListbox) cmd_searchTo(xMatchedTable, xMatchedToTable, displayString, matchToType, sameBPartner.isSelected(), sameProduct.isSelected(), sameQty.isSelected(), matchMode.getSelectedIndex() == MODE_MATCHED);
}
// Display To be Matched Qty
m_xMatched = new BigDecimal (qty);
m_xMatched = BigDecimal.valueOf(qty);
xMatched.setValue(m_xMatched);
xMatchedTo.setValue(Env.ZERO);
difference.setValue(m_xMatched);
@ -528,7 +528,7 @@ public class WMatch extends Match
}
}
// update qualtities
m_xMatchedTo = new BigDecimal(qty);
m_xMatchedTo = BigDecimal.valueOf(qty);
xMatchedTo.setValue(m_xMatchedTo);
difference.setValue(m_xMatched.subtract(m_xMatchedTo));
bProcess.setEnabled(noRows != 0);

View File

@ -530,7 +530,7 @@ public class WGraph extends Div implements IdSpace {
td = new Td();
td.setSclass("pa-tdvalue");
tr.appendChild(td);
BigDecimal value = new BigDecimal(bgc.getValue());
BigDecimal value = BigDecimal.valueOf(bgc.getValue());
if (bgc.getMQuery(builder.getMGoal()) != null) {
A a = new A();
a.setSclass("pa-hrefNode");

View File

@ -123,7 +123,7 @@ public class NumberBox extends Div
else if (value instanceof BigDecimal)
decimalBox.setValue((BigDecimal) value);
else if (value instanceof Number)
decimalBox.setValue(new BigDecimal(((Number)value).doubleValue()));
decimalBox.setValue(BigDecimal.valueOf(((Number)value).doubleValue()));
else
decimalBox.setValue(new BigDecimal(value.toString()));
}

View File

@ -209,7 +209,7 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
else if (value instanceof BigDecimal)
oldValue = (BigDecimal) value;
else if (value instanceof Number)
oldValue = new BigDecimal(((Number)value).doubleValue());
oldValue = BigDecimal.valueOf(((Number)value).doubleValue());
else
oldValue = new BigDecimal(value.toString());
getComponent().setValue(oldValue);

View File

@ -316,7 +316,7 @@ public class InvoiceHistory extends Window implements EventListener<Event>
double priceList = rs.getDouble(3);
double priceActual = rs.getDouble(2);
if (priceList != 0) {
discountBD = new BigDecimal((priceList - priceActual)/priceList * 100);
discountBD = BigDecimal.valueOf((priceList - priceActual)/priceList * 100);
// Rounding:
int precision = MPriceList.getStandardPrecision(Env.getCtx(), rs.getInt(9));
if (discountBD.scale() > precision)

View File

@ -524,7 +524,7 @@ public class InfoSchedule extends Window implements EventListener<Event>
ma.setS_Resource_ID(S_Resource_ID);
ma.setAssignDateFrom(start);
ma.setQty(new BigDecimal(hours));
ma.setQty(BigDecimal.valueOf(hours));
if (m_parent == null || m_callback == null) {
final boolean createNew = true;
if (vad != null && vad.getPage() != null)
@ -569,7 +569,7 @@ public class InfoSchedule extends Window implements EventListener<Event>
MResourceAssignment ma = slot.getMAssignment();
ma.setAssignDateFrom(start);
ma.setQty(new BigDecimal(hours));
ma.setQty(BigDecimal.valueOf(hours));
if (m_parent == null || m_callback == null) {
if (event.getBeginDate() != null && event.getEndDate() != null) {

View File

@ -53,9 +53,9 @@ public class Allocation
public int m_C_BPartner_ID = 0;
private int m_noInvoices = 0;
private int m_noPayments = 0;
public BigDecimal totalInv = new BigDecimal(0.0);
public BigDecimal totalPay = new BigDecimal(0.0);
public BigDecimal totalDiff = new BigDecimal(0.0);
public BigDecimal totalInv = BigDecimal.valueOf(0.0);
public BigDecimal totalPay = BigDecimal.valueOf(0.0);
public BigDecimal totalDiff = BigDecimal.valueOf(0.0);
public Timestamp allocDate = null;
@ -548,7 +548,7 @@ public class Allocation
log.config("");
// Payment
totalPay = new BigDecimal(0.0);
totalPay = BigDecimal.valueOf(0.0);
int rows = payment.getRowCount();
m_noPayments = 0;
for (int i = 0; i < rows; i++)
@ -571,7 +571,7 @@ public class Allocation
public String calculateInvoice(IMiniTable invoice, boolean isMultiCurrency)
{
// Invoices
totalInv = new BigDecimal(0.0);
totalInv = BigDecimal.valueOf(0.0);
int rows = invoice.getRowCount();
m_noInvoices = 0;

View File

@ -206,7 +206,7 @@ public class Match
// Create it
String innerTrxName = Trx.createTrxName("Match");
Trx innerTrx = Trx.get(innerTrxName, true);
if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, new BigDecimal(qty), innerTrxName))
if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, BigDecimal.valueOf(qty), innerTrxName))
innerTrx.commit();
else
innerTrx.rollback();

View File

@ -61,7 +61,7 @@ public class PaySelect
/** Format */
public DecimalFormat m_format = DisplayType.getNumberFormat(DisplayType.Amount);
/** Bank Balance */
private BigDecimal m_bankBalance = new BigDecimal(0.0);
private BigDecimal m_bankBalance = BigDecimal.valueOf(0.0);
/** SQL for Query */
private String m_sql;
/** Number of selected rows */
@ -379,7 +379,7 @@ public class PaySelect
public String calculateSelection(IMiniTable miniTable)
{
m_noSelected = 0;
BigDecimal invoiceAmt = new BigDecimal(0.0);
BigDecimal invoiceAmt = BigDecimal.valueOf(0.0);
int rows = miniTable.getRowCount();
for (int i = 0; i < rows; i++)