state-machine-systems / envy

Super simple configuration for Java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Properties processed in non-deterministic order

coudy opened this issue · comments

Nothing disastrous but a bit surprising that with multiple runs of my app the config barfs on different properties.

~/d/q ❯❯❯ java -jar something.jar                                                                                                                               ⏎
Exception in thread "main" com.statemachinesystems.envy.MissingParameterValueException: Missing configuration parameter value for JDBC_USER in Config.getJdbcUser
    at com.statemachinesystems.envy.ConfigExtractor.getRawValue(ConfigExtractor.java:141)
    at com.statemachinesystems.envy.ConfigExtractor.extractValue(ConfigExtractor.java:112)
    at com.statemachinesystems.envy.ConfigExtractor.extractValuesByMethodName(ConfigExtractor.java:102)
    at com.statemachinesystems.envy.ConfigExtractor.extractValuesByMethodName(ConfigExtractor.java:90)
    at com.statemachinesystems.envy.Envy.proxy(Envy.java:120)
    at com.statemachinesystems.envy.Envy.configure(Envy.java:45)
    at com.statemachinesystems.envy.Envy.configure(Envy.java:22)
    at ...main(Boot.scala:19)
    at ...main(Boot.scala)
~/d/q ❯❯❯ java -jar something.jar                                                                                                                               ⏎
Exception in thread "main" com.statemachinesystems.envy.MissingParameterValueException: Missing configuration parameter value for JDBC_URL in Config.getJdbcUrl
    at com.statemachinesystems.envy.ConfigExtractor.getRawValue(ConfigExtractor.java:141)
    at com.statemachinesystems.envy.ConfigExtractor.extractValue(ConfigExtractor.java:112)
    at com.statemachinesystems.envy.ConfigExtractor.extractValuesByMethodName(ConfigExtractor.java:102)
    at com.statemachinesystems.envy.ConfigExtractor.extractValuesByMethodName(ConfigExtractor.java:90)
    at com.statemachinesystems.envy.Envy.proxy(Envy.java:120)
    at com.statemachinesystems.envy.Envy.configure(Envy.java:45)
    at com.statemachinesystems.envy.Envy.configure(Envy.java:22)
    at ...main(Boot.scala:19)
    at ...main(Boot.scala)

This is related to http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7023180.

A quick fix would be to sort method names alphabetically, rather than relying on the order they're returned in.

Fixed in 1.6