[ phpeclipse-Bugs-1329348 ] source format raises error and breaks view

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.ide.eclipse.phpeclipse.devel
Message-ID <[email protected]>
Bugs item #1329348, was opened at 2005-10-18 07:03
Message generated for change (Comment added) made by salamanders
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=484801&aid=1329348&group_id=57621

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PHP Editor
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Norcas (norcas)
Assigned to: Nobody/Anonymous (nobody)
Summary: source format raises error and breaks view

Initial Comment:
When I use code format by pressing Ctrl+Shift+F the 
editor view clears and nothing is shown anymore. Often 
(not always) an error box occures saying: "Format" did 
not complete normally.  Please see the log for more 
information.

At that point I close and reopen the file to work on with 
the file - which is now shown again and formated(!).

WinXP SP2, Eclipse 3.1.1 (and 3.1), phpeclipse 1.1.
8CVS-2005-10-12 (and 1.1.7 ...)

Thanks for a great plugin.




!SESSION 2005-10-18 12:44:28.964 -----------------------------
------------------
eclipse.buildId=I20050627-1435
java.version=1.5.0_02
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, 
WS=win32, NL=de_DE
Command-line arguments:  -os win32 -ws win32 -arch 
x86


!ENTRY org.eclipse.ui 4 4 2005-10-18 12:46:33.319
!MESSAGE "Format" did not complete normally.  Please 
see the log for more information.

!ENTRY org.eclipse.ui 4 0 2005-10-18 12:46:33.319
!MESSAGE Argument not valid
!STACK 0
java.lang.IllegalArgumentException: Argument not valid

----------------------------------------------------------------------

Comment By: Benjamin Hill (salamanders)
Date: 2006-11-01 12:36

Message:
Logged In: YES 
user_id=370500

Confirming that this bug exists (Format sometimes causes an
"Argument not valid" error, can still save the file, but
have to close the open window) in PHPEclipse 1.1.9.CVS-20060424

Also confirmed that disabling all folding was a successful
workaround - error no longer happens.

----------------------------------------------------------------------

Comment By: Norcas (norcas)
Date: 2006-01-13 07:08

Message:
Logged In: YES 
user_id=302230

One more detail: 
take an empty file, insert 
<?
?>
set cursor to very first position,
start code formater.
=> after format the first 2 chars are selected.

if one starts again with this emtpy php code, cursor set to 
end of line one. After code formating the cursor jumped to 
the middle of last line (line 3).

(in both cases there is a blank line inserted between 
opening and closing php)

Again: Hope this is related and helps.

----------------------------------------------------------------------

Comment By: Norcas (norcas)
Date: 2006-01-13 02:32

Message:
Logged In: YES 
user_id=302230

I noticed another strange behaviour while formating the code 
posted below:

Before formating there are no blank lines between <?php and 
the /**. 
After formating it once there is one blank. 
After formating it again there is a second blank line. 
Further formats do not insert more blanks.

Why is it inserting blanks? 
If this is wanted why does this take two steps?

Hope this is related and helps.


----------------------------------------------------------------------

Comment By: Bananeweizen (bananeweizen)
Date: 2006-01-11 03:22

Message:
Logged In: YES 
user_id=440739

I can reproduce it. I debugged that thing and found that the
segment positions for the folding fragments become invalid
during the formatting, but I didn't find the root cause for
those invalid positions in the PositionUpdater.

----------------------------------------------------------------------

Comment By: Tobias Munk (schmunk)
Date: 2006-01-09 05:14

Message:
Logged In: YES 
user_id=1104620

Can you reproduce this, with the PHP file below (sorry, don't know where to 
add another "file")?

1. Open the PHP-file and fold "class SthAdminPage extends LPage" (you 
should see only about 20 lines of code)
2. Right-click on the editor: Source > Format

This causes the described error (broken editor view).
Maybe because of my brackets style with breaks. If the class is open 
(unfolded) everything works fine. So I have to correct my previous post: code 
folding has an effect for me.

8<------------ snipp ----------------
<?php
/**
 * Admin page file.
 *
 * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public 
License 
 * @copyright 2005, diemeisterei GmbH. All rights reserved.
 * @author $Author: tobias $
 * @version $Revision: 1.2 $  $Date: 2006/01/04 00:15:11 $
 * @package LModules.Sitehandler
 * @subpackage Pages
 */

