]
Mario Fusco resolved DROOLS-506.
--------------------------------
Fix Version/s: 6.2.0.CR1
Resolution: Done
Example project: massive number of code quality / correctness
warnings
----------------------------------------------------------------------
Key: DROOLS-506
URL:
https://issues.jboss.org/browse/DROOLS-506
Project: Drools
Issue Type: Bug
Reporter: Peter Horvath
Assignee: Mario Fusco
Priority: Trivial
Fix For: 6.2.0.CR1
Attachments: eclipse_warnings.png
The Drools example project contains code snippets that yield warnings: *while I
absolutely understand that resources are limited and examples might not be the priority
and the core code of the engine is of good quality*, I do think it is important to display
dedication to high quality products.
Having an example project full of code quality issues just gives a very bad first
impression of the whole Drools project...
Examples:
{code:title=org.drools.examples.cashflow.CashFlowMain|borderStyle=solid}
public class CashFlowMain {
public static void main(String[] args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
{code}
yields {color:red}WARNING: The value of the local variable sdf is not used {color}
{code:title=org.drools.examples.sudoku.Sudoku.dumpGrid()|borderStyle=solid}
/**
* Nice printout of the grid.
*/
public void dumpGrid() {
Formatter fmt = new Formatter(System.out);
{code}
yields {color:red}WARNING: Resource leak: 'fmt' is never closed {color}
{code:title=org.drools.games.pong.PongUI|borderStyle=solid}
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.font.FontRenderContext;
import java.awt.font.TextLayout;
import java.awt.image.BufferedImage;
import javax.swing.*;
import org.drools.games.GameConfiguration;
import org.drools.games.GameUI;
import org.kie.api.runtime.KieSession;
import org.kie.internal.runtime.StatefulKnowledgeSession;
import org.kie.api.runtime.rule.FactHandle;
import org.kie.api.runtime.rule.EntryPoint;
public class PongUI extends GameUI {
{code}
yields {color:red}WARNING: The import java.awt.event.KeyEvent is never used {color} \\
{color:red}WARNING: The import java.awt.event.KeyListener is never used {color} \\
{color:red}WARNING: The import java.awt.event.MouseEvent is never used {color} \\
{color:red}WARNING: The import java.awt.event.MouseListener is never used {color} \\
{color:red}WARNING: The import java.awt.image.BufferedImage is never used {color} \\
{color:red}WARNING: The import javax.swing.* is never used {color} \\
{color:red}WARNING: The import org.kie.internal.runtime.StatefulKnowledgeSession is never
used {color} \\
{color:red}WARNING: The import org.kie.api.runtime.rule.FactHandle is never used {color}
\\
{color:red}WARNING: The import org.kie.api.runtime.rule.EntryPoint is never used {color}
\\
etc