J4Fry JSF Errorhandling aims

Characteristics

Attribute Value
Project name J4Fry JSF Errorhandling [Subproject of J4Fry JSFComponents]
Prerequisites JDK >= 1.4, MyFaces, JSON, EzMorph
CVS module JSFComponents

About

The errorhandling routines where written in times of JSF 1.1. Many of the shortcomings described here where met with JSF 1.2. With JSF 2.0 we consider them as solved, so we recommed the usage of native JSF converters and validators.

JSF errorhandling "sucks" as many say. Why is this so?

  • JSF converters and validators do not support context-specific errortexts. If the same conversion error occurs on different pages or in different fields you cannot deliver the appropriate messages when using the standard JSF converters.
  • JSF messages reside in Java resourcebundles. To change an error message you need to roll out your application. There is no option to configure your messages in a database or with any other application specific lookup system.
  • JSF converters disable pre-conversion validation. If you want to force users to follow a pattern when entering numbers you are lost because conversion happens with any parseable format and you can only do validation on the converted value.
  • There is no global validation pattern, but instead one needs to know the specific usage of different validators.
  • JSF actions need to explicitly add FacesMessages to the FacesContext and to induce roundtrips by the means of their return value.
  • Exceptions throws by JSF actions will not result in user messages. Instead they will cause the application to show the error page.

J4Fry JSF errorhandling addresses all these issues and more. We provide a universal approach with maximum developer comfort, perfect configurability and seamless JSF integration to validate user input and lookup and propagate messages to the user.

J4Fry JSF errorhandling usage

Refer to the general JSF Components installation for installation instructions.

J4Fy JSF errorhandling is based on two basic technologies.

  • Converter driven errorhandling provides 4 different converters which allow rule and pattern based validation and formatting. The J4Fry converters accept distinct message texts for each control that the converters are attached to and for each rule or pattern that the user input failed to validate against. The different converters are: The StringConverter, the BooleanConverter, the NumberConverter and the DateConverter. There is a set of basic validation options that each of them provides and that is documented in the Basic converter options section.
  • J4Fry's action driven errorhandling is a thin wrapper around JSF actions which catches exceptions, adds their messages to the FacesContexts and returns null to induce a JSF roundtrip. The usage of the J4Fry action wrapper is documented in the Action wrapper section.

The basic validation options

The following converters are available:

To configure the converters the following options are available for all J4Fry converters. Every option may contain JSF EL and thus reference customizable data. You may use J4Fry's aspect oriented lookups to obtain a completely customizable user message system.

  • Required - can be true or false, enforces user input in a field if true, defers validation if false, defaults to false
  • RequiredMessage - a message that the user receives if he didn't input a value though it was required
  • RegExp - any pattern following the syntax defined in the javadoc of the java.util.regex.Pattern class
  • RegExpMessage - a message that the user receives if his input doesn't match the pattern defined in the RegExp attribute
  • MinLength - the minimum number of characters to input into a field
  • MinLengthMessage - a message that the user receives if he enters less characters than defined in the MinLength attribute
  • MaxLength - the maximum number of characters to input into a field
  • MaxLengthMessage - a message that the user receives if he enters more characters than defined in the MaxLength attribute
  • Any additional attributes can be referenced from within the messages (in the example below attribute Label is used within MinLengthMessage and MaxLengthMessage). This feature is also available for the message attributes of the specialized converters.

Here you can see how to use the basic validation options:

<h:someJSFTag value="#{someValue}" converter="org.j4fry.String | org.j4fry.Boolean | org.j4fry.Number | org.j4fry.Date">
<f:attribute name="Required" value="true" />
<f:attribute name="RequiredMessage" value="Please enter a value field $ {Label}" />
<f:attribute name="RegExp" value="[0-9a-z]{2,4}" />
<f:attribute name="RegExpMessage" value="Please input 2 to 4 characters (lower case or numbers) in field $ {Label}" />
<f:attribute name="MinLength" value="1" />
<f:attribute name="MinLengthMessage" value="Please enter at least $ {MinLength} characters in field $ {Label}" />
<f:attribute name="MaxLength" value="7" />
<f:attribute name="MaxLengthMessage" value="Please enter at most $ {MaxLength} characters in field $ {Label}" />
<f:attribute name="Label" value="Amount" />
</h:someJSFTag>

