eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
863 stars 782 forks source link

[PaperUI] Whitespace in location setting #4634

Closed NorbertHD closed 6 years ago

NorbertHD commented 6 years ago

In PaperUI Configuration>System>Regional Settings>Location I put accidently a space after the comma that separates longitude and latitude:

49.123456, 8.123456,123

There was no error message in the UI, and I searched a long time why the astro binding didn't auto discover the location.

In the log there was only one warning:

 [WARN ] [.core.internal.i18n.I18nProviderImpl] - Could not set new location, keeping old one:
 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to de_DE, Location set to null, Time zone set to Europe/Berlin

But no reason why the location was not set.

Please either ignore whitespaces in the location string or give an explicit error message.

maggu2810 commented 6 years ago

I agree that the error message could be improved. Do you consider to create a PR with the text you expect in the special cases?

kaikreuzer commented 6 years ago

We could also enhance the parser to strip spaces from the values, so that it would actually accept the entry.

maggu2810 commented 6 years ago

I think about it, too and was not sure about that change. Wouldn't it be better to have e.g. some special context so the UI could provide better input field(s)? IMHO a strict format that should be used and a UI that checks and perhaps correct the format would be better then a parser that does the "format fixes" itself (or that accepts a more less strict format).

Just to prevent another issue that came up with: I have written "1;2;3" instead of "1,2,3" can we change the parser to support semicolons as separator, too?

I would prefer a strict and easy format and a UI that accept that format only (or perhaps the UI could be such clever and fix format).

htreu commented 6 years ago

I would also suggest a custom formatter for PaperUI to accept separation by , or ; and also stripping whitespaces. Since the location property already has the location config description context this can be enhanced UI only.

@maggu2810 or @kaikreuzer please add tag PaperUI and Help Wanted.