Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Possible bug in PreferenceService#getByteArray
Possible bug in PreferenceService#getByteArray [message #509097] Thu, 21 January 2010 11:34 Go to next message
Marcel Hoetter is currently offline Marcel HoetterFriend
Messages: 28
Registered: July 2009
Junior Member
Hello,

i found a possible bug in the org.eclipse.core.internal.preferences.PreferencesService#get ByteArray
method.

The following JUnit test fails:

@Test
public void putByteArray_DefaultScope() {
final byte[] testArray = new byte[] { 10, 13, 15, 20 };
DefaultScope defaultScope = new DefaultScope();
defaultScope.getNode(TEST_NODE_PATH).putByteArray(TEST_PREF_ KEY, testArray);
final byte[] returnArray = Platform.getPreferencesService().
getByteArray(TEST_NODE_PATH,TEST_PREF_KEY,new byte[] {}, null);
Assert.assertArrayEquals(testArray, returnArray);
}

I think the bug is in line 512 of PrefereceService, where a "Base64.decode" is missing.
The method should look like this:

public byte[] getByteArray(String qualifier, String key, byte[] defaultValue, IScopeContext[] scopes) {
String result =
get(EclipsePreferences.decodePath(key)[1], null, getNodes(qualifier, key, scopes));
return result == null ? defaultValue : Base64.decode(result.getBytes());
}

Would someone please verify and confirm this bug?
I will then open a bug report.

Thanks,

Marcel
Re: Possible bug in PreferenceService#getByteArray [message #509170 is a reply to message #509097] Thu, 21 January 2010 15:08 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Yes that looks like a real bug. Please open a bug report against RT->Equinox->Compendium

Thanks! Good Catch!

Tom.
Re: Possible bug in PreferenceService#getByteArray [message #509182 is a reply to message #509170] Thu, 21 January 2010 15:29 Go to previous messageGo to next message
Marcel Hoetter is currently offline Marcel HoetterFriend
Messages: 28
Registered: July 2009
Junior Member
Thomas Watson schrieb:
> Yes that looks like a real bug. Please open a bug report against
> RT->Equinox->Compendium
>
> Thanks! Good Catch!
>
> Tom.
>
done. :)
Re: Possible bug in PreferenceService#getByteArray [message #509183 is a reply to message #509182] Thu, 21 January 2010 15:31 Go to previous message
Marcel Hoetter is currently offline Marcel HoetterFriend
Messages: 28
Registered: July 2009
Junior Member
Marcel Hoetter schrieb:
> done. :)
Link: https://bugs.eclipse.org/bugs/show_bug.cgi?id=300385
Previous Topic:Where's the best place to put code that shutdowns Ehcache CacheManager ?
Next Topic:How to let run Equinox on a debian server in the background / deploy Equinox?
Goto Forum:
  


Current Time: Thu Apr 25 12:39:10 GMT 2024

Powered by FUDForum. Page generated in 0.02831 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top