Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325052 - Possible editor bug - improperly parses try/catch/finally blocks
Summary: Possible editor bug - improperly parses try/catch/finally blocks
Status: CLOSED DUPLICATE of bug 298698
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-12 10:46 EDT by Nick Radonic CLA
Modified: 2010-09-13 11:58 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Radonic CLA 2010-09-12 10:46:39 EDT
The editor behaves erratically when I am trying to edit try/catch/finally blocks. Sections of code don't show up as I scroll up and down through this short code block. Yes, the syntax is garbled on my part, but I still expect to be able to see the text and I can't edit what doesn't show up on the screen. Everything below the 'try' keyword is malformed as I scroll the cursor up and down, and things like auto-indent don't help.

Nick



public class tctest {
	private void readInFile() throws FileNotFoundException
	{

		JFileChooser chooser = new JFileChooser();

		FileReader in = null;
		
		try ?{ ?			File selectedFile = chooser.getSelectedFile();
		if  (chooser.showOpenDialog(null)  == JFileChooser.APPROVE_OPTION) 
		{
			FileReader reader = new FileReader(selectedFile);
			FileReader reader = new FileReader(filename); ?   Scanner in = new Scanner(reader); ?   readData(in); ?} ?finally ?{ ?   reader.close();
			// if an exception occurs, finally clause?   // is also executed before exception 
			// is passed to its handler ?}

			}
		}
	}

}



-- Configuration Details --
Product: Eclipse 1.3.0.20100617-0521 (org.eclipse.epp.package.jee.product)
Installed Features:
 org.eclipse.jdt 3.6.0.v20100526-0800-7z8XFUJFMTfCWGoVuHImpms9H155
Comment 1 Remy Suen CLA 2010-09-12 17:34:12 EDT
Please attach a screenshot of what you're seeing.
Comment 2 Walter Harley CLA 2010-09-12 19:22:39 EDT
In my web browser, the segment of code you've attached appears to contain a lot of special characters.  Are you using non-default character set, key mapping, etc. that could be contributing to the problem?