All these attribute values can either be constant Strings as in the exampe above or can be returned by bean properties through the EL as #{bean.property}. Also the placeholder syntax $ {...} can be part of a message String returned by the EL and will be correctly replaced by the referenced attribute value.

You may want to add a detail message to your FacesMessages. The J4Fry_ACTION_DETAIL_MESSAGE context param allows you to provide a detailMessage that is provided within your FacesMessage. Again the value may even be a JSF EL expression to allow programmatically specialized detail messages.

The converter org.j4fry.String

The String converter sticks to the basic options. When formatting objects it will return an empty String for null objects and else call their toString() method.

The converter org.j4fry.Boolean

When formatting a Boolean this converter will work just like the String converter, but when parsing a String it will return true if the input value is Y, J, ON, 1, TRUE or CHECKED. The parser is NOT case sensitive, so it will also accept y, j, on, true and checked to return true.

The converter org.j4fry.Date

The Date converter exposes the capacities of java.text.SimpleDateFormat and adds date boundary setters with distinct messages wich allow allow declarative date boundary validation. The following attributes are available:

  • Pattern - a date pattern following the definition of "Date and Time Patterns" in the Javadoc of of java.text.SimpleDateFormat that is used for formatting and parsing
  • PatternMessage - a message that the user receives if his input doesn't match the pattern defined in the Pattern attribute
  • TimeZone - the timezone the formatted and parsed String representations of the dates are in (defaults to your web servers timezone). Timezones are defined according to the Javadoc of java.util.TimeZone. For a list of supported timezones in jdk 1.4.2 see appendix timzones
  • Lenient - accepts true or false, defaults to true. From the java.text.SimpleDateFormat Javadoc: "Specify whether or not date/time parsing is to be lenient. With lenient parsing, the parser may use heuristics to interpret inputs that do not precisely match this object's format. With strict parsing, inputs must match this object's format."
  • LastAllowed - last date accepted by the validation. Follows the format given in the Pattern attribute.
  • LastAllowedMessage - a message that the user receives if he enters a date after the LastAllowed date
  • FirstAllowed - first date accepted by the validation. Follows the format given in the Pattern attribute.
  • FirstAllowedMessage - a message that the user receives if he enters a date before the FirstAllowed date

Here you can see how to use the date converter options:

<h:someJSFTag value="#{someValue}" converter="org.j4fry.Date">
<f:attribute name="Pattern" value="dd.MM.yyyy" />
<f:attribute name="PatternMessage" value="Please enter a date in format dd.mm.yyyy" />
<f:attribute name="TimeZone" value="Europe/Berlin" />
<f:attribute name="Lenient" value="false" />
<f:attribute name="LastAllowed" value="12.12.2016" />
<f:attribute name="LastAllowedMessage" value="Please enter a date before $ {LastAllowed} in field $ {Label}" />
<f:attribute name="FirstAllowed" value="12.12.1998" />
<f:attribute name="FirstAllowedMessage" value="Please enter a date after $ {FirstAllowed} in field $ {Label}" />
</h:someJSFTag>

The converter org.j4fry.Number

The Number converter accepts the attributes:

  • Pattern - a number pattern following the definition of Patterns in the Javadoc of java.text.DecimalFormat that is used for formatting and parsing.
  • Lenient - accepts true or false, defaults to false. Specifies whether parsing of numbers should accept user input that is not fully parseable. If this is set to true and the user input starts with parseable number characters but ends with some alpha cahracters that cannot be parsed as numbers than the part which is parseable is used and the rest discarded.
  • NumberMessage - this message is output if the user input cannot be parsed as a number
  • Language - the language that is used for parsing and formatting according to the chosen locale - see languagecode
  • Country - the country that is used for parsing and formatting according to the chosen locale - see countrycode
  • Variant - the variant that is used for parsing and formatting according to the chosen locale - rarely used feature of the java.util.Locale class
  • Type - you can supply "Currency" or "Percent" to enable parsing and formatting of currency and percent values according to the chosen locale

