<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>stacktrace &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/stacktrace/</link>
	<description>Feed of posts on WordPress.com tagged "stacktrace"</description>
	<pubDate>Sat, 26 Dec 2009 04:36:49 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[java.lang.UnsupportedClassVersionError: Bad version number in .class file]]></title>
<link>http://bernytech.wordpress.com/2009/11/13/java-lang-unsupportedclassversionerror-bad-version-number-in-class-file/</link>
<pubDate>Fri, 13 Nov 2009 19:04:10 +0000</pubDate>
<dc:creator>bernytech</dc:creator>
<guid>http://bernytech.wordpress.com/2009/11/13/java-lang-unsupportedclassversionerror-bad-version-number-in-class-file/</guid>
<description><![CDATA[So this error appeared after I compiled my java classes, packaged them in a war, and deployed it to ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>So this error appeared after I compiled my java classes, packaged them in a war, and deployed it to the application server.  The only major change that happened to my system was an upgrade to Snow Leopard.  I searched the web forums and discovered that this issue is due to compiling the java classes with a different Java compiler version than the JVM version on the application server.</p>
<p>How can this be?  It was working fine all this time.  I checked my JAVA_HOME environment variable and it was pointing to a JVM-specific directory:  1.X.0</p>
<p>On the command line, I typed:  </p>
<p>javac -version </p>
<p>and it returned the latest version.  So I thought that maybe the OS upgrade overrided my default Java compiler.  I started to look into the ant file to find a task attribute to point to a specific JVM.  After redeployment, the error still persisted.</p>
<p>So finally, I thought about testing the actual java compiler, in the 1.X.0 directory.  I typed: javac -version and it returned again the latest version.  I tried:  ./javac -version.. the results are the same.</p>
<p>Then I traversed to the other previous versioned directories.  All of them returned the latest version. </p>
<p>This was really odd.  So finally, I decided to override all the directories from the AWESOME Time Machine.  Specifically, I replaced the directories with the directories before the OS upgrade.  </p>
<p>I ran the compilation and deployment and the issue is RESOLVED.  </p>
<p>I&#8217;m not sure why Snow Leopard overrided my directories with the latest Java compiler, but I&#8217;m glad the war file is deployable.  If I didn&#8217;t discover this issue, then it  would have caused me unneccessary stress and panic if it was a release day.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Criando sua própria classe exception (encapsulamento) em asp.net c#]]></title>
<link>http://webmaicon.wordpress.com/2009/09/18/criando-sua-propria-classe-exception-encapsulamento-em-asp-net-c/</link>
<pubDate>Fri, 18 Sep 2009 14:08:04 +0000</pubDate>
<dc:creator>webmaicon</dc:creator>
<guid>http://webmaicon.wordpress.com/2009/09/18/criando-sua-propria-classe-exception-encapsulamento-em-asp-net-c/</guid>
<description><![CDATA[(Creating your own exception class (encapsulation) in asp.net c #) Visitantes webianos, tudo bem? Es]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:left;">(Creating your own exception class (encapsulation) in asp.net c #)</p>
<p>Visitantes webianos, tudo bem?</p>
<p>Este artigo será pequeno, porém muito útil para sua aplicação.</p>
<p>Criar sua própria classe exception <a title="encapsulamento" href="http://pt.wikipedia.org/wiki/Encapsulamento" target="_blank">encapsulamento</a> a classe exception do <em><a title="Framework" href="http://pt.wikipedia.org/wiki/Framework" target="_blank">framework</a> .net</em>.</p>
<p>Trabalhar com exception de forma estruturada e organizada, otimiza muito as atividades de manutenção, implementação de layout (interface) e entendimento do código. Além de possibilitar a criação de um esquema de log para melhor monitoramento destes exceptions.<br />
<!--more--><br />
<strong>Mão na massa:</strong></p>
<p>Minha sugestão é criar uma pasta &#8220;<span style="color:#008000;">Util</span>&#8221; dentro de <em><span style="color:#008000;">App_Code</span></em>. E dentro dela pasta &#8220;<span style="color:#008000;">Util</span>&#8221; criar seu arquivo contendo sua classe.</p>
<p>Eu uso como padrão de nomenclatura a letra &#8220;c&#8221; minúsculo antes de qualquer classe, isso para me ajudar nas identificações das minhas classes com as classes do próprio <em>framework .net</em>, das classes de bibliotecas externas e de plugins.</p>
<p>Para este exemplo, minha classe chamará &#8220;<span style="color:#008000;">cException</span>&#8220;, mas poderia ser &#8220;<em>myException</em>&#8221; ou &#8220;<em>minhasExcessões</em>&#8220;&#8230; vc coloca o nome que achar mais semântico para sua aplicação e equipe.</p>
<p style="text-align:center;"><a href="http://webmaicon.wordpress.com/files/2009/09/folder_app_code_exception.jpg" target="_blank"><img class="size-large wp-image-82 aligncenter" title="folder_app_code_exception" src="http://webmaicon.wordpress.com/files/2009/09/folder_app_code_exception.jpg?w=1024" alt="folder_app_code_exception" width="1024" height="496" /></a><br />
<strong>Meu arquivo ficou assim:</strong></p>
<p><span style="color:#3366ff;">using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.HtmlControls;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;</span></p>
<p><strong>namespace classe.util</strong><br />
{</p>
<p style="padding-left:30px;"><span style="color:#3366ff;"><span style="color:#999999;">/// &#60;summary&#62;<br />
/// Classe para tratamento de exceções (erros) personalizadas.<br />
/// &#60;/summary&#62;</span><br />
public class <strong>cException : Exception</strong><br />
{<br />
<span style="color:#999999;">#region Fields</span><br />
private string _exceptionmessage;<br />
<span style="color:#999999;">#endregion</span></span></p>
<p><span style="color:#999999;">#region Properties</span><br />
public string ExceptionMessage<br />
{<br />
get { return _exceptionmessage; }<br />
set { _exceptionmessage = value; }<br />
}<br />
<span style="color:#999999;">#endregion</span></p>
<p><span style="color:#999999;">#region Constructor<br />
/// &#60;summary&#62;<br />
/// Construtor da classe, este popula a field _exceptionmessage, usado para armazenar a mensagem original da exception.<br />
/// &#60;/summary&#62;<br />
/// &#60;param name=&#8221;excep&#8221;&#62;Objeto Exception&#60;/param&#62;</span></p>
<p><strong>public cException(Exception excep)</strong><br />
{<br />
ExceptionMessage = excep.Message;<br />
}</p>
<p style="padding-left:30px;"><span style="color:#3366ff;"><span style="color:#999999;">/// &#60;summary&#62;<br />
/// Construtor da classe, este popula a field _exceptionmessage, usado para armazenar a mensagem da exception.<br />
/// Use msgDefinida(int) para melhor manutenção desta classe.<br />
/// &#60;/summary&#62;<br />
/// &#60;param name=&#8221;excepmsg&#8221;&#62;String de exceção especifica&#60;/param&#62;</span><br />
public cException(string excepmsg)<br />
{<br />
ExceptionMessage = excepmsg;<br />
}</span></p>
<p><span style="color:#999999;">#endregion</span></p>
<p>#region Methods</p>
<p style="padding-left:60px;"><span style="color:#3366ff;"><span style="color:#999999;">/// &#60;summary&#62;<br />
/// Método que retorna mensagens de procedimentos inválidos (cath)<br />
/// &#60;/summary&#62;<br />
/// &#60;param name=&#8221;tipomsg&#8221;&#62;<br />
/// Código controle do tipo de mensagem que será retornada, especifico da exceção.<br />
/// 1 &#8211; Dados inválidos, verifique a quantidade de caracteres digitados.<br />
/// 2 &#8211; Usuário não autenticado.<br />
/// 3 &#8211; Erro ao conectar com banco de dados.<br />
/// 4 &#8211; Dados inválidos.<br />
/// 5 &#8211; Erro de banco. Operação não foi concluída.<br />
/// 6 &#8211; Erro: i não é maior que j (Mensagem teste)<br />
/// &#60;/param&#62;<br />
/// &#60;returns&#62;String com mensagem&#60;/returns&#62;</span><br />
<strong>public static string MsgDefinida(int tipomsg)</strong><br />
{<br />
string msg = &#8220;<span style="color:#ff0000;">Operação invalida. Tente novamente!</span>&#8220;;<br />
</span></p>
<p style="padding-left:90px;"><span style="color:#3366ff;"> switch (tipomsg)<br />
{<br />
case 1:<br />
msg = &#8220;<span style="color:#ff0000;">Erro: Dados inválidos, verifique a quantidade de caracteres digitados.</span>&#8220;;<br />
break;<br />
case 2:<br />
msg = &#8220;<span style="color:#ff0000;">Erro: Usuário não autenticado.&#8221;</span>;<br />
break;<br />
case 3:<br />
msg = &#8220;<span style="color:#ff0000;">Erro DB: Não conectou com banco de dados</span>.&#8221;; <span style="color:#999999;">///usada em: cMensagem</span><br />
break;<br />
case 4:<br />
msg = &#8220;<span style="color:#ff0000;">Erro: Dados inválidos.</span>&#8220;; <span style="color:#999999;">///usada em: cMensagem</span><br />
break;<br />
case 5:<br />
msg = &#8220;<span style="color:#ff0000;">Erro DB: Operação não foi concluída.</span>&#8220;; <span style="color:#999999;">///usada em: cMensagem</span><br />
break;<br />
<span style="color:#ff0000;">case 6:<br />
msg = &#8220;Erro: i não é maior que j (Mensagem teste).&#8221;; ///usada em: Default.aspx.cs<br />
break;</span><br />
default:<br />
break;<br />
}</span></p>
<p style="padding-left:60px;"><span style="color:#3366ff;"> return msg;<br />
}</span></p>
<p style="padding-left:30px;"><span style="color:#3366ff;"><br />
#endregion</span></p>
<p>}</p>
<p><span style="color:#3366ff;">}</span></p>
<p><strong>Explicando alguns pontos interessantes:</strong></p>
<ol>
<li><em><span style="color:#008000;">namespace classe.util.</span></em> Eu uso sempre namespace para melhor organização do meu sistema.</li>
<li><span style="color:#008000;"><em>public class cException : Exception</em></span>. Minha classe herda a classe Exception .net que já possui varias propriedades interessantes. (Mais abaixo vou explicar algumas)</li>
<li><em><span style="color:#008000;">/// &#60;summary&#62;</span></em>. Tente sempre comentar seus códigos usando atributos prefixados para <a title="Documentação XML" href="http://www.codeguru.com/columns/vb/article.php/c14699" target="_blank">documentação xml</a> do .net. Use também comentários in-line (aqueles informativos usando &#8220;///aqui um comentário&#8221;).</li>
<li><span style="color:#008000;"><em>public static string MsgDefinida(int tipomsg)</em></span>. Já predefini algumas mensagens mais usadas pelo meu sistema.</li>
</ol>
<p><span style="color:#008000;"><strong>Algumas propriedades publicas da classe Exception .net:</strong><br />
</span></p>
<ul>
<li><span style="color:#000000;"><em>HelpLink Read-write</em></span></li>
</ul>
<p style="padding-left:30px;"><span style="color:#008000;">Gets or sets a link to the help file associated with this exception.<br />
Obtém ou define um link para o arquivo de Ajuda associado com esta exceção. </span></p>
<ul>
<li><span style="color:#000000;"><em>InnerException     Read-only</em></span></li>
</ul>
<p style="padding-left:30px;"><span style="color:#008000;">Gets the Exception instance that caused the current exception.<br />
Obtém a instância Exception que causou a exceção atual.</span></p>
<ul>
<li><span style="color:#000000;"><em>Message     Read-only</em></span></li>
</ul>
<p style="padding-left:30px;"><span style="color:#008000;">Gets a message that describes the current exception.<br />
Recebe uma mensagem que descreve a exceção atual. </span></p>
<ul>
<li><span style="color:#000000;"><em>Source     Read-write</em></span></li>
</ul>
<p style="padding-left:30px;"><span style="color:#008000;">Gets or sets the name of the application or the object that causes the error.<br />
Obtém ou define o nome do aplicativo ou o objeto que causa o erro. </span></p>
<ul>
<li><span style="color:#000000;"><em>StackTrace     Read-only</em></span></li>
</ul>
<p style="padding-left:30px;"><span style="color:#008000;">Gets a string representation of the frames on the call stack at the time the current exception was thrown.<br />
Obtém uma representação de seqüência dos quadros na pilha de chamada no momento atual a exceção foi acionada. </span></p>
<ul>
<li><span style="color:#000000;"><em>TargetSite     Read-only</em></span></li>
</ul>
<p style="padding-left:30px;"><span style="color:#008000;">Gets the method that throws the current exception.<br />
Obtém o método que gera a exceção atual.</span></p>
<p><em>Fonte: <a title="http://www1.cs.columbia.edu/~lok/csharp/refdocs/System/types/Exception.html" href="http://www1.cs.columbia.edu/~lok/csharp/refdocs/System/types/Exception.html" target="_blank">http://www1.cs.columbia.edu/~lok/csharp/refdocs/System/types/Exception.html</a></em></p>
<p><strong><br />
</strong></p>
<p><strong>Usando minha própria classe exception:</strong></p>
<p style="padding-left:30px;"><span style="color:#3366ff;">using System;<br />
using System.Configuration;<br />
using System.Data;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.HtmlControls;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Collections;<br />
using classe.util;</span></p>
<p>public partial class _Default : System.Web.UI.Page<br />
{</p>
<p style="padding-left:60px;"><span style="color:#3366ff;"><br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
</span></p>
<p style="padding-left:90px;"><span style="color:#3366ff;">int i = 0;<br />
int j = 10;<br />
int x;</span></p>
<p style="padding-left:90px;"><span style="color:#3366ff;"> </span></p>
<p><span style="color:#999999;">///1º) Primeiro tipo de uso, especificando o texto da minha própria exception.<br />
</span>try<br />
{<br />
if (i &#62; j)<br />
{<br />
<span style="color:#999999;">///aqui fazer qualquer coisa.</span><br />
Response.Write(&#8220;<span style="color:#ff0000;">&#60;br /&#62;i é maior que j</span>&#8220;);<br />
<span style="color:#999999;">///estou usando response.write pq estou na camada de apresentação. e para ficar mais fácil o entendimento.</span><br />
}<br />
else<br />
{<br />
throw new cException(&#8220;<span style="color:#ff0000;">erro: i não é maior que j.</span>&#8220;);<br />
}<br />
}<br />
catch (cException myexcep)<br />
{<br />
Response.Write(&#8220;<span style="color:#ff0000;">&#60;br /&#62;1ª exception(texto escrito). Ocorreu uma exception: </span>&#8220;);<br />
Response.Write(myexcep.ExceptionMessage);<br />
}</p>
<p style="padding-left:90px;"><span style="color:#3366ff;"><br />
<span style="color:#999999;">///2º) Segundo tipo de uso, especificando um texto predefinido da minha própria exception.</span><br />
try<br />
{<br />
if (i &#62; j)<br />
{<br />
<span style="color:#999999;">///aqui fazer qualquer coisa.</span><br />
Response.Write(&#8220;<span style="color:#ff0000;">&#60;br /&#62;i é maior que j</span>&#8220;);<br />
<span style="color:#999999;">///estou usando response.write pq estou na camada de apresentação. e para ficar mais facil o entendimento.</span><br />
}<br />
else<br />
{<br />
throw new cException(cException.MsgDefinida(6));<br />
}<br />
}<br />
catch (cException myexcep)<br />
{<br />
Response.Write(&#8220;<span style="color:#ff0000;">&#60;br /&#62;2ª exception(texto dinâmico). Ocorreu uma exception:</span> &#8220;);<br />
Response.Write(myexcep.ExceptionMessage);<br />
}</span></p>
<p style="padding-left:90px;"><span style="color:#3366ff;"><br />
<span style="color:#999999;">///3º) Terceiro tipo de uso, usando texto(message) da própria classe exception do framework .net.</span><br />
try<br />
{</span></p>
<p style="padding-left:120px;"><span style="color:#3366ff;"> try<br />
{<br />
x = j / i;  ///DivideByZeroException<br />
}<br />
catch (Exception myexcepsub)<br />
{<br />
throw new cException(myexcepsub);<br />
}</span></p>
<p style="padding-left:90px;"><span style="color:#3366ff;">}<br />
catch (cException myexcep)<br />
{</span></p>
<p style="padding-left:120px;"><span style="color:#3366ff;"> Response.Write(&#8220;<span style="color:#ff0000;">&#60;br /&#62;3ª exception(Framework). Ocorreu uma exception:</span> &#8220;);<br />
Response.Write(myexcep.ExceptionMessage);</span></p>
<p style="padding-left:90px;"><span style="color:#3366ff;"> }</span></p>
<p style="padding-left:60px;"><span style="color:#3366ff;"><br />
}<br />
</span></p>
<p style="padding-left:30px;"><span style="color:#3366ff;"><br />
}</span></p>
<p><span style="color:#3366ff;"><em>* Me desculpem pela endentação, mas não consegui ainda colocar codigos endentados igual do Visual Studio. hehe</em></span></p>
<p><strong>Explicando alguns pontos interessantes:</strong><br />
1. Este teste foi feito no arquivo Default.aspx<br />
2. using classe.util; Não esqueça de &#8220;chamar&#8221; o uso da classe pelo namespace, assim vc &#8220;inclui/include&#8221; a sua classe nesta pagina para ser usada.<br />
3. 1º) Primeiro tipo de uso, especificando o texto da minha própria exception.<br />
4. 2º) Segundo tipo de uso, especificando um texto predefinido da minha própria exception.<br />
5. 3º) Terceiro tipo de uso, usando texto(message) da própria classe exception do framework .net.</p>
<p>Amigos usem e abusem desta classe.</p>
<p>Qualquer dúvida deixe seu comentário que eu respondo. Humm&#8230; e se tiver sugestão de algum tema para artigo também é só mandar seu comentário.</p>
<p>Abraços&#8230;. e até o próximo artigo.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Saving the Java Exception Stack Trace into a file]]></title>
<link>http://devdevdev.wordpress.com/2009/03/13/saving-the-java-exception-stack-trace-into-a-file/</link>
<pubDate>Fri, 13 Mar 2009 03:08:20 +0000</pubDate>
<dc:creator>kerwintang</dc:creator>
<guid>http://devdevdev.wordpress.com/2009/03/13/saving-the-java-exception-stack-trace-into-a-file/</guid>
<description><![CDATA[If we want to get the Stack Trace of a Java Exception, we can&#8217;t simply use exception.printStac]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>If we want to get the Stack Trace of a Java Exception, we can&#8217;t simply use exception.printStackTrace() because that method returns nothing and just prints the stack trace into the console.</p>
<p>To get the Stack Trace and store it into a file, you can do this:</p>
<p><code><br />
StringBuilder sb = new StringBuilder();<br />
StackTraceElement[] stackTrace = exception.getStackTrace();<br />
for(int i=0;i&#60;stackTrace.length;i++){<br />
  sb.append(stackTrace[i]);<br />
  sb.append("\n");<br />
}<br />
</code></p>
<p>Given the StringBuilder sb above, you can proceed to write the string in a file. This is how i would do it:<br />
<code><br />
FileOutputStream fos = new FileOutputStream(filename);<br />
try{<br />
  OutputStreamWriter osw = new OutputStreamWriter(fos);<br />
  try{<br />
    BufferedWriter bw = new BufferedWriter(osw);<br />
    try{<br />
      bw.write(sb.toString());<br />
    }finally{<br />
      bw.close();<br />
    }<br />
  }finally{<br />
    osw.close();<br />
  }<br />
}finally{<br />
  fos.close();<br />
}<br />
</code></p>
<p>Similarly, you can merge the 2 codes above like below:<br />
<code><br />
FileOutputStream fos = new FileOutputStream(filename);<br />
try{<br />
  OutputStreamWriter osw = new OutputStreamWriter(fos);<br />
  try{<br />
    BufferedWriter bw = new BufferedWriter(osw);<br />
    try{<br />
      StackTraceElement[] stackTrace = exception.getStackTrace();<br />
      for(int i=0;i&#60;stackTrace.length;i++){<br />
        bw.write(stackTrace[i]);<br />
        bw.newLine();<br />
      }<br />
    }finally{<br />
      bw.close();<br />
    }<br />
  }finally{<br />
    osw.close();<br />
  }<br />
}finally{<br />
  fos.close();<br />
}<br />
</code></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[RCP Exception Handling]]></title>
<link>http://eclipseerfahrungen.wordpress.com/2008/11/03/rcp-exception-handling/</link>
<pubDate>Mon, 03 Nov 2008 15:35:57 +0000</pubDate>
<dc:creator>1000sunny</dc:creator>
<guid>http://eclipseerfahrungen.wordpress.com/2008/11/03/rcp-exception-handling/</guid>
<description><![CDATA[Einen Artikel, der das Error-Handling in Eclipse beschreibt finden wir hier: http://wiki.eclipse.org]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Einen Artikel, der das Error-Handling in Eclipse beschreibt finden wir hier:</p>
<p><a href="http://wiki.eclipse.org/Platform_UI_Error_Handling" target="_blank">http://wiki.eclipse.org/Platform_UI_Error_Handling</a></p>
<p>Um über das Exception-Handling die Kontrolle zu bekommen montiere ich folgende Teile im</p>
<p><em>ApplicationWorkbenchAdvisor:</em></p>
<p><em><br />
</em></p>
<pre>//+++++hier bekommen wir alles gelogt, was in der Main-Event-Loop an Exceptions fliegt
public void eventLoopException(Throwable exception) {
     //        super.eventLoopException(exception);
     exception.printStackTrace();
}
//++++nach dem Startup will ich die Einstellung für die Variable WorkbenchPlugin.DEBUG überprüfen
public void postStartup() {
       System.out.println(" DEBUG : "  + WorkbenchPlugin.DEBUG);
       WorkbenchPlugin.DEBUG=true; //++++++dann setze ich die Variable von Hand auf Debug</pre>
<pre>//+++++immer, wenn irgendein Fehler auftritt wird der Standard Policy Handler aufgerufen,
//+++++dieser zeigt nur einen Dialog mit dem Fehler auf - aber kein Stacktrace
//+++++das ändern wir jetzt:
//den alten StatusHandler heben wir uns auf</pre>
<pre>        final StatusHandler defaultStatusHandler= Policy.getStatusHandler();</pre>
<pre>        Policy.setStatusHandler(new StatusHandler() {</pre>
<pre>                                @Override
                                public void show(IStatus status, String title) {
                                     status.getException().printStackTrace();</pre>
<pre>                                     //und leiten an den alten StatusHandler weiter</pre>
<pre>                                     defaultStatusHandler.show(status,title);</pre>
<pre>                                }</pre>
<pre>         });
         //++++++++zur Kontrolle: nochmal den Status Handler ausgeben
         System.out.println(" status handler " + Policy.getStatusHandler());
         //++++++++und auch noch mal das WorkbenchPlugin.DEBUG-Feld
         System.out.println(" DEBUG : "  + WorkbenchPlugin.DEBUG);</pre>
<pre>}</pre>
<p>Ursprünglich wird der StatusHandler in <em><strong>org.eclipse.ui.internal.JFaceUtils</strong>.initializeJFace</em> initialisiert.</p>
<p>Der Weg dorthin führt über:</p>
<p>ExtensionRegistry.createExecutableExtension-&#62;BundleHost.startWorker-&#62;&#8230;AbstractBundle.startActivator -&#62; WorkbenchPlugin.start(BundleContext) -&#62; JFaceUtils.initializeJFace</p>
<p>&#8212;</p>
<p>das Workbench.DEBUG -Feld wird über die Run-Configurations (Reiter: <em>Trace</em>) gesteuert. org.eclipse.ui -Checkbox</p>
<p>Nach Aktivierung erscheinen eine Menge Debug Informationen. Diese muss ich noch genauer untersuchen.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The SEVERE but ignorable error]]></title>
<link>http://ourcraft.wordpress.com/2008/10/16/the-severe-but-ignorable-error/</link>
<pubDate>Thu, 16 Oct 2008 16:20:18 +0000</pubDate>
<dc:creator>danielmeyer</dc:creator>
<guid>http://ourcraft.wordpress.com/2008/10/16/the-severe-but-ignorable-error/</guid>
<description><![CDATA[There&#8217;s a certain error-and-stack-trace we get every time we bring up an instance of JBoss (or]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>There&#8217;s a certain error-and-stack-trace we get every time we bring up an instance of JBoss (or is it every time we deploy one of our war projects?), to wit:</p>
<pre class="brush: php;">
09:15:37,945 ERROR [STDERR] Oct 16, 2008 9:15:37 AM oracle.jdbc.driver.OracleDriver registerMBeans
SEVERE: Error while registering Oracle JDBC Diagnosability MBean.
javax.management.MalformedObjectNameException: Invalid character '
' in value part of property
        at javax.management.ObjectName.construct(ObjectName.java:529)
        at javax.management.ObjectName.(ObjectName.java:1314)
        at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:303)
        at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:213)
        at java.security.AccessController.doPrivileged(Native Method)
        at oracle.jdbc.driver.OracleDriver.(OracleDriver.java:209)
        at oracle.jdbc.pool.OracleDataSource.(OracleDataSource.java:94)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:219)
        at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:136)
        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:577)
        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262)
        at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:500)
        at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
        at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:315)
        at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
        at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
        at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
        at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
        at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
        at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:105)
        [...]
</pre>
<p>We&#8217;re used to this, and it doesn&#8217;t seem to cause any harm, so we ignore it, but wish it weren&#8217;t there.</p>
<p><a href="http://forums.oracle.com/forums/message.jspa?messageID=2152565#2152565">A post to the SQLJ/JDBC forum</a> at Oracle Technology Network Discussion Forums brings up this same issue, and <a href="http://forums.oracle.com/forums/message.jspa?messageID=2172499#2172499">the reply</a> says that a patch to ojdbc5.jar has been released, dealing with this issue.  My results show we&#8217;re not using the patched version:</p>
<pre class="brush: php;">
C:\path\to\jboss-4.2.2.GA\server\default\lib&gt;java -jar ojdbc5-11.1.0.6.0.jar
Oracle 11.1.0.6.0-Production JDBC 3.0 compiled with JDK5
</pre>
<p>(If we had the patch, the output would be</p>
<pre class="brush: php;">
Oracle 11.1.0.6.0-Production+ JDBC 3.0 compiled with JDK5
</pre>
<p>).</p>
<p><a href="http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html">The drivers are available from Oracle</a>.  Perhaps soon we&#8217;ll upgrade to them&#8230;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Analysing application flow using Throwable object]]></title>
<link>http://ramakrsna.wordpress.com/2008/05/05/analyse-application-flow-using-throwable-object/</link>
<pubDate>Mon, 05 May 2008 14:07:33 +0000</pubDate>
<dc:creator>Rama Krishna</dc:creator>
<guid>http://ramakrsna.wordpress.com/2008/05/05/analyse-application-flow-using-throwable-object/</guid>
<description><![CDATA[Often it will be required to find out how a particular method is invoked in order to investigate a b]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Often it will be required to find out how a particular method is invoked in order to investigate a bug or to understand the application flow. This can be done easily in small application using debugging tool or reading through the code. Even though, it is possible to debug large applications to find out the flow, it will obviously difficult to try the wide variety of usage scenarios. In case of large web applications, the developer may not even know every usage scenarios. Even missing a single usage scenario, also misses  method usage scenario.</p>
<p>This blog is about how to track various usage scenario in Java from code perspective.</p>
<p>The stack trace provides an excellent way to track the code flow. You would have seen in stack trace logs when exceptions are thrown, the stack trace has detail information on the classes, methods and the line numbers. We will use the same approach to trace the code flow without waiting for exceptions to happen.</p>
<p>In this scenario, we create a Throwable object, which the parent class of Exception. The Throwable object contains the entire stackTrace at the point where the object is created. We can use the getStackTrace() method on the Throwable object to obtain the stackTrace. The method returns an array of StackTraceElement. Each StackTraceElement represent a single stack frame and has information regarding the method which was invoked in the execution sequence. Also, the java class file name, complete java class name and the line number of invocation is also present.</p>
<p>Consider the following simple code scenario.</p>
<pre class="brush: java;">

public String getName() {
          return &quot;SOL_APP_MANG&quot;;
}
</pre>
<p>Inorder to trace, how the method getName is used in a application, the method is modified as follows.</p>
<pre class="brush: java;">

public String getName() {
          Throwable throwable = new Throwable();
          StackTraceElement[] stElements = throwable.getStackTrace();
          for (StackTraceElement ste: stElement)
                   system.out.println(&quot;File Name:&quot; + ste.getFileName());
                   system.out.println(&quot;Class Name:&quot; + ste.getClassName());
                   system.out.println(&quot;Method Name:&quot; + ste.getMethodName());
                   system.out.println(&quot;Line number:&quot; + ste.getLineNumber());
          return &quot;SOL_APP_MANG&quot;;
}
</pre>
<p>The code is very straightforword and simple.</p>
<p>I have implemented a small library for analyzing the stackTrace of the Throwable object. The library is a very small jar file with size of just 6.5 kb. The UML diagram is shown below.</p>
<p style="text-align:center;"><a href="http://ramakrsna.wordpress.com/files/2008/05/ast_classdia1.gif"><img class="aligncenter size-full wp-image-41" style="border:0 none;" src="http://ramakrsna.wordpress.com/files/2008/05/ast_classdia1.gif" alt="Class diagram of ast.jar" width="502" height="276" /></a></p>
<p>It consists of 2 classes and a interface. The interface IDisplayableStackTrace has the method</p>
<pre class="brush: java;">

public String getDisplayedStackTrace(StackTraceElement st)
</pre>
<p>Every implementation of the IDisplayableStackTrace should implement the method and implement the functionality of how a StackTraceElement should be represented as a String.</p>
<p>This allows any implmentation to be plugged based on requirement.</p>
<p>The following SimpleDisplayableStackTrace is an implementation.</p>
<pre class="brush: java;">

package com.ast.sampleExample;

import com.ast.analyse.IDisplayableStackTrace;

public class SimpleDisplayableStackTrace implements IDisplayableStackTrace {

    @Override
    public String getDisplayedStackTrace(StackTraceElement st) {
        StringBuilder sb = new StringBuilder();
        sb.append(&quot;:$FILE$:&quot;).append(st.getFileName())
          .append(&quot;:$CLASS$:&quot;).append(st.getClassName())
          .append(&quot;:$METHOD$:&quot;).append(st.getMethodName())
          .append(&quot;:$LINE$:&quot;).append(st.getLineNumber());
        return sb.toString();
    }
}
</pre>
<p>You can write your own implementation of IDisplayableStackTrace depending on requirement.</p>
<p>The AnalyseThrowable class is the single most important class of the library. The AnalyseThrowable class has a static method.</p>
<pre class="brush: java;">

public static void dumpStackTrace(IDisplayableStackTrace dst, PrintStream pw, Throwable throwable)
            throws AnalyseThrowableException
</pre>
<p>This method has the following arguments.</p>
<ul>
<li>IDisplayableStackTrace dst &#8211; An implementation of the class IDisplayableStackTrace</li>
<li>PrintStream pw &#8211; A PrintStream object to where the customized stack trace needs to be written</li>
<li>Throwable throwable &#8211; A Throwable whose stack trace needs to be analysed</li>
</ul>
<p>Also, the class provides the method</p>
<pre class="brush: java;">

public void dumpStackTrace(Throwable throwable) throws AnalyseThrowableException
</pre>
<p>which can be invoked using an instanceof AnalyseThrowable. The AnalyseThrowable has a parameterized constructor which accepts an implementation of IDisplayableStackTrace and PrintStream.</p>
<p>One of the variations of the dumpStackTrace method can be used depending on the scenario.</p>
<p>The class AnalyseThrowableException extends Exception class and some of the methods of class<br />
AnalyseThrowable throws the AnalyseThrowableException exception object which needs to be<br />
handled by the client using the library.</p>
<p>A typical usage scenario of the library is given below.</p>
<pre class="brush: java;">

public String getName() {
          try {
                AnalyseThrowable.dumpStackTrace(new SimpleDisplayableStackTrace(), System.out, new Throwable());
          }
          catch(AnalyseThrowableException ex) {
                ex.printStackTrace(System.out);
          }
          return &quot;SOL_APP_MANG&quot;;
}
</pre>
<p>An sample stack trace, when executed through a junit test case is shown below.</p>
<h6>:$FILE$:AnalyseThrowableTest.java:$CLASS$:com.ast.analyse.AnalyseThrowableTest:$METHOD$:testDumpStackTraceIDisplayableStackTracePrintStreamThrowable:$LINE$:13<br />
:$FILE$:NativeMethodAccessorImpl.java:$CLASS$:sun.reflect.NativeMethodAccessorImpl:$METHOD$:invoke0:$LINE$:-2<br />
:$FILE$:NativeMethodAccessorImpl.java:$CLASS$:sun.reflect.NativeMethodAccessorImpl:$METHOD$:invoke:$LINE$:39<br />
:$FILE$:DelegatingMethodAccessorImpl.java:$CLASS$:sun.reflect.DelegatingMethodAccessorImpl:$METHOD$:invoke:$LINE$:25<br />
:$FILE$:Method.java:$CLASS$:java.lang.reflect.Method:$METHOD$:invoke:$LINE$:597<br />
:$FILE$:TestMethodRunner.java:$CLASS$:org.junit.internal.runners.TestMethodRunner:$METHOD$:executeMethodBody:$LINE$:99<br />
:$FILE$:TestMethodRunner.java:$CLASS$:org.junit.internal.runners.TestMethodRunner:$METHOD$:runUnprotected:$LINE$:81<br />
:$FILE$:BeforeAndAfterRunner.java:$CLASS$:org.junit.internal.runners.BeforeAndAfterRunner:$METHOD$:runProtected:$LINE$:34<br />
:$FILE$:TestMethodRunner.java:$CLASS$:org.junit.internal.runners.TestMethodRunner:$METHOD$:runMethod:$LINE$:75<br />
:$FILE$:TestMethodRunner.java:$CLASS$:org.junit.internal.runners.TestMethodRunner:$METHOD$:run:$LINE$:45<br />
:$FILE$:TestClassMethodsRunner.java:$CLASS$:org.junit.internal.runners.TestClassMethodsRunner:$METHOD$:invokeTestMethod:$LINE$:66<br />
:$FILE$:TestClassMethodsRunner.java:$CLASS$:org.junit.internal.runners.TestClassMethodsRunner:$METHOD$:run:$LINE$:35<br />
:$FILE$:TestClassRunner.java:$CLASS$:org.junit.internal.runners.TestClassRunner$1:$METHOD$:runUnprotected:$LINE$:42<br />
:$FILE$:BeforeAndAfterRunner.java:$CLASS$:org.junit.internal.runners.BeforeAndAfterRunner:$METHOD$:runProtected:$LINE$:34<br />
:$FILE$:TestClassRunner.java:$CLASS$:org.junit.internal.runners.TestClassRunner:$METHOD$:run:$LINE$:52<br />
:$FILE$:JUnit4TestReference.java:$CLASS$:org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference:$METHOD$:run:$LINE$:38<br />
:$FILE$:TestExecution.java:$CLASS$:org.eclipse.jdt.internal.junit.runner.TestExecution:$METHOD$:run:$LINE$:38<br />
:$FILE$:RemoteTestRunner.java:$CLASS$:org.eclipse.jdt.internal.junit.runner.RemoteTestRunner:$METHOD$:runTests:$LINE$:460<br />
:$FILE$:RemoteTestRunner.java:$CLASS$:org.eclipse.jdt.internal.junit.runner.RemoteTestRunner:$METHOD$:runTests:$LINE$:673<br />
:$FILE$:RemoteTestRunner.java:$CLASS$:org.eclipse.jdt.internal.junit.runner.RemoteTestRunner:$METHOD$:run:$LINE$:386<br />
:$FILE$:RemoteTestRunner.java:$CLASS$:org.eclipse.jdt.internal.junit.runner.RemoteTestRunner:$METHOD$:main:$LINE$:196</h6>
<p><a class="alignleft" title="ast.jar" href="http://www.divshare.com/download/4417819-6f2" target="_self"><span class="alignleft">Download jar file</span></a></p>
<p>OR</p>
<p><a class="alignleft" title="ast.jar" href="http://www.mediafire.com/?9jxu0lv4j12" target="_blank">Download jar file</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Progetto Eulero]]></title>
<link>http://ubuntista.wordpress.com/2007/12/31/progetto-eulero/</link>
<pubDate>Mon, 31 Dec 2007 09:17:16 +0000</pubDate>
<dc:creator>simone</dc:creator>
<guid>http://ubuntista.wordpress.com/2007/12/31/progetto-eulero/</guid>
<description><![CDATA[Stacktrace segnala il progetto Eulero&#8230; per gli appassionati di programmazione, e di matematica]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://stacktrace.it/articoli/2007/12/progetto-eulero-problema-1/" title="stacktrace" target="_blank"><b>Stacktrace segnala il progetto Eulero</b></a>&#8230; per gli appassionati di programmazione, e di matematica!</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
