Tuesday, November 5, 2013

Suppressing PMD & Findbugs rules

PMD 


PMD rules can be suppress by using the @SuppressWarnings("PMD") annotation.
A specific rule can also be set on the annotation @SuppressWarnings("PMD.[rule]").
For ex.


A list of rules supported by PMD can be found at : PMD Rules

Findbugs

To use the Findbugs @SupressWarnings, you've to include the following dependency -

<dependency>
 <groupId>com.google.code.findbugs</groupId>
 <artifactId>annotations</artifactId>
 <version>2.0.2</version>
</dependency>

Note: The @edu.umd.cs.findbugs.annotations.SuppressWarnings annotation is different from @java.lang.SupressWarnings annotation.

Usage :

@SupressWarnings("RULE")
A list of bugs can be found at : Findbugs

Friday, August 2, 2013

Auto generated ID / primary key in JPA [Oracle Database]

Introduction

* Use the @SequeunceGenerator annotation in your entity class.
*  Create a sequence in Oracle database


Wednesday, November 21, 2012

JSP JSTL String length

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"  %>
<c:if test="${fn:length(string)>0}">
...
</c:if>