wyona / yanel

http://www.yanel.org
Apache License 2.0
10 stars 5 forks source link

If no target environment is configured then the welcome resource should also work #39

Closed michaelwechner closed 12 years ago

michaelwechner commented 12 years ago

If one is commenting the target environment inside

local/apache-tomcat-7.0.25/webapps/yanel/WEB-INF/classes/yanel.xml

then one receives the following null pointer when accessing

http://127.0.0.1:8080/yanel/

java.lang.NullPointerException at org.apache.xml.serializer.TreeWalker.dispatachChars(TreeWalker.java:244) at org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:414) at org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:143) at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:389) at org.wyona.yanel.impl.resources.showrealms.ShowRealms.getContentXML(ShowRealms.java:189)

csstaub commented 12 years ago

Imho, the target environment should always be set. I'm not sure every single piece of code depending on the target environment is always checking whether or not it is null before using the value (and it should not have to). If anything, the getTargetEnvironment() function should return an empty string instead of null. That being said, I added a check and will push it shortly.

michaelwechner commented 12 years ago

Thanks for implementing the check.

For backwards compatibility reasons and also because there are no pre-configured target environments, but just suggestions to use by convention, we cannot require the configuration of the target environment.