Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347302 - [preferences] NumberFormatException: For input string: "container" when creating new Java project
Summary: [preferences] NumberFormatException: For input string: "container" when creat...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: 3.7 RC4   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-26 08:32 EDT by John CLA
Modified: 2011-06-03 04:29 EDT (History)
6 users (show)

See Also:
daniel_megert: review+
deepakazad: review+
Michael_Rennie: review+


Attachments
org.eclipse.jdt.launching.prefs (3.24 KB, text/plain)
2011-05-26 08:56 EDT, John CLA
no flags Details
org.eclipse.jdt.launching.prefs (471 bytes, text/plain)
2011-05-26 09:27 EDT, John CLA
no flags Details
Fix (1.01 KB, patch)
2011-05-26 10:18 EDT, Dani Megert CLA
no flags Details | Diff
Fix 2 (revert bug 338673) (2.25 KB, patch)
2011-05-27 08:48 EDT, Markus Keller CLA
daniel_megert: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John CLA 2011-05-26 08:32:51 EDT
Build Identifier: I20110524-2200

I'm getting 4 exceptions during the File->New Java Project and only after pressing the first Next button. These are seen only in Error Log (view).
They are all titles the same: `Error while decoding JRE entry`
Eclipse SDK

Version: 4.1.0
Build id: I20110524-2200

eclipse.buildId=I20110524-2200
java.version=1.6.0_25
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64


here are the exceptions in the order of occurrence:
=============
java.lang.NumberFormatException: For input string: "container"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	at java.lang.Integer.parseInt(Integer.java:449)
	at java.lang.Integer.parseInt(Integer.java:499)
	at org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.decodeJRELibraryClasspathEntries(NewJavaProjectPreferencePage.java:145)
	at org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.getDefaultJRELibrary(NewJavaProjectPreferencePage.java:102)
	at org.eclipse.jdt.ui.PreferenceConstants.getDefaultJRELibrary(PreferenceConstants.java:4004)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne.getDefaultClasspathEntries(NewJavaProjectWizardPageOne.java:1289)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.initializeBuildPath(NewJavaProjectWizardPageTwo.java:304)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.updateProject(NewJavaProjectWizardPageTwo.java:252)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.access$2(NewJavaProjectWizardPageTwo.java:200)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo$1UpdateRunnable.run(NewJavaProjectWizardPageTwo.java:161)
	at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
----------------
java.lang.NumberFormatException: For input string: "org.eclipse.jdt.launching.JRE_CONTAINER"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	at java.lang.Integer.parseInt(Integer.java:449)
	at java.lang.Integer.parseInt(Integer.java:499)
	at org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.decodeJRELibraryClasspathEntries(NewJavaProjectPreferencePage.java:145)
	at org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.getDefaultJRELibrary(NewJavaProjectPreferencePage.java:102)
	at org.eclipse.jdt.ui.PreferenceConstants.getDefaultJRELibrary(PreferenceConstants.java:4004)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne.getDefaultClasspathEntries(NewJavaProjectWizardPageOne.java:1289)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.initializeBuildPath(NewJavaProjectWizardPageTwo.java:304)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.updateProject(NewJavaProjectWizardPageTwo.java:252)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.access$2(NewJavaProjectWizardPageTwo.java:200)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo$1UpdateRunnable.run(NewJavaProjectWizardPageTwo.java:161)
	at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
----------------------------
java.lang.NumberFormatException: For input string: "#"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	at java.lang.Integer.parseInt(Integer.java:449)
	at java.lang.Integer.parseInt(Integer.java:499)
	at org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.decodeJRELibraryClasspathEntries(NewJavaProjectPreferencePage.java:145)
	at org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.getDefaultJRELibrary(NewJavaProjectPreferencePage.java:102)
	at org.eclipse.jdt.ui.PreferenceConstants.getDefaultJRELibrary(PreferenceConstants.java:4004)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne.getDefaultClasspathEntries(NewJavaProjectWizardPageOne.java:1289)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.initializeBuildPath(NewJavaProjectWizardPageTwo.java:304)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.updateProject(NewJavaProjectWizardPageTwo.java:252)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.access$2(NewJavaProjectWizardPageTwo.java:200)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo$1UpdateRunnable.run(NewJavaProjectWizardPageTwo.java:161)
	at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
------------------- and the last one:
java.util.NoSuchElementException
	at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
	at org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.decodeJRELibraryClasspathEntries(NewJavaProjectPreferencePage.java:145)
	at org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.getDefaultJRELibrary(NewJavaProjectPreferencePage.java:102)
	at org.eclipse.jdt.ui.PreferenceConstants.getDefaultJRELibrary(PreferenceConstants.java:4004)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne.getDefaultClasspathEntries(NewJavaProjectWizardPageOne.java:1289)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.initializeBuildPath(NewJavaProjectWizardPageTwo.java:304)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.updateProject(NewJavaProjectWizardPageTwo.java:252)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo.access$2(NewJavaProjectWizardPageTwo.java:200)
	at org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageTwo$1UpdateRunnable.run(NewJavaProjectWizardPageTwo.java:161)
	at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
