Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 142181 Details for
Bug 217443
Documentation for JavaCore#CORE_ENCODING does not match the observed behavior
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_217443.txt (text/plain), 3.92 KB, created by
Olivier Thomann
on 2009-07-21 16:24:54 EDT
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2009-07-21 16:24:54 EDT
Size:
3.92 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/OptionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/OptionTests.java,v >retrieving revision 1.26 >diff -u -r1.26 OptionTests.java >--- src/org/eclipse/jdt/core/tests/model/OptionTests.java 27 Jun 2008 16:02:40 -0000 1.26 >+++ src/org/eclipse/jdt/core/tests/model/OptionTests.java 21 Jul 2009 20:26:08 -0000 >@@ -14,6 +14,8 @@ > import java.util.Map; > > import junit.framework.Test; >+ >+import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.preferences.DefaultScope; >@@ -522,7 +524,15 @@ > preferences.remove(JavaModelManager.CP_VARIABLE_PREFERENCES_PREFIX+"TEST"); > } > } >- >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=217443 >+public void test13() { >+ Hashtable options = JavaCore.getDefaultOptions(); >+ String immutableValue = (String) options.get(JavaCore.CORE_ENCODING); >+ assertEquals(ResourcesPlugin.getEncoding(), immutableValue); >+ options.put(JavaCore.CORE_ENCODING, immutableValue + "_extra_tail"); >+ JavaCore.setOptions(options); >+ assertEquals(immutableValue, JavaCore.getOptions().get(JavaCore.CORE_ENCODING)); >+} > /** > * Bug 68993: [Preferences] IAE when opening project preferences > * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=68993" >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.435 >diff -u -r1.435 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 7 May 2009 18:00:56 -0000 1.435 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 21 Jul 2009 20:26:09 -0000 >@@ -1961,11 +1961,11 @@ > // set options using preferences service lookup > Iterator iterator = this.optionNames.iterator(); > while (iterator.hasNext()) { >- String propertyName = (String) iterator.next(); >- String propertyValue = service.get(propertyName, null, this.preferencesLookup); >- if (propertyValue != null) { >- options.put(propertyName, propertyValue); >- } >+ String propertyName = (String) iterator.next(); >+ String propertyValue = service.get(propertyName, null, this.preferencesLookup); >+ if (propertyValue != null) { >+ options.put(propertyName, propertyValue); >+ } > } > > // get encoding through resource plugin >@@ -4516,6 +4516,7 @@ > public void setOptions(Hashtable newOptions) { > > try { >+ Hashtable cachedValue = newOptions == null ? null : new Hashtable(newOptions); > IEclipsePreferences defaultPreferences = getDefaultPreferences(); > IEclipsePreferences instancePreferences = getInstancePreferences(); > >@@ -4526,7 +4527,12 @@ > while (keys.hasMoreElements()){ > String key = (String)keys.nextElement(); > if (!this.optionNames.contains(key)) continue; // unrecognized option >- if (key.equals(JavaCore.CORE_ENCODING)) continue; // skipped, contributed by resource prefs >+ if (key.equals(JavaCore.CORE_ENCODING)) { >+ if (cachedValue != null) { >+ cachedValue.put(key, JavaCore.getEncoding()); >+ } >+ continue; // skipped, contributed by resource prefs >+ } > String value = (String)newOptions.get(key); > String defaultValue = defaultPreferences.get(key, null); > if (defaultValue != null && defaultValue.equals(value)) { >@@ -4541,7 +4547,7 @@ > instancePreferences.flush(); > > // update cache >- this.optionsCache = newOptions==null ? null : new Hashtable(newOptions); >+ this.optionsCache = cachedValue; > } catch (BackingStoreException e) { > // ignore > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 217443
: 142181