<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Naveen Gurram - Medium]]></title>
        <description><![CDATA[My thoughts about software engineering, books, podcasts and many other things. - Medium]]></description>
        <link>https://medium.com/i-me-myself-naveen?source=rss----df94dd953442---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Naveen Gurram - Medium</title>
            <link>https://medium.com/i-me-myself-naveen?source=rss----df94dd953442---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 10:45:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/i-me-myself-naveen" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Jackson Object Mapper]]></title>
            <link>https://medium.com/i-me-myself-naveen/jackson-object-mapper-b17754c66d9f?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/b17754c66d9f</guid>
            <category><![CDATA[objectmapper]]></category>
            <category><![CDATA[jackson]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Sat, 06 Jun 2020 18:01:37 GMT</pubDate>
            <atom:updated>2020-06-06T18:01:37.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*qzbdvqE1ZymrWoq82c84Mw.png" /></figure><p>There are many tales about Jackson Object Mapper and I have seen many gotchas in my career, and every time I get struck and later find the gotch and always wanted to document.</p><p>Here are some of the quirks from last week.</p><p><strong>GraphQl has it own Object Mapper</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*RHWi_Erl7eAzfsiDf3sanQ.png" /></figure><p>we were using Graphql with SpringBoot and we use <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO-8601</a> and with newer jackson if we have JSR301 module jar in the classpath ObjectMapper gets registered with new JavaTimeModule which deals with newer <a href="https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html">Java8 time api </a>, however when using GraphQl we saw Instant type had problems with serializing and deserializing and after spending some time, we found it has its own object mapper and unless we explicitly register this new module it wont pick magically.</p><pre>@Bean<br>public SchemaParserOptions schemaParserOptions() {<br>  // custom implementation to configure object mapper with new JavaTimeModule<br>  return SchemaParserOptions.<em>newOptions</em>()<br>      .objectMapperConfigurer(<br>          (ObjectMapper mapper, ObjectMapperConfigurerContext context) -&gt;<br>              mapper.registerModule(new JavaTimeModule()))<br>      .build();<br>}</pre><p><strong>Object Mapper dealing with JSONObject.Null</strong></p><p>We were writing a piece of code to take two JSON as Java Map and do a diff between then and we wanted a special NULL construct to represent to caller and initially we represented as Java “null” it worked when we use ObjectMapper to write it as string however when we use JSONObject ( org.json) it doesn’t write the key out when the value of it is null.</p><p>Other option was to use this special construct <a href="https://stleary.github.io/JSON-java/org/json/JSONObject.html">JSONObject.NULL</a> when we try to serialize this didn’t work with ObjectMapper because this construct doesn’t have serializer or deserializer registered.</p><p>So we went back to Java null and when we started using Spring Boot Native object mapper it didn’t include the key when it is null.</p><p>eg:</p><ol><li>This prints {“a”:null}</li></ol><pre>objectMapper.writeValueAsString(Collections.<em>singletonMap</em>(&quot;a&quot;, null));</pre><p>whereas if you have a map wrapped in a bean then it conveniently skips the null value</p><pre>public class InstanceDifferences {<br>  @JsonProperty(value = &quot;data&quot;, required = true)<br>  private Map&lt;String, Object&gt; data;<br>}</pre><p>to ensure values of maps are returned always we have to add this additional annotation.</p><pre>@JsonInclude // this will ensure nulls in map are displayed as null</pre><p>so my wrapper class becomes</p><pre>public class InstanceDifferences {<br>  @JsonProperty(value = &quot;data&quot;, required = true)<br>  @JsonInclude // this will ensure nulls in map are displayed as null<br>  private Map&lt;String, Object&gt; data;<br>}</pre><p>I am sure along the way I am going to find more of these, I hope to document them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b17754c66d9f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/jackson-object-mapper-b17754c66d9f">Jackson Object Mapper</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cyclomatic Complexity]]></title>
            <link>https://medium.com/i-me-myself-naveen/cyclomatic-complexity-b69d517c949?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/b69d517c949</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[cyclomatic-complexity]]></category>
            <category><![CDATA[pmd]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Sat, 30 May 2020 12:44:41 GMT</pubDate>
            <atom:updated>2020-05-30T12:44:41.546Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are developing code, and running PMD as static code analysis you might have encountered violations and in this post I want to talk about my experience and how I fixed violations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*jELaHRZ6bUher88yYr_Mvw.png" /></figure><p>Recently I wrote a piece of code which is a helper class and designed it to be a single class with a sole purpose, and as it grew over the time, started seeing <a href="https://pmd.github.io/pmd-6.17.0/pmd_rules_java_design.html#cyclomaticcomplexity">PMD Cyclomatic Complexity </a>violation and I tried different things to avoid but it never went away and it started some anxiety even though I try to justify there were no other ways code is complex or unmanageable.</p><p>Here is the example showing from PMD website</p><p><strong>Example(s):</strong></p><pre><strong>class</strong> <strong>Foo</strong> <strong>{</strong><br>  <strong>void</strong> <strong>baseCyclo()</strong> <strong>{</strong>                <em>// Cyclo = 1</em><br>    highCyclo<strong>();</strong><br>  <strong>}</strong></pre><pre><strong>void</strong> <strong>highCyclo()</strong> <strong>{</strong>                <em>// Cyclo = 10: reported!</em><br>    <strong>int</strong> x <strong>=</strong> 0<strong>,</strong> y <strong>=</strong> 2<strong>;</strong><br>    <strong>boolean</strong> a <strong>=</strong> <strong>false,</strong> b <strong>=</strong> <strong>true;</strong></pre><pre><strong>if</strong> <strong>(</strong>a <strong>&amp;&amp;</strong> <strong>(</strong>y <strong>==</strong> 1 <strong>?</strong> b <strong>:</strong> <strong>true))</strong> <strong>{</strong> <em>// +3</em><br>      <strong>if</strong> <strong>(</strong>y <strong>==</strong> x<strong>)</strong> <strong>{</strong>                 <em>// +1</em><br>        <strong>while</strong> <strong>(true)</strong> <strong>{</strong>              <em>// +1</em><br>          <strong>if</strong> <strong>(</strong>x<strong>++</strong> <strong>&lt;</strong> 20<strong>)</strong> <strong>{</strong>           <em>// +1</em><br>            <strong>break;</strong>                  <em>// +1</em><br>          <strong>}</strong><br>        <strong>}</strong><br>      <strong>}</strong> <strong>else</strong> <strong>if</strong> <strong>(</strong>y <strong>==</strong> t <strong>&amp;&amp;</strong> <strong>!</strong>d<strong>)</strong> <strong>{</strong>    <em>// +2</em><br>        x <strong>=</strong> a <strong>?</strong> y <strong>:</strong> x<strong>;</strong>              <em>// +1</em><br>      <strong>}</strong> <strong>else</strong> <strong>{</strong><br>        x <strong>=</strong> 2<strong>;</strong><br>      <strong>}</strong><br>    <strong>}</strong><br>  <strong>}</strong><br><strong>}</strong></pre><p>in my case, since I was writing a helper method and I have some convenience method which are calling other methods within the class and as per requirements I have lot of if/else loops and that started increasing the complexity and after reading posts in stack overflow and others, applied some of the techniques and able to fix the violation.</p><p><strong>Modifications</strong></p><p>Before</p><pre>for(int i=0;i&lt;10;i++){<br>  if(object instanceof String){<br>    // string<br>  }else if(object instanceof Map){<br>    // map<br>  }else if(object instanceof List){<br>    // list<br>  }else{<br>    // primitive<br>  }<br>}</pre><p>Changed to return from certain blocks if there is no additional processing</p><pre>for(int i=0;i&lt;10;i++){<br>  if(object instanceof String){<br>    // process<br>    continue;<br>  }<br>  if(object instanceof Map){<br>    // process<br>    return process();<br>  }<br>  if(object instanceof List){<br>    // list<br>  }else{<br>    // primitive<br>  }<br>}</pre><p>2. Extracted all helper methods to a static class to avoid adding complexity to existing blocks.</p><p>When chaining method complexity will also get appended, to break the chain, if there are methods which could be a static method, those are exposed as separate classes or convert to a static method within the context also helped reduced complexity.</p><p>3. Extracted some of the code as Java Functional interface methods which as static final variables.</p><p>Before all these fixes, complexity came around 80 and after making changes I was able to remove the violation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b69d517c949" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/cyclomatic-complexity-b69d517c949">Cyclomatic Complexity</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Parallel Threads with Spring Context]]></title>
            <link>https://medium.com/i-me-myself-naveen/parallel-threads-with-spring-context-d1215efdf9fd?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/d1215efdf9fd</guid>
            <category><![CDATA[spring-security]]></category>
            <category><![CDATA[threadpoolexecutor]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Wed, 27 May 2020 00:30:16 GMT</pubDate>
            <atom:updated>2020-04-29T14:36:55.666Z</atom:updated>
            <content:encoded><![CDATA[<p>We are developing a piece of code and in that we are executing bunch of methods in sequence, and these method are not working on a shared resource so we thought converting that to a parallel might help us with the execution time, so we used <a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html">FixedThreadPool</a>, however we started seeing some issues with Spring Security Context not available in the methods which are executed in these threads.</p><p>There were no errors, but more runtime errors where information we expect wasn’t available, and luckily previous build worked fine and after doing a diff we found only code change we did was to use ThreadPool and digging further we noticed spring context is missing.</p><p>Luckily <a href="https://docs.spring.io/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/core/context/SecurityContextHolder.html">SecurityContextHolder</a> which holds our spring security Authentication object has a property to enable this in inheritable threads via <a href="https://docs.spring.io/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/core/context/SecurityContextHolder.html#MODE_INHERITABLETHREADLOCAL">MODE_INHERITABLETHREADLOCAL</a></p><pre>SecurityContextHolder.<em>setStrategyName</em>(SecurityContextHolder.<em>MODE_INHERITABLETHREADLOCAL</em>);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1215efdf9fd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/parallel-threads-with-spring-context-d1215efdf9fd">Parallel Threads with Spring Context</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Compound Unique Index in AWS DocumentDB]]></title>
            <link>https://medium.com/i-me-myself-naveen/creating-compound-unique-index-in-aws-documentdb-18a8bac51f3?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/18a8bac51f3</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[compound-indexes]]></category>
            <category><![CDATA[aws-documentdb]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Wed, 27 May 2020 00:29:55 GMT</pubDate>
            <atom:updated>2020-05-14T19:25:25.941Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rjqFKI2uSND_bBN588pF9g.jpeg" /></figure><p>In this I want to describe problem we faced and solution, just in case helpful for folks looking for solution, because I haven’t find any and has to rely on AWS support.</p><p>Let me describe the problem.</p><p>We are relying on scripting Indexes for our DocumentDb cluster by executing scripts in mongodb shell. We created a unique compound index and and didn’t verify whether it was created, because mongo shell gives immediate feedback of whether script was able to create index or not but it doesn’t tell you whether it is of type “unique” or not in this case.</p><p>Below is the initial script</p><pre>db.collection.createIndex(<br>        { field1: 1, field2: 1, field3: 1, field4: 1 },<br>    { name: &quot;instc_indx1&quot;},<br>    { unique: true}<br>);</pre><p>with this one we were able to create a compound index but it wasn’t unique.</p><p>After struggling for couple of days, searching mongo documentation, forums etc, we opened a ticket with AWS and they were able to suggest change in the syntax to achieve what we were looking</p><pre>db.collection.createIndex(<br>        { field1: 1, field2: 1, field3: 1, field4: 1 },<br>    { name: &quot;instc_indx1&quot;, unique: true }<br>);</pre><p>difference is we need to combine “name” and “unique” property in a single statement.</p><p><strong>Note:</strong> if you create without name it works, reason we had to give a name instead of relying on the system generated was because mongo generated was exceeding the size in Mongo itself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18a8bac51f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/creating-compound-unique-index-in-aws-documentdb-18a8bac51f3">Creating Compound Unique Index in AWS DocumentDB</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 5 podcasts I listen to daily]]></title>
            <link>https://medium.com/i-me-myself-naveen/top-5-podcasts-i-listen-to-daily-1c563cb81b88?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/1c563cb81b88</guid>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[reporting]]></category>
            <category><![CDATA[npr]]></category>
            <category><![CDATA[podcast]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Sat, 05 Jan 2019 18:08:34 GMT</pubDate>
            <atom:updated>2019-01-05T18:08:34.051Z</atom:updated>
            <content:encoded><![CDATA[<p>My habit of finding and listening podcasts happened when I brought a car during my initial days in UnitedStates, like most of the folks, my used car has cassette player and a CD player, Initial days it was creating music CD’s and changing them and after a while it became monotonous and that’s when one of my good friend suggested about Podcasts and luckily I had an earlier version of IPhone made it easy for me to subscribe and journey started around 2009 and continuing until now.</p><p>Over the years I had my collection grew, then shrink ( for different reasons, may be in some other post) and told many friends about new shows I discovered and prompted them to listen Podcasts.</p><p>Initially I went with the Top Trending in those days, like Freakonomics and over the year I added some many to my list. I want to list my top 5 podcasts and why they are my favorites.</p><p><a href="http://freakonomics.com/about/"><strong>Freakonomics</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*CwgzrJlhm6hbPoJklmHAHg.png" /></figure><p>It’s been my all time favorite. I can proudly say I learnt a lot about Economics. Hosts Stephen Dubner and Steven Levitt presentation and quality of guests they bring to the show is amazingly entertaining and also same time educational.</p><p>Another show I like from Stephen Dubner is <a href="http://tmsidk.com/"><strong>Tell me something I don’t know</strong></a></p><p><a href="https://www.npr.org/planetmoney"><strong>Planet Money</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*9uy5pZi9OWc9EDeHrUdGRg.jpeg" /></figure><p>One of the many NPR shows I listen to and love it. Feakonomics might be the one drove me to this one and never looked back, shows content, reporting to bunch of reporters ( or should I call them Hosts) make this show interesting. Recently in October 2018, they played re-run of their first ever episode and after listening to it, it felt that episode is felt so true even with today’s economy.</p><p><a href="https://www.npr.org/podcasts/510325/the-indicator-from-planet-money"><strong>Indicator</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*eUG9q2Vg9pKuiFp8pAL4pg.jpeg" /></figure><p>Indicator being the recent one from the NPR Planet Money team, this is a quickie about 5–10 mins show about the economy and they pick a interesting theme for each episode and it is very much related to the current economy and it is like day to day synopsis of economy.</p><p><a href="https://www.npr.org/podcasts/510313/how-i-built-this"><strong>How I built this</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Ept4AspHoskgb433k9omqw.jpeg" /></figure><p>Another NPR show, with host Guy Raz show about interviewing Entrepreneurs who made it big and as a bonus every episode ends with budding entrepreneurs who are venturing out. I used to listen to TED Radio Hours by Guy and that’s how I got interested in this and boy it is amazing to hear how most of companies were built and want went in it.</p><p>Other NPR shows I listen mostly are <a href="https://www.npr.org/programs/invisibilia/"><strong>Invisibilia</strong></a><strong>, </strong><a href="https://www.npr.org/series/423302056/hidden-brain"><strong>Hidden Brain</strong></a></p><p><a href="https://www.gimletmedia.com/reply-all"><strong>Reply All</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*10dXWtUiRtxNT6wf89XiKg.png" /></figure><p>Gimlet media is another company who has some amazing shows and some of them are seasonal, Gimlet is started by former NPR host and that how I got hooked to this. One of the shows is Reply All which talks about current technology and its merits and perils. Some of the reporting led me to interesting reads on internet about people and technology.</p><p>Other shows from Gimlet my favorites some of them are seasonal, <a href="https://www.gimletmedia.com/crimetown"><strong>Crimetown</strong></a><strong> </strong>(First season was amazing), <a href="https://www.gimletmedia.com/science-vs"><strong>Science vs</strong></a></p><p>Some other shows I listen to occasionally <a href="https://99percentinvisible.org/about/the-show/"><strong>99% Invisible</strong></a>, <a href="https://serialpodcast.org/"><strong>Serial</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c563cb81b88" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/top-5-podcasts-i-listen-to-daily-1c563cb81b88">Top 5 podcasts I listen to daily</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project Lombok love and hate relationship]]></title>
            <link>https://medium.com/i-me-myself-naveen/project-lombok-love-and-hate-relationship-a8c9dddc50f6?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/a8c9dddc50f6</guid>
            <category><![CDATA[ide]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[lombok]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Thu, 03 Jan 2019 03:09:44 GMT</pubDate>
            <atom:updated>2019-01-03T04:12:40.418Z</atom:updated>
            <content:encoded><![CDATA[<h3>Project Lombok</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7OrY9-74-x1M1PE6kuCOkQ.png" /></figure><p>Four years ago when I first read about <a href="https://projectlombok.org/">Project Lombok</a> it sounded cool but never got a chance to use it anywhere.</p><p>After that never got a chance to use Project Lombok and at the same time, there were some people talking about Project Lombok using JDK’s experimental API’s and how it’s not ready for primetime.</p><p>Up until the last couple of months, I was against it and argued that modern day IDE’s are up to to the task of generating Getter/Setter/Builders and there really isn’t a need for Project Lombok.</p><p>Some of the folks who were using Project Lombok in their previous workplaces convinced us to use it in our new codebase and within no time I became a fan of Project Lombok for the simplicity it brought to the codebase. We started to experiment with primitive features like <a href="https://projectlombok.org/features/Data">Data</a>, <a href="https://projectlombok.org/features/Builder">Builders</a>, <a href="https://projectlombok.org/features/log">slf4j</a>, and <a href="https://projectlombok.org/features/constructor">Constructors</a> and It became so easy and codebase looks so much cleaner compared to writing a getter/setter and a builder in a DTO.</p><p>When we have inheritance and builder, we have to do some fancy things, but otherwise, overall we are quite happy with it so far.</p><p>Project Lombok didn’t come up some upfront apprehensions about some of the features like <a href="https://projectlombok.org/features/EqualsAndHashCode">Equals</a> especially when used with JPA, we still hear rumblings and we are treading with caution.</p><p>Project Lombok helped us to implement spring dependency injection by the constructor ( by the way that’s the <a href="https://www.vojtechruzicka.com/field-dependency-injection-considered-harmful/">preferred</a> way to autowire dependencies ) once we decided to switch to it from the field dependency having Project Lombok really saved a lot of time, by just having annotations and converting existing fields to a constructor.</p><p>Overall I recommend Project Lombok for any Java project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8c9dddc50f6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/project-lombok-love-and-hate-relationship-a8c9dddc50f6">Project Lombok love and hate relationship</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TIKD Review]]></title>
            <link>https://medium.com/i-me-myself-naveen/tikd-review-5e49cc8c7d4e?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/5e49cc8c7d4e</guid>
            <category><![CDATA[tikd]]></category>
            <category><![CDATA[traffic-court]]></category>
            <category><![CDATA[apps]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Wed, 26 Dec 2018 05:13:01 GMT</pubDate>
            <atom:updated>2018-12-26T05:13:23.396Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*tfYii7IlgVxVOwv6Kd5pNw.png" /></figure><p>I meaning to write review about my experience with TIKD from long time, when I wanted to use this service a year back, there weren’t any reviews available online anywhere, and I hope to make this post so it layout my experience and hoping it might help someone.</p><p><a href="https://tikd.com/"><strong>TIKD</strong></a> <strong><em>Get rid of your traffic ticket from your phone in two minutes, plus no points or your money back guaranteed!</em></strong></p><p>Any year back I was involved in a collision and as a result, I got 3 points and a ticket and I was prepared to pay the fine on the same day, but information was not available in their system immediately and I started to think about challenging it in the court and was looking for attorney specialized in that area, and I stumbled on this TIKD and I remembered a story in NPR as well about the service.</p><p>As an online service, it is easy to avail and all it took was snap a picture of your violation ticket and provide authorization for your credit card so when the time comes they will use it pay for the ticket.</p><p>Since I had about 30 days to pay the ticket and I submitted my ticket info on Day 0, I was quite confident that if they didn’t accept the ticket, I will have enough time to pay the ticket. By the way at the time service was offered in a handful of states and counties.</p><p>I forgot about it and I was busy dealing with insurance and other related info and even though I had the deadline date in my mind, I forgot to follow up with them and they had this link which shows the status of your service ticket.</p><p>To my surprise, I got a letter from county court that I failed to pay the fine within a stipulated timeframe so they gave me the notice to appear before the court or get my license canceled. I got panicked and called their custom care and after a half hour waiting finally they mentioned that my case was given to an attorney and they would reach out to me and when I told it’s been a month and no one reached out to me, they gave me the attorney contact and asked me to deal with him directly. So I called up the attorney and luckily I got them on the phone and they confirmed they got my case, and the delay was due to the fact they were waiting to hear from TIKD if they can take up collision case.</p><p>Attorney assured me that they are going to file a motion with the court on that day and promised me that I don’t need to worry about the court notice and assured me a speedy process. They asked me to get my driving report from the MVA and send that along with the description of events that preceded the collision. On the same day, the attorney sent me a copy of the brief they filed in the court.</p><p>With that assurance, I was waiting to hear from them or the court about the date but to my surprise court sent another note that I failed to pay file or requested date so they sent a letter stating in a week my driver&#39;s license will be canceled. I sent an email and called Attorney to find out what happened, and they told me court clerk lost the filing and they are preparing an immediate injunction to set a date, that was during December holiday time and even though I was not planning to travel, I was extra cautious to plan any driving trips.</p><p>Finally, after a week court set a date and lawyer represented me and able to <strong>reduce points from 3 to 1 and $50 from the original fine</strong>. With TIKD promise of a refund, if points are not reduced, I was given a refund of full ticket amount and they, in fact, paid the fine.</p><p>For a common man finding an attorney to challenging in court, the hassle is taken away by this app and I liked some many things about them like the email or phone customer service to asking questions and getting clarifications from the attorney and app to track the status was pretty good. <strong>On the flip side</strong>, if you are using the service be top on your request and follow up immediately to see if an attorney is assigned to your ticket and they filed with court according to the deadlines.</p><p>It’s been a year and I hope they added more service areas and might have improved their service, even though service is great, I hope I never have to use their service again ( touchwood ..). I sincerely hope this is useful for anyone looking to avail their service.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e49cc8c7d4e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/tikd-review-5e49cc8c7d4e">TIKD Review</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PMD Unused private method failure even though it is used]]></title>
            <link>https://medium.com/i-me-myself-naveen/pmd-unused-private-method-failure-even-though-it-is-used-870b78de7d36?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/870b78de7d36</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[static-code-analysis]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Fri, 02 Nov 2018 20:17:09 GMT</pubDate>
            <atom:updated>2018-11-02T20:17:09.363Z</atom:updated>
            <content:encoded><![CDATA[<h3>PMD Unused private method</h3><p>We use PMD for static analysis of our code and while doing that we encountered “unused private method” and while our IDE (Intellij in this case) clearly shows that method is used.</p><p>Since this method is a private method invoked from another private method which in-turn invoked by a public interface implementation method, so initial suspicion was on the this invocation tree and that effort didn’t help.</p><pre>// Entry point<br>private void startProcess() {<br>   this.createEvent(a,new JSONObject(b).toString(),c);</pre><pre>}</pre><pre>// method invoked <br>private void createEvent(<br>    String a, String b, String c) {<br>  // do some logic<br>}</pre><p>After going through the PMD documentation and looking at some of the bug reports, second argument in <strong>startProcess </strong>method is the offender since the method is expecting a String type by doing <strong><em>new JSONObject(b)</em></strong> PMD deduces its a different type and is not looking at the toString().</p><p>We had to change the code to resolved the second argument as String upfront before passing it to the next method.</p><pre>// Entry point<br>private void startProcess() {</pre><pre>   String str = new JSONObject(b).toString();<br>   this.createEvent(a,str,c);</pre><pre>}</pre><p>This seems like a counter intuitive thing, now just for PMD we are creating a variable and increasing the number of lines in the program and on the flip side might be more readable.</p><p>Below are the links to the rule and bug report which did give out some clue to fix it.</p><p><a href="https://pmd.github.io/pmd-5.8.1/pmd-java/rules/java/unusedcode.html#UnusedPrivateMethod">https://pmd.github.io/pmd-5.8.1/pmd-java/rules/java/unusedcode.html#UnusedPrivateMethod</a></p><p><a href="https://sourceforge.net/p/pmd/bugs/1156/">https://sourceforge.net/p/pmd/bugs/1156/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=870b78de7d36" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/pmd-unused-private-method-failure-even-though-it-is-used-870b78de7d36">PMD Unused private method failure even though it is used</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Externalize static code analysis configs in Gradle]]></title>
            <link>https://medium.com/i-me-myself-naveen/externalize-static-code-analysis-configs-in-gradle-3a0cc14c4643?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/3a0cc14c4643</guid>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[static-code-analysis]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Sun, 28 Oct 2018 20:03:11 GMT</pubDate>
            <atom:updated>2018-10-28T20:03:11.242Z</atom:updated>
            <content:encoded><![CDATA[<h3>Externalize static analysis configs in Gradle</h3><p>With Gradle for a project we can create config files in the project and refer them relative to root project.</p><pre>checkstyle {<br>    toolVersion = &quot;8.0&quot;<br>    configFile = rootProject.file(&#39;config/checkstyle/checkstyle.xml&#39;)<br>    sourceSets = [] // disables checkstyle with normal &#39;build&#39; task, to run checkstyle tasks specify directly on command line<br>    ignoreFailures = false<br>    showViolations = true<br>}<br><br>pmd {<br>    toolVersion = &quot;5.8.1&quot;<br>    ruleSetFiles = rootProject.files(&quot;config/pmd/ruleset.xml&quot;)<br>    sourceSets = []<br>}<br><br>findbugs {<br>    toolVersion = &quot;3.0.1&quot;<br>    excludeFilter = rootProject.file(&quot;config/findbugs/findbugs-exclude.xml&quot;)<br>    sourceSets = []<br>}</pre><p>in my case we have multiple micro services and we wanted to use same set of configurations and here is how we achieved it.</p><p>Created new module with the configuration files and created a jar and published to a remote artifactory and then added that jar in our dependency and modified tasks to read configuration files from the jar as below.</p><pre>checkstyle {<br>      toolVersion = &quot;8.0&quot;<br>      config = project.resources.text.fromString(getClass().getResource(&quot;checkstyle.xml&quot;).text)<br>      sourceSets = [] // disables checkstyle with normal &#39;build&#39; task, to run checkstyle tasks specify directly on command line<br>      ignoreFailures = false<br>      showViolations = true<br>  }<br><br>  pmd {<br>      toolVersion = &quot;5.8.1&quot;<br>      ruleSetConfig = project.resources.text.fromString(getClass().getResource(&quot;pmd-ruleset.xml&quot;).text)<br>      sourceSets = []<br>  }<br><br>  findbugs {<br>      toolVersion = &quot;3.0.1&quot;<br>      excludeFilterConfig = project.resources.text.fromString(getClass().getResource(&quot;findbugs-exclude.xml&quot;).text)<br>      sourceSets = []<br>  }</pre><p>Static analysis gradle plugins allows options to load file or set it as resourceFile.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a0cc14c4643" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/externalize-static-code-analysis-configs-in-gradle-3a0cc14c4643">Externalize static code analysis configs in Gradle</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Download file in GWT]]></title>
            <link>https://medium.com/i-me-myself-naveen/download-file-in-gwt-3e6623c0d57f?source=rss----df94dd953442---4</link>
            <guid isPermaLink="false">https://medium.com/p/3e6623c0d57f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[download]]></category>
            <category><![CDATA[gwt]]></category>
            <dc:creator><![CDATA[Naveen Gurram]]></dc:creator>
            <pubDate>Wed, 26 Sep 2018 17:56:18 GMT</pubDate>
            <atom:updated>2018-10-05T21:31:25.098Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the years working on GWT was always fun at the same time I have some many war stories where found quirks along the way to get to the solution. One such was the below one.</p><p>The requirement is to provide download feature and my initial idea was to make RPC calls to some service layer which happens to be a servlet on which I can write out content to servlet output stream. In my GWT controller, I planned to leave the RPC async onSuccess response block.</p><p><strong><em>Note</em></strong>: <em>Servlet extending a RemoteServlet you can get the response by calling </em><strong><em>getThreadLocalResponse</em></strong><em>() gives HttpServletResponse</em></p><p>But in reality even though in my Servlet I write response stream out it doesn’t force the browser to save the file in fact call reaches GWT async onSuccess method. I tried other alternatives of calling a different micro service which forces the download that also didn’t give me my intended experience of downloading the file.</p><p>After trying a little bit, I went to implement a native javascript solution in my async method which did the trick. Here is the code block</p><pre>public static native void downloadFile(String fileName, String urlData) /*-{<br>    var aLink = document.createElement(&#39;a&#39;);<br>    aLink.download = fileName;<br>    aLink.href = encodeURI(urlData);<br>    var event = new MouseEvent(&#39;click&#39;);<br>    aLink.dispatchEvent(event);<br>}-*/;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e6623c0d57f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i-me-myself-naveen/download-file-in-gwt-3e6623c0d57f">Download file in GWT</a> was originally published in <a href="https://medium.com/i-me-myself-naveen">Naveen Gurram</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>