Description
I changed it to this, does it look better? We should write a test case for it at some point.
I didn't merge yet, but will at some point. Do you need it sooner than later?
We should probably post 1.5.2 at some point not too long...
Thanks,
chris
public Subject getSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull)
throws SubjectNotFoundException, SubjectNotUniqueException {
Subject subject = null;
//try by id first
subject = this.getSubject(idOrIdentifier, false);
//try by identifier if not by id
if (subject == null)
//if null at this point, and exception, then throw it
if (subject == null && exceptionIfNull)
return subject;
}
----Original Message----
Sent: Monday, January 11, 2010 4:03 PM
To: Chris Hyzer
Cc: Shilen Patel; Gary Brown
Subject: Re: BaseSourceAdapter getSubjectByIdOrIdentifier() ?
Oh, and, I guess that method doesn't really work if exceptionIfNull is
false, since if getSubject() doesn't return null and
getSubjectByIdentifier does, the result will be null.
> Sure, please commit, since I don't know how to merge 1.5 to 1.6 -
> maybe you could clue me in ?
>
> On Mon, Jan 11, 2010 at 2:58 PM, Chris Hyzer <mchyzer@isc.upenn.edu> wrote:
>> Yes, it should, whoops... that should go in the 1.5 branch... let me know if you want me to commit it.
>>
>> Good catch!
>> Thanks,
>> Chris
>>
>>
>> ----Original Message----
>> Sent: Monday, January 11, 2010 3:52 PM
>> To: Chris Hyzer
>> Cc: Shilen Patel; Gary Brown
>> Subject: BaseSourceAdapter getSubjectByIdOrIdentifier() ?
>>
>> Hey,
>>
>> Shouldn't SubjectNotFoundException be caught when calling
>> this.getSubjectByIdentifier() ? is SubjectNotUniqueException a typo ?
>>
>> public Subject getSubjectByIdOrIdentifier(String idOrIdentifier,
>> boolean exceptionIfNull)
>> throws SubjectNotFoundException, SubjectNotUniqueException {
>> Subject subject = null;
>> try
catch (SubjectNotFoundException snfe) {
>> try
catch (SubjectNotUniqueException snfe2) {
>> if (exceptionIfNull)
>> return null;
>> }
>> }
>> return subject;
>> }
>>
>