Re: jdk 1.6 bug or feature?
gg wrote:
here is the compilable code from working app ( I could optimize per Lew
suggestion, I am sure there are better coding than this)
....
Here's my attempt at minimal changes to turn this into a self-contained
program. However, it fails to reproduce the alleged problem:
class CPA_argException extends Exception {
String sArgName = "EFT_Originator_ID", sSz = "10";
public CPA_argException(String argNm, String sz) {
sArgName = argNm;
sSz = sz;
}
public @Override
String getMessage() {
return "CPAStd005Header argument exception -"
+ " Invalid length for ".concat(sArgName).concat(
", must be ").concat(sSz)
+ "numeric digits only";
}
};
public class HRecords {
String sEFT_Originator_ID;
String sFileCreationNumber;
EFT_Format eft_main;
IEText ieText;
public HRecords(String EFT_Originator_ID /* 10 digit */,
String FileCreationNumber /* sz=4 */,
EFT_Format eft_driver) throws CPA_argException {
sEFT_Originator_ID = EFT_Originator_ID;
sFileCreationNumber = FileCreationNumber;
eft_main = eft_driver;
if (!((sEFT_Originator_ID.length() == 10) & (ieText
.matchesPattern("[0-9]{10,10}", EFT_Originator_ID)))) {
eft_main
.showStatus("EFT_Originator_ID must be 10 numeric"
+ " digits only but we got "
+ EFT_Originator_ID.length()
+ " for the value=" + EFT_Originator_ID);
throw new CPA_argException("EFT_Originator_ID", "10");
}
try {
int i = Integer.valueOf(EFT_Originator_ID);
} catch (Exception e) {
throw new CPA_argException("FileCreationNumber", "4");
}
if (!(FileCreationNumber.length() == 4)) {
eft_main
.showStatus("FileCreationNumber must be 4 numeric"
+ " digits only but we got"
+ FileCreationNumber.length()
+ " for the value=<"
+ FileCreationNumber
+ ">");
throw new CPA_argException("FileCreationNumber", "4");
}
} // constructor ends
}
class EFT_Format {
void showStatus(String s) {
}
}
class IEText {
public boolean matchesPattern(String string,
String originator_ID) {
// TODO Auto-generated method stub
return false;
}
}