You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and this template: {{statuses.[lineStatus.line].cssClass}}, which now I understand is wrong, I think I need lookup.
However I did not get that understanding from the error message, since it was:
Caused by: com.github.jknack.handlebars.HandlebarsException: /views/LineStatus.hbs:99:24:
java.lang.IllegalArgumentException: net.twisterrob.blt.model.Line$2 is not an enum class
at java.base/java.lang.Class.enumConstantDirectory(Class.java:3862)
at java.base/java.lang.Enum.valueOf(Enum.java:267)
at com.github.jknack.handlebars.context.MapValueResolver.resolve(MapValueResolver.java:52)
java.lang.IllegalArgumentException: No enum constant net.twisterrob.blt.model.Line.lineStatus.line
Sadly this not only affects the error cases, the feature to be able to index into an EnumMap via a String in [] is broken too, because it won't find the valueOf given the wrong class. I tried {{statuses.[Bakerloo].cssClass}} and got the same is not an enum class exception, even though according to the MapValueResolver it should've "just worked".
The text was updated successfully, but these errors were encountered:
I have a model property
Map<Line, StatusChange> statuses = new EnumMap(Line.class);
where these are the enum definitions:
and this template:
{{statuses.[lineStatus.line].cssClass}}
, which now I understand is wrong, I think I needlookup
.However I did not get that understanding from the error message, since it was:
I had a look at the sources:
handlebars.java/handlebars/src/main/java/com/github/jknack/handlebars/context/MapValueResolver.java
Line 52 in 683c5e8
and debugged, where I confirmed that the code is passing in the wrong class:
then the error becomes a more meaningful:
Sadly this not only affects the error cases, the feature to be able to index into an
EnumMap
via aString
in[]
is broken too, because it won't find thevalueOf
given the wrong class. I tried{{statuses.[Bakerloo].cssClass}}
and got the sameis not an enum class
exception, even though according to theMapValueResolver
it should've "just worked".The text was updated successfully, but these errors were encountered: