on 03-02-2007 11:53 AM
Hi Expetrs,
I am using the following code in my WD applucation. It retrives country locale value.
// Retrive the local locale (country)
final String CURRENT_SESSION_LOCALE = WDResourceHandler.getCurrentSessionLocale().toString();
country_local = CURRENT_SESSION_LOCALE.substring(3).trim();
The above code is working . But some times not working and throughs exceptions
'Null Pointer Exception'
'IndexRangeOutOfBoundException'
Could any one figure it out why its failing few times. Is is Cache issue, Or Portal Memory issues?
I appreciate your tips and helpfull information on this. I will award points for answers.
Thank you
Maruti
Don't fiddle around with string representation of locale.
Use something like
Locale sessionLocale = WDResourceHandler.getCurrentSessionLocale();
String country = sessionLocale.getCountry();
See java.util.Locale Javadoc:
/**
* Returns the country/region code for this locale, which will
* either be the empty string or an uppercase ISO 3166 2-letter code.
* @see #getDisplayCountry
*/
public String getCountry() {
return country;
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.