[TASK] Checkstyle report and mvn site configuration

This commit is contained in:
Maxime Sinclair
2014-02-06 18:28:06 +01:00
parent 77b9c2f0bd
commit fd2b6e7c02
22 changed files with 273 additions and 83 deletions

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: checkstyle
Description: none
-->
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="JavadocMethod">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocType">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocVariable">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocStyle">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="LineLength">
<property name="max" value="120"/>
<property name="tabWidth" value="4"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="ModifierOrder">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="AvoidInlineConditionals">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="SimplifyBooleanReturn"/>
<module name="DesignForExtension">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<module name="ArrayTypeStyle"/>
<module name="FinalParameters">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
<module name="JavadocPackage">
<property name="severity" value="ignore"/>
<property name="allowLegacy" value="true"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="NewlineAtEndOfFile">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="Translation"/>
<module name="FileLength"/>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
</module>

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat;
/*
/*
* ASCII servlet of the webapp.
* This servlet produces the UML sequence diagram in text format.
*/

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@ class DiagramResponse {
SourceStringReader reader = new SourceStringReader(uml);
reader.generateImage(response.getOutputStream(), new FileFormatOption(format, false));
}
void sendMap(String uml) throws IOException {
if (StringUtils.isDiagramCacheable(uml)) {
addHeaderForCache();
@@ -76,11 +76,11 @@ class DiagramResponse {
String map = reader.generateImage(new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false));
String[] mapLines = map.split("[\\r\\n]");
PrintWriter httpOut = response.getWriter();
for (int i=2; (i+1)<mapLines.length; i++) {
for (int i = 2; (i + 1) < mapLines.length; i++) {
httpOut.print(mapLines[i]);
}
}
private void addHeaderForCache() {
long today = System.currentTimeMillis();
// Add http headers to force the browser to cache the image
@@ -90,7 +90,7 @@ class DiagramResponse {
// 2009 dec 22 constant date in the past
response.addHeader("Cache-Control", "public");
}
private String getContentType() {
return contentType.get(format);
}

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat;
/*
/*
* Image servlet of the webapp.
* This servlet produces the UML diagram in PNG format.
*/

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.servlet.utility.UmlExtractor;
/*
/*
* MAP servlet of the webapp.
* This servlet produces the image map of the diagram in HTML format.
*/
@@ -57,7 +57,7 @@ public class MapServlet extends HttpServlet {
}
dr = null;
}
public String getSource(String uri) {
String[] result = uri.split("/map/", 2);
if (result.length != 2) {

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader;
/*
/*
* Proxy servlet of the webapp.
* This servlet retrieves the diagram source of a web resource (web html page)
* and renders it.
@@ -58,7 +58,7 @@ public class OldProxyServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
final String uri = request.getRequestURI();
final String uri = request.getRequestURI();
Matcher proxyMatcher = proxyPattern.matcher(uri);
if (proxyMatcher.matches()) {

View File

@@ -51,7 +51,7 @@ import net.sourceforge.plantuml.api.PlantumlUtils;
*
* This class is the old all-in-one historic implementation of the PlantUml server.
* See package.html for the new design. It's a work in progress.
*
*
* Modified by Arnaud Roques
* Modified by Pablo Lalloni
* Modified by Maxime Sinclair
@@ -112,22 +112,22 @@ public class PlantUmlServlet extends HttpServlet {
request.setAttribute("decoded", text);
request.setAttribute("encoded", encoded);
// check if an image map is necessary
if (text != null && PlantumlUtils.hasCMapData(text)) {
request.setAttribute("mapneeded", Boolean.TRUE);
}
}
// forward to index.jsp
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
dispatcher.forward(request, response);
return;
}
public void init(ServletConfig config) throws ServletException {
config.getServletContext().setAttribute("cfg", Configuration.get());
}
private Transcoder getTranscoder() {
return TranscoderUtil.getDefaultTranscoder();
}

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@ import javax.imageio.IIOException;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLPeerUnverifiedException;
/*
/*
* Proxy servlet of the webapp.
* This servlet retrieves the diagram source of a web resource (web html page)
* and renders it.
@@ -70,7 +70,7 @@ public class ProxyServlet extends HttpServlet {
} catch (MalformedURLException mue) {
mue.printStackTrace();
return;
}
}
// generate the response
String diagmarkup = getSource(srcUrl);
@@ -82,20 +82,20 @@ public class ProxyServlet extends HttpServlet {
Diagram diagram = block.getDiagram();
UmlSource umlSrc = diagram.getSource();
String uml = umlSrc.getPlainString();
System.out.println("uml="+uml);
System.out.println("uml=" + uml);
// generate the response
DiagramResponse dr = new DiagramResponse(response, getOutputFormat());
try {
dr.sendDiagram(uml);
} catch (IIOException iioe) {
// Browser has closed the connection, so the HTTP OutputStream is closed
// Silently catch the exception to avoid annoying log
// Silently catch the exception to avoid annoying log
}
dr = null;
dr = null;
}
private String getSource(URL url) throws IOException {
private String getSource(final URL url) throws IOException {
String line;
BufferedReader rd;
StringBuilder sb;
@@ -111,7 +111,7 @@ public class ProxyServlet extends HttpServlet {
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
} finally{
} finally {
rd = null;
}
return "";
@@ -130,7 +130,7 @@ public class ProxyServlet extends HttpServlet {
return FileFormat.PNG;
}
private HttpURLConnection getConnection(URL url) throws IOException {
private HttpURLConnection getConnection(final URL url) throws IOException {
if (url.getProtocol().startsWith("https")) {
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET");
@@ -146,12 +146,13 @@ public class ProxyServlet extends HttpServlet {
return con;
}
}
/**
* Debug method used to dump the certificate info
* Debug method used to dump the certificate info
* @param con the https connection
*/
private void printHttpsCert(HttpsURLConnection con) {
@SuppressWarnings("unused")
private void printHttpsCert(final HttpsURLConnection con) {
if (con != null) {
try {
System.out.println("Response Code : " + con.getResponseCode());

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat;
/*
/*
* SVG servlet of the webapp.
* This servlet produces the UML diagram in SVG format.
*/

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -51,14 +51,14 @@ public abstract class UmlDiagramService extends HttpServlet {
dr.sendDiagram(uml);
} catch (IIOException iioe) {
// Browser has closed the connection, so the HTTP OutputStream is closed
// Silently catch the exception to avoid annoying log
// Silently catch the exception to avoid annoying log
}
dr = null;
}
/**
* Extracts the compressed UML source from the HTTP URI.
*
*
* @param uri
* the complete URI as returned by request.getRequestURI()
* @return the compressed UML source
@@ -67,7 +67,7 @@ public abstract class UmlDiagramService extends HttpServlet {
/**
* Gives the wished output format of the diagram. This value is used by the DiagramResponse class.
*
*
* @return the format
*/
abstract public FileFormat getOutputFormat();

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*
/*
* Welcome servlet of the webapp.
* Displays the sample Bob and Alice sequence diagram.
*/

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@ import java.io.InputStream;
import java.util.Properties;
public class Configuration {
public final class Configuration {
private static Configuration instance;
private Properties config;
@@ -58,7 +58,7 @@ public class Configuration {
/**
* Get the configuration
*
*
* @return the complete configuration
*/
public static Properties get() {
@@ -70,10 +70,10 @@ public class Configuration {
/**
* Get a boolean configuration value
*
*
* @return true if the value is "on"
*/
public static boolean get(String key) {
public static boolean get(final String key) {
if (instance.config.getProperty(key) == null) {
return false;
}

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@ public class NullOutputStream extends OutputStream {
* Overridden for performance reason
*/
@Override
public void write(byte b[]) throws IOException {
public void write(byte[] b) throws IOException {
// Do nothing silently
}
@@ -48,7 +48,7 @@ public class NullOutputStream extends OutputStream {
* Overridden for performance reason
*/
@Override
public void write(byte b[], int off, int len) throws IOException {
public void write(byte[] b, int off, int len) throws IOException {
// Do nothing silently
}
}

View File

@@ -3,7 +3,7 @@
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
@@ -31,13 +31,14 @@ import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil;
/**
* Utility class to extract the UML source from the compressed UML source contained in the end part of the requested URI.
* Utility class to extract the UML source from the compressed UML source contained in the end part
* of the requested URI.
*/
public class UmlExtractor {
/**
* Build the complete UML source from the compressed source extracted from the HTTP URI.
*
*
* @param source
* the last part of the URI containing the compressed UML
* @return the textual UML source