/**
 * Displays and manages the pagehandler admin page
 *
 * @package LModules.Sitehandler
 * @subpackage Pages
 */

class SthAdminPage extends LPage
{
	private $UI;

	/**
	 * Adds name mapping
	 */
	public function onInit($param)
	{
		parent::onInit($param);
		$this->UI =& $this->CellModule;
	}
	
	/**
	 * DEV FUNC
	 *
	 * @internal
	 */
	function onPreRender($param)
	{
		$this->UI->CreateSiteName->setText("page ".rand(100,10000));
		parent::onPreRender($param);
	}

	/**
	 * Prepares data and calls the core function
	 */
	public function onCreateSitenode()
	{
		$this->Log->log('Create site postback');
		$path 	=& $this->UI->CreateSitePath->getSelectedValue();
		$name 	=& $this->UI->CreateSiteName->getText();
		$pos 	=& $this->UI->CreateSitePosition->getText();
		$modpage = split(":",$this->UI->CreateSiteModulePage-
>getSelectedValue());
		$mod 	=& $modpage[0];
		$page 	=& $modpage[1];
		SthCore::createSiteNode($path, $pos, $name, $mod, $page);
	}

	/**
	 * Prepares data and calls the core function
	 */
	public function onCreateBrick()
	{
		$this->Log->log('Create brick postback');
		SthCore::createBrick(
			$this->UI->CreateBrickSiteId->getValue(),
			$this->UI->CreateBrickPosition->getSelectedValue(),
			$this->UI->CreateBrickControl->getSelectedValue(),
			$this->UI->CreateBrickParam->getText()
		);
		$this->Application->transfer($this->Application->getRequest()-
>getRequestedPage());
	}

	/**
	 * Prepares data and calls the core function
	 */
	public function onMoveSitenode()
	{
		$this->Log->log('Nove nodes postback');
		SthCore::moveNodes(
			$this->UI->MoveSrcNodePath->getSelectedValue(),
			$this->UI->MoveDestNodePath->getSelectedValue(),
			$this->UI->MoveDestPosition->getText()
		);
	}

	/**
	 * DEV FUNC
	 *
	 * @internal
	 */
	public function onReset()
	{
		SthCore::genRoot();
	}
}

?>
8<------------ snipp ----------------

Thanks for developing this plugin.
 

----------------------------------------------------------------------

Comment By: Bananeweizen (bananeweizen)
Date: 2006-01-07 05:51

Message:
Logged In: YES 
user_id=440739

Can someone please attach a php file which causes this bug
for him?
Thanks.

----------------------------------------------------------------------

Comment By: Tobias Munk (schmunk)
Date: 2006-01-06 20:36

Message:
Logged In: YES 
user_id=1104620

I can confirm this bug with Eclipse 3.1 and phpeclipse-1.1.8
on Mac OS X 10.4.3.
"Disable folding" had no effect for me.

Just a note: The source formatting worked for me with the
xored-1.0.1-plugin from http://www.xored.com, also with
folding enabled.

----------------------------------------------------------------------

Comment By: Norcas (norcas)
Date: 2006-01-06 02:53

Message:
Logged In: YES 
user_id=302230

Sorry, it still does not working completely.

Here are my steps:
I open my file, everything is collapsed, I see to plus signs 
(one collapsed phpdoc, one collapsed class). 
I press CTRL+SHIFT+F, the plus signs become minus signs, but 
 there is no code anymore (empty editor/white page).
If I press CTRL+SHIFT+F again, an error msg pops up:
 - title: Error Executing Command
 - Message: "Format" did not complete normally. Please see 
the log for more information. Reason: Argument not valid.
 - Details: overlaps with existing fragment

Here is a working way:
(Closed file without saving)
Reopen file, press CTRL+(Num-/), whole code is unfolded, 
press CTRL+SHIFT+F, everythings works fine.

--
Details:
After format, the background eclipse says on its console: 
Unhandled event loop exception
Reason:
Failed to execute runnable (java.lang.IllegalStateException)
Unhandled event loop exception
Reason:
Failed to execute runnable (java.lang.IllegalStateException)
Unhandled event loop exception
Reason:
Failed to execute runnable (java.lang.IllegalStateException)
Unhandled event loop exception
Reason:
Failed to execute runnable (java.lang.IllegalStateException)

