placemarkt / address-formatter-java

Maven package for formatting data in the OpenStreetMaps address field generated by the Nominatim API.
MIT License
7 stars 0 forks source link

Unsupported flags: 256 #5

Closed woheller69 closed 2 years ago

woheller69 commented 2 years ago

I am trying to use your library in my LavSeeker app (Android) which searches for toilets on OSM and gets their address via Nominatim API.

I just pasted your sample code in my app as a first try and get this:

2022-09-09 18:23:42.937 7246-7246/? E/AndroidRuntime: FATAL EXCEPTION: main Process: org.woheller69.lavatories, PID: 7246 java.lang.IllegalArgumentException: Unsupported flags: 256 at java.util.regex.Pattern.(Pattern.java:1397) at java.util.regex.Pattern.compile(Pattern.java:988) at net.placemarkt.RegexPatternCache.get(RegexPatternCache.java:24) at net.placemarkt.AddressFormatter.cleanupRender(AddressFormatter.java:451) at net.placemarkt.AddressFormatter.renderTemplate(AddressFormatter.java:430) at net.placemarkt.AddressFormatter.format(AddressFormatter.java:91) at net.placemarkt.AddressFormatter.format(AddressFormatter.java:62) at org.woheller69.lavatories.activities.LavSeekerActivity.startRefreshAnimation(LavSeekerActivity.java:278)

I am using Java 8 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } ... dependencies { ... implementation 'net.placemarkt:address-formatter-java:0.0.10' }

Any ideas?

woheller69 commented 2 years ago

I found this: Flag Pattern.UNICODE_CHARACTER_CLASS is not supported on Android. It exists in Android and docs says that it has no effect on Android and can be passed but it is omitted in Pattern constructor and passing it throws exception.

https://github.com/cucumber/common/issues/494

woheller69 commented 2 years ago

I fixed the problem and created a library that works with Android:

https://github.com/woheller69/AndroidAddressFormatter