==================


Let me know what else (info) you need so I can provide, thanks!


Reproducible: Always

Steps to Reproduce:
1. Window->Show View->Error Log
2. File->New->Java Project
3. press Next once
there should now be 4 errors titles the same:
Error while decoding JRE entry
Comment 1 Dani Megert CLA 2011-05-26 08:49:20 EDT
Works fine fore me.

Can you provide steps starting with a new workspace? Or can you attach your workspace here?
Comment 2 John CLA 2011-05-26 08:56:53 EDT
Created attachment 196657 [details]
org.eclipse.jdt.launching.prefs

this file:
org.eclipse.jdt.launching.prefs
located in:
workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings
Comment 3 Dani Megert CLA 2011-05-26 08:58:06 EDT
Sorry but this doesn't help. We either need steps to reproduce the problem or a workspace where we can investigate the issue.
Comment 4 John CLA 2011-05-26 09:07:31 EDT
ok, I will see what I can do about packing up the workspace ... :)
Comment 5 John CLA 2011-05-26 09:25:30 EDT
Alrightie then, here's steps to reproduce:
0. Window->Show View->Error Log
1. switch to a new never-before-created workspace, do not copy settings from current one (obviously xD)
2. File->New->Java Project
give project a name ie. "x"
3. JRE: select `Use default JRE (currently 'jdk1.6.0_25')
4. press Next
at this point there should be 4 errors in Error Log (as described above)
(no need to press Finish to create the project)

let me know if this isn't enough, I also include the new (since it's different) org.eclipse.jdt.launching.prefs
as attachment

I don't think you'd need the workspace to reproduce this, but you'd probably(?) need at least(and maybe only) jdk6u25
Comment 6 John CLA 2011-05-26 09:27:50 EDT
Created attachment 196660 [details]
org.eclipse.jdt.launching.prefs

workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings
Comment 7 Dani Megert CLA 2011-05-26 09:31:16 EDT
Thanks! I can reproduce now.
Comment 8 John CLA 2011-05-26 09:34:32 EDT
feel free to ignore this comment, it's mostly for stating the obvious
---
also note, if you miss step 3, thus you'll be using the defaults:
JRE: `Use and execution environment JRE: JavaSE-1.6`
then the bug/error will not appear, and apparently the last selected option remains set for all future `new java project` wizards, thus I failed to specify the defaults(that were on my computer, considering it remembers the last selected ones) which I will do so now:

Project name: can be anything
(checked) Use default location:
JRE: 
(selected) Use default JRE (currently 'jdk1.6.0_25')
Project layout:
(selected) Create separate folders for sources and class files
Working sets:
(unchecked) Add project to working sets
Comment 9 Dani Megert CLA 2011-05-26 10:16:46 EDT
Caused by fix for bug 338673.
Comment 10 Dani Megert CLA 2011-05-26 10:18:49 EDT
Created attachment 196665 [details]
Fix
Comment 11 Markus Keller CLA 2011-05-27 08:48:49 EDT
Created attachment 196750 [details]
Fix 2 (revert bug 338673)

(In reply to comment #10)
> Created attachment 196665 [details] [diff]
> Fix

The fix is problematic, since it still doesn't restore the symmetry between the encode and decode operations. E.g. when the UI string contains a + or something like %x, then the decoding with the URLEncoder can return wrong results or even fail with an IAE.

Discussed this with Dani, and we think the safest fix at this point is to revert bug 338673 completely. That scenario is unlikely to happen in the real world. Users who work in a localized version of Eclipse that uses multi-byte characters typically also have a platform encoding that supports multi-byte characters (and then bug 338673 doesn't appear at all).
Comment 12 Markus Keller CLA 2011-05-27 08:52:23 EDT
I'll reopen bug 338673. Dani & Deepak, can you please review Fix 2 (which just reverts to NewJavaProjectPreferencePage.java 1.33)?
Comment 13 Dani Megert CLA 2011-05-27 10:02:57 EDT
I think that's the safest fix at this point. +1 for RC4.
Comment 14 Deepak Azad CLA 2011-05-27 10:09:51 EDT
+1. Though you could leave in the changes to the comments.
Comment 15 Markus Keller CLA 2011-05-27 10:51:39 EDT
> +1. Though you could leave in the changes to the comments.

Yeah, but we're already in RC4, so reverting the whole file seems safer.
Comment 16 Markus Keller CLA 2011-05-27 10:52:28 EDT
RISK: Very low. We revert the code to the pre-3.7M7 state. This brings back bug 338673, but that's a minor problem that we don't think will show up in practice (see bug 338673 comment 6).

Mike, can you please give the last +1?
Comment 17 Michael Rennie CLA 2011-05-27 12:26:19 EDT
+1 looks good. I did notice the addition of '//AW' at the top of the patch, not sure if that is intentional or not.
Comment 18 Dani Megert CLA 2011-05-30 04:27:04 EDT
Committed to HEAD.
Comment 19 Dani Megert CLA 2011-06-03 04:29:37 EDT
Verified in I20110602-1051.