Tag Archives: java

Using system properties in with Spring

This is actually pretty easy to pull off. First you must use a property-placeholder like this: [xml] <context:property-placeholder location="classpath:myapp.properties" system-properties-mode="ENVIRONMENT"/> [/xml] The system-properties-mode supports several options including: FALLBACK – Indicates placeholders should be resolved against any local properties and then against system properties NEVER – Indicates placeholders should be resolved only against local properties and… Read More »

Issues with IntelliJ IDEA 9 M1 (Maia) in Linux and OSX (build #10372)

IntelliJ 9 (codenamed Maia) looks promising with lots and lots of great features. There seems to be an endless list of newly supported technologies, tweaks, and usability features. Maia has been superb in Mac OSX Snow Leopard. Unfortunately, my Ubuntu 9.04 desktop is an entirely different story. A big feature of Maia that I’m looking… Read More »

Five code commenting anti-patterns

In some projects (most?) comments multiply like tribbles creeping up everywhere. Sometimes the comments are especially useful but other times comments useless are destructive to maintainability. Contrary to some beliefs, bad and inaccurate comments are not mostly harmless. Bad comments take many forms. There are four forms that I think could be considered anti-patterns: 1.… Read More »

Hudson and the Sonar plugin fail: MavenInstallation NoSuchMethodError

We ran into an interesting and less than informative error when configuring Maven with our Hudson installation. Maven worked great, as expected, but the Sonar plugin stopped working and were causing builds to fail. The error message wasn’t terribly helpful: FATAL: hudson.tasks.Maven$MavenInstallation.forNode(Lhudson/model/Node;Lhudson/model/TaskListener;)Lhudson/tasks/Maven$MavenInstallation; java.lang.NoSuchMethodError: hudson.tasks.Maven$MavenInstallation.forNode(Lhudson/model/Node;Lhudson/model/TaskListener;)Lhudson/tasks/Maven$MavenInstallation; at hudson.plugins.sonar.SonarPublisher.getMavenInstallationForSonar(SonarPublisher.java:204) at hudson.plugins.sonar.SonarPublisher.executeSonar(SonarPublisher.java:213) at hudson.plugins.sonar.SonarPublisher.perform(SonarPublisher.java:177) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360) at… Read More »

Unit testing private methods using reflection (and other solutions)

When it comes to unit testing you might find yourself wanting to test private methods. Here’s four solutions, some much better than others. 1. Don’t test private methods (refactor!) If you find yourself needing to test private methods, you’re code is trying to tell you something – listen up! Unit tests should test the behavior… Read More »

Solved: Digester.getParser: org.xml.sax. SAXNotRecognizedException: http://apache.org/xml/features/validation/dynamic

I ran into a nice little problem trying to get richfaces deployed on Oracle’s OC4J: [text] Digester.getParser: org.xml.sax.SAXNotRecognizedException: http://apache.org/xml/features/validation/dynamic at oracle.xml.jaxp.JXSAXParserFactory.setFeature(JXSAXParserFactory.java:128) at org.apache.commons.digester.parser.XercesParser.configureXerces(XercesParser.java:185) at org.apache.commons.digester.parser.XercesParser.newSAXParser(XercesParser.java:138) … snip … [/text] From a little bit of googling, I found several people running into this problem or something very similar. Frustratingly, not a whole lot of solutions. One… Read More »