Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] NPE in ProfileChangeRequest

Fixed in HEAD

On 2010-04-07, at 4:48 PM, Matt Hughes wrote:

> It appears there is a NPE bug in ProfileChangeRequest#toString
> 
> If you don't have either additions or removals, the toString will
> throw a NPE when iterating over the elements.  The underlying
> variables (iusToRemove, iusToAdd) are lazily instantiated.  So if you
> never create an addition or removal, they will be null when you
> perform the toString.
> 
> public String toString() {
> 		StringBuffer result = new StringBuffer(1000);
> 		result.append("==Profile change request for "); //$NON-NLS-1$
> 		result.append(profile.getProfileId());
> 		result.append('\n');
> 		result.append("==Additions=="); //$NON-NLS-1$
> 		result.append('\n');
> 		for (IInstallableUnit iu : iusToAdd) { // blows up if no additions
> have been made, need to wrap in null check
> 			result.append('\t');
> 			result.append(iu);
> 			result.append('\n');
> 		}
> 		result.append("==Removals=="); //$NON-NLS-1$
> 		result.append('\n');
> 		for (IInstallableUnit iu : iusToRemove) { // blows up if no removals
> have been made, need to wrap in null check
> 			result.append('\t');
> 			result.append(iu);
> 			result.append('\n');
> 		}
> 		return result.toString();
> 	}
> _______________________________________________
> p2-dev mailing list
> p2-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/p2-dev



Back to the top