<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Musings about this and that</title>
	<atom:link href="http://ajesse.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ajesse.wordpress.com</link>
	<description>have a disney day ;)</description>
	<lastBuildDate>Mon, 07 Mar 2011 15:01:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ajesse.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Musings about this and that</title>
		<link>http://ajesse.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ajesse.wordpress.com/osd.xml" title="Musings about this and that" />
	<atom:link rel='hub' href='http://ajesse.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Performance monitor for free?</title>
		<link>http://ajesse.wordpress.com/2011/03/07/performance-monitor-for-free/</link>
		<comments>http://ajesse.wordpress.com/2011/03/07/performance-monitor-for-free/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 15:01:25 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Toolbox]]></category>
		<category><![CDATA[Tool]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=84</guid>
		<description><![CDATA[Toolbox-addition: a performance analyzer for free.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=84&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The other day I needed to analyze some performance issue in our web-application. A short search on the net offered a link to developer-friendly solution: a performance analyzer for free requiring only few resources. Can this be true? &#8211;&gt; Sure is worth as try.</p>
<p>The download from <a title="AppDynamics Lite product website" href="http://www.appdynamics.com/lite.php" target="_blank">AppDynamics Lite&#8217;s website</a> was done immediately. Setup was also easy, just a line to add to the app-server startup script and launching a java-app. All good described on the <a title="AppDynamics Lite documentation website" href="http://litedocs.appdynamics.com/" target="_blank">doc-website</a>.</p>
<p>Behind the trenches a Jetty-server is started which serves the info to the webclient interface and collects the data from the applications.</p>
<p>Using the webclient to analyze data is rather intuitive, if you are used to performance analyzing tools.</p>
<p>My task was to discover why a request was taking longer than the same request in a previous release. Well after some configuration of the call-graph exclusion/inclusion  list I found that some 90% of the processing time was spent writing the data to the socket-stream. This puts a &#8220;infrastructural change&#8221; (java-version, app-server,&#8230;) on the table as the main suspect. As application  development team, there is not much one can do about that&#8230; case closed. In this task I did not need to check on memory consumption, which is not served by this particular analyzer. Normally the amount of time spent in low-level libraries like java.* is not reported seperately, but this can be configured. In my case I had to include &#8220;java.net.*&#8221; and &#8220;java.io.*&#8221; because the exclusion of &#8220;java.*&#8221; cannot be overridden. An inconvenience that can be solved in 2 minutes&#8230; If you do not make some errors in the configuration. I screwed up that part of the config and as I had not done an export before (backup, me???) I had to reinstall the performance analyzer. 15 minutes and I was up and running again.</p>
<p><strong>Tu put in a nutshell:<br />
A usefull addition to my toolbox.<br />
</strong></p>
<p>Thanks to the people at AppDynamics for putting the price tag of the lite version so exceptionally low: for free.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/84/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=84&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2011/03/07/performance-monitor-for-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Pearls: assertNotNull() &#8211; the expert version</title>
		<link>http://ajesse.wordpress.com/2011/01/18/java-pearls-assertnotnull-the-expert-version/</link>
		<comments>http://ajesse.wordpress.com/2011/01/18/java-pearls-assertnotnull-the-expert-version/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 09:49:06 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Java Pearls]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=80</guid>
		<description><![CDATA[An expert's version of assertNotNull.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=80&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently a colleague stumbled upon this pearl doing a production code review:</p>
<pre style="border:1px dashed #999999;overflow:auto;background-color:#ffffe0;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;">/**
 * Assert not null.
 * @param object the object
 * @param  element type
 * @return the not null object
 */
public static  T assertNotNull(T object) {
	if (object == null) {
		assertNotNull(object, "");
		throw thisLineShouldNeverBeReached();
	}
	return object;
}
/**
 * Assert not null.
 * @param object the object
 * @param msg the msg
 */
public static void assertNotNull(Object object, String msg) {
	if (object == null) {
		throwRuntimeException("assertion: object is null but was expected not to be null. \n"
				+ msg);
	}
}
</pre>
<p>well at least it is a generic method <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The commenting is also from the production code&#8230; Hell of a expert developer.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=80&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2011/01/18/java-pearls-assertnotnull-the-expert-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>Jazoon 2010 &#8211; Testing-related Talks</title>
		<link>http://ajesse.wordpress.com/2010/06/03/jazoon-2010-testing-related-talks/</link>
		<comments>http://ajesse.wordpress.com/2010/06/03/jazoon-2010-testing-related-talks/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 19:42:43 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Unit Testing]]></category>
		<category><![CDATA[UnitTest]]></category>
		<category><![CDATA[Jazoon]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=76</guid>
		<description><![CDATA[Jazoon 2010 is history. What remains is the surprise in the eyes of the speakers of the two testing related talks: Full house, one talk had all the seats occupied and the other almost, just a few seats remained empty. Seems like testing gets more attention.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=76&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Jazoon 2010 is history. What remains is the surprise in the eyes of the speakers of the two testing related talks: Full house, one talk had all the seats occupied and the other almost, just a few seats remained empty. Seems like testing gets more attention.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=76&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2010/06/03/jazoon-2010-testing-related-talks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>SAX parser &#8211; nasty behaviour</title>
		<link>http://ajesse.wordpress.com/2010/04/09/sax-parser-nasty-behaviour/</link>
		<comments>http://ajesse.wordpress.com/2010/04/09/sax-parser-nasty-behaviour/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 15:55:19 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SAX]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=74</guid>
		<description><![CDATA[The other day an office colleague was looking for a strange error in his SAX-parsing class: Every now and then the data he got in his endElement() method was crippled, resulting in conversion problems. A few searches revealed that the SAX-Api has a nasty behaviour: it does not garantee rules for buffer-handling. This is to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=74&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The other day an office colleague was looking for a strange error in his SAX-parsing class: Every now and then the data he got in his endElement() method was crippled, resulting in conversion problems.</p>
<p>A few searches revealed that the SAX-Api has a nasty behaviour: it does not garantee rules for buffer-handling. This is to be done by the client-application. </p>
<p>Instead of relying on complete data delivered to the characters method my colleague had to buffer the data hiomself. Using a bit of sample code it was an easy fix&#8230; but you first have to get the notion of this kind of reason for an otherwise seemingly unrelated problem&#8230;</p>
<p><a href="http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPSAX3.html">This page</a> shows the sample code that we recycled:</p>
<pre style="border:1px dashed #999999;overflow:auto;background-color:#ffffe0;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;">package some.pkg;
public void characters(char buf[], int offset, int len)
throws SAXException
{
  String s = new String(buf, offset, len);
  if (textBuffer == null) {
    textBuffer = new StringBuffer(s);
  } else {
    textBuffer.append(s);
  }
}
</pre>
<p>The textBuffer can be reset in the startElement method.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=74&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2010/04/09/sax-parser-nasty-behaviour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>New adventure: try to help out with JSFUnit&#8217;s static analysis package</title>
		<link>http://ajesse.wordpress.com/2009/12/03/new-adventure-try-to-help-out-with-jsfunits-static-analysis-package/</link>
		<comments>http://ajesse.wordpress.com/2009/12/03/new-adventure-try-to-help-out-with-jsfunits-static-analysis-package/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 14:50:26 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[JSFUnit]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=72</guid>
		<description><![CDATA[I have joined the JSFUnit team to help out with the static analysis package.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=72&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It itches too much, so I am trying to scratch.</p>
<p>I have joined the JSFUnit team to help out with the static analysis package. One of the special features of JSFUnit has been orphaned for some time.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=72&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2009/12/03/new-adventure-try-to-help-out-with-jsfunits-static-analysis-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>NPE comparing BigDecimal objects?</title>
		<link>http://ajesse.wordpress.com/2009/11/13/npe-comparing-bigdecimal-objects/</link>
		<comments>http://ajesse.wordpress.com/2009/11/13/npe-comparing-bigdecimal-objects/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 10:55:10 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BigDecimal]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=69</guid>
		<description><![CDATA[BigDecimal.compareTo has a nasty precondition that can result in a NPE, but this is not documented.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=69&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After having learned that equals() is not equal enough (<a href="http://ajesse.wordpress.com/2009/10/27/when-equals-is-not-equal-enough/">my other post</a>) I just replaced equals by compareTo. After studying the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#compareTo(java.math.BigDecimal)">Javadoc for BigDecimal.compareTo</a> I did not expect any problems&#8230; until some <a href="http://en.wikipedia.org/wiki/Boundary-value_analysis">Boundary-value analysis</a> occurred and there the NPE-issue was raised&#8230; What a NPE in a simple comparision?</p>
<p>A quick look into the compareTo code showed, what research into the Javadoc confirmed, even though not at the expected place.<br />
The Javadoc for <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#compareTo(java.math.BigDecimal)">BigDecimal.compareTo(java.math.BigDecimal)</a> did not reveal any pitfalls or precoonditions. Neither did the Javadoc for <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html#compareTo(T)">Comparable.compareTo(T)</a>. Nothing about preconditions&#8230;<br />
Only in the class-javadoc for Comparable an innocent sentence revealed the source of the problem. Whereas in other places <strong>null</strong> is just a special case of an <em>Object</em>, <em>Comparable</em> follows this credo: </p>
<blockquote><p>Note that null  is not an instance of any class, and e.compareTo(null) should throw a NullPointerException even though e.equals(null)  returns false.</p></blockquote>
<p>So another lesson learned. A pity that this precondition is not documented somewhere. NullPointerException obviously is a RuntimeExcpetion and as such does not need to be documented. But when a method should repsond with such a runtime expcetion to a precondition, this behaviour should be documented as a precondition to the method.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=69&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2009/11/13/npe-comparing-bigdecimal-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>When equals() is not equal enough</title>
		<link>http://ajesse.wordpress.com/2009/10/27/when-equals-is-not-equal-enough/</link>
		<comments>http://ajesse.wordpress.com/2009/10/27/when-equals-is-not-equal-enough/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 12:36:21 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[BigDecimal]]></category>
		<category><![CDATA[equals]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=65</guid>
		<description><![CDATA[We learn that we should always use equals() to compare Java objects. But that is not always the best ticket...<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=65&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The other day we were struggling doing comparisions with BigDecimals in a distributed application with BigDecimals originating from different sources. As we had learned we used equals() to compare the objects and even though everything seemed correct, even in the debugger, the logic that indicated an equality condition never was executed.</p>
<p>Check these two methods, and try to predict the outcome:</p>
<pre style="border:1px dashed #999999;overflow:auto;background-color:#ffffe0;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;"><code>  private void sample1() {
    BigDecimal one1 = new BigDecimal("1");
    BigDecimal one2 = new BigDecimal("1.000");

    System.out.println("Comparing new BigDecimal(\"1\") and BigDecimal(\"1.000\"):");
    if (one1.equals(one2)) {
      System.out.println("  equals() indicates equality...");
    } else {
      System.out.println("  equals() indicates different values...");
      if (one1.compareTo(one2) == 0) {
        System.out.println("    but comparesTo() thinks the two BigDecimals are equal.");
      } else {
        System.out.println("    and comparesTo() thinks the same.");
      }
    }
  }

  private void sample2() {
    BigDecimal one1 = new BigDecimal(1);
    BigDecimal one2 = one1.setScale(3);

    System.out.println("Comparing new BigDecimal(1) and BigDecimal(1).setScale(3):");
    if (one1.equals(one2)) {
      System.out.println("  equals() indicates equality...");
    } else {
      System.out.println("  equals() indicates different values...");
      if (one1.compareTo(one2) == 0) {
        System.out.println("    but comparesTo() thinks the two BigDecimals are equal.");
      } else {
        System.out.println("    and comparesTo() thinks the same.");
      }
    }
  }
</code></pre>
<p>Looking into the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html">Javadoc (Java 5) of BigDecimals</a> gave a first hints:</p>
<blockquote><p>Note: care should be exercised if BigDecimal objects are used as keys in a SortedMap or elements in a SortedSet since BigDecimal&#8217;s natural ordering is inconsistent with equals. See Comparable, SortedMap or SortedSet for more information.</p></blockquote>
<p>and</p>
<blockquote><p>Compares this BigDecimal with the specified Object for equality. Unlike compareTo, this method considers two BigDecimal objects equal only if they are equal in value and scale (thus 2.0 is not equal to 2.00 when compared by this method).</p></blockquote>
<p>That definitely was a bit unexpected, but at least documented.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=65&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2009/10/27/when-equals-is-not-equal-enough/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>JadeLiquid first impressions</title>
		<link>http://ajesse.wordpress.com/2009/10/09/jadeliquid-first-impressions/</link>
		<comments>http://ajesse.wordpress.com/2009/10/09/jadeliquid-first-impressions/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 12:24:33 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[JadeLiquid]]></category>
		<category><![CDATA[Unit Testing]]></category>
		<category><![CDATA[UnitTest]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=59</guid>
		<description><![CDATA[First 5 minutes using JadeLiquid testing "tool"<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=59&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Time to test another testing tool. This time I&#8217;ll try to give a commercial tool possibility to convince me: <a href="http://www.jadeliquid.com/index.php" target="_blank">LiquidTest &#8211; Agile Functional Testing</a></p>
<p>The first installation attempt did fail, because the license key sent by mail was distorted by some element in the mail-chain. A call or an email will supply you with a test-file with a working license key.<br />
Once the eclipse plugin is installed and the license activated, you will find a new eclipse perspective and a sample project with the usual test-sample (a call to a famous search engine). Another nice touch is the creation of a new test-class. The plugin immediately offers to enter &#8220;record mode&#8221;&#8230;</p>
<p>to be continued</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=59&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2009/10/09/jadeliquid-first-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Pearls: Really short production ready class</title>
		<link>http://ajesse.wordpress.com/2009/08/10/55/</link>
		<comments>http://ajesse.wordpress.com/2009/08/10/55/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 12:41:39 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[Java Pearls]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=55</guid>
		<description><![CDATA[A sample of a really short java class.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=55&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Browsing through project code for clean up has let us stumble upon this sample of a really short java class:</p>
<pre style="border:1px dashed #999999;overflow:auto;background-color:#ffffe0;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;">package some.pkg;
public class CopyParameters {
}
</pre>
<p>The package this class was found in has already been declared production ready by the developer. Looking for checkstyle violations (missing type javadoc) let us stumble on that class. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=55&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2009/08/10/55/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Pearls: the Void class</title>
		<link>http://ajesse.wordpress.com/2009/08/07/java-pearls-the-void-class/</link>
		<comments>http://ajesse.wordpress.com/2009/08/07/java-pearls-the-void-class/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 11:37:39 +0000</pubDate>
		<dc:creator>ajesse</dc:creator>
				<category><![CDATA[Java Pearls]]></category>

		<guid isPermaLink="false">http://ajesse.wordpress.com/?p=51</guid>
		<description><![CDATA[Void class a serializable null object.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=51&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Browsing through project code for clean up has let us stumble upon this:</p>
<pre style="border:1px dashed #999999;overflow:auto;background-color:#ffffe0;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;">package some.pkg;
import java.io.Serializable;
public class Void4MyProject implements Serializable{
  public static final Void4MyProject NULL = null;
  private Void4MyProject() {
  }
}
</pre>
<p>I never had the need to have a serializable null-instance. Simply beautifull and creative.</p>
<p>Just for playing&#8230;  how is it used&#8230;</p>
<pre style="border:1px dashed #999999;overflow:auto;background-color:#ffffe0;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;">
  final protected IAccessor subTable() {
    return new IAccessor() {
      public String getId() {
        return SUB_TABLE;
      }
      public Class getStaticType() {
        return Void4MyProject.class;
      }
      public Void4MyProject getValue(T parent) {
        return <strong>null</strong>;
      }
      public void setValue(T parent, Void4MyProject value) {
        // nothing to do
      }
    };
  };
</pre>
<p>Here I consider it a <strong>big NoNo</strong> that the defined instance of Void4MyProject is not even used.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajesse.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajesse.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajesse.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajesse.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ajesse.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ajesse.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ajesse.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ajesse.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajesse.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajesse.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajesse.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajesse.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajesse.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajesse.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajesse.wordpress.com&amp;blog=1325848&amp;post=51&amp;subd=ajesse&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ajesse.wordpress.com/2009/08/07/java-pearls-the-void-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/980962c822005ada86cdfe0df61095f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ajesse</media:title>
		</media:content>
	</item>
	</channel>
</rss>
