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

Bug 341977

Summary: [DBCS 3.7] Open from clipboard does not work for DBCS.
Product: [Eclipse Project] JDT Reporter: Harendra <harendra>
Component: DebugAssignee: Dani Megert <daniel_megert>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: camle, daniel_megert, deepakazad, harendra, kennoji, kitlo, markus.kell.r, Michael_Rennie, prakash, pwebster
Version: 3.7   
Target Milestone: 3.7 M7   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
DBCS class file
none
Error message while opening DBCS resources from Clipboard
none
Fix
none
Fix 2 daniel_megert: review+

Description Harendra CLA 2011-04-06 01:29:51 EDT
Build Identifier: I20110329-0800

Eclipse version:I20110329-0800
OS: Red Hat Enterprise Linux 6.0
Java Version: JRE 1.6.0 IBM Linux build pxi3260sr9fp1-20110208_03 (SR9 FP1)
Locale: ja_JP.utf8

Opening a resource using Navigate->Open from Clipboard does not work for resources that have DBCS in them.

Reproducible: Always

Steps to Reproduce:
1. Create a new Java Class with DBCS name eg 新規クラス.java(also included as attachment)
2. Now copy the class name to the clipboard.
3. Go to Navigate->Open from clipboard
4. You get error message saying “Clipboard content could not be opened, refine it and try again”.
   It works fine for ascii characters.
Comment 1 Harendra CLA 2011-04-06 01:31:58 EDT
Created attachment 192611 [details]
DBCS class file
Comment 2 Harendra CLA 2011-04-06 01:32:40 EDT
Created attachment 192612 [details]
Error message while opening DBCS resources from Clipboard
Comment 3 Prakash Rangaraj CLA 2011-04-06 01:34:58 EDT
Open from Clipboard is contributed by JDT
Comment 4 Harendra CLA 2011-04-06 01:40:08 EDT
(In reply to comment #3)
> Open from Clipboard is contributed by JDT

Thanks for pointing that out.
Comment 5 Dani Megert CLA 2011-04-07 12:19:43 EDT
Fixed in HEAD.
Available in builds >= N20110407-2000.
Comment 6 Dani Megert CLA 2011-04-07 12:20:19 EDT
Created attachment 192761 [details]
Fix
Comment 7 Markus Keller CLA 2011-04-08 07:06:11 EDT
Created attachment 192812 [details]
Fix 2

The fix should be more general and support all valid Java identifier characters. The first patch, e.g. didn't support a class called "Blöd".
Comment 8 Markus Keller CLA 2011-04-08 07:06:31 EDT
.
Comment 9 Michael Rennie CLA 2011-04-08 12:10:20 EDT
The new DBCS test also failed in the N build from 04/07/2011:

expected:<3> but was:<0>
junit.framework.AssertionFailedError: expected:<3> but was:<0>
at org.eclipse.jdt.debug.tests.ui.OpenFromClipboardTests.testDBCS(OpenFromClipboardTests.java:204)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
at junit.extensions.TestSetup.run(TestSetup.java:27)
at org.eclipse.jdt.debug.tests.DebugSuite$1.run(DebugSuite.java:54)
at java.lang.Thread.run(Thread.java:619)
Comment 10 Markus Keller CLA 2011-04-08 13:32:48 EDT
(In reply to comment #9)
> The new DBCS test also failed in the N build from 04/07/2011:
Yeah, please comment it out for now.

Dani should replace the DBCS characters in the test with \uHHHH sequences.
Comment 11 Michael Rennie CLA 2011-04-08 14:33:56 EDT
(In reply to comment #10)
> Yeah, please comment it out for now.

Done.
Comment 12 Dani Megert CLA 2011-04-11 10:55:40 EDT
Comment on attachment 192812 [details]
Fix 2

Indeed a better fix. Also added test case for 'Blöd'.
Comment 13 Dani Megert CLA 2011-04-11 10:58:20 EDT
(In reply to comment #10)
> (In reply to comment #9)
> > The new DBCS test also failed in the N build from 04/07/2011:
> Yeah, please comment it out for now.
> 
> Dani should replace the DBCS characters in the test with \uHHHH sequences.

The file was set to UTF-8 but that wasn't picked up by PDE Build. I've replaced the chars with \uHHHH as suggested by Markus instead of adding the encoding to the build.properties. It's easier if all files of the project have the same encoding.

Fixed in HEAD (OpenFromClipboardTests.java, rev. 1.8).
Comment 14 Michael Rennie CLA 2011-04-11 15:37:32 EDT
(In reply to comment #13)

> Fixed in HEAD (OpenFromClipboardTests.java, rev. 1.8).

The tests all pass for me locally on Ubuntu / Win 7 64bit
Comment 15 Kentaroh Noji CLA 2011-05-02 00:32:18 EDT
Verified the problem was fixed with I20110421-1800 (Windows XP, 7)
Comment 16 Harendra CLA 2011-05-16 22:54:03 EDT
Confirmed fix in Japanese locale as well.