Log says:


!ENTRY org.eclipse.ui 4 4 2006-01-06 08:52:42.82
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 2006-01-06 08:52:42.82
!MESSAGE Failed to execute runnable (java.lang.
IllegalStateException)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable 
(java.lang.IllegalStateException)
	at org.eclipse.swt.SWT.error(SWT.java:2942)
	at org.eclipse.swt.SWT.error(SWT.java:2865)
	at org.eclipse.swt.widgets.Synchronizer.
runAsyncMessages(Synchronizer.java:126)
	at org.eclipse.swt.widgets.Display.
runAsyncMessages(Display.java:3057)
	at org.eclipse.swt.widgets.Display.
readAndDispatch(Display.java:2716)
	at org.eclipse.ui.internal.Workbench.
runEventLoop(Workbench.java:1699)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.
java:1663)
	at org.eclipse.ui.internal.Workbench.
createAndRunWorkbench(Workbench.java:367)
	at org.eclipse.ui.PlatformUI.
createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.
run(IDEApplication.java:103)
	at org.eclipse.core.internal.runtime.
PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown 
Source)
	at sun.reflect.DelegatingMethodAccessorImpl.
invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.
invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:
278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.IllegalStateException
	at org.eclipse.jface.text.projection.
ProjectionMapping.toImageLine(ProjectionMapping.java:478)
	at org.eclipse.jface.text.TextViewer.
modelLine2WidgetLine(TextViewer.java:4745)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
doPaint1(ChangeRulerColumn.java:397)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
doubleBufferPaint(ChangeRulerColumn.java:262)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
redraw(ChangeRulerColumn.java:414)
	at org.eclipse.jface.text.source.ChangeRulerColumn$3.
run(ChangeRulerColumn.java:640)
	at org.eclipse.swt.widgets.RunnableLock.
run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.
runAsyncMessages(Synchronizer.java:123)
	... 18 more

!ENTRY org.eclipse.ui 4 4 2006-01-06 08:52:42.92
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 2006-01-06 08:52:42.92
!MESSAGE Failed to execute runnable (java.lang.
IllegalStateException)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable 
(java.lang.IllegalStateException)
	at org.eclipse.swt.SWT.error(SWT.java:2942)
	at org.eclipse.swt.SWT.error(SWT.java:2865)
	at org.eclipse.swt.widgets.Synchronizer.
runAsyncMessages(Synchronizer.java:126)
	at org.eclipse.swt.widgets.Display.
runAsyncMessages(Display.java:3057)
	at org.eclipse.swt.widgets.Display.
readAndDispatch(Display.java:2716)
	at org.eclipse.ui.internal.Workbench.
runEventLoop(Workbench.java:1699)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.
java:1663)
	at org.eclipse.ui.internal.Workbench.
createAndRunWorkbench(Workbench.java:367)
	at org.eclipse.ui.PlatformUI.
createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.
run(IDEApplication.java:103)
	at org.eclipse.core.internal.runtime.
PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown 
Source)
	at sun.reflect.DelegatingMethodAccessorImpl.
invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.
invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:
278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.IllegalStateException
	at org.eclipse.jface.text.projection.
ProjectionMapping.toImageLine(ProjectionMapping.java:478)
	at org.eclipse.jface.text.TextViewer.
modelLine2WidgetLine(TextViewer.java:4745)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
doPaint1(ChangeRulerColumn.java:397)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
doubleBufferPaint(ChangeRulerColumn.java:262)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
redraw(ChangeRulerColumn.java:414)
	at org.eclipse.jface.text.source.ChangeRulerColumn$3.
run(ChangeRulerColumn.java:640)
	at org.eclipse.swt.widgets.RunnableLock.
run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.
runAsyncMessages(Synchronizer.java:123)
	... 18 more

!ENTRY org.eclipse.ui 4 4 2006-01-06 08:52:42.102
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 2006-01-06 08:52:42.102
!MESSAGE Failed to execute runnable (java.lang.
IllegalStateException)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable 
(java.lang.IllegalStateException)
	at org.eclipse.swt.SWT.error(SWT.java:2942)
	at org.eclipse.swt.SWT.error(SWT.java:2865)
	at org.eclipse.swt.widgets.Synchronizer.