Here you can see how to use the number converter options. For validation of the format of user input use RegExps (as you see in the example). The parser of DecimalFormat, that is used here, accepts german formatted numbers:

<h:someJSFTag value="#{someValue}" converter="org.j4fry.Date">
<f:attribute name="RegExp" value="[0-9]*,[0-9]*" />
<f:attribute name="RegExpMessage" value="Please enter the number ...." />
<f:attribute name="Pattern" value="###0.00###" />
<f:attribute name="Lenient" value="true" />
<f:attribute name="Language" value="de" />
<f:attribute name="Country" value="DE" />
<f:attribute name="NumberMessage" value="Please enter a number" />
</h:someJSFTag>

The J4Fry action wrapper

As long as your application runs without throwing an exception you will not notice any difference when using the J4Fry action wrapper. But as soon as your action throws an Exception the J4Fry action wrapper will catch it, remove the JSF specific part of the exception chain, place the exceptions error message in the JSF message context and induce a roundtrip by returning null. If you don't use the J4Fry action wrapper JSF actions need to access the JSF context to provide application messages thus making the action know about the JSF context it runs in. When using the J4Fry action wrapper the method doesn't know anything about the JSF context it is used in. The J4Fry action wrapper is declared in the JSF page making JSF actions a completely non-intrusive thing keeping the actions free of JSF specific message handling code.

To use the J4Fry JSF action wrapper prefix your JSF action method bindig EL expression with

