Bug 71110 - [find/replace] Replace/Find replaces incorrectly
Summary: [find/replace] Replace/Find replaces incorrectly
Status: RESOLVED DUPLICATE of bug 6202
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-29 15:31 EDT by Randy Hudson CLA
Modified: 2004-08-04 03:37 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2004-07-29 15:31:10 EDT
I was invoking "Replace/Find" with "Helper." being the search, and "rb." being 
the replacement value.  I invoked this about 30 times.  I then found the 
following compile error in my code:

DeleteAction_Label = rb.getString("%DeleteAction.Label");//$NON-NLS-1$
DeleteActrb.ltip = rb.getString("%DeleteAction.Tooltip");//$NON-NLS-1$

The field "DeleteActrb.ltip" does not exist.  This used to 
say "DeleteAction_Tooltip", but somehow the Replace action overwrote the 
incorrect range of characters.  Before using ReplaceFind, the code was:

DeleteAction_Label = Helper.getString("%DeleteAction.Label");//$NON-NLS-1$
DeleteAction_Tooltip = Helper.getString("%DeleteAction.Tooltip");//$NON-NLS-1$
Comment 1 Dani Megert CLA 2004-08-02 06:41:24 EDT
Cannot reproduce in Java editor using R3.0 with file that has several lines like:
  DeleteAction_Label = Helper.getString("%DeleteAction.Label");//$NON-NLS-1$
  DeleteAction_Tooltip = Helper.getString("%DeleteAction.Tooltip");//$NON-NLS-1$
and find string = "Helper." and replace string = "rb.".

Please reopen after providing the following information:
- which build?
- which editor?
- what are the Find/Replace dialog settings?
- anything in .log?
- can you reproduce? if so, what are the steps?
Comment 2 Randy Hudson CLA 2004-08-02 09:59:18 EDT
I was using R3.0.
Dialog has default settings (Forward, all, no check boxes checked).  Nothing in 
the .log, but that's not surprising since a range of text was actually 
replaced, it just happened to be the wrong range.

Steps to reproduce?  Unknown, but it involved repeatedly invoking 
the "Replace/Find" button, not the "Replace All" button.  If you can't think of 
any reason why this could happen, I could try again with the same file to see 
if I can reproduce.  I'd have to revert my changes to previous revision.
Comment 3 Dani Megert CLA 2004-08-02 12:51:24 EDT
I can reproduce it if I add some more steps e.g. I select some other text in the
editor where I replace and then switch to a view and then click on the editor
tab. Now the Find string gets changed to the editors selection and the selection
is fed into the Find/Replace dialog. Pressing "Replace/Find" now replaces the
selection. Might that be your scenario? If so, this is bug 6202.
Comment 4 Randy Hudson CLA 2004-08-02 15:24:23 EDT
I doubt it is that bug.  First, what is the chance that I would have selected 
exactly the same number of characters, 7.  Second, I am 99% sure that I 
continued to find/replace repeatedly after this one and the rest did not show 
the problem.  But, I suppose there's a change that I had to retype in the find 
string.  Still, the 7 characters is pretty interesting.
Comment 5 Dani Megert CLA 2004-08-03 03:18:22 EDT
OK. Please try whether you can reproduce and provide more detailed steps. If so,
reopen the bug. I close it as duplicate for now.

*** This bug has been marked as a duplicate of 6202 ***
Comment 6 Randy Hudson CLA 2004-08-03 13:28:36 EDT
While trying to reproduce this bug, I got the following stacktrace:

java.lang.IllegalArgumentException: Argument not valid
at org.eclipse.swt.SWT.error(SWT.java:2677)
at org.eclipse.swt.SWT.error(SWT.java:2616)
at org.eclipse.swt.SWT.error(SWT.java:2587)
at org.eclipse.swt.custom.StyledText.getBidiSegments(StyledText.java:4140)
at org.eclipse.swt.custom.DisplayRenderer.getBidiSegments
(DisplayRenderer.java:128)
at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout
(StyledTextRenderer.java:415)
at org.eclipse.swt.custom.StyledText$ContentWidthCache.contentWidth
(StyledText.java:1257)
at org.eclipse.swt.custom.StyledText$ContentWidthCache.calculate
(StyledText.java:1221)
at org.eclipse.swt.custom.StyledText.redraw(StyledText.java:5849)
at org.eclipse.swt.custom.StyledText.handleResize(StyledText.java:5092)
at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4753)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:801)
at org.eclipse.swt.widgets.Control.WM_SIZE(Control.java:4171)
at org.eclipse.swt.widgets.Scrollable.WM_SIZE(Scrollable.java:312)
at org.eclipse.swt.widgets.Composite.WM_SIZE(Composite.java:875)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3037)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3338)
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1391)
at org.eclipse.swt.internal.BidiUtil.windowProc(BidiUtil.java:647)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1462)
at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:77)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3050)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3338)
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1391)
at org.eclipse.swt.internal.BidiUtil.windowProc(BidiUtil.java:647)
at org.eclipse.swt.internal.win32.OS.EndDeferWindowPos(Native Method)
at org.eclipse.swt.widgets.Composite.resizeChildren(Composite.java:432)
at org.eclipse.swt.widgets.Composite.resizeChildren(Composite.java:398)
at org.eclipse.swt.widgets.Composite.setResizeChildren(Composite.java:499)
at org.eclipse.swt.widgets.Composite.layout(Composite.java:349)
at org.eclipse.jface.text.source.CompositeRuler.layoutTextViewer
(CompositeRuler.java:606)
at org.eclipse.jface.text.source.CompositeRuler.addDecorator
(CompositeRuler.java:560)
at 
org.eclipse.jface.text.source.projection.ProjectionViewer.addVerticalRulerColumn
(ProjectionViewer.java:1187)
at org.eclipse.jface.text.source.projection.ProjectionSupport.doEnableProjection
(ProjectionSupport.java:253)
at 
org.eclipse.jface.text.source.projection.ProjectionSupport$ProjectionListener.pr
ojectionEnabled(ProjectionSupport.java:141)
at 
org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled
(ProjectionViewer.java:473)
at org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection
(ProjectionViewer.java:521)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.performRevert
(JavaEditor.java:4327)
at org.eclipse.ui.texteditor.AbstractTextEditor.doRevertToSaved
(AbstractTextEditor.java:3646)
at org.eclipse.ui.texteditor.StatusTextEditor.doRevertToSaved
(StatusTextEditor.java:183)
at org.eclipse.ui.texteditor.RevertToSavedAction.run
(RevertToSavedAction.java:47)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:915)
at org.eclipse.jface.action.ActionContributionItem.access$2
(ActionContributionItem.java:866)
at org.eclipse.jface.action.ActionContributionItem$7.handleEvent
(ActionContributionItem.java:785)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
at org.eclipse.core.launcher.Main.run(Main.java:644)
at org.eclipse.core.launcher.Main.main(Main.java:628)

I was invoking Find/Replace quickly, also undo, and "revert file" so that I 
could start fresh to try to reproduce the original bug.
Comment 7 Dani Megert CLA 2004-08-03 13:33:42 EDT
This bug is closed and hence there won't be any action on this new bug that you
included in this closed one ;-) Please file separate bugs in separate bug
reports - thanx.
Comment 8 Randy Hudson CLA 2004-08-03 13:58:43 EDT
I thought it was possible that this was the same exception which caused the 
original bug.
Comment 9 Dani Megert CLA 2004-08-03 14:19:25 EDT
I thought it is not related because
- in comment 2 you stated that there was nothing in .log
- the stack trace happened during revert
Comment 10 Dani Megert CLA 2004-08-04 03:37:44 EDT
Filed separate bug 71354.