synyx / messagesource

Synyx Messagesource for Spring. This project brings an implementation of Springs MessageSource interface, which is responsible for resolving texts in an internationalised manner.
19 stars 11 forks source link

Java version #2

Closed fabianbuch closed 12 years ago

fabianbuch commented 12 years ago

Currently messagesource as dependency on JDK 1.6

Is a version for 1.5 doable?

fabianbuch commented 12 years ago

Comment of Marc Kannegiesser: The Tool is built for 1.5 so there should be no problem using it with Java5.

What are the concrete problems that occur?

fabianbuch commented 12 years ago

Comment of Edward Pawlik: The offending class is org.synyx.messagesource.InitializableMessageSource

The method is below and the problem is that the String.isEmpty() is a Java 6 method.

private List getPath(Locale locale) {
        List path = resolvingPath.get(locale);
        if (path == null) {
            path = new ArrayList();

            List localePath = LocaleUtils.getPath(locale, getDefaultLocale());
            for (Locale loc : localePath) {
                if (loc == null) {
                    path.add("_");
                } else {

                    String language = LocaleUtils.getLanguage(loc);
                    String country = LocaleUtils.getCountry(loc);
                    String variant = LocaleUtils.getVariant(loc);
                    if (!variant.isEmpty()) {
                        path.add(String.format("_%s_%s_%s", language, country, variant));
                    } else if (!country.isEmpty()) {
                        path.add(String.format("_%s_%s", language, country));
                    } else if (!language.isEmpty()) {
                        path.add(String.format("_%s", language));
                    }
                }
            }
            resolvingPath.put(locale, path);
        }
        return path;
    }

Can I point you to the maven compiler plugin and how it doesn’t actually guarantee that the source code will actually run on the targeted jdk.. [http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html]

fabianbuch commented 12 years ago

Comment of Marc Kannegiesser: hi, thanks for pointing this out.

ill take care of it.

fabianbuch commented 12 years ago

Comment of Anonymous: Applied in changeset r15614.

fabianbuch commented 12 years ago

Comment of Marc Kannegiesser: I just deployed the latest changes as SNAPSHOT so you might want to give it a try (0.7-SNAPSHOT from the regular repo).