<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Dangerous Java</title>
 <link href="http://vitalidze.github.com/atom.xml" rel="self"/>
 <link href="http://vitalidze.github.com"/>
 <updated>2013-11-06T10:05:33-08:00</updated>
 <id>http://vitalidze.github.com</id>
 <author>
   <name>Vitaly Litvak</name>
   <email>vitavaque@gmail.com</email>
 </author>

 
 <entry>
   <title>Git Bash Colored Branch Name On Mac Os X</title>
   <link href="http://vitalidze.github.com/2013/11/06/Git-bash-colored-branch-name-on-Mac-OS-X"/>
   <updated>2013-11-06T00:00:00-08:00</updated>
   <id>http://vitalidze.github.com/2013/11/06/Git-bash-colored-branch-name-on-Mac-OS-X</id>
   <content type="html">&lt;p&gt;I have moved recently to Mac OS X (10.8.2) and I am still using git-svn to work with our corporate repository with git. First of all I wanted to add git bash completion:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
 echo &amp;quot;source ~/.git-completion.bash&amp;quot; &amp;gt;&amp;gt; ~/.bash_profile&amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then I wanted to beautify command prompt and put this line to &lt;code&gt;~/.profile&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; export PS1=&amp;quot;\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\] \$ &amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The next step was to add git branch name to the command prompt.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; curl https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.bash&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then put following line to the beginning of ~/.profile&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; source ~/.git-prompt.bash&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next we need to modify the PS1 variable.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; export PS1=&amp;quot;\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\e[0;32m$(__git_ps1 &amp;quot; (%s)&amp;quot;)\e[m \$ &amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will work, but only once! It evaluates expression for only one time. After googling around I have found that one of possible solutions is to escapte dollar sign (&amp;#8217;$&amp;#8217;) at the beginning of &lt;code&gt;__git_ps1&lt;/code&gt; invocation. However, this doesn&amp;#8217;t solve problem and breaks PS1 at all. The solution is to use single quote characters to define string for &lt;code&gt;PS1&lt;/code&gt; variable. This tells bash to evaluate expression each time.&lt;/p&gt;

&lt;p&gt;The working example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; export PS1=&amp;#39;\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\e[0;32m$(__git_ps1 &amp;quot; (%s)&amp;quot;)\e[m \$ &amp;#39;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I haven&amp;#8217;t found it in google, hope someone finds it helpful.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Git Svn Command Error 128</title>
   <link href="http://vitalidze.github.com/2013/06/27/Git-SVN-command-error-128"/>
   <updated>2013-06-27T00:00:00-07:00</updated>
   <id>http://vitalidze.github.com/2013/06/27/Git-SVN-command-error-128</id>
   <content type="html">&lt;p&gt;On my current work we&amp;#8217;re using SVN as the code repository for our main project and all sub projects. About a month ago I started working with this repo via git-svn. So I have my local git repository, commit there changes and then push them to the SVN repository. I will not describe how to do that, maybe as a separate post.&lt;/p&gt;

&lt;p&gt;My openSUSE comes with pretty old 1.7.3.4 version of git. However, it was good until today. I got following error message after trying to fetch changes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt; git svn fetch --fetch-all 
  Index mismatch: 1bac9c8667e2b3772d71108562404c95c8f7d9b0 != 97bb5a8fb29d0cb3a9b38456bf73d3c126d7c6fd
  rereading 0bf8f076838b6078e7a8bf68b0f2a234f509cf46
    M	src/com/company/project/package/UpdatedClass.java
  W: Cannot find common ancestor between 0bf8f076838b6078e7a8bf68b0f2a234f509cf46 and acd2afc03bb5b2dc10126905cfd0cb2774aa4b2b. Ignoring merge info.
  W: Cannot find common ancestor between 0bf8f076838b6078e7a8bf68b0f2a234f509cf46 and 99a066db650463dd8c3c926129bf462edeb2ed14. Ignoring merge info.
  W: Cannot find common ancestor between 0bf8f076838b6078e7a8bf68b0f2a234f509cf46 and 5aa2ecdf0f8fd56480f5d71e67c2d190d1ebcbc0. Ignoring merge info.
  W: Cannot find common ancestor between 0bf8f076838b6078e7a8bf68b0f2a234f509cf46 and dd5cd8aaf1d01ce8de212c29faa10891e8b45578. Ignoring merge info.
  W: Cannot find common ancestor between 0bf8f076838b6078e7a8bf68b0f2a234f509cf46 and 2537435f7970943e4cb8f15a1864c641bd09a231. Ignoring merge info.
  W: Cannot find common ancestor between 0bf8f076838b6078e7a8bf68b0f2a234f509cf46 and bb13cc7c762e2589966a459c8f7a6a332d7939cb. Ignoring merge info.
  W: Cannot find common ancestor between 0bf8f076838b6078e7a8bf68b0f2a234f509cf46 and 0ca1856db48e52c300f6a0a04beb54e9f5edc747. Ignoring merge info.
  fatal: ambiguous argument &amp;#39;618f50e5893d13f274652b0dd87b29b17cd32072^..c53f7450af7b937ca9e6d9659d9c7e7467b780ca&amp;#39;: unknown revision or path not in the working tree.
  Use &amp;#39;--&amp;#39; to separate paths from revisions
  rev-list 618f50e5893d13f274652b0dd87b29b17cd32072^..c53f7450af7b937ca9e6d9659d9c7e7467b780ca: command returned error: 128&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The only possible solution I&amp;#8217;ve found is to remove git-svn caches:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rm .git/svn/.caches/check_cherry_pick.db
rm .git/svn/.caches/lookup_svn_merge.db&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then do the same fetch. However, it looks like my version of git is so old that even this doesn&amp;#8217;t help.&lt;/p&gt;

&lt;p&gt;To solve this I managed to update git to the latest version by cloning official repo at git clone https://github.com/git/git.git . Then I&amp;#8217;ve uninstalled currentl git package, compiled sources, cleared SVN cache again and voila! Everything works again.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve thought that maybe someone would find this information useful.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Raspberry Pi Io</title>
   <link href="http://vitalidze.github.com/2013/04/05/Raspberry-PI-IO"/>
   <updated>2013-04-05T00:00:00-07:00</updated>
   <id>http://vitalidze.github.com/2013/04/05/Raspberry-PI-IO</id>
   <content type="html">&lt;p&gt;Recently I got three Raspberry PIs. Ignoring fails of other PI users I want to set up a simple NAS on tiny PC. So, first all I&amp;#8217;ve thought about storing data on SD card to increase I/O speed. However, some day this will kill both the SD card and as a result entire linux system. I got an external WD drive, which was bought to store wedding video archive. After re-partitioning I got a new 160GB ext4.&lt;/p&gt;

&lt;p&gt;Checking raspberry PI write to external USB drive, ext4:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# dd if=/dev/zero bs=512K count=2048 of=/media/disk-linux/speed.tmp
1073741824 bytes (1.1 GB) copied, 43.4 s, 24.7 MB/s

# dd if=/dev/zero bs=1M count=1024 of=/media/disk-linux/speed.tmp
1073741824 bytes (1.1 GB) copied, 42.7062 s, 25.1 MB/s

# dd if=/dev/zero bs=16M count=64 of=/media/disk-linux/speed.tmp
1073741824 bytes (1.1 GB) copied, 46.4082 s, 23.1 MB/s&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Checking read from same ext4 external USB drive:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# dd if=/media/disk-linux/speed.tmp bs=512k count=2048 of=/dev/null
1073741824 bytes (1.1 GB) copied, 38.1892 s, 28.1 MB/s

# dd if=/media/disk-linux/speed.tmp bs=1M of=/dev/null
1073741824 bytes (1.1 GB) copied, 38.2423 s, 28.1 MB/s

# dd if=/media/disk-linux/speed.tmp bs=16M of=/dev/null
1073741824 bytes (1.1 GB) copied, 38.3897 s, 28.0 MB/s&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Similar tests for SD card:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# dd if=/dev/zero bs=512K count=2048 of=/usr/data/speed.tmp
1073741824 bytes (1.1 GB) copied, 62.1034 s, 17.3 MB/s

# dd if=/dev/zero bs=1M count=1024 of=/usr/data/speed.tmp
1073741824 bytes (1.1 GB) copied, 64.2532 s, 16.7 MB/s

# sudo dd if=/usr/data/speed.tmp bs=512k of=/dev/null
1073741824 bytes (1.1 GB) copied, 50.2513 s, 21.4 MB/s&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Conclusion: just use the external drive to store data on raspberry PI. Don&amp;#8217;t forget to buy good power source for both raspberry PI and external drive. (I use USB hub with separate power adapter)&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Simple Progress Bar In Bash</title>
   <link href="http://vitalidze.github.com/2012/11/25/Simple-progress-bar-in-bash"/>
   <updated>2012-11-25T00:00:00-08:00</updated>
   <id>http://vitalidze.github.com/2012/11/25/Simple-progress-bar-in-bash</id>
   <content type="html">&lt;p&gt;Bash coding is a mistreious thing I can&amp;#8217;t get used at. The syntax is awful, it doesn&amp;#8217;t look like anything that I use in my every day work.&lt;/p&gt;

&lt;p&gt;Today, I&amp;#8217;m doing an upgrade of our support desk tool. Their upgrade tool makes a mandatory backup. It&amp;#8217;s size on our installation in ~46GB, so when waiting I&amp;#8217;ve decided to write an shell script that will check an upgrade file to reach the pre-defined size, display progress bar and size in MB.&lt;/p&gt;

&lt;p&gt;The following things I&amp;#8217;ve learned during writing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;to read the output of command right to the variable - use back quotes `. The key is usually at the top lef corner of the main keyboard right below the &amp;#8216;Esc&amp;#8217; button. I almost haven&amp;#8217;t used this button before, so this is like a new discovery for me :)&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;arithmetic operations in shell go in double brackets and should be preceeded by the $ symbol, like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;a=1
$b = $(( a + 1))&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;the for cycle may be defined either as an quick sequence&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;for i in {0..5}&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I couldn&amp;#8217;t use the variables here neither for the lower bound nor for the upper, so given up with it. The second style is an &amp;#8216;arithmetic&amp;#8217; style:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;	for (( expr1; expr2; expr3 ))&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The variables may be defined in a java (or c++) friendly way, so that&amp;#8217;s my choice.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To display progress bar the easiest (and maybe the only) way is to rewrite the same line by prining the caret return symbol each time at the end of progress bar.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the code that I&amp;#8217;ve got (&lt;a href=&#39;https://github.com/vitalidze/shell-scripts/blob/master/monitor_progress.sh&#39;&gt;also available at github&lt;/a&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash
to_monitor=$1
target_gb=$2
read_mb=0
while [ $read_mb -le $(( $target_gb*1024 )) ]
do
        read_mb=`du -sm $to_monitor | cut -f 1`
        read_gb=$(( $read_mb/1024 ))
        echo -ne &amp;#39;[ &amp;#39;
        for (( gb=0; gb&amp;lt;$target_gb; gb++ ))
            	do
                    	if [ $read_gb -ge $gb ]
                    	then
                                echo -ne &amp;#39;#&amp;#39;;
                    	else
                                echo -ne &amp;#39; &amp;#39;
                    	fi
            	done
    	perc=$(( $read_mb*100/($target_gb*1024) ))
    	echo -ne &amp;quot; $perc%] $read_mb of $(($target_gb*1024))\r&amp;quot;
    	sleep 1
done&lt;/code&gt;&lt;/pre&gt;</content>
 </entry>
 
 <entry>
   <title>Opensuse Yguard Issue</title>
   <link href="http://vitalidze.github.com/2012/10/24/openSUSE-yguard-issue"/>
   <updated>2012-10-24T00:00:00-07:00</updated>
   <id>http://vitalidze.github.com/2012/10/24/openSUSE-yguard-issue</id>
   <content type="html">&lt;p&gt;Recently we&amp;#8217;ve installed a new headless PC with openSUSE 12.2 to run tests. We&amp;#8217;re testing GUI using &lt;a href=&#39;http://code.google.com/p/fest/&#39;&gt;FEST Swing Library&lt;/a&gt; and for running each parallel set of tests in isolation we use &lt;a href=&#39;https://wiki.jenkins-ci.org/display/JENKINS/Xvnc+Plugin&#39;&gt;jenkins Xvnc plugin&lt;/a&gt;. It starts up an Xvnc server before every build and tears it down after build is finished. Each time it looks for a free display number, then sets DISPLAY environment variable.&lt;/p&gt;

&lt;p&gt;The problem that we&amp;#8217;ve faced was during obfuscation when Xvnc server is started and DISPLAY variable is set:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/opt/hudson/workspace/Testing MySQL/dev_frozen/build.xml:705: The following error occurred while executing this line:
/opt/hudson/workspace/Testing MySQL/dev_frozen/build.xml:429: java.lang.NoClassDefFoundError: java.awt.Container
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
	at java.lang.Class.privateGetPublicMethods(Class.java:2547)
	at java.lang.Class.getMethods(Class.java:1410)
	at com.yworks.yguard.obf.Cl.scanExtSupers(Unknown Source)
	at com.yworks.yguard.obf.Cl.scanExtSupers(Unknown Source)
	at com.yworks.yguard.obf.Cl.scanNameSpaceExcept(Unknown Source)
	at com.yworks.yguard.obf.Cl.resolveOptimally(Unknown Source)
	at com.yworks.yguard.obf.ClassTree$4.classAction(Unknown Source)
	at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
	at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
	at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
	at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
	at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
	at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
	at com.yworks.yguard.obf.ClassTree.walkTree(Unknown Source)
	at com.yworks.yguard.obf.ClassTree.resolveClasses(Unknown Source)
	at com.yworks.yguard.obf.GuardDB.createMap(Unknown Source)
	at com.yworks.yguard.obf.GuardDB.remapTo(Unknown Source)
	at com.yworks.yguard.ObfuscatorTask.execute(Unknown Source)
	at com.yworks.yguard.YGuardTask.execute(Unknown Source)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:390)
	at org.apache.tools.ant.Target.performTasks(Target.java:411)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
	at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:390)
	at org.apache.tools.ant.Target.performTasks(Target.java:411)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
	at org.apache.tools.ant.Main.runBuild(Main.java:801)
	at org.apache.tools.ant.Main.startAnt(Main.java:218)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It tooks couple of hours for me to find out that the reason for this thing is Xvnc plugin, which sets up DISPLAY variable and forces JVM to run in headful mode. I&amp;#8217;ve guessed that class loader fails to load some library in such case.&lt;/p&gt;

