question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Null control character in the hash of breadcrumb

See original GitHub issue

Hello!

I tried this little example:

 PreferencesFx preferencesFx = PreferencesFx.of(MainApp.class,
                Category.of("Test", Group.of("TestGroup",
                        Setting.of("Test Setting", new SimpleStringProperty("aa")))));
 preferencesFx.show();

At the show() method I got an exception:

Caused by: java.lang.IllegalArgumentException: Key contains code point U+0000
	at java.prefs/java.util.prefs.AbstractPreferences.get(AbstractPreferences.java:296)
	at com.dlsc.preferencesfx.util.StorageHandlerImpl.loadObject(StorageHandlerImpl.java:178)
	at com.dlsc.preferencesfx.model.Setting.loadSettingValue(Setting.java:359)
	at com.dlsc.preferencesfx.model.PreferencesFxModel.lambda$loadSettingValues$7(PreferencesFxModel.java:192)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1378)
	at com.dlsc.preferencesfx.model.PreferencesFxModel.loadSettingValues(PreferencesFxModel.java:189)
	at com.dlsc.preferencesfx.PreferencesFx.init(PreferencesFx.java:66)
	at com.dlsc.preferencesfx.PreferencesFx.<init>(PreferencesFx.java:61)
	at com.dlsc.preferencesfx.PreferencesFx.<init>(PreferencesFx.java:52)
	at com.dlsc.preferencesfx.PreferencesFx.of(PreferencesFx.java:97)
	at com.nokia.supervisor.controller.agent.MenuBarController.openSettings(MenuBarController.java:127)

The hashed breadcrumb contains a null control character which if prohibited in the key of a preference. The breadcrumb: Test#TestGroup#Test Setting The hashed breadcrumb: image The null control character is at the index of 16.

This prohibition for the preference key was added in JDK9 9 b63, see: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8075156

Could you change the hashing algorithm so it avoids adding null control characters to the hashed value?

Cheers

Edit: Is this fixed in #55 ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
incendiumcommented, Feb 9, 2020

I am running into this issue in 11.6.0. Under a fresh project, it still tries the invalid hash after it is unable to find an existing preference with the valid hash. This problem goes away if I implement a custom storage handler which bypasses the legacy hash fallback.

Stack trace:

Caused by: java.lang.IllegalArgumentException: Key contains code point U+0000
	at java.prefs/java.util.prefs.AbstractPreferences.get(AbstractPreferences.java:296)
	at com.dlsc.preferencesfx.util.PreferencesBasedStorageHandler.getSerializedPreferencesValue(PreferencesBasedStorageHandler.java:302)
	at com.dlsc.preferencesfx.util.PreferencesBasedStorageHandler.loadObject(PreferencesBasedStorageHandler.java:227)
	at com.dlsc.preferencesfx.model.Setting.loadSettingValue(Setting.java:517)
	at com.dlsc.preferencesfx.model.PreferencesFxModel.lambda$loadSettingValues$7(PreferencesFxModel.java:213)
	at com.dlsc.preferencesfx.model.PreferencesFxModel$$Lambda$199/0000000000000000.accept(Unknown Source)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at com.dlsc.preferencesfx.model.PreferencesFxModel.loadSettingValues(PreferencesFxModel.java:209)
	at com.dlsc.preferencesfx.PreferencesFx.init(PreferencesFx.java:69)
	at com.dlsc.preferencesfx.PreferencesFx.<init>(PreferencesFx.java:64)
	at com.dlsc.preferencesfx.PreferencesFx.<init>(PreferencesFx.java:55)
	at com.dlsc.preferencesfx.PreferencesFx.of(PreferencesFx.java:102)
1reaction
marvkcommented, Dec 15, 2020

@martinfrancois updated to 11.7.0 from 11.3.2 and my application is working fine, no perceivable difference so far! Looks good!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Null control character in the hash of breadcrumb #64 - GitHub
I am running into this issue in 11.6.0 . Under a fresh project, it still tries the invalid hash after it is unable...
Read more >
Null character - Wikipedia
The null character (also null terminator) is a control character with the value zero. It is present in many character sets, including those...
Read more >
HTB: Breadcrumbs | 0xdf hacks stuff - GitLab
The session cookie is calculated by pullone one character at random from the username and adding some static characters and taking a hash....
Read more >
How can dynamic breadcrumbs be achieved with ASP.net ...
I'd like to show how to turn your _Partial into a Bootstrap styled breadcrumb string, and how to change the bootstrap separator character(s)......
Read more >
Symbols to avoid in an Oracle password - Ask TOM
Symbols to avoid in an Oracle password Is there a definitive list of symbols that should be avoided when creating a new password....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found