Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353917

Summary: org.eclipse.tm.tcf.core.Command.toError reports only part of the command
Product: [Tools] TCF Reporter: Michael Scharf <eclipse>
Component: CoreAssignee: Project Inbox <tcf.core-inbox>
Status: RESOLVED FIXED QA Contact: Eugene Tarassov <eugene>
Severity: normal    
Priority: P3 CC: cdtdoug, daniel.thomas
Version: 1.0   
Target Milestone: 0.4.0   
Hardware: All   
OS: All   
Whiteboard:

Description Michael Scharf CLA 2011-08-04 12:07:53 EDT
org.eclipse.tm.tcf.core.Command.toError arbitary chops off the command after 120 characters before reporting the error:

            String cmd = getCommandString();
            if (cmd.length() > 120) cmd = cmd.substring(0, 120) + "...";

This means, when some error occurs it is very hard to get to the command that caused the problem, because only part of the command is reported.

What is the reason to arbitrarily cut the command?

Proposal: remove the line  
   if (cmd.length() > 120) cmd = cmd.substring(0, 120) + "...";
Comment 1 Eugene Tarassov CLA 2011-08-04 14:32:29 EDT
TCF command can arbitrary long, for example, FileSystem.write command can easily have megabytes of data in it. If such long message will end up in, for example, Eclipse error log, it will certainly cause problems. So removing the limit is not really an option.

One way to resolve this would be to extend IErrorReport interface to allow clients to get the original command if they need it.
Comment 2 Michael Scharf CLA 2011-08-04 16:04:07 EDT
Sure a multi-megabyte of data is big, but 120 bytes as cut-off is a bit short. If the limit is changed to let's say 100kb then most text commands should be covered.

For example, a StackOverflowError can easily add a few 100kb to the eclispe log. So, I think we should not be too much concerned about the size of the log.

Adding the command to the IErrorReport would be an option, but I guess the command would not show up in the log unless the receiver of the error would get it form the IErrorReport interface....

Therefore my preference would be to increase the limit. 

Another option would be a java System property to specify the limit. Then one could increase the limit if needed.
Comment 3 Eugene Tarassov CLA 2011-08-08 15:09:06 EDT
I have changed the code to apply the limit to individual command arguments instead of the whole command - I believe this will provide much better balance between usefulness and size of error reports.

Also the code now checks system property org.eclipse.tcf.core.errmsg_size_limit, so one can increase the limit if needed.

Changing status to FIXED.
Comment 4 Michael Scharf CLA 2011-08-09 22:18:03 EDT
thank you! this seems a better solution :-)
Comment 5 Eugene Tarassov CLA 2011-09-08 13:09:52 EDT
*** Bug 357046 has been marked as a duplicate of this bug. ***