&lt;p&gt;Then I&amp;#8217;ve decided to run following test sample after running Xvnc:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import javax.swing.*;

public class FrameTest extends JFrame
{
    public static void main(String[] args)
    {
        FrameTest f = new FrameTest();
        f.setTitle(&amp;quot;Test&amp;quot;);
        f.setBounds(0, 0, 100, 100);
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.setVisible(true);
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This results in following error:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Exception in thread &amp;quot;main&amp;quot; java.lang.UnsatisfiedLinkError: /usr/lib64/jvm/jdk1.6.0_35/jre/lib/amd64/xawt/libmawt.so: libXtst.so.6: cannot open shared object file: No such file or directory
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
	at java.lang.Runtime.load0(Runtime.java:770)
	at java.lang.System.load(System.java:1003)
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724)
	at java.lang.Runtime.loadLibrary0(Runtime.java:823)
	at java.lang.System.loadLibrary(System.java:1028)
	at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
	at sun.awt.DebugHelper.&amp;lt;clinit&amp;gt;(DebugHelper.java:29)
	at java.awt.Component.&amp;lt;clinit&amp;gt;(Component.java:566)
Could not find the main class: FrameTest.  Program will exit.&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After googling around the solution came:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;zypper in libXtst-devel libXtst6&lt;/code&gt;&lt;/pre&gt;</content>
 </entry>
 
