It's all about the answers!

Ask a question

Summary from IAdvisorInfoCollector#createExceptionInfo


Geoff Alexander (19623948) | asked Jul 22 '10, 1:46 p.m.
I'm using IAdvisorInfoCollector#createExceptionInfo to handle exceptions in a work item save precondition plug-in as follows:

public void run( AdvisableOperation operation,

IProcessConfigurationElement advisorConfiguration,
IAdvisorInfoCollector collector, IProgressMonitor monitor )
throws TeamRepositoryException
{
try
{
...
}
catch (Throwable t)
{
IAdvisorInfo info = collector.createExceptionInfo(
"The XXXX WorkItemSave operation advisor "
+ "encountered an unexpected exeception", t );
collector.addInfo( info );
}
}


When an exception is thrown and caught in my plug-in, the work item save fails as intended. However, the message displayed to the user doesn't contain the summary string I specified in IAdvisorInfoCollector#createExceptionInfo call. Rather, the message displayed is

'Save Work Item' failed. Preconditions have not been met: Error: exception message.


How can I have the IAdvisorInfoCollector#createExceptionInfo summary string included in the user message?

Thanks,
Geoff Alexander

4 answers



permanent link
Jared Burns (4.5k29) | answered Jul 28 '10, 3:17 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
On Thu, 22 Jul 2010 17:53:00 +0000, gdlxn wrote:
How can I have the IAdvisorInfoCollector#createExceptionInfo summary
string included in the user message?

The output you're reporting based on that code doesn't look right. You
should be seeing the summary as you expect.

I would suggest debugging this by placing two breakpoints:
1. In AdvisorInfoCollector#createExceptionInfo(...)
Double-check that the summary you expect to be passing in is getting
passed.
2. In TeamAdvisorViewLabelProvider#getBaseText(...), inside the
instanceof IReportInfo block.
Here you should be able to see how the text is being retrieved for the
report info.

- Jared
------------------------
Jazz Team process

permanent link
Geoff Alexander (19623948) | answered Aug 10 '10, 11:16 a.m.
My summary is getting passed to AdvisorInfoCollector#createExceptionInfo(...). In setting a breakpoint on the first line of TeamAdvisorViewLabelProvider#getBaseText(...), I find that it's not being called.

What I did find is that the following code segment from OperationAdviseManager#advise(...) does not include the summary in the message string:
String message;

IReportInfo firstError = findFirstError(operationReport);
if (firstError == null || firstError.getIdentifier().equals(IParticipantInfoCollector.ID_EXCEPTION_PROBLEM) || firstError.getIdentifier().equals(ID_OPERATION_EXCEPTION)) {
message = NLS.bind(Messages.getCommonString("OperationAdviceManager.11"), name); //$NON-NLS-1$
} else if (firstError.getIdentifier().equals(ID_PERMISSION_DENIED_PROBLEM)) {
message = NLS.bind(Messages.getCommonString("OperationAdviceManager.12"), name); //$NON-NLS-1$
if (operation.shouldThrowPermissionDeniedException()) {
PermissionDeniedException permissionDenied = new PermissionDeniedException(message);
permissionDenied.setProcessReportData(operationReport);
throw permissionDenied;
}
} else if (firstError instanceof IAdvisorInfo) {
message = NLS.bind(Messages.getCommonString("OperationAdviceManager.13"), name, firstError.getDescription()); //$NON-NLS-1$
} else {
message = NLS.bind(Messages.getCommonString("OperationAdviceManager.14"), name, firstError.getDescription()); //$NON-NLS-1$
}
throw new TeamOperationCanceledException(operationReport, message);

So, for example, on a NullPointerException message is set "'Save Work Item' failed. Preconditions have not been met: Error: null.".

Also, IAdvisorInfo#createExceptionInfo(...) only includes the exception's message in the IAdvisorInfo's description, which for example in the case of a NullPointerException is simply "null". It would be useful to include the exception's class name in the description as well.

permanent link
Jared Burns (4.5k29) | answered Aug 16 '10, 1:03 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
On Tue, 10 Aug 2010 15:23:01 +0000, gdlxn wrote:

My summary is getting passed to
AdvisorInfoCollector#createExceptionInfo(...). In setting a breakpoint
on the first line of
TeamAdvisorViewLabelProvider#getBaseText(...), I find that it's not
being called.

What I did find is that the following code segment from
OperationAdviseManager#advise(...) does not include the summary in the
message string:

Also, IAdvisorInfo#createExceptionInfo(...) only includes the
exception's message in the IAdvisorInfo's description, which for example
in the case of a NullPointerException is simply "null". It would be
useful to include the exception's class name in the description as well.

Thank you for tracking this down. Can you please file a workitem with
these details?

Thanks,
- Jared
-------------------------
Jazz Team Process

permanent link
Geoff Alexander (19623948) | answered Sep 07 '10, 10:02 a.m.

Thank you for tracking this down. Can you please file a workitem with
these details?


I've opended Defect 129976 (http://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=129976).

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.