Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Billy Sclater

Ranch Hand
+ Follow
since Nov 18, 2012
Billy likes ...
Eclipse IDE Java Linux
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Billy Sclater

I have a task to convert an incoming json message into an xml. I've made a prototype which puts the json message into an org.json.JSONObject. I then cherry pick the fields I'm interested in (not all of them), and plug them into my freemarker template. The output is the desired xml.

Is using freemarker for this sort of thing a bad idea? Objections I've heard are

'it's really for generating html or emails where you fill in the blanks, not for transforming data.''it's difficult to change if the mapping rules (from json to xml) change.''using a pojo based library like model mapper is cleaner.'

However, I like the freemarker approach as it doesn't care whether all the fields (even the ones I'm not interested in) are present/valid on the input json. It only cares about the fields that I have cherry picked. I suppose it follows the 'tolerant reader' pattern that Martin Fowler talks about.

Any thoughts/opinions?


8 months ago
I'm having some trouble using @PropertySource, I get an NPE when using 'env.getProperty(..).
Does anybody have any insight?

My environment:
JDK/JRE: 1.6.0_06
OS: Linux Mint 13
Spring: 4.1.6.RELEASE

The stacktrace

My properties file:

My config class:

Model class:

Failed attempts (a bit random!!):
#1 I have tried playing around with the @PropertySource annotation, for example using the file: prefix and absolute path to the properties file.
Dropping the backslash before the classpath eg/@PropertySource("classpath:com/mycompany/app/").
Putting the properties file in different places.

#2 I've also tried using @PropertySources containing an @PropertySource annotation too.

#3 I've added:
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();

Any help/advice much appreciated!!
5 years ago
Hi, seem to have lost my old workspace Sorry about that. But I vaguely recall, just switching the bundle starting order in Eclipse :/
5 years ago
Hi Marios!

Wow! It's been a while since I posted this OSGI problem, I'd forgotten all about it! I'll have a look in my old workspace and see if I can get it to run again, if so I'll post the code and the steps I used :/
5 years ago
In Robert Martin (Uncle Bob)'s book 'Clean Code'. He advises to use comments very sparingly. And seems to suggest that a comment represents that the programmer failed to code correctly in a readable fashion! So what about JavaDoc? Should this be skipped under 'clean code standards'? Does JavaDoc indicate poorly written code?

I'm very interested to hear your opinions!!
5 years ago
Well, that's good news!! And the 'Javascript in 24hours' book is next on my reading list!!
5 years ago
Ok, I've just bought the Bates & Sierra book 'Head First: JSP & Servlets', I'm working through the book and enjoying it!

In my workplace one coworker described JSP and Servlets as 'old school'.
Another agreed, but did concede that there is still a lot of call for these technologies in the industry.
He said that there are a lot of 'legacy' solutions out there using JSP and Servlets, so it is a technology worth knowing.

Hmm.. doesn't sound very reassuring! I want to learn web development, so what is your advice?

Should I go ahead and study Servlets & JSP? Or is there another technology you'd recommend?

Also, what's your opinion? Are Servlets & JSP really going the way of the dinosaurs?
5 years ago
In answer to my own!! (:
5 years ago
Hi, I have an AcvtiveMq question. Sorry, I'm quite new to messaging so I wasn't sure which forum to post this on

I get the following warning in my log:

It occurs when I run a test using maven. The test itself uses very little memory, certainly less than 1GB!!

Is the issue this warning represent likely to cause a test failure?

5 years ago

is my source code safe at all?

Not really ....

link to thread on decompilers

But it looks like you're safe if you use a version later than Java 7.0, least until somebody makes a decompiler for it!!

The company I work for use licenses (similar to your Windows license) to protect their products.
5 years ago
Sounds like heaven! I hope we move to using versions (in my company) soon(:
5 years ago

A lot of people get sloppy and don't specify version numbers in their pom dependency stanzas or use "grab bag" versioning (as in "give me the latest".)

Currently version numbers aren't used in my company (to my understanding) or rather everything is stamped with the same version number!!
But I get your point.

From what you are saying, it sounds like if version numbers are used correctly.
Then if 'version 2' of a certain artifact is broken, then you can just choose 'version 1' instead. (Assuming 'version 1' is compatible with your source code.)
Is that right?
5 years ago

What exactly do you mean with an "accurate result"?

Today, I've made some minor changes which were not in yesterday's code. But... I'm using yesterday's local repo (offline) when I build.
Does this matter? Is it possible, that my changes won't be picked up? (Forgive me if my question is a bit newbie-ish! I'm quite new to maven!).

5 years ago
I have a copy of my company's project locally on my hard drive and yesterday, the code built successfully.
However, this morning with 'the same source code' (except a few minor changes) the build failed due to some test failures.

This happens from time to time, I believe some 'in-house' jars that the tests require occaisonally 'get broken' by other developers,
and this causes these intermittent build failures.

If I now run mvn clean install from my machine, I'll get a failed build.

However, I still have a copy of yesterday's .m2 local repository. And if I use it and build 'offline', I'll get a build success!

My question is this:
Is this 'successful build' an accurate result?
5 years ago