‎2017 Aug 10 11:35 PM - edited ‎2024 Feb 04 2:05 AM
I am getting a null pointer exception for the below java code on AgeUploadntry java.
" Null object loaded from local variable 'ad'."
public void setAddresses(JCO.Table AddressTbl) throws Exception
{
String flag = "";
String methodLabel = "setAddresses";
ArrayList<Addr> woAddresses = new ArrayList<Addr>();
try {
Logger log = new Logger(_user, methodLabel);
int numRows = AddressTbl.getNumRows();
log.info("Number of rows: "+ numRows);
int i =0;
for (int x = 0; x < numRows; x++) {
AddressTbl.setRow(x);
String ad_num = AddressTbl.getString("ADDRNUMBER");
// int len = ad_num.length();
// String res2 = ad_num.substring(2, len); // Remove leading OR/QM
// String res3 = trimLeadingZeros(res2);
if (ad_num.equals(getAddrNum()))
{
flag = "X";
Addr ad = (Addr) SAPObjectFactory.create(_user, "Addr");
ad.setProperties(AddressTbl);
// ad.setPartnerID(String.valueOf(i));
woAddresses.add(ad);
i++;
// String message = Ex12nManager.getMessage(MessageNames.ADDING_OBJECT_TO_ARRAY,
// new Object[] {ad.getPartnerFunctionID()});
// log.info(message);
}
}
}
catch (Exception e) {
_user.rethrowException(e, true);
}
if (flag == "X") {
setAddresses( (Addr[])SAPObjectArrayFactory.createSAPObjectArray( woAddresses, SAPObjectFactory.create(_user, "Addr")));
}
}
Request clarification before answering.
Hi Sarita,
Did you edit this code or is this out of the box?
Thanks,
Francisco Hernandez
SAP Product Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 12 | |
| 7 | |
| 4 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.