runAsyncMessages(Synchronizer.java:126)
	at org.eclipse.swt.widgets.Display.
runAsyncMessages(Display.java:3057)
	at org.eclipse.swt.widgets.Display.
readAndDispatch(Display.java:2716)
	at org.eclipse.ui.internal.Workbench.
runEventLoop(Workbench.java:1699)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.
java:1663)
	at org.eclipse.ui.internal.Workbench.
createAndRunWorkbench(Workbench.java:367)
	at org.eclipse.ui.PlatformUI.
createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.
run(IDEApplication.java:103)
	at org.eclipse.core.internal.runtime.
PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown 
Source)
	at sun.reflect.DelegatingMethodAccessorImpl.
invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.
invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:
278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.IllegalStateException
	at org.eclipse.jface.text.projection.
ProjectionMapping.toImageLine(ProjectionMapping.java:478)
	at org.eclipse.jface.text.TextViewer.
modelLine2WidgetLine(TextViewer.java:4745)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
doPaint1(ChangeRulerColumn.java:397)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
doubleBufferPaint(ChangeRulerColumn.java:262)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
redraw(ChangeRulerColumn.java:414)
	at org.eclipse.jface.text.source.ChangeRulerColumn$3.
run(ChangeRulerColumn.java:640)
	at org.eclipse.swt.widgets.RunnableLock.
run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.
runAsyncMessages(Synchronizer.java:123)
	... 18 more

!ENTRY org.eclipse.ui 4 4 2006-01-06 08:52:42.513
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 2006-01-06 08:52:42.513
!MESSAGE Failed to execute runnable (java.lang.
IllegalStateException)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable 
(java.lang.IllegalStateException)
	at org.eclipse.swt.SWT.error(SWT.java:2942)
	at org.eclipse.swt.SWT.error(SWT.java:2865)
	at org.eclipse.swt.widgets.Synchronizer.
runAsyncMessages(Synchronizer.java:126)
	at org.eclipse.swt.widgets.Display.
runAsyncMessages(Display.java:3057)
	at org.eclipse.swt.widgets.Display.
readAndDispatch(Display.java:2716)
	at org.eclipse.ui.internal.Workbench.
runEventLoop(Workbench.java:1699)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.
java:1663)
	at org.eclipse.ui.internal.Workbench.
createAndRunWorkbench(Workbench.java:367)
	at org.eclipse.ui.PlatformUI.
createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.
run(IDEApplication.java:103)
	at org.eclipse.core.internal.runtime.
PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.
run(EclipseStarter.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown 
Source)
	at sun.reflect.DelegatingMethodAccessorImpl.
invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.
invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:
278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.IllegalStateException
	at org.eclipse.jface.text.projection.
ProjectionMapping.toImageLine(ProjectionMapping.java:478)
	at org.eclipse.jface.text.TextViewer.
modelLine2WidgetLine(TextViewer.java:4745)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
doPaint1(ChangeRulerColumn.java:397)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
doubleBufferPaint(ChangeRulerColumn.java:262)
	at org.eclipse.jface.text.source.ChangeRulerColumn.
redraw(ChangeRulerColumn.java:414)
	at org.eclipse.jface.text.source.ChangeRulerColumn$3.
run(ChangeRulerColumn.java:640)
	at org.eclipse.swt.widgets.RunnableLock.
run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.
runAsyncMessages(Synchronizer.java:123)
	... 18 more


----------------------------------------------------------------------

Comment By: Bananeweizen (bananeweizen)
Date: 2006-01-04 17:55

Message:
Logged In: YES 
user_id=440739

Could you please test with the next CVS version? I made some
changes to the code formatter today so that it does no
longer fail when markers (like folding or problem markers)
have invalid positions after the formatting. And folding
markers are sometimes out of sync...

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2005-10-26 18:04

Message:
Logged In: NO 

This bug seems to be related to code folding.
If you disable the folding the formater seems to work.

Maybe related to Document.positions handling in the
formatter or to the DefaultJavaFoldingStructureProvider.java
implementation.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=484801&aid=1329348&group_id=57621

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.