Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D6BDAF6C2 for ; Thu, 9 May 2013 15:33:08 +0000 (UTC) Received: (qmail 21779 invoked by uid 500); 9 May 2013 15:33:08 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 21754 invoked by uid 500); 9 May 2013 15:33:08 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 21745 invoked by uid 99); 9 May 2013 15:33:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2013 15:33:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2013 15:33:05 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C9D342388993; Thu, 9 May 2013 15:32:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1480691 - in /logging/log4j/log4j2/trunk: jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ taglib/src/main/java/org/apache/logging/log4j/taglib/ taglib/src/test/java/org/apache/logging/log4j/taglib/ Date: Thu, 09 May 2013 15:32:43 -0000 To: commits@logging.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130509153244.C9D342388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ggregory Date: Thu May 9 15:32:42 2013 New Revision: 1480691 URL: http://svn.apache.org/r1480691 Log: Use final where possible. Modified: logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientEditConfigPanel.java logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUIJConsolePlugin.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/CatchingTag.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/DumpTag.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/EntryTag.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExceptionAwareTagSupport.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExitTag.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/IfEnabledTag.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLogger.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LogTag.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupport.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupport.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/SetLoggerTag.java logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/TagUtils.java logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/CatchingTagTest.java logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/DumpTagTest.java logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/EntryTagTest.java logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/ExitTagTest.java logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/IfEnabledTagTest.java logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupportTest.java logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupportTest.java logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/SetLoggerTagTest.java Modified: logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java (original) +++ logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java Thu May 9 15:32:42 2013 @@ -38,7 +38,7 @@ import org.apache.logging.log4j.core.jmx */ public class Client { private JMXConnector connector; - private MBeanServerConnection connection; + private final MBeanServerConnection connection; private StatusLoggerAdminMBean statusLoggerAdmin; private ContextSelectorAdminMBean contextSelectorAdmin; private List contextAdminList; @@ -53,7 +53,7 @@ public class Client { * one of the remote mbeans * @throws IOException if the connection failed */ - public Client(JMXConnector connector) throws MalformedObjectNameException, + public Client(final JMXConnector connector) throws MalformedObjectNameException, IOException { this.connector = Assert.isNotNull(connector, "JMXConnector"); this.connector.connect(); @@ -71,7 +71,7 @@ public class Client { * one of the remote mbeans * @throws IOException if the connection failed */ - public Client(MBeanServerConnection mBeanServerConnection) + public Client(final MBeanServerConnection mBeanServerConnection) throws MalformedObjectNameException, IOException { this.connection = mBeanServerConnection; init(); @@ -87,11 +87,11 @@ public class Client { ContextSelectorAdminMBean.class, false); contextAdminList = new ArrayList(); - String pattern = String.format(LoggerContextAdminMBean.PATTERN, "*"); - ObjectName search = new ObjectName(pattern); - Set found = connection.queryNames(search, null); - for (ObjectName contextName : found) { - LoggerContextAdminMBean ctx = JMX.newMBeanProxy(connection, // + final String pattern = String.format(LoggerContextAdminMBean.PATTERN, "*"); + final ObjectName search = new ObjectName(pattern); + final Set found = connection.queryNames(search, null); + for (final ObjectName contextName : found) { + final LoggerContextAdminMBean ctx = JMX.newMBeanProxy(connection, // contextName, // LoggerContextAdminMBean.class, false); contextAdminList.add(ctx); @@ -127,7 +127,7 @@ public class Client { public void close() { try { connector.close(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } Modified: logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientEditConfigPanel.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientEditConfigPanel.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientEditConfigPanel.java (original) +++ logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientEditConfigPanel.java Thu May 9 15:32:42 2013 @@ -54,51 +54,51 @@ public class ClientEditConfigPanel exten private JButton buttonSendLocation; private JButton buttonSendConfigText; private JTextArea configTextArea; - private LoggerContextAdminMBean contextAdmin; + private final LoggerContextAdminMBean contextAdmin; - private AbstractAction actionReconfigureFromLocation = new AbstractAction( + private final AbstractAction actionReconfigureFromLocation = new AbstractAction( "Reconfigure from Location") { private static final long serialVersionUID = 6995219797596745774L; @Override - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { try { contextAdmin.setConfigLocationURI(locationTextField.getText()); populateWidgets(); showConfirmation(); - } catch (Exception ex) { + } catch (final Exception ex) { populateWidgets(); handle("Could not reconfigure from location", ex); } } }; - private AbstractAction actionReconfigureFromText = new AbstractAction( + private final AbstractAction actionReconfigureFromText = new AbstractAction( "Reconfigure with XML Below") { private static final long serialVersionUID = -2846103707134292312L; @Override - public void actionPerformed(ActionEvent e) { - String encoding = System.getProperty("file.encoding"); + public void actionPerformed(final ActionEvent e) { + final String encoding = System.getProperty("file.encoding"); try { contextAdmin.setConfigText(configTextArea.getText(), encoding); populateWidgets(); showConfirmation(); - } catch (Exception ex) { + } catch (final Exception ex) { populateWidgets(); handle("Could not reconfigure from XML", ex); } } }; - public ClientEditConfigPanel(LoggerContextAdminMBean contextAdmin) { + public ClientEditConfigPanel(final LoggerContextAdminMBean contextAdmin) { this.contextAdmin = contextAdmin; createWidgets(); populateWidgets(); } - private void handle(String msg, Exception ex) { - StringWriter sr = new StringWriter(BUFFER_SIZE); - PrintWriter pw = new PrintWriter(sr); + private void handle(final String msg, final Exception ex) { + final StringWriter sr = new StringWriter(BUFFER_SIZE); + final PrintWriter pw = new PrintWriter(sr); pw.println("Please check the StatusLogger tab for details"); pw.println(); ex.printStackTrace(pw); @@ -114,12 +114,12 @@ public class ClientEditConfigPanel exten private void populateWidgets() { try { configTextArea.setText(contextAdmin.getConfigText()); - } catch (Exception ex) { - StringWriter sw = new StringWriter(ERR_MSG_INITIAL_BUFFER_SIZE); + } catch (final Exception ex) { + final StringWriter sw = new StringWriter(ERR_MSG_INITIAL_BUFFER_SIZE); ex.printStackTrace(new PrintWriter(sw)); configTextArea.setText(sw.toString()); } - String uri = contextAdmin.getConfigLocationURI(); + final String uri = contextAdmin.getConfigLocationURI(); locationTextField.setText(uri); } @@ -130,7 +130,7 @@ public class ClientEditConfigPanel exten configTextArea.setForeground(Color.black); configTextArea.setFont(new Font("Monospaced", Font.PLAIN, configTextArea.getFont().getSize())); - JScrollPane scrollConfig = new JScrollPane(configTextArea); + final JScrollPane scrollConfig = new JScrollPane(configTextArea); locationTextField = new JTextField(LOCATION_TEXT_COLS); locationLabel = new JLabel("Location: "); @@ -138,7 +138,7 @@ public class ClientEditConfigPanel exten buttonSendLocation = new JButton(actionReconfigureFromLocation); buttonSendConfigText = new JButton(actionReconfigureFromText); - JPanel north = new JPanel(); + final JPanel north = new JPanel(); north.setLayout(new BoxLayout(north, BoxLayout.LINE_AXIS)); north.add(locationLabel); north.add(locationTextField); Modified: logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java (original) +++ logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java Thu May 9 15:32:42 2013 @@ -61,22 +61,22 @@ import org.apache.logging.log4j.core.jmx */ public class ClientGUI extends JPanel implements NotificationListener { private static final long serialVersionUID = -253621277232291174L; - private Client client; + private final Client client; private JTextArea statusLogTextArea; private JTabbedPane tabbedPane; private JToggleButton wrapLinesToggleButton; - private AbstractAction toggleWrapAction = new AbstractAction() { + private final AbstractAction toggleWrapAction = new AbstractAction() { private static final long serialVersionUID = -4214143754637722322L; @Override - public void actionPerformed(ActionEvent e) { - boolean wrap = wrapLinesToggleButton.isSelected(); + public void actionPerformed(final ActionEvent e) { + final boolean wrap = wrapLinesToggleButton.isSelected(); statusLogTextArea.setLineWrap(wrap); } }; - public ClientGUI(Client client) throws InstanceNotFoundException, + public ClientGUI(final Client client) throws InstanceNotFoundException, MalformedObjectNameException, IOException { this.client = Assert.isNotNull(client, "client"); createWidgets(); @@ -95,7 +95,7 @@ public class ClientGUI extends JPanel im wrapLinesToggleButton = new JToggleButton(toggleWrapAction); wrapLinesToggleButton.setToolTipText("Toggle line wrapping"); - JScrollPane scrollStatusLog = new JScrollPane(statusLogTextArea, // + final JScrollPane scrollStatusLog = new JScrollPane(statusLogTextArea, // JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, // JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollStatusLog.setCorner(JScrollPane.LOWER_RIGHT_CORNER, wrapLinesToggleButton); @@ -109,29 +109,29 @@ public class ClientGUI extends JPanel im private void populateWidgets() { - StatusLoggerAdminMBean statusAdmin = client.getStatusLoggerAdmin(); - String[] messages = statusAdmin.getStatusDataHistory(); - for (String message : messages) { + final StatusLoggerAdminMBean statusAdmin = client.getStatusLoggerAdmin(); + final String[] messages = statusAdmin.getStatusDataHistory(); + for (final String message : messages) { statusLogTextArea.append(message + "\n"); } - for (LoggerContextAdminMBean ctx : client.getLoggerContextAdmins()) { - ClientEditConfigPanel editor = new ClientEditConfigPanel(ctx); + for (final LoggerContextAdminMBean ctx : client.getLoggerContextAdmins()) { + final ClientEditConfigPanel editor = new ClientEditConfigPanel(ctx); tabbedPane.addTab("LoggerContext: " + ctx.getName(), editor); } } private void registerListeners() throws InstanceNotFoundException, MalformedObjectNameException, IOException { - NotificationFilterSupport filter = new NotificationFilterSupport(); + final NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType(StatusLoggerAdminMBean.NOTIF_TYPE_MESSAGE); - ObjectName objName = new ObjectName(StatusLoggerAdminMBean.NAME); + final ObjectName objName = new ObjectName(StatusLoggerAdminMBean.NAME); client.getConnection().addNotificationListener(objName, this, filter, null); } @Override - public void handleNotification(Notification notif, Object paramObject) { + public void handleNotification(final Notification notif, final Object paramObject) { if (StatusLoggerAdminMBean.NOTIF_TYPE_MESSAGE.equals(notif.getType())) { statusLogTextArea.append(notif.getMessage() + "\n"); } @@ -151,7 +151,7 @@ public class ClientGUI extends JPanel im * {@code service:jmx:rmi://:/jndi/rmi://:/jmxrmi} * @throws Exception if anything goes wrong */ - public static void main(String[] args) throws Exception { + public static void main(final String[] args) throws Exception { if (args.length < 1) { usage(); return; @@ -160,13 +160,13 @@ public class ClientGUI extends JPanel im if (!serviceUrl.startsWith("service:jmx")) { serviceUrl = "service:jmx:rmi:///jndi/rmi://" + args[0] + "/jmxrmi"; } - JMXServiceURL url = new JMXServiceURL(serviceUrl); - Map paramMap = new HashMap(); - for (Object objKey : System.getProperties().keySet()) { - String key = (String) objKey; + final JMXServiceURL url = new JMXServiceURL(serviceUrl); + final Map paramMap = new HashMap(); + for (final Object objKey : System.getProperties().keySet()) { + final String key = (String) objKey; paramMap.put(key, System.getProperties().getProperty(key)); } - JMXConnector connector = JMXConnectorFactory.connect(url, paramMap); + final JMXConnector connector = JMXConnectorFactory.connect(url, paramMap); final Client client = new Client(connector); final String title = "Log4J2 JMX Client - " + url; @@ -175,13 +175,13 @@ public class ClientGUI extends JPanel im public void run() { installLookAndFeel(); try { - ClientGUI gui = new ClientGUI(client); - JFrame frame = new JFrame(title); + final ClientGUI gui = new ClientGUI(client); + final JFrame frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(gui, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); - } catch (Exception ex) { + } catch (final Exception ex) { // if console is visible, print error so that // the stack trace remains visible after error dialog is // closed @@ -189,7 +189,7 @@ public class ClientGUI extends JPanel im // show error in dialog: there may not be a console window // visible - StringWriter sr = new StringWriter(); + final StringWriter sr = new StringWriter(); ex.printStackTrace(new PrintWriter(sr)); JOptionPane.showMessageDialog(null, sr.toString(), "Error", JOptionPane.ERROR_MESSAGE); @@ -199,28 +199,28 @@ public class ClientGUI extends JPanel im } private static void usage() { - String me = ClientGUI.class.getName(); + final String me = ClientGUI.class.getName(); System.err.println("Usage: java " + me + " :"); System.err.println(" or: java " + me + " service:jmx:rmi:///jndi/rmi://:/jmxrmi"); - String longAdr = " service:jmx:rmi://:/jndi/rmi://:/jmxrmi"; + final String longAdr = " service:jmx:rmi://:/jndi/rmi://:/jmxrmi"; System.err.println(" or: java " + me + longAdr); } private static void installLookAndFeel() { try { - for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); return; } } - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } Modified: logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUIJConsolePlugin.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUIJConsolePlugin.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUIJConsolePlugin.java (original) +++ logging/log4j/log4j2/trunk/jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUIJConsolePlugin.java Thu May 9 15:32:42 2013 @@ -32,12 +32,12 @@ public class ClientGUIJConsolePlugin ext @Override public Map getTabs() { try { - Client client = new Client(getContext().getMBeanServerConnection()); - ClientGUI gui = new ClientGUI(client); - Map result = new HashMap(); + final Client client = new Client(getContext().getMBeanServerConnection()); + final ClientGUI gui = new ClientGUI(client); + final Map result = new HashMap(); result.put("Log4j2", gui); return result; - } catch (Throwable ex) { + } catch (final Throwable ex) { throw new IllegalStateException(ex); } } Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/CatchingTag.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/CatchingTag.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/CatchingTag.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/CatchingTag.java Thu May 9 15:32:42 2013 @@ -39,13 +39,13 @@ public class CatchingTag extends Excepti this.level = null; } - public void setLevel(Object level) { + public void setLevel(final Object level) { this.level = TagUtils.resolveLevel(level); } @Override public int doEndTag() throws JspException { - Log4jTaglibLogger logger = this.getLogger(); + final Log4jTaglibLogger logger = this.getLogger(); if (this.level == null) { logger.catching(FQCN, Level.ERROR, this.getException()); Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/DumpTag.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/DumpTag.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/DumpTag.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/DumpTag.java Thu May 9 15:32:42 2013 @@ -48,24 +48,24 @@ public class DumpTag extends TagSupport this.scope = PageContext.PAGE_SCOPE; } - public void setScope(String scope) { + public void setScope(final String scope) { this.scope = TagUtils.getScope(scope); } @Override public int doEndTag() throws JspException { try { - Enumeration names = this.pageContext.getAttributeNamesInScope(this.scope); + final Enumeration names = this.pageContext.getAttributeNamesInScope(this.scope); this.pageContext.getOut().write("
"); while (names != null && names.hasMoreElements()) { - String name = names.nextElement(); - Object value = this.pageContext.getAttribute(name, this.scope); + final String name = names.nextElement(); + final Object value = this.pageContext.getAttribute(name, this.scope); this.pageContext.getOut().write("
" + name + "
"); this.pageContext.getOut().write("
" + value + "
"); } this.pageContext.getOut().write("
"); - } catch (IOException e) { + } catch (final IOException e) { throw new JspException("Could not write scope contents. Cause: " + e.toString(), e); } Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/EntryTag.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/EntryTag.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/EntryTag.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/EntryTag.java Thu May 9 15:32:42 2013 @@ -46,13 +46,13 @@ public class EntryTag extends LoggerAwar } } - public void setDynamicAttribute(String uri, String name, Object value) { + public void setDynamicAttribute(final String uri, final String name, final Object value) { this.attributes.add(value); } @Override public int doEndTag() throws JspException { - Log4jTaglibLogger logger = this.getLogger(); + final Log4jTaglibLogger logger = this.getLogger(); if (TagUtils.isEnabled(logger, Level.TRACE, null)) { if (this.attributes.size() == 0) { Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExceptionAwareTagSupport.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExceptionAwareTagSupport.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExceptionAwareTagSupport.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExceptionAwareTagSupport.java Thu May 9 15:32:42 2013 @@ -36,7 +36,7 @@ abstract class ExceptionAwareTagSupport return this.exception; } - public final void setException(Throwable exception) { + public final void setException(final Throwable exception) { this.exception = exception; } } Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExitTag.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExitTag.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExitTag.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/ExitTag.java Thu May 9 15:32:42 2013 @@ -39,13 +39,13 @@ public class ExitTag extends LoggerAware this.result = null; } - public void setResult(Object result) { + public void setResult(final Object result) { this.result = result; } @Override public int doEndTag() throws JspException { - Log4jTaglibLogger logger = this.getLogger(); + final Log4jTaglibLogger logger = this.getLogger(); if (TagUtils.isEnabled(logger, Level.TRACE, null)) { if (this.result == null) { Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/IfEnabledTag.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/IfEnabledTag.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/IfEnabledTag.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/IfEnabledTag.java Thu May 9 15:32:42 2013 @@ -41,17 +41,17 @@ public class IfEnabledTag extends Logger this.marker = null; } - public final void setLevel(Object level) { + public final void setLevel(final Object level) { this.level = level; } - public final void setMarker(Marker marker) { + public final void setMarker(final Marker marker) { this.marker = marker; } @Override public int doStartTag() throws JspException { - Level level = TagUtils.resolveLevel(this.level); + final Level level = TagUtils.resolveLevel(this.level); if (level == null) { throw new JspException("Level must be of type String or org.apache.logging.log4j.Level."); } Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLogger.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLogger.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLogger.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLogger.java Thu May 9 15:32:42 2013 @@ -28,27 +28,27 @@ import org.apache.logging.log4j.spi.Abst * @since 2.0 */ class Log4jTaglibLogger extends AbstractLoggerWrapper { - public Log4jTaglibLogger(AbstractLogger logger, String name, MessageFactory messageFactory) { + public Log4jTaglibLogger(final AbstractLogger logger, final String name, final MessageFactory messageFactory) { super(logger, name, messageFactory); } @Override - protected void entry(String fqcn, Object... params) { + protected void entry(final String fqcn, final Object... params) { super.entry(fqcn, params); } @Override - protected R exit(String fqcn, R result) { + protected R exit(final String fqcn, final R result) { return super.exit(fqcn, result); } @Override - protected void catching(String fqcn, Level level, Throwable t) { + protected void catching(final String fqcn, final Level level, final Throwable t) { super.catching(fqcn, level, t); } @Override - protected T throwing(String fqcn, Level level, T t) { + protected T throwing(final String fqcn, final Level level, final T t) { return super.throwing(fqcn, level, t); } } Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java Thu May 9 15:32:42 2013 @@ -43,7 +43,7 @@ final class Log4jTaglibLoggerContext imp private final ServletContext servletContext; - private Log4jTaglibLoggerContext(ServletContext servletContext) { + private Log4jTaglibLoggerContext(final ServletContext servletContext) { this.servletContext = servletContext; } @@ -51,11 +51,11 @@ final class Log4jTaglibLoggerContext imp return this.servletContext; } - public Log4jTaglibLogger getLogger(String name) { + public Log4jTaglibLogger getLogger(final String name) { return this.getLogger(name, null); } - public Log4jTaglibLogger getLogger(String name, MessageFactory factory) { + public Log4jTaglibLogger getLogger(final String name, final MessageFactory factory) { Log4jTaglibLogger logger = this.loggers.get(name); if (logger != null) { AbstractLogger.checkMessageFactory(logger, factory); @@ -65,7 +65,7 @@ final class Log4jTaglibLoggerContext imp synchronized (this.loggers) { logger = this.loggers.get(name); if (logger == null) { - Logger original = factory == null ? LogManager.getLogger(name) : LogManager.getLogger(name, factory); + final Logger original = factory == null ? LogManager.getLogger(name) : LogManager.getLogger(name, factory); if (!(original instanceof AbstractLogger)) { throw new LoggingException( "Log4j Tag Library requires base logging system to extend Log4j AbstractLogger." @@ -80,11 +80,11 @@ final class Log4jTaglibLoggerContext imp return logger; } - public boolean hasLogger(String name) { + public boolean hasLogger(final String name) { return this.loggers.containsKey(name); } - static synchronized Log4jTaglibLoggerContext getInstance(ServletContext servletContext) { + static synchronized Log4jTaglibLoggerContext getInstance(final ServletContext servletContext) { Log4jTaglibLoggerContext loggerContext = CONTEXTS.get(servletContext); if (loggerContext != null) { return loggerContext; Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LogTag.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LogTag.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LogTag.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LogTag.java Thu May 9 15:32:42 2013 @@ -39,7 +39,7 @@ public class LogTag extends LoggingMessa return this.level; } - public void setLevel(Object level) { + public void setLevel(final Object level) { this.level = TagUtils.resolveLevel(level); } } Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupport.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupport.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupport.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupport.java Thu May 9 15:32:42 2013 @@ -47,7 +47,7 @@ abstract class LoggerAwareTagSupport ext } @Override - public final void setPageContext(PageContext pageContext) { + public final void setPageContext(final PageContext pageContext) { super.setPageContext(pageContext); this.loggerContext = Log4jTaglibLoggerContext.getInstance(pageContext.getServletContext()); } @@ -58,14 +58,14 @@ abstract class LoggerAwareTagSupport ext } Log4jTaglibLogger logger = TagUtils.getDefaultLogger(this.pageContext); if (logger == null) { - String name = this.pageContext.getPage().getClass().getName(); + final String name = this.pageContext.getPage().getClass().getName(); logger = TagUtils.resolveLogger(this.loggerContext, name, null); TagUtils.setDefaultLogger(this.pageContext, logger); } return logger; } - public final void setLogger(Object logger) { + public final void setLogger(final Object logger) { this.logger = logger; } } Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupport.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupport.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupport.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupport.java Thu May 9 15:32:42 2013 @@ -65,7 +65,7 @@ abstract class LoggingMessageTagSupport return this.message; } - public final void setMessage(Object message) { + public final void setMessage(final Object message) { this.message = message; } @@ -73,13 +73,13 @@ abstract class LoggingMessageTagSupport return this.marker; } - public final void setMarker(Marker marker) { + public final void setMarker(final Marker marker) { this.marker = marker; } protected abstract Level getLevel(); - public final void setDynamicAttribute(String uri, String name, Object value) { + public final void setDynamicAttribute(final String uri, final String name, final Object value) { this.attributes.add(value); } @@ -90,13 +90,13 @@ abstract class LoggingMessageTagSupport @Override public final int doEndTag() throws JspException { - Log4jTaglibLogger logger = this.getLogger(); - Level level = this.getLevel(); - Marker marker = this.getMarker(); + final Log4jTaglibLogger logger = this.getLogger(); + final Level level = this.getLevel(); + final Marker marker = this.getMarker(); if (TagUtils.isEnabled(logger, level, marker)) { - Object message = this.getMessage(); - Throwable exception = this.getException(); + final Object message = this.getMessage(); + final Throwable exception = this.getException(); if (message instanceof Message) { logger.log(marker, FQCN, level, (Message) message, exception); } else if (message instanceof String) { Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/SetLoggerTag.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/SetLoggerTag.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/SetLoggerTag.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/SetLoggerTag.java Thu May 9 15:32:42 2013 @@ -59,30 +59,30 @@ public class SetLoggerTag extends BodyTa } @Override - public void setPageContext(PageContext pageContext) { + public void setPageContext(final PageContext pageContext) { super.setPageContext(pageContext); this.loggerContext = Log4jTaglibLoggerContext.getInstance(pageContext.getServletContext()); } - public void setLogger(Object logger) { + public void setLogger(final Object logger) { this.logger = logger; } - public void setFactory(MessageFactory factory) { + public void setFactory(final MessageFactory factory) { this.factory = factory; } - public void setVar(String var) { + public void setVar(final String var) { this.var = var; } - public void setScope(String scope) { + public void setScope(final String scope) { this.scope = TagUtils.getScope(scope); } @Override public int doEndTag() throws JspException { - Log4jTaglibLogger logger = TagUtils.resolveLogger(this.loggerContext, this.logger, this.factory); + final Log4jTaglibLogger logger = TagUtils.resolveLogger(this.loggerContext, this.logger, this.factory); if (this.var != null) { this.pageContext.setAttribute(this.var, logger, this.scope); Modified: logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/TagUtils.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/TagUtils.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/TagUtils.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/main/java/org/apache/logging/log4j/taglib/TagUtils.java Thu May 9 15:32:42 2013 @@ -45,7 +45,7 @@ final class TagUtils { throw new RuntimeException("TagUtils cannot be instantiated."); } - static int getScope(String scope) { + static int getScope(final String scope) { if ("request".equalsIgnoreCase(scope)) { return PageContext.REQUEST_SCOPE; } @@ -58,7 +58,7 @@ final class TagUtils { return PageContext.PAGE_SCOPE; } - static Level resolveLevel(Object level) { + static Level resolveLevel(final Object level) { if (level instanceof Level) { return (Level) level; } @@ -80,7 +80,7 @@ final class TagUtils { logger.getClass().getName()); WARNED_FOR.add(logger); } - AbstractLogger original = (AbstractLogger) logger; + final AbstractLogger original = (AbstractLogger) logger; return getLogger(context, original.getName(), original.getMessageFactory()); } throw new JspException( @@ -92,24 +92,24 @@ final class TagUtils { throw new JspException("Logger must be of type String or org.apache.logging.log4j.Logger."); } - private static Log4jTaglibLogger getLogger(Log4jTaglibLoggerContext context, String name, MessageFactory factory) + private static Log4jTaglibLogger getLogger(final Log4jTaglibLoggerContext context, final String name, final MessageFactory factory) throws JspException { try { return context.getLogger(name, factory); - } catch (LoggingException e) { + } catch (final LoggingException e) { throw new JspException(e.getMessage(), e); } } - static void setDefaultLogger(PageContext pageContext, Log4jTaglibLogger logger) { + static void setDefaultLogger(final PageContext pageContext, final Log4jTaglibLogger logger) { pageContext.setAttribute(TagUtils.LOGGER_SCOPE_ATTRIBUTE, logger, PageContext.PAGE_SCOPE); } - static Log4jTaglibLogger getDefaultLogger(PageContext pageContext) { + static Log4jTaglibLogger getDefaultLogger(final PageContext pageContext) { return (Log4jTaglibLogger) pageContext.getAttribute(TagUtils.LOGGER_SCOPE_ATTRIBUTE, PageContext.PAGE_SCOPE); } - static boolean isEnabled(Log4jTaglibLogger logger, Level level, Marker marker) { + static boolean isEnabled(final Log4jTaglibLogger logger, final Level level, final Marker marker) { if (marker == null) { return logger.isEnabled(level); } Modified: logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/CatchingTagTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/CatchingTagTest.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/CatchingTagTest.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/CatchingTagTest.java Thu May 9 15:32:42 2013 @@ -59,7 +59,7 @@ public class CatchingTagTest { StatusLogger.getLogger().reset(); } - private Logger logger = LogManager.getLogger("LoggingMessageTagSupportTestLogger"); + private final Logger logger = LogManager.getLogger("LoggingMessageTagSupportTestLogger"); private CatchingTag tag; @Before Modified: logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/DumpTagTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/DumpTagTest.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/DumpTagTest.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/DumpTagTest.java Thu May 9 15:32:42 2013 @@ -47,7 +47,7 @@ public class DumpTagTest { this.writer = new OutputStreamWriter(this.output, UTF8); this.context = new MockPageContext() { - private MockJspWriter jspWriter = new MockJspWriter(writer); + private final MockJspWriter jspWriter = new MockJspWriter(writer); @Override public JspWriter getOut() { return this.jspWriter; @@ -60,11 +60,11 @@ public class DumpTagTest { @Test public void testDoEndTagDefaultPageScopeNoAttributes() throws Exception { - int returnValue = this.tag.doEndTag(); + final int returnValue = this.tag.doEndTag(); assertEquals("The return value is not correct.", Tag.EVAL_PAGE, returnValue); this.writer.flush(); - String output = new String(this.output.toByteArray(), UTF8); + final String output = new String(this.output.toByteArray(), UTF8); assertEquals("The output is not correct.", "
", output); } @@ -74,11 +74,11 @@ public class DumpTagTest { this.context.setAttribute("anotherAttribute02", "finalValue02", PageContext.PAGE_SCOPE); this.context.setAttribute("badAttribute03", "skippedValue03", PageContext.SESSION_SCOPE); - int returnValue = this.tag.doEndTag(); + final int returnValue = this.tag.doEndTag(); assertEquals("The return value is not correct.", Tag.EVAL_PAGE, returnValue); this.writer.flush(); - String output = new String(this.output.toByteArray(), UTF8); + final String output = new String(this.output.toByteArray(), UTF8); assertEquals("The output is not correct.", "
" + "
testAttribute01
testValue01
" + @@ -91,11 +91,11 @@ public class DumpTagTest { this.context.setAttribute("badAttribute01", "skippedValue01", PageContext.PAGE_SCOPE); this.tag.setScope("session"); - int returnValue = this.tag.doEndTag(); + final int returnValue = this.tag.doEndTag(); assertEquals("The return value is not correct.", Tag.EVAL_PAGE, returnValue); this.writer.flush(); - String output = new String(this.output.toByteArray(), UTF8); + final String output = new String(this.output.toByteArray(), UTF8); assertEquals("The output is not correct.", "
", output); } @@ -106,11 +106,11 @@ public class DumpTagTest { this.context.setAttribute("testAttribute02", "testValue02", PageContext.SESSION_SCOPE); this.tag.setScope("session"); - int returnValue = this.tag.doEndTag(); + final int returnValue = this.tag.doEndTag(); assertEquals("The return value is not correct.", Tag.EVAL_PAGE, returnValue); this.writer.flush(); - String output = new String(this.output.toByteArray(), UTF8); + final String output = new String(this.output.toByteArray(), UTF8); assertEquals("The output is not correct.", "
" + "
coolAttribute01
weirdValue01
" + Modified: logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/EntryTagTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/EntryTagTest.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/EntryTagTest.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/EntryTagTest.java Thu May 9 15:32:42 2013 @@ -58,7 +58,7 @@ public class EntryTagTest { StatusLogger.getLogger().reset(); } - private Logger logger = LogManager.getLogger("LoggingMessageTagSupportTestLogger"); + private final Logger logger = LogManager.getLogger("LoggingMessageTagSupportTestLogger"); private EntryTag tag; @Before Modified: logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/ExitTagTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/ExitTagTest.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/ExitTagTest.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/ExitTagTest.java Thu May 9 15:32:42 2013 @@ -58,7 +58,7 @@ public class ExitTagTest { StatusLogger.getLogger().reset(); } - private Logger logger = LogManager.getLogger("LoggingMessageTagSupportTestLogger"); + private final Logger logger = LogManager.getLogger("LoggingMessageTagSupportTestLogger"); private ExitTag tag; @Before Modified: logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/IfEnabledTagTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/IfEnabledTagTest.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/IfEnabledTagTest.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/IfEnabledTagTest.java Thu May 9 15:32:42 2013 @@ -54,7 +54,7 @@ public class IfEnabledTagTest { StatusLogger.getLogger().reset(); } - private Logger logger = LogManager.getLogger("IfEnabledTagTest"); + private final Logger logger = LogManager.getLogger("IfEnabledTagTest"); private IfEnabledTag tag; @Before Modified: logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupportTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupportTest.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupportTest.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggerAwareTagSupportTest.java Thu May 9 15:32:42 2013 @@ -48,23 +48,23 @@ public class LoggerAwareTagSupportTest { public void testGetLoggerWithGenericLogger() throws Exception { this.setUp(null); - Logger logger = LogManager.getLogger("testGetLoggerWithGenericLogger"); + final Logger logger = LogManager.getLogger("testGetLoggerWithGenericLogger"); this.tag.setLogger(logger); - Log4jTaglibLogger returned = this.tag.getLogger(); + final Log4jTaglibLogger returned = this.tag.getLogger(); assertNotNull("The first returned logger should not be null.", returned); assertNotSame("The first returned logger should not be the same as the set.", logger, returned); assertEquals("The name is not correct.", "testGetLoggerWithGenericLogger", returned.getName()); - Log4jTaglibLogger returned2 = this.tag.getLogger(); + final Log4jTaglibLogger returned2 = this.tag.getLogger(); assertNotNull("The second returned logger should not be null.", returned2); assertSame("The second returned logger should be the same as the first.", returned, returned2); this.tag.release(); - Log4jTaglibLogger returned3 = this.tag.getLogger(); + final Log4jTaglibLogger returned3 = this.tag.getLogger(); assertNotNull("The third returned logger should not be null.", returned3); assertNotSame("The third returned logger should not be the same as the first.", returned, returned3); @@ -74,8 +74,8 @@ public class LoggerAwareTagSupportTest { public void testGetLoggerWithTaglibLogger() throws Exception { this.setUp(null); - AbstractLogger wrapped = (AbstractLogger)LogManager.getLogger("testGetLoggerWithTaglibLogger"); - Log4jTaglibLogger logger = new Log4jTaglibLogger(wrapped, wrapped.getName(), wrapped.getMessageFactory()); + final AbstractLogger wrapped = (AbstractLogger)LogManager.getLogger("testGetLoggerWithTaglibLogger"); + final Log4jTaglibLogger logger = new Log4jTaglibLogger(wrapped, wrapped.getName(), wrapped.getMessageFactory()); this.tag.setLogger(logger); Log4jTaglibLogger returned = this.tag.getLogger(); @@ -95,12 +95,12 @@ public class LoggerAwareTagSupportTest { this.setUp(null); this.tag.setLogger("testGetLoggerWithStringLogger"); - Log4jTaglibLogger returned = this.tag.getLogger(); + final Log4jTaglibLogger returned = this.tag.getLogger(); assertNotNull("The first returned logger should not be null.", returned); assertEquals("The name is not correct.", "testGetLoggerWithStringLogger", returned.getName()); - Log4jTaglibLogger returned2 = this.tag.getLogger(); + final Log4jTaglibLogger returned2 = this.tag.getLogger(); assertNotNull("The second returned logger should not be null.", returned2); assertSame("The second returned logger should be the same as the first.", returned, returned2); @@ -108,20 +108,20 @@ public class LoggerAwareTagSupportTest { @Test public void testGetDefaultLogger01() throws Exception { - Object page = new Object() {}; + final Object page = new Object() {}; this.setUp(page); assertNull("The default logger should be null.", TagUtils.getDefaultLogger(this.context)); - Log4jTaglibLogger returned = this.tag.getLogger(); + final Log4jTaglibLogger returned = this.tag.getLogger(); assertNotNull("The first returned logger should not be null.", returned); assertEquals("The logger name is not correct.", page.getClass().getName(), returned.getName()); - Log4jTaglibLogger defaultLogger = TagUtils.getDefaultLogger(this.context); + final Log4jTaglibLogger defaultLogger = TagUtils.getDefaultLogger(this.context); assertNotNull("The default logger should not be null anymore.", defaultLogger); assertSame("The default logger should be the same as the returned logger.", returned, defaultLogger); - Log4jTaglibLogger returned2 = this.tag.getLogger(); + final Log4jTaglibLogger returned2 = this.tag.getLogger(); assertNotNull("The second returned logger should not be null.", returned2); assertSame("The second returned logger should be the same as the first.", returned, returned2); @@ -129,20 +129,20 @@ public class LoggerAwareTagSupportTest { @Test public void testGetDefaultLogger02() throws Exception { - Object page = new Object() {}; + final Object page = new Object() {}; this.setUp(page); assertNull("The default logger should be null.", TagUtils.getDefaultLogger(this.context)); - Log4jTaglibLogger returned = this.tag.getLogger(); + final Log4jTaglibLogger returned = this.tag.getLogger(); assertNotNull("The first returned logger should not be null.", returned); assertEquals("The logger name is not correct.", page.getClass().getName(), returned.getName()); - Log4jTaglibLogger defaultLogger = TagUtils.getDefaultLogger(this.context); + final Log4jTaglibLogger defaultLogger = TagUtils.getDefaultLogger(this.context); assertNotNull("The default logger should not be null anymore.", defaultLogger); assertSame("The default logger should be the same as the returned logger.", returned, defaultLogger); - Log4jTaglibLogger returned2 = this.tag.getLogger(); + final Log4jTaglibLogger returned2 = this.tag.getLogger(); assertNotNull("The second returned logger should not be null.", returned2); assertSame("The second returned logger should be the same as the first.", returned, returned2); Modified: logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupportTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupportTest.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupportTest.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupportTest.java Thu May 9 15:32:42 2013 @@ -60,7 +60,7 @@ public class LoggingMessageTagSupportTes StatusLogger.getLogger().reset(); } - private Logger logger = LogManager.getLogger("LoggingMessageTagSupportTestLogger"); + private final Logger logger = LogManager.getLogger("LoggingMessageTagSupportTestLogger"); private LoggingMessageTagSupport tag; private void setUp(final Level level) { @@ -96,7 +96,7 @@ public class LoggingMessageTagSupportTes public void testMessageObject() throws Exception { this.setUp(null); - Object message = new Object(); + final Object message = new Object(); this.tag.setMessage(message); assertSame("The message is not correct.", message, this.tag.getMessage()); @@ -106,7 +106,7 @@ public class LoggingMessageTagSupportTes public void testMessageBody() throws Exception { this.setUp(null); - MockBodyContent content = new MockBodyContent("This is the body content 01.", (Writer)null); + final MockBodyContent content = new MockBodyContent("This is the body content 01.", (Writer)null); this.tag.setBodyContent(content); assertEquals("The message is not correct.", "This is the body content 01.", this.tag.getMessage()); @@ -116,7 +116,7 @@ public class LoggingMessageTagSupportTes public void testMessageStringBodyIgnored() throws Exception { this.setUp(null); - MockBodyContent content = new MockBodyContent("This is more body content 02.", (Writer)null); + final MockBodyContent content = new MockBodyContent("This is more body content 02.", (Writer)null); this.tag.setBodyContent(content); this.tag.setMessage("This is another message 02."); @@ -315,7 +315,7 @@ public class LoggingMessageTagSupportTes private static class MyMessage { private final String internal; - public MyMessage(String internal) { + public MyMessage(final String internal) { this.internal = internal; } Modified: logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/SetLoggerTagTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/SetLoggerTagTest.java?rev=1480691&r1=1480690&r2=1480691&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/SetLoggerTagTest.java (original) +++ logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/SetLoggerTagTest.java Thu May 9 15:32:42 2013 @@ -52,11 +52,11 @@ public class SetLoggerTagTest { assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); assertNull("The default logger should still be null.", TagUtils.getDefaultLogger(this.context)); - Object attribute = this.context.getAttribute("helloWorld", PageContext.PAGE_SCOPE); + final Object attribute = this.context.getAttribute("helloWorld", PageContext.PAGE_SCOPE); assertNotNull("The attribute should not be null.", attribute); assertTrue("The attribute should be a Log4jTaglibLogger.", attribute instanceof Log4jTaglibLogger); - Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; + final Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; assertEquals("The logger name is not correct.", "testDoEndTagLoggerVarPageScope", logger.getName()); } @@ -70,11 +70,11 @@ public class SetLoggerTagTest { assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); assertNull("The default logger should still be null.", TagUtils.getDefaultLogger(this.context)); - Object attribute = this.context.getAttribute("goodbyeCruelWorld", PageContext.PAGE_SCOPE); + final Object attribute = this.context.getAttribute("goodbyeCruelWorld", PageContext.PAGE_SCOPE); assertNotNull("The attribute should not be null.", attribute); assertTrue("The attribute should be a Log4jTaglibLogger.", attribute instanceof Log4jTaglibLogger); - Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; + final Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; assertEquals("The logger name is not correct.", "testDoEndTagStringVarPageScope", logger.getName()); } @@ -82,7 +82,7 @@ public class SetLoggerTagTest { public void testDoEndTagStringFactoryVarPageScope() throws Exception { this.tag.setLogger("testDoEndTagStringFactoryVarPageScope"); - MessageFactory factory = new StringFormatterMessageFactory(); + final MessageFactory factory = new StringFormatterMessageFactory(); this.tag.setFactory(factory); this.tag.setVar("goodbyeCruelWorld"); @@ -91,11 +91,11 @@ public class SetLoggerTagTest { assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); assertNull("The default logger should still be null.", TagUtils.getDefaultLogger(this.context)); - Object attribute = this.context.getAttribute("goodbyeCruelWorld", PageContext.PAGE_SCOPE); + final Object attribute = this.context.getAttribute("goodbyeCruelWorld", PageContext.PAGE_SCOPE); assertNotNull("The attribute should not be null.", attribute); assertTrue("The attribute should be a Log4jTaglibLogger.", attribute instanceof Log4jTaglibLogger); - Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; + final Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; assertEquals("The logger name is not correct.", "testDoEndTagStringFactoryVarPageScope", logger.getName()); assertSame("The message factory is not correct.", factory, logger.getMessageFactory()); } @@ -111,11 +111,11 @@ public class SetLoggerTagTest { assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); assertNull("The default logger should still be null.", TagUtils.getDefaultLogger(this.context)); - Object attribute = this.context.getAttribute("helloWorld", PageContext.SESSION_SCOPE); + final Object attribute = this.context.getAttribute("helloWorld", PageContext.SESSION_SCOPE); assertNotNull("The attribute should not be null.", attribute); assertTrue("The attribute should be a Log4jTaglibLogger.", attribute instanceof Log4jTaglibLogger); - Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; + final Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; assertEquals("The logger name is not correct.", "testDoEndTagLoggerVarSessionScope", logger.getName()); } @@ -130,11 +130,11 @@ public class SetLoggerTagTest { assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); assertNull("The default logger should still be null.", TagUtils.getDefaultLogger(this.context)); - Object attribute = this.context.getAttribute("goodbyeCruelWorld", PageContext.REQUEST_SCOPE); + final Object attribute = this.context.getAttribute("goodbyeCruelWorld", PageContext.REQUEST_SCOPE); assertNotNull("The attribute should not be null.", attribute); assertTrue("The attribute should be a Log4jTaglibLogger.", attribute instanceof Log4jTaglibLogger); - Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; + final Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; assertEquals("The logger name is not correct.", "testDoEndTagStringVarRequestScope", logger.getName()); } @@ -142,7 +142,7 @@ public class SetLoggerTagTest { public void testDoEndTagStringFactoryVarApplicationScope() throws Exception { this.tag.setLogger("testDoEndTagStringFactoryVarApplicationScope"); - MessageFactory factory = new StringFormatterMessageFactory(); + final MessageFactory factory = new StringFormatterMessageFactory(); this.tag.setFactory(factory); this.tag.setVar("goodbyeCruelWorld"); @@ -152,11 +152,11 @@ public class SetLoggerTagTest { assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); assertNull("The default logger should still be null.", TagUtils.getDefaultLogger(this.context)); - Object attribute = this.context.getAttribute("goodbyeCruelWorld", PageContext.APPLICATION_SCOPE); + final Object attribute = this.context.getAttribute("goodbyeCruelWorld", PageContext.APPLICATION_SCOPE); assertNotNull("The attribute should not be null.", attribute); assertTrue("The attribute should be a Log4jTaglibLogger.", attribute instanceof Log4jTaglibLogger); - Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; + final Log4jTaglibLogger logger = (Log4jTaglibLogger)attribute; assertEquals("The logger name is not correct.", "testDoEndTagStringFactoryVarApplicationScope", logger.getName()); assertSame("The message factory is not correct.", factory, logger.getMessageFactory()); @@ -169,7 +169,7 @@ public class SetLoggerTagTest { assertNull("The default logger should be null.", TagUtils.getDefaultLogger(this.context)); assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); - Log4jTaglibLogger logger = TagUtils.getDefaultLogger(this.context); + final Log4jTaglibLogger logger = TagUtils.getDefaultLogger(this.context); assertNotNull("The default logger should not be null anymore.", logger); assertEquals("The logger name is not correct.", "testDoEndTagLoggerDefault", logger.getName()); } @@ -181,7 +181,7 @@ public class SetLoggerTagTest { assertNull("The default logger should be null.", TagUtils.getDefaultLogger(this.context)); assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); - Log4jTaglibLogger logger = TagUtils.getDefaultLogger(this.context); + final Log4jTaglibLogger logger = TagUtils.getDefaultLogger(this.context); assertNotNull("The default logger should not be null anymore.", logger); assertEquals("The logger name is not correct.", "testDoEndTagStringDefault", logger.getName()); } @@ -190,14 +190,14 @@ public class SetLoggerTagTest { public void testDoEndTagStringFactoryDefault() throws Exception { this.tag.setLogger("testDoEndTagStringFactoryDefault"); - MessageFactory factory = new StringFormatterMessageFactory(); + final MessageFactory factory = new StringFormatterMessageFactory(); this.tag.setFactory(factory); assertNull("The default logger should be null.", TagUtils.getDefaultLogger(this.context)); assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag()); - Log4jTaglibLogger logger = TagUtils.getDefaultLogger(this.context); + final Log4jTaglibLogger logger = TagUtils.getDefaultLogger(this.context); assertNotNull("The default logger should not be null anymore.", logger); assertEquals("The logger name is not correct.", "testDoEndTagStringFactoryDefault", logger.getName()); assertSame("The message factory is not correct.", factory, logger.getMessageFactory());