Win2k sp2, jdk1.3.1, idea #604

Still here in #604.

Here is an example. Note that there are three "value"s to change and 
they are changed different.

Just in case, I send my config/options dir as an attachment.

--------------------------------------------------------------
Original example
--------------------------------------------------------------

package pt.keysoft.ztest;
import java.math.BigDecimal;

public class TestBug {

/**
 * Convert a String to a Number.
 * <p>
 * TODO: another method that uses DecimalFormat and the current
 * dfs symbols to determine what is the decimal point
 * TODO: return an appropriate Integer/Long/BigInteger as necessary
 *
 * @param value to convert
 * @return a BigDecimal if "value" has a decimal point, a Long otherwise
 * @throws NumberFormatException when "value" is a malformed number
 */
public static final Number toNumber(final String value) throws 
NumberFormatException {
        if (value.indexOf('.') == -1) {
                return Long.valueOf(value);
        }
        else {
                return new BigDecimal(value);
        }
}
}

--------------------------------------------------------------
Rename the parameter "value" to "longParameter". 

In this example, renaming completely misses the mark:)

Result:
--------------------------------------------------------------

/**
 * Convert a String to a Number.
 * <p>
 * TODO: another method that uses DecimalFormat and the current
 * dfs symbols to determine what is the decimal point
 * TODO: return an appropriate Integer/Long/BigInteger as necessary
 *
 * @param longParameterarameter to convert
 * @return a BigDecilongParameterf "value" has a decimal point, a Long 
otherwise
 * @throws NumberFormatExceptiolongParametern "value" is a malformed 
number
 */
public static final Number toNumber(final String longParameter) throws 
NumberFormatException {
        if (longParameter.indexOf('.') == -1) {
                return Long.valueOf(longParameter);
        }
        else {
                return new BigDecimal(longParameter);
        }
}

--------------------------------------------------------------
Rename the parameter "value" to "aaa". Result:
--------------------------------------------------------------

/**
 * Convert a String to a Number.
 * <p>
 * TODO: another method that uses DecimalFormat and the current
 * dfs symbols to determine what is the decimal point
 * TODO: return an appropriate Integer/Long/BigInteger as necessary
 *
 * @param aaao convert
 * @return a BigDecimal if "vaaaahas a decimal point, a Long otherwise
 * @throws NumberFormatException when "vaaaais a malformed number
 */
public static final Number toNumber(final String aaa) throws 
NumberFormatException {
        if (aaa.indexOf('.') == -1) {
                return Long.valueOf(aaa);
        }
        else {
                return new BigDecimal(aaa);
        }
}

--------------------------------------------------------------

Attachment: options.zip
Description: Zip archive

Reply via email to