This is my situation:
I thought when I did an ArrayList.add(ErrorObject) I was passing a COPY of the ErrorObject and that COPY of the ErrorObject was preserved no matter what happened to the �source� ErrorObject.
This doesn't appear to be the case...
Below is a drawn out description of what I'm experiencing � in case you need more details of my situation.
============
I designed a result object that I use when making calls. Almost all of my methods have a return value of ResultObject.
Example call:
roResult = member.addMember("chris","montgomery");
This result object (roResult) has a few boolean members:
protected boolean isSuccessful, hasErrors...
It also has a few string members:
protected String methodName,className,packageName,responseString;
Lastly, it has two array list members:
protected ArrayList errorArrayList, responseArrayList;
This way I can have a clear view of who, what, where, when and why each time a method call is made.
Anyway...
During the execution of addMember, if I stumble upon an error, I have yet another object - this time it's an ErrorObject (eoError) that I fill with what caused the error:
eoError.fillErrorObject("stuff",�more stuff�,�even more stuff�, etc.);
(ErrorObject is a class with the following members:
protected String errorNumber,errorDescription,errorPackageOccurnace,errorClassOccurnace,errorMethodOccurnace,externalErrorCode
Once this ErrorObject is filled, I do an addMemberErrorArrayList.add(ErrorObject);.
For each error I stumble upon in the addMember code, I clear and fill the ErrorObject and then make another addMemberErrorArrayList.add(ErrorObject) call.
Once I�ve gone gone through as much as I can, I set my ResultObject�s errorArrayList equal to my addMemberErrorArrayList that was built during the execution of addMember and return roResult.
The goal is to store ALL the errors I encountered during the call in my array list (so the user is fully informed rather than displaying one error at a time).
What I'm finding is that if I have 5 errors, my array list has 5 items in it, but they all contain the LAST error encountered (rather than the 5 individual errors):
Result Package: com.aid.core.data.process
Result Class: ProcessMemberData
Result Successful: true
Result Has Errors: true
ERROR COUNT: 1 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
ERROR COUNT: 2 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
ERROR COUNT: 3 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
ERROR COUNT: 4 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
ERROR COUNT: 5 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
I guess I thought when I did an ArrayList.add() I was passing a COPY of the ErrorObject and that COPY of the ErrorObject was preserved no matter what happened to the �source�.
Do I really have to instantiate a new ErrorObject every time I hit an error?
Seems process intensive�
Thanks!
Chris
I thought when I did an ArrayList.add(ErrorObject) I was passing a COPY of the ErrorObject and that COPY of the ErrorObject was preserved no matter what happened to the �source� ErrorObject.
This doesn't appear to be the case...
Below is a drawn out description of what I'm experiencing � in case you need more details of my situation.
============
I designed a result object that I use when making calls. Almost all of my methods have a return value of ResultObject.
Example call:
roResult = member.addMember("chris","montgomery");
This result object (roResult) has a few boolean members:
protected boolean isSuccessful, hasErrors...
It also has a few string members:
protected String methodName,className,packageName,responseString;
Lastly, it has two array list members:
protected ArrayList errorArrayList, responseArrayList;
This way I can have a clear view of who, what, where, when and why each time a method call is made.
Anyway...
During the execution of addMember, if I stumble upon an error, I have yet another object - this time it's an ErrorObject (eoError) that I fill with what caused the error:
eoError.fillErrorObject("stuff",�more stuff�,�even more stuff�, etc.);
(ErrorObject is a class with the following members:
protected String errorNumber,errorDescription,errorPackageOccurnace,errorClassOccurnace,errorMethodOccurnace,externalErrorCode
Once this ErrorObject is filled, I do an addMemberErrorArrayList.add(ErrorObject);.
For each error I stumble upon in the addMember code, I clear and fill the ErrorObject and then make another addMemberErrorArrayList.add(ErrorObject) call.
Once I�ve gone gone through as much as I can, I set my ResultObject�s errorArrayList equal to my addMemberErrorArrayList that was built during the execution of addMember and return roResult.
The goal is to store ALL the errors I encountered during the call in my array list (so the user is fully informed rather than displaying one error at a time).
What I'm finding is that if I have 5 errors, my array list has 5 items in it, but they all contain the LAST error encountered (rather than the 5 individual errors):
Result Package: com.aid.core.data.process
Result Class: ProcessMemberData
Result Successful: true
Result Has Errors: true
ERROR COUNT: 1 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
ERROR COUNT: 2 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
ERROR COUNT: 3 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
ERROR COUNT: 4 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
ERROR COUNT: 5 OF 5
ERROR NUMBER: 11
ERROR DESCRIPTION: Email address is null.
I guess I thought when I did an ArrayList.add() I was passing a COPY of the ErrorObject and that COPY of the ErrorObject was preserved no matter what happened to the �source�.
Do I really have to instantiate a new ErrorObject every time I hit an error?
Seems process intensive�
Thanks!
Chris