[
https://issues.apache.org/jira/browse/FELIX-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Carsten Ziegeler resolved FELIX-3547.
-------------------------------------
Resolution: Won't Fix
> NPE in httplite on android creating Locale.
> -------------------------------------------
>
> Key: FELIX-3547
> URL: https://issues.apache.org/jira/browse/FELIX-3547
> Project: Felix
> Issue Type: Bug
> Components: Lightweight HTTP Service
> Environment: Android 2.3.x
> Reporter: Ed Schaller
> Assignee: Ken Gilmer
> Priority: Major
> Labels: patch
> Attachments: HttpServletRequestImpl.3547.patch
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> httplite/core/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java
> contains the following at line 86:
> private final Locale m_locale = new Locale( System.getProperty(
> "user.language" ), System.getProperty( "user.country" ) );
> On Android (at least 2.3, other versions not tried) this produces a
> NullPointerException when HttpServletRequestImpl is constructed because the
> Locale constructor cannot handle null and neither property is defined by
> default on Android.
> This is trivial to work around with code like:
> if(System.getProperty("user.language")==null)
> System.setProperty("user.language",
> Locale.getDefault().getLanguage());
> if(System.getProperty("user.country")==null)
> System.setProperty("user.country", Locale.getDefault().getCountry());
> A easy solution is to replace the above line with:
> private final Locale m_locale = Locale.getDefault();
> This would cause each instance to have the same Local object. Although I
> would be surprised if this is an issue the following would also work:
> private final Locale m_locale = new Locale( System.getProperty(
> "user.language", Locale.getDefault().getLanguage() ), System.getProperty(
> "user.country" ) , Locale.getDefault().getCountry());
> I'm using httplite with the felx web console for debugging. Other than this
> bug and needing to set an uncaught exception handler so android doesn't force
> close the app all is working well (the memory usage plugin of coarse dose not
> work because it depends on jmx which android doesn't have.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)