The library smartics exception for Java has been released with version 0.12.0.

This release adds a new feature that allows methods for message parameters to create locale dependent representations. Such a method simply adds a parameter of type java.util.Locale and gets the locale passed from the calling framework. Here is an example of a method that generates the replacement for a message parameter that is dependent on the locale:

public final String getViolationsAsText(final Locale locale) {
  final StringBuilder buffer = new StringBuilder();
  if (propertyViolations != null && !propertyViolations.isEmpty()) {
    for (final PropertyException violation : propertyViolations) {
      buffer.append("  ")
  return StringUtils.chomp(buffer.toString());

A second new feature allows to call the locale-aware message getter on the cause of an I18N smartics exception. Prior to this the getLocalizedMessage had been called that used the system’s default locale, which usually did not return the desired representation.

For details on this version of the library please visit the project’s homepage, for changes since the last version, please consult the release report.





Loading tagcloud ...