 <entry>
   <title>Threadlocal Pain</title>
   <link href="http://vitalidze.github.com/2012/09/13/ThreadLocal-pain"/>
   <updated>2012-09-13T00:00:00-07:00</updated>
   <id>http://vitalidze.github.com/2012/09/13/ThreadLocal-pain</id>
   <content type="html">&lt;p&gt;In our application we use several session factories, one per each database connection. Sessions are always created by thread local current-session context (we use default &lt;code&gt;org.hibernate.context.ThreadLocalSessionContext&lt;/code&gt; implementation). The transactions are managed manually. If the transaction was opened but didn&amp;#8217;t closed then that particular thread will have a session in the thread-local variable. When session factory gets closed the reference remains in that thread local, which produces a memory leak.&lt;/p&gt;

&lt;p&gt;As for now I&amp;#8217;ve found &lt;a href=&#39;http://blog.igorminar.com/2009/03/identifying-threadlocal-memory-leaks-in.html&#39;&gt;the only hardcore solution&lt;/a&gt; for such issue. So when session factory gets closed walk through all thread locals and clean up.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Intellij Idea Svn Sucks</title>
   <link href="http://vitalidze.github.com/2012/09/06/intellij-idea-SVN-sucks"/>
   <updated>2012-09-06T00:00:00-07:00</updated>
   <id>http://vitalidze.github.com/2012/09/06/intellij-idea-SVN-sucks</id>
   <content type="html">&lt;p&gt;It just can&amp;#8217;t neither merge nor load history of our repository. This really sucks. The only thing that delays my full movement to that IDE. So my way is now to use the eclipse to merge branches and see history.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Npe With Empty Stack Trace</title>
   <link href="http://vitalidze.github.com/2012/09/05/NPE-with-empty-stack-trace"/>
   <updated>2012-09-05T00:00:00-07:00</updated>
   <id>http://vitalidze.github.com/2012/09/05/NPE-with-empty-stack-trace</id>
   <content type="html">&lt;p&gt;Every day gives the more pleasant problems. This time it&amp;#8217;s the magic of the -XX:-OmitStackTraceInFastThrow VM flag. I don&amp;#8217;t know, maybe someone faced problem when JIT decides that exception is thrown too often in same place and replaces it with empty stacktrace-less stub in all next occurrencies. I believe that kind of optimization was directed to leverage costs of stack trace reterieval.&lt;/p&gt;

&lt;p&gt;However, in our case the exception fellt to infrequent:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;2012-08-22 14:29:52,911 FATAL: java.lang.NullPointerException
2012-08-22 14:30:01,578 FATAL: java.lang.NullPointerException
2012-08-22 14:30:10,303 FATAL: java.lang.NullPointerException&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then JIT starts replacing NPE object with static stub for a week (!) of application worktime. Hell yeah! You rock, JIT!&lt;/p&gt;</content>
 </entry>
 
 
</feed>