<?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>Codedrop™ Weblog &#187; Java</title>
	<atom:link href="http://www.codedrop.ca/blog/archives/category/programming/java/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codedrop.ca/blog</link>
	<description>Drop'n some code and other tech tidbits...</description>
	<lastBuildDate>Mon, 26 Jul 2010 16:45:02 +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>OpenSSL Certificate Formats / Conversion</title>
		<link>http://www.codedrop.ca/blog/archives/131</link>
		<comments>http://www.codedrop.ca/blog/archives/131#comments</comments>
		<pubDate>Tue, 15 Sep 2009 20:45:55 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/131</guid>
		<description><![CDATA[This past week has left me having to learn much more about https certificates then I ever thought I would care to know&#8230;&#160;&#160; Here&#8217;s a synopsis of some of the highlights of my learnings as pulled from various resources on the web.
OpenSSL supports several certificate formats. Certificates are based on the DSA signature algorithm and [...]]]></description>
			<content:encoded><![CDATA[<p>This past week has left me having to learn much more about https certificates then I ever thought I would care to know&#8230;&nbsp;&nbsp; Here&#8217;s a synopsis of some of the highlights of my learnings as pulled from various resources on the web.</p>
<p>OpenSSL supports several certificate formats. Certificates are based on the DSA signature algorithm and the RSA algorithm for public-key cryptography according to PKCS algorithms.&nbsp; The certificate format depends on the application, as there is no agreement on file format standards.</p>
<p>Private keys are usually available in the PEM and DER format. The related files have names of the following type:</p>
<p>*key-rsa.pem for pem files<br />*key-rsa.der for der files</p>
<p>For OpenSSL applications, the PEM format should suffice. For Java applications, the DER format might be more suitable for importing the private key and certificates.</p>
<p>For certificates, the available formats are PEM, DER and PKCS12 with file names of the following type:</p>
<p>*cert.pem for pem files<br />*cert.der for der files<br />*cert.p12 for pkcs12 files</p>
<p>In general, the PEM formats are mostly used in the Unix world, PCKS12 in the Microsoft world and DER in the Java world.</p>
<p>Certificate files are ASN.1-encoded objects that may be encrypted according to DES (Data Encryption Standard). The files can optionally be encrypted using a symmetric cipher algorithm, such as 3DES.</p>
<p>An unencrypted PEM file might look something like this:</p>
<p>&nbsp;&nbsp;&nbsp; &#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;<br />&nbsp;&nbsp;&nbsp; MB4CGQDUoLoCULb9LsYm5+/WN992xxbiLQlEuIsCAQM=<br />&nbsp;&nbsp;&nbsp; &#8212;&#8211;END CERTIFICATE&#8212;&#8211;</p>
<p>The string beginning with MB4C&#8230; is the Base64-encoded, ASN.1-encoded object.</p>
<p>An encrypted file would have headers describing the type of encryption used, and the initialization vector:</p>
<p>&nbsp;&nbsp;&nbsp; &#8212;&#8211;BEGIN RSA PRIVATE KEY&#8212;&#8211;<br />&nbsp;&nbsp;&nbsp; Proc-Type: 4,ENCRYPTED<br />&nbsp;&nbsp;&nbsp; DEK-Info: DES-EDE3-CBC,C814158661DC1449<br />&nbsp;&nbsp;&nbsp; AFAZFbnQNrGjZJ/ZemdVSoZa3HWujxZuvBHzHNoesxeyqqidFvnydA==<br />&nbsp;&nbsp;&nbsp; &#8212;&#8211;END RSA PRIVATE KEY&#8212;&#8211;</p>
<p>The two headers Proc-Type and DEK-Info declare the type of encryption, and the string starting with AFAZ&#8230; is the Base64-encoded, encrypted, ASN.1-encoded object.</p>
<p>As web browsers make use of Java applications, they import/export certificates in pkcs12 file format, i.e. public and private keys are packed in one single file using the PKCS#12 algorithm. Other applications require the pem format with unpacked public and private keys, thus the user must remember the appropriate file format for each application and must perform format conversions as appropriate.</p>
<p>The following tables report a summary of formats used for INFN-Grid applications and two simple scripts with format conversion commands.</p>
<p>INFN-Grid Certificates Format Summary<br />Certificate Type &nbsp;&nbsp;&nbsp; Certificate Format<br />CA Authority Certificate &nbsp;&nbsp;&nbsp; DER<br />Personal Certificate from CA &nbsp;&nbsp;&nbsp; PKCS12<br />Grid Access Certificate &nbsp;&nbsp;&nbsp; PEM</p>
<p>=========================<br />CONVERT pkcs12 to pem<br />=========================<br />#!/bin/sh<br />echo &#8220;copy your cert to cert.p12 &#8211; then run this script&#8221;<br />openssl pkcs12 -clcerts -nokeys -in cert.p12 -out usercert.pem<br />openssl pkcs12 -nocerts -in cert.p12 -out userkey.pem</p>
<p>=========================<br />CONVERT pem to pkcs12<br />=========================<br />#!/bin/sh<br />echo &#8220;Verify that you are using the correct certificate pair (key/cert)&#8221;<br />openssl pkcs12 -export -out one.identity.neteller.com.p12 -inkey ./one.identity.neteller.com.key -in ./one.identity.neteller.com.cert </p>
<p>** NOTE: specify the -in and -inkey parameters as PEM format files&#8230; </p>
<p>If your running JRockit, you might also be interested in how to <a href="http://publib.boulder.ibm.com/infocenter/iwphelp/v2r5m1/index.jsp?topic=/com.ibm.wcs.ic.doc_2.5.1/infocenter/i_sec_t_updateverisignrootcert.html">update Verisign CA root certificates</a>. </p>
<p>This might be required if you start seeing errors such as this:<br />javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=5d37ff70-843b-8313-8968-e114e42e13b9" /></div>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=OpenSSL+Certificate+Formats+%2F+Conversion+http://tqy6o.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=OpenSSL+Certificate+Formats+%2F+Conversion+http://tqy6o.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/131/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a default &#8216;usage&#8217; target for your ANT project builds</title>
		<link>http://www.codedrop.ca/blog/archives/121</link>
		<comments>http://www.codedrop.ca/blog/archives/121#comments</comments>
		<pubDate>Fri, 14 Aug 2009 17:14:13 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Build Automation]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/121</guid>
		<description><![CDATA[I keep coming across instances of ant build files where developers have hard coded a usage target that outputs target actions.&#160; This is not required and should be avoided as it is often not maintained.&#160; Instead, properly maintain the description attribute of each target and use a default target as below:&#160;&#160;


&#60;project name="foo" basedir="." default="usage"&#62;

...

&#60;target name="usage"&#62;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>I keep coming across instances of ant build files where developers have hard coded a usage target that outputs target actions.&nbsp; This is not required and should be avoided as it is often not maintained.&nbsp; Instead, properly maintain the description attribute of each target and use a default target as below:&nbsp;&nbsp;<br />
<br/><br/></p>
<pre>
&lt;project name="foo" basedir="." default="usage"&gt;

...

&lt;target name="usage"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;java classname="org.apache.tools.ant.Main"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;arg value="-projecthelp"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;classpath&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pathelement location="${lib.dir}/ant/ant.jar"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pathelement location="${lib.dir}/ant/ant-launcher.jar"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pathelement location="${lib.dir}/ant/xerces_2.8.0.jar"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/classpath&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/java&gt;
&nbsp;&nbsp;&nbsp; &lt;/target&gt;

...

&lt;/project&gt;
</pre>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=79307383-1e97-863a-86f6-4643f16acad8" /></div>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Create+a+default+%E2%80%98usage%E2%80%99+target+for+your+ANT+project+builds+http://xza5o.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Create+a+default+%E2%80%98usage%E2%80%99+target+for+your+ANT+project+builds+http://xza5o.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/121/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MaxPermSize and how it relates to the overall heap</title>
		<link>http://www.codedrop.ca/blog/archives/110</link>
		<comments>http://www.codedrop.ca/blog/archives/110#comments</comments>
		<pubDate>Thu, 16 Jul 2009 19:08:38 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Memory]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/110</guid>
		<description><![CDATA[Grails application throwing OutOfMemory error and PermGen space was exceeeded errors&#8230; Looks like grails applications require a fairly large permgen space&#8230; Here&#8217;s a useful&#160; article on how to address this. 



 Tweet This Post]]></description>
			<content:encoded><![CDATA[<p>Grails application throwing OutOfMemory error and PermGen space was exceeeded errors&#8230; Looks like grails applications require a fairly large permgen space&#8230; Here&#8217;s a useful&nbsp; <a href="http://www.unixville.com/%7Emoazam/stories/2004/05/17/maxpermsizeAndHowItRelatesToTheOverallHeap.html">article</a> on how to address this. </p>
<p><font face="sans-serif"></font></p>
<p><font face="sans-serif"></font></p>
<p></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=MaxPermSize+and+how+it+relates+to+the+overall+heap+http://zzg7c.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=MaxPermSize+and+how+it+relates+to+the+overall+heap+http://zzg7c.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/110/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Returning raw XML string from Oracle XDB within Groovy / Grails</title>
		<link>http://www.codedrop.ca/blog/archives/101</link>
		<comments>http://www.codedrop.ca/blog/archives/101#comments</comments>
		<pubDate>Mon, 13 Jul 2009 16:11:16 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[XMLDB]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/101</guid>
		<description><![CDATA[Here&#8217;s a quick solution for trying to extract the raw xml string from an Oracle XDB database when working with Grails.
After an initial attempt to hardcode a hibernate query to return the raw sql using .getStringVal() as follows:
  SELECT x.id, x.xmlData xmldata.getStringVal(), lines.*
  FROM xml_requests x
       XMLTable('declare [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick solution for trying to extract the raw xml string from an <a href="http://www.oracle.com/technology/tech/xml/xmldb/index.html">Oracle XDB</a> database when working with Grails.</p>
<p>After an initial attempt to hardcode a hibernate query to return the raw sql using .getStringVal() as follows:</p>
<pre>  SELECT x.id, x.xmlData xmldata.getStringVal(), lines.*
  FROM xml_requests x
       XMLTable('declare default element namespace
				"http://www.foo.com/fooservice";
                for $i in /XXXResponse/ResponseData/*/node()
                where $i/*:Error/*:Code = "0"
                return $i'
                PASSING x.xmldata
                COLUMNS GivenName NVARCHAR2(200)
	          PATH './*:PersonAdresseData/*:Person/*:Navn/*:Fornavne',
                    Surname  NVARCHAR2(200)
	          PATH './*:PersonAdresseData/*:Person/*:Navn/*:Efternavn') lines
  WHERE ....</pre>
<p>I found that the query would blow up if the xml string returned exceeded some threshold.  Approx ~ 2000 chars as I&#8217;m using an oracle database.</p>
<p>Solution was relatively simple thanks to the various support libraries Oracle brings to the table.</p>
<p>Add the <strong>xdb.jar</strong> and <strong>xmlparserv2.jar</strong> libraries from the Oracle installation into your Grails application /lib directory and then modify the .gsp page to handle the custom type accordingly as below:</p>
<pre>  &lt;div class="list"&gt;
    &lt;table&gt;
      &lt;thead&gt;
      &lt;tr&gt;
        &lt;g:each var="key" in="${list[0].keySet()}"&gt;
          &lt;g:sortableColumn property="${key}" title="${key}"/&gt;
        &lt;/g:each&gt;
      &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
      &lt;g:each in="${list}" status="i" var="item"&gt;
        &lt;tr class="${(i % 2) == 0 ? 'odd' : 'even'}"&gt;
          &lt;g:each var="key" in="${list[0].keySet()}"&gt;
            &lt;td&gt;
            &lt;g:if test="${item[key] instanceof oracle.xdb.XMLType}"&gt;
              ${item[key].getStringVal()}
            &lt;/g:if&gt;
            &lt;g:else&gt;
              ${item[key]}
            &lt;/g:else&gt;
            &lt;/td&gt;
          &lt;/g:each&gt;
        &lt;/tr&gt;
      &lt;/g:each&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;</pre>
<p>** The above code will dynamically render a table view using the column names as headers in an HTML table. In my eaxmple one the columns I wanted to display was XMLType and stored in Oracle XDB format.</p>
<p><span style="font-family: sans-serif;"> </span></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Returning+raw+XML+string+from+Oracle+XDB+within+Groovy+%2F+Grails+http://3m4gf.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Returning+raw+XML+string+from+Oracle+XDB+within+Groovy+%2F+Grails+http://3m4gf.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/101/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips for dealing with javac OutOfMemoryError</title>
		<link>http://www.codedrop.ca/blog/archives/97</link>
		<comments>http://www.codedrop.ca/blog/archives/97#comments</comments>
		<pubDate>Fri, 12 Jun 2009 16:25:11 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Memory]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/97</guid>
		<description><![CDATA[When javac is compiling a large number of java source files, it may fail with java.lang.OutOfMemoryError:
The system is out of resources.Consult the following stack trace for details.java.lang.OutOfMemoryError: Java heap space
It&#8217;s no different than OutOfMemoryError in other java applications. When you run javac in Sun JDK, it&#8217;s invoking com.sun.tools.javac.main.Main located in %JAVA_HOME%\lib\tools.jar.
If you are compiling with [...]]]></description>
			<content:encoded><![CDATA[<p>When javac is compiling a large number of java source files, it may fail with java.lang.OutOfMemoryError:</p>
<p>The system is out of resources.<br />Consult the following stack trace for details.<br />java.lang.OutOfMemoryError: Java heap space</p>
<p>It&#8217;s no different than OutOfMemoryError in other java applications. When you run javac in Sun JDK, it&#8217;s invoking com.sun.tools.javac.main.Main located in %JAVA_HOME%\lib\tools.jar.</p>
<p>If you are compiling with javac task in Apache Ant, set fork attribute to true, to run javac in a separate process with its own heap size settings. If fork is set to false, or not set (default is false), javac will run in the same process as Ant, which has a default maximum heap size of 64m.</p>
<pre>
&lt;javac fork="true"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; srcdir="${basedir}/src"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destdir="${basedir}/build/classes"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; classpath="${project.classpath}"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memoryinitialsize="256m"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memorymaximumsize="256m"&amp;gt;
&lt;/javac&gt;
</pre>
<p>Setting fork to true will also limit any memory leaks in javac implementation to its own child process, without affecting the parent Ant process.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Tips+for+dealing+with+javac+OutOfMemoryError+http://q38oc.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Tips+for+dealing+with+javac+OutOfMemoryError+http://q38oc.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/97/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing Header Class (CSS) in JSF Datatables</title>
		<link>http://www.codedrop.ca/blog/archives/46</link>
		<comments>http://www.codedrop.ca/blog/archives/46#comments</comments>
		<pubDate>Mon, 05 May 2008 16:30:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/?p=46</guid>
		<description><![CDATA[Something I have always found annoying about JSF datatables is the limitation to only apply one header class style to the entire table.  This is un-functional for datatables that would display monetary amount or other data that is typically right aligned whereas descriptive columns are left aligned.  The table doesn&#8217;t look very nice [...]]]></description>
			<content:encoded><![CDATA[<p>Something I have always found annoying about JSF datatables is the limitation to only apply one header class style to the entire table.  This is un-functional for datatables that would display monetary amount or other data that is typically right aligned whereas descriptive columns are left aligned.  The table doesn&#8217;t look very nice if the heading don&#8217;t match the columns.</p>
<p>To work around this I&#8217;ve found that declaring a &lt;div/&gt; within the header facet allows you to override the style to behave as desired&#8230; below is an example of a table that uses a default headerClass for the majority of columns but is overridden to left align where applicable.</p>
<p><img src="http://www.codedrop.ca/blog/wp-content/uploads/2008/05/headers_sample.jpg" alt="Headers Sample" width="477" height="115" /></p>
<p>Code:</p>
<p>&lt;h:panelGrid width=&#8221;100%&#8221; id=&#8221;memberTransactionTableBody&#8221; border=&#8221;0&#8243; cellspacing=&#8221;0&#8243; cellpadding=&#8221;0&#8243; columns=&#8221;1&#8243;&gt;<br />
&lt;h:column&gt;<br />
&lt;h:form id=&#8221;form&#8221;&gt;</p>
<p>&lt;h:dataTable rowClasses=&#8221;accountTransactionRowDefault, accountTransactionRowAlternate&#8221;<br />
headerClass=&#8221;accountColumnHeader StrongText&#8221;<br />
footerClass=&#8221;accountColumnFooter&#8221;<br />
width=&#8221;100%&#8221;<br />
cellpadding=&#8221;0&#8243; cellspacing=&#8221;0&#8243; border=&#8221;0&#8243;                               columnClasses=&#8221;account-padding,account-date,account-description,account-debit,</p>
<p>account-credit,account-currency,account-status&#8221;<br />
styleClass=&#8221;accountTransactionText&#8221;<br />
var=&#8221;transaction&#8221;<br />
value=&#8221;#{transactionHandler.transactionBean.transactionHistory}&#8221;<br />
rows=&#8221;40&#8243;&gt;</p>
<p>&lt;h:column&gt; &lt;/h:column&gt;</p>
<p>&lt;h:column&gt;<br />
&lt;f:facet name=&#8221;header&#8221;&gt;<br />
<span style="color: #330099;"><strong>&lt;div style=&#8221;float: left;&#8221;&gt;</strong></span><br />
#{messages['message.account.column.date']}<br />
<span style="color: #330099;"><strong>&lt;/div&gt;</strong></span><br />
&lt;/f:facet&gt;<br />
&lt;h:outputText value=&#8221;#{transaction.dateTimeStamp}&#8221;/&gt;<br />
&lt;f:facet name=&#8221;footer&#8221;&gt; &lt;/f:facet&gt;<br />
&lt;/h:column&gt;</p>
<p>&lt;h:column&gt;<br />
&lt;f:facet name=&#8221;header&#8221;&gt;<br />
<span style="color: #330099;"><strong>&lt;div style=&#8221;float: left;&#8221;&gt;</strong></span><br />
#{messages['message.account.column.description']}<br />
<span style="color: #330099;"><strong>&lt;/div&gt;</strong></span><br />
&lt;/f:facet&gt;<br />
&lt;h:outputText value=&#8221;#{transaction.description}&#8221;/&gt;<br />
&lt;/h:column&gt;</p>
<p>&lt;h:column&gt;<br />
&lt;f:facet name=&#8221;header&#8221;&gt;<br />
#{messages['message.account.column.debit']}<br />
&lt;/f:facet&gt;<br />
&lt;h:outputText value=&#8221;#{transaction.debit}&#8221;/&gt;<br />
&lt;/h:column&gt;</p>
<p>&lt;h:column&gt;<br />
&lt;f:facet name=&#8221;header&#8221;&gt;<br />
#{messages['message.account.column.credit']}<br />
&lt;/f:facet&gt;<br />
&lt;h:outputText value=&#8221;#{transaction.credit}&#8221;/&gt;<br />
&lt;/h:column&gt;</p>
<p>&lt;h:column&gt;<br />
&lt;f:facet name=&#8221;header&#8221;&gt;<br />
#{messages['message.account.column.currency']}<br />
&lt;/f:facet&gt;<br />
&lt;h:outputText value=&#8221;#{transaction.currency}&#8221;/&gt;<br />
&lt;/h:column&gt;</p>
<p>&lt;/h:dataTable&gt;</p>
<p>&lt;/h:form&gt;<br />
&lt;/h:column&gt;<br />
&lt;/h:panelGrid&gt;</p>
<pre></pre>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Changing+Header+Class+%28CSS%29+in+JSF+Datatables+http://7goy6.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Changing+Header+Class+%28CSS%29+in+JSF+Datatables+http://7goy6.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/46/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intercepting JUnit Assertion Error</title>
		<link>http://www.codedrop.ca/blog/archives/32</link>
		<comments>http://www.codedrop.ca/blog/archives/32#comments</comments>
		<pubDate>Thu, 03 May 2007 19:09:36 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/?p=32</guid>
		<description><![CDATA[There have been times where I&#8217;ve had the need to perform some custom code when a JUnit test failure occurs. A simple way to handle this would be to catch Throwable do you logic and then re-throw the exception.
Not the most elegant of solutions.. but works nonetheless.  Heres an example using the selenium rc [...]]]></description>
			<content:encoded><![CDATA[<p>There have been times where I&#8217;ve had the need to perform some custom code when a JUnit test failure occurs. A simple way to handle this would be to catch Throwable do you logic and then re-throw the exception.</p>
<p>Not the most elegant of solutions.. but works nonetheless.  Heres an example using the selenium rc framework:</p>
<p>public void testNewSignInDEValidMember() throws Exception {</p>
<p>try {<br />
selenium.open(&#8220;/tests/&#8221;);<br />
selenium.click(&#8220;link=Member Fixture UI&#8221;);<br />
selenium.waitForPageToLoad(&#8220;30000&#8243;);<br />
selenium.select(&#8220;memberFixture:address:country&#8221;, &#8220;label=GERMANY&#8221;);<br />
selenium.select(&#8220;memberFixture:member:currency&#8221;, &#8220;label=EUR&#8221;);<br />
selenium.type(&#8220;memberFixture:address:city&#8221;, &#8220;Berlin&#8221;);<br />
selenium.type(&#8220;memberFixture:address:provinceState&#8221;, &#8220;&#8221;);<br />
selenium.click(&#8220;memberFixture:submit&#8221;);<br />
selenium.waitForPageToLoad(&#8220;30000&#8243;);<br />
String accountId = selenium.getText(&#8220;accountId&#8221;);<br />
&#8230; etc&#8230;</p>
<p>} catch (Throwable ex) {<br />
log.error(&#8220;Failure Occurred! &#8221; + ex);<br />
ex.printStackTrace();</p>
<p>// Do custom logic here&#8230; (ie: screencapture)</p>
<p>throw new Exception(ex);<br />
}</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Intercepting+JUnit+Assertion+Error+http://5gmbd.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Intercepting+JUnit+Assertion+Error+http://5gmbd.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/32/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logging (Log4J/Jakarta Commons) Config</title>
		<link>http://www.codedrop.ca/blog/archives/11</link>
		<comments>http://www.codedrop.ca/blog/archives/11#comments</comments>
		<pubDate>Thu, 30 Jun 2005 19:01:14 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/?p=11</guid>
		<description><![CDATA[The Jakarta Commons Logging package is an ultra-thin bridge between different logging libraries. Components may use the Commons Logging API to remove compile-time and run-time dependencies on any particular logging package, and contributors may write Log implementations for the library of their choice.
Levels To Use
The six logging levels provided by the commons logging API and [...]]]></description>
			<content:encoded><![CDATA[<p>The Jakarta Commons Logging package is an ultra-thin bridge between different logging libraries. Components may use the Commons Logging <span class="caps">API</span> to remove compile-time and run-time dependencies on any particular logging package, and contributors may write Log implementations for the library of their choice.</p>
<h3>Levels To Use</h3>
<p>The six logging levels provided by the commons logging <span class="caps">API</span> and my suggested uses for them are (in order):</p>
<ul>
<li><strong>trace</strong> the least serious; not to be used unless very fine grained tracing is required in a complex piece of code.</li>
<li><strong>debug</strong> used to print debugging information, helpful in development and for debugging; this will almost certainly be disabled when running in production.</li>
<li><strong>info</strong> informatory messages to the logging destination, which help understanding the flow of control within an application; significant application events should be logged at this level (account creation, account closed, etc.).</li>
<li><strong>warn</strong> information related to some faulty and unexpected behavior of the system, which needs attention in near future or else can cause malfunctioning of the application.</li>
<li><strong>error</strong> error related messages; this will very likely be configured to email the associated error message and exception to the operations/support team and should be used sparingly.</li>
<li><strong>fatal</strong> system critical information, for problems which are causing the application to crash; not to be used.</li>
</ul>
<p>Utilizing the commons api for logging allows for a simple migration to any of the supported logging implementation with little or no code change. Logging messages within your code is simple:</p>
<pre>import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class SomeClass {
private static final transient Log log = LogFactory.getLog(SomeClass.class);
...

public void someMethod() {

log.info("This is the log message");

... do something ...

}

public void someOtherMethod() {

if (log.isDebugEnabled()) {
... do something complex...
log .debug(theResult);
}

}
}</pre>
<h3>Log4J Implementation</h3>
<p>In order to activate the log4j functionality within tomcat you must tell tomcat how to use log4j.Ensure that the log4j.jar is available in <span class="caps">TOMCAT</span>_HOME/common/lib and copy the log4j.properties.sample file to <span class="caps">TOMCAT</span>_HOME/common/classes/log4j.properties. Log4J only supports one instance per container so we configure the logging properties at the container level so that the individual webapps do not interfere with eachother.</p>
<p>Sample Log4J Properties File</p>
<pre>###############################################################################
# Set default logging level and default appenders.
#
# Syntax: log4j.[logger]=[level], appenderName, appenderName, ...
###############################################################################
log4j.rootLogger=INFO, console, file

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d %p [%c] - %m%n

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=${catalina.home}/logs/stdout.log
log4j.appender.file.MaxFileSize=512KB
log4j.appender.file.MaxBackupIndex=3
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d %p [%c] - %m%

### We don't want items outside of com.neteller to log to our custom
### log files so set additivity to false.
log4j.additivity.com.xxx=false

###############################################################################
# Backend classes
###############################################################################

### Spring
#log4j.logger.org.springframework=WARN

### Hibernate
#log4j.logger.net.sf.hibernate=INFO
#log4j.logger.net.sf.hibernate.SQL=DEBUG

### EHCache
#net.sf.hibernate.cache=DEBUG

###############################################################################
# UI classes
###############################################################################

### MyFaces
#log4j.logger.org.apache.myfaces.el.VariableResolverImpl=info
#log4j.logger.org.apache.myfaces=WARN

### Tiles logging
#log4j.logger.org.apache=info

###############################################################################
# Configure member (com.xxx.*) specific logger.
###############################################################################
### Direct log message to the member specific log file as well as to the
### default console (as we defined in tomcat's log4j properties file).
log4j.logger.com.xxx.yyy=DEBUG, console, yyylog

log4j.appender.yyylog=org.apache.log4j.RollingFileAppender
log4j.appender.yyylog.File=${catalina.home}/logs/member.log
log4j.appender.yyylog.MaxFileSize=512KB
log4j.appender.yyylog.MaxBackupIndex=3
log4j.appender.yyylog.layout=org.apache.log4j.PatternLayout
log4j.appender.yyylog.layout.ConversionPattern=%d %p [%c] - %m%n

### Override specific categories to the appropriate logging level here.
#log4j.logger.com.yyylog.service=debug</pre>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Logging+%28Log4J%2FJakarta+Commons%29+Config+http://c6pdb.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Logging+%28Log4J%2FJakarta+Commons%29+Config+http://c6pdb.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/11/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
