Fix checkstyle warnings

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-07-02 13:20:48 +02:00
parent cf4e7412d4
commit 89e756a21e
6 changed files with 29 additions and 27 deletions

View File

@ -88,7 +88,7 @@ public class Injection
tmpTarget = IntrospectionUtil.findMethod(clazz, setter, new Class[]{_resourceClass}, true, false);
tmpParamClass = _resourceClass;
}
catch (NoSuchMethodException me)
catch (NoSuchMethodException nsme)
{
//try as a field
try
@ -96,9 +96,10 @@ public class Injection
tmpTarget = IntrospectionUtil.findField(clazz, target, resourceType, true, false);
tmpParamClass = null;
}
catch (NoSuchFieldException fe)
catch (NoSuchFieldException nsfe)
{
throw new IllegalArgumentException("No such field or method " + target + " on class " + _targetClass);
nsme.addSuppressed(nsfe);
throw new IllegalArgumentException("No such field or method " + target + " on class " + _targetClass, nsme);
}
}

View File

@ -311,6 +311,9 @@ public abstract class Resource implements ResourceFactory, Closeable
return r.isContainedIn(containingResource);
}
/**
* @checkstyle-disable-check : NoFinalizerCheck
*/
@Override
protected void finalize()
{

View File

@ -18,33 +18,32 @@
package com.acme;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
public final class AddListServletRequestListener
implements ServletRequestListener
{
public void requestDestroyed( ServletRequestEvent event )
public void requestDestroyed(ServletRequestEvent event)
{
List al = (List) event.getServletContext().getAttribute( "arraylist" );
if ( al != null )
List al = (List)event.getServletContext().getAttribute("arraylist");
if (al != null)
{
event.getServletContext().removeAttribute( "arraylist" );
event.getServletContext().removeAttribute("arraylist");
}
}
public void requestInitialized( ServletRequestEvent event )
public void requestInitialized(ServletRequestEvent event)
{
List al = (List) event.getServletContext().getAttribute( "arraylist" );
if ( al == null )
List al = (List)event.getServletContext().getAttribute("arraylist");
if (al == null)
{
al = new ArrayList();
}
al.add( "in requestInitialized method of "+ getClass().getName() );
event.getServletContext().setAttribute( "arraylist", al );
al.add("in requestInitialized method of " + getClass().getName());
event.getServletContext().setAttribute("arraylist", al);
}
}

View File

@ -833,10 +833,10 @@ public class Dump extends HttpServlet
pout.write("<br/>");
pout.write("<h2>International Characters (UTF-8)</h2>");
pout.write("LATIN LETTER SMALL CAPITAL AE<br/>\n");
pout.write("Directly uni encoded(\\u1d01): \u1d01<br/>");
pout.write("Directly uni encoded(\\u1d01): \u1d01<br/>"); // uni encoded
pout.write("HTML reference (&amp;AElig;): &AElig;<br/>");
pout.write("Decimal (&amp;#7425;): &#7425;<br/>");
pout.write("Javascript unicode (\\u1d01) : <script language='javascript'>document.write(\"\u1d01\");</script><br/>");
pout.write("Javascript unicode (\\u1d01) : <script language='javascript'>document.write(\"\u1d01\");</script><br/>"); // uni encoded
pout.write("<br/>");
pout.write("<h2>Form to generate GET content</h2>");
pout.write("<form method=\"GET\" action=\"" + response.encodeURL(getURI(request)) + "\">");

View File

@ -144,14 +144,13 @@ public class TestListener implements HttpSessionListener, HttpSessionAttributeLi
try
{
AddListServletRequestListener listenerClass =
sce.getServletContext().createListener( AddListServletRequestListener.class );
sce.getServletContext().addListener( listenerClass );
sce.getServletContext().createListener(AddListServletRequestListener.class);
sce.getServletContext().addListener(listenerClass);
}
catch ( ServletException e )
catch (ServletException e)
{
throw new RuntimeException( e.getMessage(), e );
throw new RuntimeException(e.getMessage(), e);
}
}
@Override

View File

@ -18,21 +18,21 @@
package com.acme;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
public class TestServlet extends HttpServlet
{
@Override
protected void doGet( HttpServletRequest req, HttpServletResponse resp )
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
List l = (List) getServletContext().getAttribute( "arraylist" );
List l = (List)getServletContext().getAttribute("arraylist");
resp.getOutputStream().println( "All Good " + l.toString() );
resp.getOutputStream().println("All Good " + l.toString());
}
}