<?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>non-random ramble &#187; jdk</title>
	<atom:link href="http://jimbarritt.com/non-random/category/code/jdk/feed/" rel="self" type="application/rss+xml" />
	<link>http://jimbarritt.com/non-random</link>
	<description>adventures in code</description>
	<lastBuildDate>Tue, 20 Sep 2011 13:16:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Java Sources (src.jar) for JDK on OSX</title>
		<link>http://jimbarritt.com/non-random/2009/12/02/java-sources-src-jar-for-jdk-on-osx/</link>
		<comments>http://jimbarritt.com/non-random/2009/12/02/java-sources-src-jar-for-jdk-on-osx/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 10:19:41 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/?p=320</guid>
		<description><![CDATA[I just discovered that I don&#8217;t have the src.jar for my JDK installation and took a bit of ferreting about to find out that you need to download and install the JDK documentation bundle from apple developer site, aswell as the actual jdk. You can see the thread I found here The downloads for both [...]]]></description>
			<content:encoded><![CDATA[<p>I just discovered that I don&#8217;t have the src.jar for my JDK installation and took a bit of ferreting about to find out that you need to download and install the JDK documentation bundle from apple developer site, aswell as the actual jdk.</p>
<p>You can see the thread I found <a href="http://lists.apple.com/archives/Java-dev/2008/Sep/msg00360.html">here</a></p>
<p>The downloads for both the JDK and the associated documentation live <a href="https://connect.apple.com">here</a> login and go to downloads. You want &#8220;Java for Mac OS X Release X&#8221; and &#8220;Java for Mac OS X Release X Developer documentation&#8221;</p>
<p>It then lives in (e.g) <code>/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home</code></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2009%2F12%2F02%2Fjava-sources-src-jar-for-jdk-on-osx%2F&amp;title=Java%20Sources%20%28src.jar%29%20for%20JDK%20on%20OSX"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2009/12/02/java-sources-src-jar-for-jdk-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XStream collections: when is an ArrayList not an ArrayList ?</title>
		<link>http://jimbarritt.com/non-random/2009/11/25/xstream-collections-when-is-an-arraylist-not-an-arraylist/</link>
		<comments>http://jimbarritt.com/non-random/2009/11/25/xstream-collections-when-is-an-arraylist-not-an-arraylist/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 15:29:44 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/?p=315</guid>
		<description><![CDATA[I was just getting the following output from XStream when trying to serialize an object which has a collection property: &#60;addresses class="java.util.Arrays$ArrayList"> &#60;a class="address-array"> &#60;address> It had to step through the code to see what was going on. The key is in the subtlety of the type of the list that I was putting in [...]]]></description>
			<content:encoded><![CDATA[<p>I was just getting the following output from XStream when trying to serialize an object which has a collection property:</p>
<pre>
&lt;addresses class="java.util.Arrays$ArrayList">
&lt;a class="address-array">
&lt;address>
</pre>
<p>It had to step through the code to see what was going on.</p>
<p>The key is in the subtlety of the type of the list that I was putting in there. Notice that actually its not an <code>java.util.ArrayList</code> its actually an inner class of the <code>Arrays</code>, called, happily <code>$ArrayList</code>, so I had been staring at it the whole time and not noticed.</p>
<p>When XStream serializes its doing the following:</p>
<pre name='code' class='java:nogutter:nocontrols'>
        Class actualType = newObj.getClass();
        Class defaultType = mapper.defaultImplementationOf(fieldType);
        if (!actualType.equals(defaultType)) {
            String serializedClassName = mapper.serializedClass(actualType);
            if (!serializedClassName.equals(mapper.serializedClass(defaultType))) {
                String attributeName = mapper.aliasForSystemAttribute(&#8220;class&#8221;);
                if (attributeName != null) {
                    writer.addAttribute(attributeName, serializedClassName);
                 }
            }
        }
</pre>
<p>From version 1.3.1 &#8211; <code>AbstractReflectionConverter:127</code></p>
<p>So its asking the mapper what the default implementation of the type is. The type in this case was <code>java.util.List</code> and the default implementation is of course <code>java.util.ArrayList</code>. It is not seeing <code>java.util.Arrays$ArrayList</code> as the same thing and so thinks it needs to specify it.</p>
<p>Now you might be asking, how come I have a strange inner class version of <code>ArrayList</code> ? Well the thing is, I thought I was being clever in the set up of my test data and im using:</p>
<pre name='code' class='java:nogutter:nocontrols'>
       addresses = Arrays.asList(
                new AddressBuilder().addressType(&#8220;home&#8221;).streetAddress(&#8220;1 The street&#8221;).build(),
                new AddressBuilder().addressType(&#8220;work&#8221;).streetAddress(&#8220;2 The street&#8221;).build(),
                new AddressBuilder().addressType(&#8220;holiday&#8221;).streetAddress(&#8220;3 The street&#8221;).build()
        );
</pre>
<p>To set up my test data. <code>asList</code> does this:</p>
<pre name='code' class='java:nogutter:nocontrols'>
 public static  List asList(T&#8230; a) {
	return new ArrayList(a);
    }
    private static class ArrayList extends AbstractList
	implements RandomAccess, java.io.Serializable
    {
        private static final long serialVersionUID = -2764017481108945198L;
	private Object[] a;
</pre>
<p>Where it uses its own implementation of ArrayList.</p>
<p>Phew, another fun couple of hours spent there.</p>
<p></e></t></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2009%2F11%2F25%2Fxstream-collections-when-is-an-arraylist-not-an-arraylist%2F&amp;title=XStream%20collections%3A%20when%20is%20an%20ArrayList%20not%20an%20ArrayList%20%3F"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2009/11/25/xstream-collections-when-is-an-arraylist-not-an-arraylist/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IntelliJ Crashes on OS X</title>
		<link>http://jimbarritt.com/non-random/2009/08/01/intellij-crashes-on-os-x/</link>
		<comments>http://jimbarritt.com/non-random/2009/08/01/intellij-crashes-on-os-x/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 09:48:00 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[ides]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/2009/08/01/intellij-crashes-on-os-x/</guid>
		<description><![CDATA[I have been running v.8 of IntelliJ on os x for a while now, and noticed the odd crash, particularly after waking up the computer. Thanks to my colleague Tom Czarniecki I have found a solution that appears to be working. Some googling turned up very little, but mostly points to the JVM being the [...]]]></description>
			<content:encoded><![CDATA[<p>I have been running v.8 of IntelliJ on os x for a while now, and noticed the odd crash, particularly after waking up the computer.</p>
<p>Thanks to my colleague <a href="http://watchitlater.com/blog/about">Tom Czarniecki</a> I have found a solution that appears to be working.</p>
<p>Some googling turned up very little, but mostly points to the JVM being the problem. I had tried updating the Java installed on os x and setting the JDK to be 1.5 which did seem to improve stability but still crashed.</p>
<p>Tom pointed out that Intellij also has a configuration for the JDK version in its config which I updated to be 1.6+ and then switched my JDK back to 1.6 64bit. That was a week ago and not only have I had no crashes, of course the whole experience is smoother under 1.6! woo hoo!</p>
<p>The trick lies in the file</p>
<pre name='code' class='java:nogutter:nocontrols'>
/Applications/IntelliJ IDEA 8.1.3.app/Contents/Info.plist
</pre>
<pre name='code' class='java:nogutter:nocontrols'>
&lt;key&gt;JVMVersion&lt;/key&gt;
&lt;string&gt;1.6*&lt;/string&gt;
</pre>
<p>To Switch JDKs:</p>
<pre name='code' class='java:nogutter:nocontrols'>
/Applications/Utilities/Java/Java Preferences.app
</pre>
<p>Some other references I found along the way:</p>
<p><a href="http://www.jetbrains.net/devnet/thread/282406">http://www.jetbrains.net/devnet/thread/282406</a> </p>
<p>JDK Update:</p>
<p><a href="http://www.apple.com/downloads/macosx/apple/application_updates/javaformacosx105update4.html">http://www.apple.com/downloads/macosx/apple/application_updates/javaformacosx105update4.html</a></p>
<p>To See IntelliJ Log output:</p>
<p> ~/Library/Caches/IntelliJIDEA8x/log/</p>
<p>UPDATE:</p>
<p>For Intellij9:</p>
<p>/Users/jim/Library/Logs/IntelliJIdea90/idea.log</p>
<p>(I found this using the activity monitor and then &#8220;inspect process&#8221; and you can see a list of open files and ports)</p>
<p>IntelliJ stores its plugins here (Thanks to <a href="http://blog.cotopia.com/2008/08/uninstall-intellij-plugins-on-os-x.html">these guys</a>) :</p>
<p>~/Library/Application Support/IntelliJIDEA80</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2009%2F08%2F01%2Fintellij-crashes-on-os-x%2F&amp;title=IntelliJ%20Crashes%20on%20OS%20X"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2009/08/01/intellij-crashes-on-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Util Logging</title>
		<link>http://jimbarritt.com/non-random/2006/01/18/9/</link>
		<comments>http://jimbarritt.com/non-random/2006/01/18/9/#comments</comments>
		<pubDate>Wed, 18 Jan 2006 01:07:10 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[jdk]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[websphere]]></category>

		<guid isPermaLink="false">http://www.planet-ix.com/non-random/2006/01/18/9/</guid>
		<description><![CDATA[ok so now i need to know about java logging with the util package&#8230; pretty simple &#8230;. private static Logger log = Logger.getLogger(XSDStoreServletParameters.class.getName()); then log.finest(&#8220;hello&#8221;); and if (log.isLoggable(Level.CONFIG)) { } etc. problem is that it doesnt do anything in the websphere process server&#8230; hey ho. it uses the old commons-logging (apparently called &#8220;JCL&#8221; these days!) [...]]]></description>
			<content:encoded><![CDATA[<p>ok so now i need to know about java logging with the util package&#8230;</p>
<p>pretty simple &#8230;.</p>
<p>private static Logger log = Logger.getLogger(XSDStoreServletParameters.class.getName());</p>
<p>then log.finest(&#8220;hello&#8221;);</p>
<p>and</p>
<p>if (log.isLoggable(Level.CONFIG))  {</p>
<p>}</p>
<p>etc.</p>
<p>problem is that it doesnt do anything in the websphere process server&#8230;</p>
<p>hey ho.</p>
<p>it uses the old commons-logging (apparently called &#8220;JCL&#8221; these days!)</p>
<p>grrrrrr!</p>
<p>so you do :</p>
<p>private static Log log = LogFactory.getLog(JDBCToXML.class);</p>
<p>then its just like Log4J</p>
<p>the trick is to get Websfear to print it out &#8211; it doesnt want to put low level logging to the console.</p>
<p>you can get it to go to a file though and tail that i guess.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2006%2F01%2F18%2F9%2F&amp;title=Util%20Logging"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2006/01/18/9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