action['

and suffix it with

'].trigger

For example, if your action is triggered with

action="#{myBean.myMethod}"

simply replace this with

action="#{action['myBean.myMethod'].trigger}"

If your application uses J4Fry JSF errorhandling and needs to provide an errormessage to the user it simply throws an exception and provides an appropriate exception message.

JSF error messages may contain a clientId to display errors in the context of a GUI component instead of displaying them in the context of the complete JSP. You may provide a mapping between exception classes and clientIds to display business exceptions in their correct business context. You do this by providing context parameters starting with J4Fry_ACTION_CLIENTID_ follwed by the mapped clientId and giving the mapped exception as value. Here is in example for mapping clientId 'partner' to exception 'org.j4fry.exceptions.PartnerException':

<context-param> <param-name>J4Fry_ACTION_CLIENTID_partner</param-name> <param-value>org.j4fry.exceptions.PartnerException</param-value> </context-param>

The severity of the generated FacesMessage corresponds to the severity of generated logfile entry. The mapping between your applications exception hierarchie and the severity of FacesMessage of logfile entry is configured through context params within your applications web.xml as described in the next paragraph. By default all FacesMessages and logfile entries get severity FATAL.

By default the action wrapper will produce FacesMessages and logfile entries of SEVERITY_FATAL. If you want to associate a branch of your exception hierarchie with another severity use the config params J4Fry_ACTION_MAPPING_INFO, J4Fry_ACTION_MAPPING_WARN, J4Fry_ACTION_MAPPING_ERROR and J4Fry_ACTION_MAPPING_FATAL and set the param-value to the base class of the branch of your exception hierarchie you want to assign the severity to. Here's an example to produce FacesMessages and logfile entries with SEVERITY_FATAL for all subclasses of java.lang.RuntimeException:

<context-param> <param-name>J4Fry_ACTION_MAPPING_FATAL</param-name> <param-value>java.lang.RuntimeException</param-value> </context-param>

If you declare overlapping branches of the exception hierarchie for different severities the algorithm will first

  • check if an exception is an instance of the J4Fry_ACTION_MAPPING_INFO class and will use SERVERITY_INFO if it is so
  • if it is not it will check if the exception is an instance of the J4Fry_ACTION_MAPPING_WARN mapping and will use SERVERITY_WARN if it is so
  • if it is not it will check if the exception is an instance of the J4Fry_ACTION_MAPPING_ERROR mapping and will use SERVERITY_ERROR if it is so
  • if it is not it will check if the exception is an instance of the J4Fry_ACTION_MAPPING_FATAL mapping and will use SERVERITY_FATAL if it is so
  • and if it is not it will use SEVERITY_FATAL

If the ActionWrapper catches exceptions, that contain no message text (most NullPointerExceptions don't) you wouldn't want an empty message to appear in your browser. J4Fry allows configuration of the message that replaces the "empty message" through the J4Fry_ACTION_EMPTY_MESSAGE context param in your web.xml. The value may even be a JSF EL expression to allow language of user role specific messages.

Finally you may want to add a detail message to your FacesMessage like it is done in the converters. The J4Fry_ACTION_DETAIL_MESSAGE context param allows you to provide a detailMessage that is provided within your FacesMessage. Again the value may even be a JSF EL expression to allow programmatically specialized detail messages.

Timezones appendix

for your convenience we provide the list of timezones supported by the SUNs JVM 1.4.2 for usage in the J4Fry Date converter:

  • Etc/GMT+12
  • Etc/GMT+11
  • MIT
  • Pacific/Apia
  • Pacific/Midway
  • Pacific/Niue
  • Pacific/Pago_Pago
  • Pacific/Samoa
  • US/Samoa
  • America/Adak
  • America/Atka
  • Etc/GMT+10
  • HST
  • Pacific/Fakaofo
  • Pacific/Honolulu
  • Pacific/Johnston
  • Pacific/Rarotonga
  • Pacific/Tahiti
  • SystemV/HST10
  • US/Aleutian
  • US/Hawaii
  • Pacific/Marquesas
  • AST
  • America/Anchorage
  • America/Juneau
  • America/Nome
  • America/Yakutat
  • Etc/GMT+9
  • Pacific/Gambier
  • SystemV/YST9
  • SystemV/YST9YDT
  • US/Alaska
  • America/Dawson
  • America/Ensenada
  • America/Los_Angeles
  • America/Tijuanav
  • America/Vancouver
  • America/Whitehorse
  • Canada/Pacific
  • Canada/Yukon
  • Etc/GMT+8
  • Mexico/BajaNorte
  • PST
  • PST8PDT
  • Pacific/Pitcairn
  • SystemV/PST8
  • SystemV/PST8PDT
  • US/Pacific
  • US/Pacific-New
  • America/Boise
  • America/Cambridge_Bay
  • America/Chihuahua
  • America/Dawson_Creek
  • America/Denver
  • America/Edmonton
  • America/Hermosillo
  • America/Inuvik
  • America/Mazatlan
  • America/Phoenix
  • America/Shiprock
  • America/Yellowknife
  • Canada/Mountain
  • Etc/GMT+7
  • MST
  • MST7MDT
  • Mexico/BajaSur
  • Navajo
  • PNT
  • SystemV/MST7
  • SystemV/MST7MDT
  • US/Arizona
  • US/Mountain
  • America/Belize
  • America/Cancun
  • America/Chicago
  • America/Costa_Rica
  • America/El_Salvador
  • America/Guatemala
  • America/Indiana/Knox
  • America/Indiana/Petersburg
  • America/Indiana/Vincennes
  • America/Knox_IN
  • America/Managua
  • America/Menominee
  • America/Merida
  • America/Mexico_City
  • America/Monterrey
  • America/North_Dakota/Center
  • America/North_Dakota/New_Salem
  • America/Rainy_River
  • America/Rankin_Inlet
  • America/Regina
  • America/Swift_Current
  • America/Tegucigalpa
  • America/Winnipeg
  • CST
  • CST6CDT
  • Canada/Central
  • Canada/East-Saskatchewan
  • Canada/Saskatchewan
  • Chile/EasterIsland
  • Etc/GMT+6
  • Mexico/General
  • Pacific/Easter
  • Pacific/Galapagos
  • SystemV/CST6
  • SystemV/CST6CDT
  • US/Central
  • US/Indiana-Starke
  • America/Atikokan
  • America/Bogota
  • America/Cayman
  • America/Coral_Harbour
  • America/Detroit
  • America/Eirunepe
  • America/Fort_Wayne
  • America/Grand_Turk
  • America/Guayaquil
  • America/Havana
  • America/Indiana/Indianapolis
  • America/Indiana/Marengo
  • America/Indiana/Vevay
  • America/Indianapolis
  • America/Iqaluit
  • America/Jamaica
  • America/Kentucky/Louisville
  • America/Kentucky/Monticello
  • America/Lima
  • America/Louisville
  • America/Montreal
  • America/Nassau
  • America/New_York
  • America/Nipigon
  • America/Panama
  • America/Pangnirtung
  • America/Port-au-Prince
  • America/Porto_Acre
  • America/Rio_Branco
  • America/Thunder_Bay
  • America/Toronto
  • Brazil/Acre
  • Canada/Eastern
  • Cuba
  • EST
  • EST5EDT
  • Etc/GMT+5
  • IET
  • Jamaica
  • SystemV/EST5
  • SystemV/EST5EDT
  • US/East-Indiana
  • US/Easternv
  • US/Michigan
  • America/Anguillav
  • America/Antigua
  • America/Aruba
  • America/Asuncion
  • America/Barbados
  • America/Blanc-Sablon
  • America/Boa_Vista
  • America/Campo_Grande
  • America/Caracas
  • America/Cuiaba
  • America/Curacao
  • America/Dominica
  • America/Glace_Bay
  • America/Goose_Bay
  • America/Grenada
  • America/Guadeloupe
  • America/Guyana
  • America/Halifax
  • America/La_Paz
  • America/Manaus
  • America/Martinique
  • America/Moncton
  • America/Montserrat
  • America/Port_of_Spain
  • America/Porto_Velho
  • America/Puerto_Rico
  • America/Santiago
  • America/Santo_Domingo
  • America/St_Kitts
  • America/St_Lucia
  • America/St_Thomas
  • America/St_Vincent
  • America/Thule
  • America/Tortola
  • America/Virgin
  • Antarctica/Palmer
  • Atlantic/Bermuda
  • Atlantic/Stanley
  • Brazil/West
  • Canada/Atlantic
  • Chile/Continental
  • Etc/GMT+4
  • PRT
  • SystemV/AST4
  • SystemV/AST4ADT
  • America/St_Johns
  • CNT
  • Canada/Newfoundland
  • AGT
  • America/Araguaina
  • America/Argentina/Buenos_Aires
  • America/Argentina/Catamarca
  • America/Argentina/ComodRivadavia
  • America/Argentina/Cordoba
  • America/Argentina/Jujuy
  • America/Argentina/La_Rioja
  • America/Argentina/Mendoza
  • America/Argentina/Rio_Gallegos
  • America/Argentina/San_Juan
  • America/Argentina/Tucuman
  • America/Argentina/Ushuaia
  • America/Bahia
  • America/Belem
  • America/Buenos_Aires
  • America/Catamarca
  • America/Cayenne
  • America/Cordoba
  • America/Fortaleza
  • America/Godthab
  • America/Jujuyv
  • America/Maceio
  • America/Mendoza
  • America/Miquelon
  • America/Montevideo
  • America/Paramaribo
  • America/Recife
  • America/Rosario
  • America/Sao_Paulo
  • Antarctica/Rothera
  • BET
  • Brazil/East
  • Etc/GMT+3
  • America/Noronha
  • Atlantic/South_Georgia
  • Brazil/DeNoronha
  • Etc/GMT+2
  • America/Scoresbysund
  • Atlantic/Azores
  • Atlantic/Cape_Verde
  • Etc/GMT+1
  • Africa/Abidjan
  • Africa/Accra
  • Africa/Bamako
  • Africa/Banjul
  • Africa/Bissau
  • Africa/Casablanca
  • Africa/Conakry
  • Africa/Dakar
  • Africa/El_Aaiunv
  • Africa/Freetown
  • Africa/Lome
  • Africa/Monrovia
  • Africa/Nouakchott
  • Africa/Ouagadougou
  • Africa/Sao_Tome
  • Africa/Timbuktu
  • America/Danmarkshavn
  • Atlantic/Canaryv
  • Atlantic/Faeroe
  • Atlantic/Madeira
  • Atlantic/Reykjavik
  • Atlantic/St_Helena
  • Eire
  • Etc/GMT
  • Etc/GMT+0
  • Etc/GMT-0
  • Etc/GMT0
  • Etc/Greenwich
  • Etc/UCT
  • Etc/UTC
  • Etc/Universal
  • Etc/Zuluv
  • Europe/Belfast
  • Europe/Dublin
  • Europe/Guernsey
  • Europe/Isle_of_Man
  • Europe/Jersey
  • Europe/Lisbon
  • Europe/London
  • GB
  • GB-Eire
  • GMT
  • GMT0
  • Greenwich
  • Iceland
  • Portugal
  • UCT
  • UTC
  • Universal
  • WET
  • Zulu
  • Africa/Algiers
  • Africa/Bangui
  • Africa/Brazzaville
  • Africa/Ceuta
  • Africa/Douala
  • Africa/Kinshasa
  • Africa/Lagos
  • Africa/Libreville
  • Africa/Luanda
  • Africa/Malabo
  • Africa/Ndjamena
  • Africa/Niamey
  • Africa/Porto-Novo
  • Africa/Tunis
  • Africa/Windhoek
  • Arctic/Longyearbyen
  • Atlantic/Jan_Mayen
  • CET
  • ECT
  • Etc/GMT-1
  • Europe/Amsterdam
  • Europe/Andorra
  • Europe/Belgrade
  • Europe/Berlin
  • Europe/Bratislava
  • Europe/Brussels
  • Europe/Budapest
  • Europe/Copenhagen
  • Europe/Gibraltar
  • Europe/Ljubljana
  • Europe/Luxembourg
  • Europe/Madrid
  • Europe/Malta
  • Europe/Monaco
  • Europe/Oslo
  • Europe/Paris
  • Europe/Prague
  • Europe/Rome
  • Europe/San_Marino
  • Europe/Sarajevo
  • Europe/Skopje
  • Europe/Stockholm
  • Europe/Tirane
  • Europe/Vaduz
  • Europe/Vatican
  • Europe/Vienna
  • Europe/Warsaw
  • Europe/Zagreb
  • Europe/Zurich
  • MET
  • Poland
  • ART
  • Africa/Blantyre
  • Africa/Bujumbura
  • Africa/Cairo
  • Africa/Gaborone
  • Africa/Harare
  • Africa/Johannesburg
  • Africa/Kigali
  • Africa/Lubumbashi
  • Africa/Lusaka
  • Africa/Maputo
  • Africa/Maseru
  • Africa/Mbabane
  • Africa/Tripoli
  • Asia/Amman
  • Asia/Beirut
  • Asia/Damascus
  • Asia/Gaza
  • Asia/Istanbul
  • Asia/Jerusalem
  • Asia/Nicosia
  • Asia/Tel_Aviv
  • CAT
  • EET
  • Egypt
  • Etc/GMT-2
  • Europe/Athens
  • Europe/Bucharest
  • Europe/Chisinau
  • Europe/Helsinki
  • Europe/Istanbul
  • Europe/Kaliningrad
  • Europe/Kiev
  • Europe/Mariehamn
  • Europe/Minsk
  • Europe/Nicosia
  • Europe/Riga
  • Europe/Simferopol
  • Europe/Sofia
  • Europe/Tallinn
  • Europe/Tiraspol
  • Europe/Uzhgorod
  • Europe/Vilnius
  • Europe/Zaporozhye
  • Israel
  • Libya
  • Turkey
  • Africa/Addis_Ababa
  • Africa/Asmera
  • Africa/Dar_es_Salaam
  • Africa/Djibouti
  • Africa/Kampala
  • Africa/Khartoum
  • Africa/Mogadishu
  • Africa/Nairobi
  • Antarctica/Syowa
  • Asia/Aden
  • Asia/Baghdad
  • Asia/Bahrain
  • Asia/Kuwait
  • Asia/Qatar
  • Asia/Riyadh
  • EAT
  • Etc/GMT-3
  • Europe/Moscow
  • Europe/Volgograd
  • Indian/Antananarivo
  • Indian/Comoro
  • Indian/Mayotte
  • W-SU
  • Asia/Riyadh87
  • Asia/Riyadh88
  • Asia/Riyadh89
  • Mideast/Riyadh87
  • Mideast/Riyadh88
  • Mideast/Riyadh89
  • Asia/Tehran
  • Iran
  • Asia/Baku
  • Asia/Dubai
  • Asia/Muscat
  • Asia/Tbilisi
  • Asia/Yerevan
  • Etc/GMT-4
  • Europe/Samara
  • Indian/Mahe
  • Indian/Mauritius
  • Indian/Reunion
  • NET
  • Asia/Kabul
  • Asia/Aqtau
  • Asia/Aqtobe
  • Asia/Ashgabat
  • Asia/Ashkhabad
  • Asia/Dushanbe
  • Asia/Karachi
  • Asia/Oral
  • Asia/Samarkand
  • Asia/Tashkent
  • Asia/Yekaterinburg
  • Etc/GMT-5
  • Indian/Kerguelen
  • Indian/Maldives
  • PLT
  • Asia/Calcutta
  • Asia/Colombo
  • IST
  • Asia/Katmandu
  • Antarctica/Mawson
  • Antarctica/Vostok
  • Asia/Almaty
  • Asia/Bishkek
  • Asia/Dacca
  • Asia/Dhaka
  • Asia/Novosibirsk
  • Asia/Omsk
  • Asia/Qyzylorda
  • Asia/Thimbu
  • Asia/Thimphu
  • BST
  • Etc/GMT-6
  • Indian/Chagos
  • Asia/Rangoon
  • Indian/Cocos
  • Antarctica/Davis
  • Asia/Bangkok
  • Asia/Hovd
  • Asia/Jakarta
  • Asia/Krasnoyarsk
  • Asia/Phnom_Penh
  • Asia/Pontianak
  • Asia/Saigon
  • Asia/Vientiane
  • Etc/GMT-7
  • Indian/Christmas
  • VST
  • Antarctica/Casey
  • Asia/Brunei
  • Asia/Chongqing
  • Asia/Chungking
  • Asia/Harbin
  • Asia/Hong_Kong
  • Asia/Irkutsk
  • Asia/Kashgar
  • Asia/Kuala_Lumpur
  • Asia/Kuching
  • Asia/Macao
  • Asia/Macau
  • Asia/Makassar
  • Asia/Manila
  • Asia/Shanghai
  • Asia/Singapore
  • Asia/Taipei
  • Asia/Ujung_Pandang
  • Asia/Ulaanbaatar
  • Asia/Ulan_Bator
  • Asia/Urumqi
  • Australia/Perth
  • Australia/West
  • CTT
  • Etc/GMT-8
  • Hongkong
  • PRC
  • Singapore
  • Asia/Choibalsan
  • Asia/Dili
  • Asia/Jayapura
  • Asia/Pyongyang
  • Asia/Seoul
  • Asia/Tokyo
  • Asia/Yakutsk
  • Etc/GMT-9
  • JST
  • Japan
  • Pacific/Palau
  • ROK
  • ACT
  • Australia/Adelaide
  • Australia/Broken_Hill
  • Australia/Darwin
  • Australia/North
  • Australia/Southv
  • Australia/Yancowinna
  • AET
  • Antarctica/DumontDUrville
  • Asia/Sakhalin
  • Asia/Vladivostok
  • Australia/ACT
  • Australia/Brisbane
  • Australia/Canberra
  • Australia/Currie
  • Australia/Hobart
  • Australia/Lindeman
  • Australia/Melbourne
  • Australia/NSW
  • Australia/Queensland
  • Australia/Sydney
  • Australia/Tasmania
  • Australia/Victoria
  • Etc/GMT-10
  • Pacific/Guam
  • Pacific/Port_Moresby
  • Pacific/Saipan
  • Pacific/Truk
  • Pacific/Yap
  • Australia/LHI
  • Australia/Lord_Howe
  • Asia/Magadan
  • Etc/GMT-11
  • Pacific/Efate
  • Pacific/Guadalcanal
  • Pacific/Kosrae
  • Pacific/Noumea
  • Pacific/Ponape
  • SST
  • Pacific/Norfolk
  • Antarctica/McMurdo
  • Antarctica/South_Pole
  • Asia/Anadyr
  • Asia/Kamchatka
  • Etc/GMT-12
  • Kwajalein
  • NST
  • NZ
  • Pacific/Auckland
  • Pacific/Fiji
  • Pacific/Funafuti
  • Pacific/Kwajalein
  • Pacific/Majuro
  • Pacific/Nauru
  • Pacific/Tarawa
  • Pacific/Wake
  • Pacific/Wallis
  • NZ-CHAT
  • Pacific/Chatham
  • Etc/GMT-13
  • Pacific/Enderbury
  • Pacific/Tongatapu
  • Etc/GMT-14
  • Pacific/Kiritimati

These are the country codes available for the converter org.j4fry.Number:

    /**
     * Returns a list of all 2-letter uppercase country codes as defined
     * in ISO 3166
     */
    public static String[] getISOCountries() {
		return new String[] {
		    "AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG",
		    "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD",
		    "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BA",
		    "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "KH",
		    "CM", "CA", "CV", "KY", "CF", "TD", "CL", "CN", "CX",
		    "CC", "CO", "KM", "CG", "CK", "CR", "CI", "HR", "CU",
		    "CY", "CZ", "DK", "DJ", "DM", "DO", "TP", "EC", "EG",
		    "SV", "GQ", "ER", "EE", "ET", "FK", "FO", "FJ", "FI",
		    "FR", "FX", "GF", "PF", "TF", "GA", "GM", "GE", "DE",
		    "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GN",
		    "GW", "GY", "HT", "HM", "HN", "HK", "HU", "IS", "IN",
		    "ID", "IR", "IQ", "IE", "IL", "IT", "JM", "JP", "JO",
		    "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV",
		    "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MK",
		    "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR",
		    "MU", "YT", "MX", "FM", "MD", "MC", "MN", "MS", "MA",
		    "MZ", "MM", "NA", "NR", "NP", "NL", "AN", "NC", "NZ",
		    "NI", "NE", "NG", "NU", "NF", "MP", "NO", "OM", "PK",
		    "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT",
		    "PR", "QA", "RE", "RO", "RU", "RW", "KN", "LC", "VC",
		    "WS", "SM", "ST", "SA", "SN", "SC", "SL", "SG", "SK",
		    "SI", "SB", "SO", "ZA", "GS", "ES", "LK", "SH", "PM",
		    "SD", "SR", "SJ", "SZ", "SE", "CH", "SY", "TW", "TJ",
		    "TZ", "TH", "TG", "TK", "TO", "TT", "TN", "TR", "TM",
		    "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY",
		    "UZ", "VU", "VA", "VE", "VN", "VG", "VI", "WF", "EH",
		    "YE", "YU", "ZR", "ZM", "ZW"
		};
    }

These are the language codes available for the converter org.j4fry.Number:

    /**
     * Returns a list of all 2-letter lowercase language codes as defined
     * in ISO 639 (both old and new variant).
     */
    public static String[] getISOLanguages() {
		return new String[] {
		    "aa", "ab", "af", "am", "ar", "as", "ay", "az", "ba",
		    "be", "bg", "bh", "bi", "bn", "bo", "br", "ca", "co",
		    "cs", "cy", "da", "de", "dz", "el", "en", "eo", "es",
		    "et", "eu", "fa", "fi", "fj", "fo", "fr", "fy", "ga",
		    "gd", "gl", "gn", "gu", "ha", "iw", "he", "hi", "hr",
		    "hu", "hy", "ia", "in", "id", "ie", "ik", "is", "it",
		    "iu", "ja", "jw", "ka", "kk", "kl", "km", "kn", "ko",
		    "ks", "ku", "ky", "la", "ln", "lo", "lt", "lv", "mg",
		    "mi", "mk", "ml", "mn", "mo", "mr", "ms", "mt", "my",
		    "na", "ne", "nl", "no", "oc", "om", "or", "pa", "pl",
		    "ps", "pt", "qu", "rm", "rn", "ro", "ru", "rw", "sa",
		    "sd", "sg", "sh", "si", "sk", "sl", "sm", "sn", "so",
		    "sq", "sr", "ss", "st", "su", "sv", "sw", "ta", "te",
		    "tg", "th", "ti", "tk", "tl", "tn", "to", "tr", "ts",
		    "tt", "tw", "ug", "uk", "ur", "uz", "vi", "vo", "wo",
		    "xh", "ji", "yi", "yo", "za", "zh", "zu"
		};
    }