Any information you can provide about what might be special about your configuration, what you have tried in order to resolve or debug the problem, etc., will be helpful.
Comment 3 Remy Suen CLA 2010-09-12 19:30:46 EDT
(In reply to comment #2)
> In my web browser, the segment of code you've attached appears to contain a lot
> of special characters.  Are you using non-default character set, key mapping,
> etc. that could be contributing to the problem?

Interesting observation, Walter. I see question marks (?) show up in comment 0 and I assumed that was intentional (as an example of malformed code). It did not occur to me that it might be my browser choking on the output.
Comment 4 Nick Radonic CLA 2010-09-12 23:23:18 EDT
I think you gentlemen are correct about the special characters. I copied part of the try/catch code segment from a PDF file.

In that case, is there a means to display 'special characters' in the editor, or a way to force it to ignore the extra characters? Or do I have to filter out my copied text in the future, before pasting it?  This will be my workaround in the future.

As for the display, it shows blank lines on the screen in the affected areas, except when running the cursor up and down, then there is a line of data displayed directly under the cursor. 

Thanks.
Comment 5 Dani Megert CLA 2010-09-13 04:18:43 EDT
Sorry, but there's not enough information here to reproduce a bug. Please reopen with more detailed steps if you can reproduce the problem using 3.7 M1 (
http://download.eclipse.org/eclipse/downloads/drops/S-3.7M1-201008051700/index.php).

Please also see http://www.eclipse.org/eclipse/platform-text/development/bug-incomplete.htm.
Comment 6 Markus Keller CLA 2010-09-13 05:00:00 EDT
Probably a dup of bug 298698. Please reopen if you think it's not.

*** This bug has been marked as a duplicate of bug 298698 ***
Comment 7 Nick Radonic CLA 2010-09-13 09:53:01 EDT
Here is another sample of code taken from a powerpoint Java slide (Cay Horstman, Big Java). It looks ugly on my screen, and not so good here either.:


public class InsufficientFundsException       extends RuntimeException {    public InsufficientFundsException() {}    public InsufficientFundsException(String message)    {       super(message);    } } 




Here's a hexdump of the string:

> hexdump -C

public class InsufficientFundsException ^K      extends RuntimeException ^K{ ^K   public InsufficientFundsException() {} ^K^K   public InsufficientFundsException(String message) ^K   { ^K      super(message); ^K   } ^K} 
00000000  0a 70 75 62 6c 69 63 20  63 6c 61 73 73 20 49 6e  |.public class In|
00000010  73 75 66 66 69 63 69 65  6e 74 46 75 6e 64 73 45  |sufficientFundsE|
00000020  78 63 65 70 74 69 6f 6e  20 0b 20 20 20 20 20 20  |xception .      |
00000030  65 78 74 65 6e 64 73 20  52 75 6e 74 69 6d 65 45  |extends RuntimeE|
00000040  78 63 65 70 74 69 6f 6e  20 0b 7b 20 0b 20 20 20  |xception .{ .   |
00000050  70 75 62 6c 69 63 20 49  6e 73 75 66 66 69 63 69  |public Insuffici|
00000060  65 6e 74 46 75 6e 64 73  45 78 63 65 70 74 69 6f  |entFundsExceptio|
00000070  6e 28 29 20 7b 7d 20 0b  0b 20 20 20 70 75 62 6c  |n() {} ..   publ|
00000080  69 63 20 49 6e 73 75 66  66 69 63 69 65 6e 74 46  |ic InsufficientF|
00000090  75 6e 64 73 45 78 63 65  70 74 69 6f 6e 28 53 74  |undsException(St|
000000a0  72 69 6e 67 20 6d 65 73  73 61 67 65 29 20 0b 20  |ring message) . |
000000b0  20 20 7b 20 0b 20 20 20  20 20 20 73 75 70 65 72  |  { .      super|
000000c0  28 6d 65 73 73 61 67 65  29 3b 20 0b 20 20 20 7d  |(message); .   }|
^C

Note: the 0x0b is control-K the vertical tab function --- that explains a lot. Now how do I turn this off, or filter it out?
Comment 8 Dani Megert CLA 2010-09-13 10:01:38 EDT
Really looks like a dup of bug 298698.

>Now how do I turn this off, or filter it out?
Use Find/Replace to change the offending character(s).

*** This bug has been marked as a duplicate of bug 298698 ***
Comment 9 Nick Radonic CLA 2010-09-13 11:39:58 EDT
Here is another sample of code taken from a powerpoint Java slide (Cay Horstman, Big Java). It looks ugly on my screen, and not so good here either.:


public class InsufficientFundsException       extends RuntimeException {    public InsufficientFundsException() {}    public InsufficientFundsException(String message)    {       super(message);    } } 




Here's a hexdump of the string:

> hexdump -C

public class InsufficientFundsException ^K      extends RuntimeException ^K{ ^K   public InsufficientFundsException() {} ^K^K   public InsufficientFundsException(String message) ^K   { ^K      super(message); ^K   } ^K} 
00000000  0a 70 75 62 6c 69 63 20  63 6c 61 73 73 20 49 6e  |.public class In|
00000010  73 75 66 66 69 63 69 65  6e 74 46 75 6e 64 73 45  |sufficientFundsE|
00000020  78 63 65 70 74 69 6f 6e  20 0b 20 20 20 20 20 20  |xception .      |
00000030  65 78 74 65 6e 64 73 20  52 75 6e 74 69 6d 65 45  |extends RuntimeE|
00000040  78 63 65 70 74 69 6f 6e  20 0b 7b 20 0b 20 20 20  |xception .{ .   |
00000050  70 75 62 6c 69 63 20 49  6e 73 75 66 66 69 63 69  |public Insuffici|
00000060  65 6e 74 46 75 6e 64 73  45 78 63 65 70 74 69 6f  |entFundsExceptio|
00000070  6e 28 29 20 7b 7d 20 0b  0b 20 20 20 70 75 62 6c  |n() {} ..   publ|
00000080  69 63 20 49 6e 73 75 66  66 69 63 69 65 6e 74 46  |ic InsufficientF|
00000090  75 6e 64 73 45 78 63 65  70 74 69 6f 6e 28 53 74  |undsException(St|
000000a0  72 69 6e 67 20 6d 65 73  73 61 67 65 29 20 0b 20  |ring message) . |
000000b0  20 20 7b 20 0b 20 20 20  20 20 20 73 75 70 65 72  |  { .      super|
000000c0  28 6d 65 73 73 61 67 65  29 3b 20 0b 20 20 20 7d  |(message); .   }|
^C

Note: the 0x0b is control-K the vertical tab function --- that explains a lot. Now how do I turn this off, or filter it out?
Comment 10 Nick Radonic CLA 2010-09-13 11:42:20 EDT
(In reply to comment #8)
> Really looks like a dup of bug 298698.
> 
> >Now how do I turn this off, or filter it out?
> Use Find/Replace to change the offending character(s).
> 
> *** This bug has been marked as a duplicate of bug 298698 ***



The other bug is FF (control J?) while my problem is VT (control K), but they both move the cursor while the editor is formatting the display.
Comment 11 Dani Megert CLA 2010-09-13 11:58:13 EDT
Just another instance of bug 298698. Please don't reopen again.

*** This bug has been marked as a duplicate of bug 298698 ***