Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353917 - org.eclipse.tm.tcf.core.Command.toError reports only part of the command
Summary: org.eclipse.tm.tcf.core.Command.toError reports only part of the command
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Core (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 0.4.0   Edit
Assignee: Project Inbox CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
: 357046 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-08-04 12:07 EDT by Michael Scharf CLA
Modified: 2013-06-05 05:53 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***