<?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/"
	>

<channel>
	<title>Pencils Down &#187; Java</title>
	<atom:link href="http://www.dantoomeysoftware.com/pencils-down/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dantoomeysoftware.com/pencils-down</link>
	<description>This weblog is about my experiences in software development</description>
	<lastBuildDate>Fri, 27 Jan 2012 13:43:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>oc4j Permgen Error Probably Isn&#8217;t</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2011/11/15/oc4j-permgen-error-probably-isnt/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2011/11/15/oc4j-permgen-error-probably-isnt/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 20:26:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Memory]]></category>
		<category><![CDATA[OC4J]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/?p=264</guid>
		<description><![CDATA[After chasing down a PERMGEN error deploying/running a site on oc4j for a while I did the smarter thing and did something else for a while. Of course it doesn&#8217;t help that the top N google hits for &#8220;PERMGEN&#8221; aren&#8217;t even from Oracle/Java.  So, you get all sorts if interesting advice for changes to Java [...]]]></description>
			<content:encoded><![CDATA[<p>After chasing down a PERMGEN error deploying/running a site on oc4j for a while I did the smarter thing and did something else for a while. Of course it doesn&#8217;t help that the top N google hits for &#8220;PERMGEN&#8221; aren&#8217;t even from Oracle/Java.  So, you get all sorts if interesting advice for changes to Java memory management.</p>
<p>Then it occurred to be: the site was working fine before a recent set of changes, maybe something got broken?</p>
<p>Even better, it had to be some kind of configuration setting that was wrong, incorrect, bad.  Any pure coding/linking error would have been more specific.  I was betting config errors were buried in the oc4j logging somewhere and only the resultant &#8220;PERMGEN&#8221; showed up.</p>
<p>Turns out a couple of items were off in the config XMLs for the project: missing setters for injections, not including a new hibernate mapping file in the list of mappings.  (I think that was the killer).</p>
<p>Took under 10 minutes to fix these things and everything started working again.</p>
<p>I really don&#8217;t like oc4j.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2011/11/15/oc4j-permgen-error-probably-isnt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Single Digit Exception in Java</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2011/08/05/single-digit-exception-in-java/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2011/08/05/single-digit-exception-in-java/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 19:17:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/?p=231</guid>
		<description><![CDATA[If you were to get an exception thrown in your app and the exception contents printed in the log is just a single digit, like 7 what you really have is an array out of bounds exception.  The number referenced is the index into an array on the line suggested by the exception.
Just trying to [...]]]></description>
			<content:encoded><![CDATA[<p>If you were to get an exception thrown in your app and the exception contents printed in the log is just a single digit, like 7 what you really have is an array out of bounds exception.  The number referenced is the index into an array on the line suggested by the exception.</p>
<p>Just trying to save someone else some pain.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2011/08/05/single-digit-exception-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to EasyMock a Void Routine</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2011/03/23/how-to-easymock-a-void-routine/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2011/03/23/how-to-easymock-a-void-routine/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 17:47:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[EasyMock]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Software Tools]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/?p=192</guid>
		<description><![CDATA[EasyMock, like other JUnit mock testers, allows you to set expectations for method calls on the mocked object.  However, the expect() method wants to see a return type from the method call.  So, what to do?
A built-in mechanism of EasyMocks is to just &#8220;call&#8221; the void method in question.  For example a commonly mocked object [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://easymock.org/">EasyMock</a>, like other JUnit mock testers, allows you to set expectations for method calls on the mocked object.  However, the expect() method wants to see a return type from the method call.  So, what to do?</p>
<p>A built-in mechanism of EasyMocks is to just &#8220;call&#8221; the void method in question.  For example a commonly mocked object is the <a href="http://download.oracle.com/javaee/1.2.1/api/javax/servlet/http/HttpSession.html">HttpSession</a>:<br />
<code><br />
    expect(request.getSession()).andReturn(session);<br />
    expect(session.getAttribute(name)).andReturn(null);<br />
    session.setAttribute(eq(name), isA(InSession.class));<br />
    replay(session);<br />
    //whatever you are really trying to test<br />
    verify(session);</code></p>
<p>Could only be easier if the doc told you this clearly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2011/03/23/how-to-easymock-a-void-routine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>icefaces commandButton not calling action</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2010/06/29/icefaces-commandbutton-not-calling-action/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2010/06/29/icefaces-commandbutton-not-calling-action/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 19:50:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[IceFaces]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/2010/06/29/icefaces-commandbutton-not-calling-action/</guid>
		<description><![CDATA[I have a screen with a series of commandButton&#8217;s.  They all should call various action methods back in the controller.  Some of the command buttons used images &#8211; they worked.  Others just had values for the buttons &#8211; they did not work.
Adding onclick showed the buttons were working, they just were not [...]]]></description>
			<content:encoded><![CDATA[<p>I have a screen with a series of commandButton&#8217;s.  They all should call various action methods back in the controller.  Some of the command buttons used images &#8211; they worked.  Others just had values for the buttons &#8211; they did not work.</p>
<p>Adding onclick showed the buttons were working, they just were not calling the actions.</p>
<p>Several misguided google&#8217;d references mentioned changing the behavior of the ui callback setting in web.xml.  I tried that and it made no difference.</p>
<p>Finally I noticed that I was missing the id attribute on the buttons.  Adding different id&#8217;s for each of the buttons fixed the problem &#8211; the buttons now invoke the methods as expected.</p>
<p>I had thought that icefaces added default id&#8217;s where necessary, but there may be a glitch when you have an assortment of fields of the same type.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2010/06/29/icefaces-commandbutton-not-calling-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORA-01461: can bind a LONG value only for insert into a LONG column</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2010/04/23/ora-01461-can-bind-a-long-value-only-for-insert-into-a-long-column/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2010/04/23/ora-01461-can-bind-a-long-value-only-for-insert-into-a-long-column/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 17:29:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/2010/04/23/ora-01461-can-bind-a-long-value-only-for-insert-into-a-long-column/</guid>
		<description><![CDATA[This is a really ugly exception thrown by Oracle from the bowels of Hibernate.  In my case I had just added a table to the mapping so I at least had some idea where to look.
Looking at the integer values in the table I went through and verified each as correct in the db, [...]]]></description>
			<content:encoded><![CDATA[<p>This is a really ugly exception thrown by Oracle from the bowels of Hibernate.  In my case I had just added a table to the mapping so I at least had some idea where to look.</p>
<p>Looking at the integer values in the table I went through and verified each as correct in the db, mapping, entity and sequence.  No luck there.</p>
<p>Poking around the internet though told me the error probably had nothing to do with a LONG mapping and could be ANY size mapping on any field.  It&#8217;s a generic sizing error.</p>
<p>Luckily the table I created only had a few fields so I was able to narrow done the problem pretty quickly.  In my case a VARCHAR2(4000) was attempted to be stored with much more.  So, the String in the Java entity had to be controlled to make sure it was small enough.</p>
<p>It&#8217;s not much, but thought I would pass the info along and maybe save you some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2010/04/23/ora-01461-can-bind-a-long-value-only-for-insert-into-a-long-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Not to Run a Project</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2010/03/01/how-not-to-run-a-project/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2010/03/01/how-not-to-run-a-project/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 18:02:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Management]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/2010/03/01/how-not-to-run-a-project/</guid>
		<description><![CDATA[A lead developer with expertise in database systems was recently promoted to project lead working in a team that was short-handed.  It seemed like a reasonable fit, at first.
Since then Ihave learned:
- The project is a modern Java web app (they hired 2 junior C (not C++ or GUI) developers from other units)
- There is no [...]]]></description>
			<content:encoded><![CDATA[<p>A lead developer with expertise in database systems was recently promoted to project lead working in a team that was short-handed.  It seemed like a reasonable fit, at first.</p>
<p>Since then Ihave learned:</p>
<p>- The project is a modern Java web app (they hired 2 junior C (not C++ or GUI) developers from other units)</p>
<p>- There is no architecture, so the developers are doing things like investigating the use of Spring or not.</p>
<p>- The project must be shipped in a few months.  This appears to be a collosal communications screw up: the contract says delivery so many days after signing, the client delayed signed for months, once signed the client assumed the clock had been ticking all along the signing was just a formality.</p>
<p>- The company we work for is strictly waterfall development with very long test cycles.  Given the expected ship date the project needs to go into test phase in a couple of weeks in order to meet their delivery date (per contract) or face penalties.</p>
<p>- Since our company is very concerned with security all 3rd party software used (tomcat, Spring, commons library, etc&#8230;) must get approval from lawyer types who go over the specific license agreement for the software involved.  Especially of interest is anything developed by non-US parties.</p>
<p>- There are no written requirements beyond a few paragraphs in the contract.</p>
<p>- There is no UI-design, it is being done by the aforementioned C developers.</p>
<p>- Like everyone else in the world there are constraints on hiring, so it is likely the project will not get a Java developer to help out.</p>
<p>That&#8217;s about all I can think of so far.  I am always amazed this kind of silliness still goes on in the world.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2010/03/01/how-not-to-run-a-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JUnit error &#8211; java.lang.Exception: No runnable methods</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 20:18:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JUnit]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/</guid>
		<description><![CDATA[This error is a catchall for anything else that might be wrong with your test class.  First make sure any of the below problems are not occurring. 
Your unit test code is running JUnit4.  At least one test method must have the @Test annotation.  Otherwise this error occurs.
If the class you are testing has @Required setters [...]]]></description>
			<content:encoded><![CDATA[<p>This error is a catchall for anything else that might be wrong with your test class.  First make sure any of the below problems are not occurring. </p>
<p>Your unit test code is running JUnit4.  At least one test method must have the @Test annotation.  Otherwise this error occurs.</p>
<p>If the class you are testing has @Required setters for Spring injections they must be set otherwise JUnit will mask the missing required exception as a no runnable methods exception.</p>
<p>If you are initializing your mock objects outside of the @Begin method you will get this error.</p>
<p>If you are attempting to mock the same class more than once you will get this error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2009/04/03/junit-error-javalangexception-no-runnable-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate NonUniqueObjectException, merge() and the Hibernate session</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2009/03/30/hibernate-nonuniqueobjectexception-merge-and-the-hibernate-session/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2009/03/30/hibernate-nonuniqueobjectexception-merge-and-the-hibernate-session/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 14:35:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/2009/03/30/hibernate-nonuniqueobjectexception-merge-and-the-hibernate-session/</guid>
		<description><![CDATA[You may have recieved an exception in Hibernate like:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session&#8230;..
This is likely caused by your code doing something like:
session.get()
object.setSomething(value)
session.update()
The session.update() call is attempting to attach an object to the Hibernate session.  This is done by the object id.  If you already have [...]]]></description>
			<content:encoded><![CDATA[<p align="left">You may have recieved an exception in Hibernate like:</p>
<p align="left">org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session&#8230;..</p>
<p align="left">This is likely caused by your code doing something like:</p>
<p align="left">session.get()</p>
<p align="left">object.setSomething(value)</p>
<p align="left">session.update()</p>
<p align="left">The session.update() call is attempting to attach an object to the Hibernate session.  This is done by the object id.  If you already have an object with the same id associated with the session (i.e. maintained by Hibernate) you get this error.</p>
<p align="left">You have two choices:</p>
<p align="left">1) Don&#8217;t call update on the object.  It is already being maintained by Hibernate.  There is no need to do so.  A later flush() will push any changes recorded in the session to the database.</p>
<p align="left">2) If you can not tell if the object is associated with the session (likely in a long user scenario) call merge() instead.  Merge() takes the instance passed and merges it with any object of the same id associated with the session.  Note, if you plan on using the object again you must use the object returned by the call to merge().  The instance object passed to merge will not be updated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2009/03/30/hibernate-nonuniqueobjectexception-merge-and-the-hibernate-session/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No Wonder Contractors Get a Bad Rep</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2009/03/11/no-wonder-contractors-get-a-bad-rep/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2009/03/11/no-wonder-contractors-get-a-bad-rep/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 12:03:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hiring]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/2009/03/11/no-wonder-contractors-get-a-bad-rep/</guid>
		<description><![CDATA[Our team lead just hired another contractor from the same agency I am working through.  The contractor went through the interview rounds (full-time&#8217;s only) including the team lead and group lead.
Per the team lead the developer has lots of experience with Java, JSF, SOA, etc&#8230;  All the stuff we need on the team
The guy talks, [...]]]></description>
			<content:encoded><![CDATA[<p>Our team lead just hired another contractor from the same agency I am working through.  The contractor went through the interview rounds (full-time&#8217;s only) including the team lead and group lead.</p>
<p>Per the team lead the developer has lots of experience with Java, JSF, SOA, etc&#8230;  All the stuff we need on the team</p>
<p>The guy talks, a lot.  This is just a personality trait that irks me.  So, maybe he&#8217;s ok anyway.</p>
<p>Then I overhear the conversations he&#8217;s having with other developers (see talks a lot above) and some of the questions he has asked me:</p>
<ul>
<li>When a screen (from the functional spec) has multiple checkboxes does that mean the user can select multiple items?</li>
<li>Similar when a screen has multiple radio buttons does that mean the user can select only one?</li>
<li>Do I need the JDK installed to compile the application?</li>
<li>Are all of the user actions affecting the database?</li>
</ul>
<p>I guess the worst part is I bet he is getting the same hourly rate (or better) than I am.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2009/03/11/no-wonder-contractors-get-a-bad-rep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate Does Not Handle Self Referencing Tables Well</title>
		<link>http://www.dantoomeysoftware.com/pencils-down/2009/02/27/62/</link>
		<comments>http://www.dantoomeysoftware.com/pencils-down/2009/02/27/62/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 18:26:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.dantoomeysoftware.com/pencils-down/2009/02/27/62/</guid>
		<description><![CDATA[After much searching around the Internet I have come to the conclusion that Hibernate really doesn&#8217;t support self-referencing tables. The typical example is something like this table:

Table Category
---------------
categoryId int
name varchar(50)
parent int

In this example the Hibernate code would be something like:

Category parent = ...Category child = ...
child.setParent(parent)
dao.create(child);//this does not appear to actually do anything in a [...]]]></description>
			<content:encoded><![CDATA[<p>After much searching around the Internet I have come to the conclusion that Hibernate really doesn&#8217;t support self-referencing tables. The typical example is something like this table:<br />
<code><br />
Table Category<br />
---------------<br />
categoryId int<br />
name varchar(50)<br />
parent int<br />
</code></p>
<p>In this example the Hibernate code would be something like:<br />
<code><br />
Category parent = ...</code><code>Category child = ...<br />
child.setParent(parent)<br />
dao.create(child);</code><code>//this does not appear to actually do anything in a self-referencing table<br />
parent.getChildren().add(child);<br />
dao.saveOrUpdate(parent);</code><code>session.flush();</p>
<p>//and then later on</p>
<p>Category category = categoryDao.something();<br />
for(Category child:category.getChildren()) {<br />
  //do something with each child<br />
}</p>
<p>Notes:</p>
<p></code></p>
<ul>
<li>Since the reference is in the same table, the above add() to the parent children does nothing.</li>
<li>The setParent() call is just setting the parent column directly in the Category object &#8211; no database action is taking place.</li>
<li>Calls to getChildren() are doing a simple query unlike other getObject ORM calls in Hibernate</li>
<li>Calls to getParent() are also doing abnormal ORM calls</li>
</ul>
<p>All of the above code &#8216;works&#8217;. It just doesn&#8217;t work like anything else really in Hibernate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dantoomeysoftware.com/pencils-down/2009/02/27/62/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

