geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1075226 - in /geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console: artifact/ keystores/ logmanager/ webmanager/
Date Mon, 28 Feb 2011 07:27:56 GMT
Author: xuhaihong
Date: Mon Feb 28 07:27:56 2011
New Revision: 1075226

URL: http://svn.apache.org/viewvc?rev=1075226&view=rev
Log:
a. Use valueOf instead of new for primitive wrapper class
b. Fix a call to equals() comparing different types

Modified:
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/artifact/ArtifactViewPortlet.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/keystores/CertificateDetailsHandler.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java
    geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/WebManagerPortlet.java

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/artifact/ArtifactViewPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/artifact/ArtifactViewPortlet.java?rev=1075226&r1=1075225&r2=1075226&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/artifact/ArtifactViewPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/artifact/ArtifactViewPortlet.java
Mon Feb 28 07:27:56 2011
@@ -58,7 +58,7 @@ public class ArtifactViewPortlet extends
     private PortletRequestDispatcher listView;
     private PortletRequestDispatcher editView;
     private ExplicitDefaultArtifactResolver instance;
-    
+
     public void init(PortletConfig portletConfig) throws PortletException {
         super.init(portletConfig);
         kernel = KernelRegistry.getSingleKernel();
@@ -74,30 +74,30 @@ public class ArtifactViewPortlet extends
         listView = portletConfig.getPortletContext().getRequestDispatcher(LIST_VIEW);
         editView = portletConfig.getPortletContext().getRequestDispatcher(EDIT_VIEW);
     }
-    
+
     public void destroy() {
         listView = null;
         editView = null;
         super.destroy();
     }
-    
+
     public void processAction(ActionRequest actionRequest,
             ActionResponse actionResponse) throws PortletException, IOException {
         String mode = actionRequest.getParameter(MODE_KEY);
         if (mode == null) {
             mode = "";
         }
-        actionResponse.setRenderParameter(MODE_KEY, mode);  
+        actionResponse.setRenderParameter(MODE_KEY, mode);
         String name = actionRequest.getParameter("name");
         if (name != null) {
-            actionResponse.setRenderParameter("name", name); 
+            actionResponse.setRenderParameter("name", name);
         }
         String aliases = actionRequest.getParameter("aliases");
         if (aliases != null) {
             actionResponse.setRenderParameter("aliases", aliases);
         }
     }
-    
+
     protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException, PortletException {
         if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
             return;
@@ -127,7 +127,7 @@ public class ArtifactViewPortlet extends
             log.error("Unable to render portlet", e);
         }
     }
-    
+
     private void renderList(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException, PortletException {
         populateList(renderRequest);
         listView.include(renderRequest, renderResponse);
@@ -144,13 +144,13 @@ public class ArtifactViewPortlet extends
         Collections.sort(list);
         renderRequest.setAttribute("AliasesDatas", list);
     }
-    
-    private void renderEdit(RenderRequest renderRequest, RenderResponse renderResponse, AliasesData
data) throws IOException, PortletException {      
+
+    private void renderEdit(RenderRequest renderRequest, RenderResponse renderResponse, AliasesData
data) throws IOException, PortletException {
         renderRequest.setAttribute("AliasesData", data);
         editView.include(renderRequest, renderResponse);
     }
-    
-    private void renderRemove(RenderRequest renderRequest, RenderResponse renderResponse,
AliasesData data) throws IOException, PortletException {      
+
+    private void renderRemove(RenderRequest renderRequest, RenderResponse renderResponse,
AliasesData data) throws IOException, PortletException {
         Properties set = new Properties();
         if (data.name != null && data.aliases != null) {
             set.put(data.name, data.aliases);
@@ -159,7 +159,7 @@ public class ArtifactViewPortlet extends
         populateList(renderRequest);
         listView.include(renderRequest, renderResponse);
     }
-    
+
     private void renderEditing(RenderRequest renderRequest, RenderResponse renderResponse,
AliasesData data) throws IOException, PortletException {
         Properties set = new Properties();
         if (data.name != null && data.aliases != null) {
@@ -176,23 +176,23 @@ public class ArtifactViewPortlet extends
         private String aliases;
 
         public AliasesData() {
-            
+
         }
-        
+
         public void load(String name, String aliases) {
             this.name = name;
             this.aliases = aliases;
         }
-        
+
         public AliasesData(String name, String aliases) {
             this.name = name;
             this.aliases = aliases;
         }
-        
+
         public String getName() {
             return name;
         }
-        
+
         public String getAliases() {
             return aliases;
         }

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/keystores/CertificateDetailsHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/keystores/CertificateDetailsHandler.java?rev=1075226&r1=1075225&r2=1075226&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/keystores/CertificateDetailsHandler.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/keystores/CertificateDetailsHandler.java
Mon Feb 28 07:27:56 2011
@@ -71,7 +71,7 @@ public class CertificateDetailsHandler e
         request.setAttribute("id", id);
         request.setAttribute("alias", alias);
         request.setAttribute("type", type);
-        request.setAttribute("keyLocked", new Boolean(keyLocked));
+        request.setAttribute("keyLocked", Boolean.valueOf(keyLocked));
         // TODO: Handle certificate chain
         request.setAttribute("certs", new Certificate[] {cert});
     }

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java?rev=1075226&r1=1075225&r2=1075226&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/LogViewerPortlet.java
Mon Feb 28 07:27:56 2011
@@ -52,12 +52,12 @@ public class LogViewerPortlet extends Ba
 
     @Override
     public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException, IOException {
-        
+
         //Add all the parameters to the actionResponse Attributes so we can get the back
         actionResponse.setRenderParameters(actionRequest.getParameterMap());
-     
+
     }
-    
+
     protected void doView(RenderRequest renderRequest,
             RenderResponse renderRespose) throws PortletException, IOException {
         if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
@@ -72,12 +72,12 @@ public class LogViewerPortlet extends Ba
             files[i] = new LogFile(logFiles[i]);
         }
         Criteria criteria = (Criteria) renderRequest.getPortletSession(true).getAttribute(CRITERIA_KEY,
PortletSession.PORTLET_SCOPE);
-        
+
         if(criteria != null) {
             // Check if criteria.logFile is in the logFileNames of current logging configuration
             boolean found = false;
             for(String logFile: logFiles) {
-                if(criteria.logFile.equals(new File(logFile))) {
+                if(criteria.logFile.equals(logFile)) {
                     found = true;
                     break;
                 }
@@ -103,7 +103,7 @@ public class LogViewerPortlet extends Ba
             if(logFile == null || logFile.equals("")) {
                 logFile = logFiles[0];
             }
-            
+
             criteria.level = logLevel == null || logLevel.equals("") ? criteria.level : logLevel;
             try{
                 criteria.max = maxRows == null || maxRows.equals("") ? criteria.max : Integer.parseInt(maxRows);
@@ -122,7 +122,7 @@ public class LogViewerPortlet extends Ba
                 }
             criteria.logFile = logFile;
             criteria.stackTraces = stackTraces != null && !stackTraces.equals("");
-            
+
             criteria.text = searchString == null || searchString.equals("") ? null : searchString;
             renderRequest.getPortletSession(true).setAttribute(CRITERIA_KEY, criteria, PortletSession.PORTLET_SCOPE);
         }

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java?rev=1075226&r1=1075225&r2=1075226&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/logmanager/WebAccessLogViewerPortlet.java
Mon Feb 28 07:27:56 2011
@@ -71,14 +71,14 @@ public class WebAccessLogViewerPortlet e
         }
 
         WebManager[] managers = PortletManager.getCurrentServer(renderRequest).getWebManagers();
-        
+
         Criteria criteria = (Criteria) renderRequest.getPortletSession(true).getAttribute(CRITERIA_KEY,
PortletSession.PORTLET_SCOPE);
-        
-        
+
+
         //todo: new
         Map products = new LinkedHashMap();
         String chosenContainer = null;;
-//      Temporarily disable container selection.  
+//      Temporarily disable container selection.
 //      We don't current enable this in the portlet anyway and at the moment it is just unnecessary
data traveling back and forth.
 //      chosenContainer = renderRequest.getParameter("selectedContainer");
 //      if(chosenContainer != null) { // Carry on to render the results with the right selection
@@ -113,7 +113,7 @@ public class WebAccessLogViewerPortlet e
         } else {
             log.error("No web managers found!");
         }
-//      Temporarily disable container and log parameters.  
+//      Temporarily disable container and log parameters.
 //      We don't current enable this in the portlet anyway and at the moment it is just unnecessary
data traveling back and forth.
 //      renderRequest.setAttribute("webContainers", products);
         String[] logNames = chosenLog.getLogNames();
@@ -144,7 +144,7 @@ public class WebAccessLogViewerPortlet e
         if (criteria == null || (action != null && !"refresh".equals(action))) {
             if(criteria == null)
                 criteria = new Criteria();
-            
+
             String fromDate = renderRequest.getParameter("fromDate");
             String toDate = renderRequest.getParameter("toDate");
             String requestHost = renderRequest.getParameter("requestHost");
@@ -159,7 +159,7 @@ public class WebAccessLogViewerPortlet e
             //ignore
             }
             String ignoreDates = renderRequest.getParameter("ignoreDates");
-            
+
             criteria.fromDate = fromDate == null || fromDate.equals("") ? null : fromDate;
             criteria.toDate = toDate == null || toDate.equals("") ? null : toDate;
             criteria.requestHost = requestHost == null || requestHost.equals("") ? null :
requestHost;
@@ -168,7 +168,7 @@ public class WebAccessLogViewerPortlet e
             criteria.requestedURI = uri == null || uri.equals("") ? null : uri;
             criteria.startResult = result == null || result.equals("") ? null : result;
             criteria.maxResult = max;
-            criteria.ignoreDates = ignoreDates != null && !ignoreDates.equals("");
 
+            criteria.ignoreDates = ignoreDates != null && !ignoreDates.equals("");
         }
         String fromDateStr = criteria.fromDate;
         String toDateStr = criteria.toDate;
@@ -195,7 +195,7 @@ public class WebAccessLogViewerPortlet e
             renderRequest.setAttribute("logLength", new Integer(matchingItems.getLineCount()));
             renderRequest.setAttribute("maxResult", criteria.maxResult);
             renderRequest.setAttribute("ignoreDates", Boolean.valueOf(criteria.ignoreDates));
-            
+
         } else {
             // Get other search criteria
             String requestHost = criteria.requestHost;
@@ -210,7 +210,7 @@ public class WebAccessLogViewerPortlet e
             }catch(NumberFormatException e){
                 //ignore
             }
-            
+
             boolean ignoreDates = criteria.ignoreDates;
             if (ignoreDates) {
                 WebAccessLog.SearchResults matchingItems = chosenLog.getMatchingItems(logToSearch,
@@ -265,7 +265,7 @@ public class WebAccessLogViewerPortlet e
                 renderRequest.setAttribute("logs", matchingItems.getResults());
                 renderRequest.setAttribute("logLength", new Integer(matchingItems.getLineCount()));
             }
-            renderRequest.setAttribute("ignoreDates", new Boolean(ignoreDates));
+            renderRequest.setAttribute("ignoreDates", Boolean.valueOf(ignoreDates));
             renderRequest.setAttribute("requestHost", requestHost);
             renderRequest.setAttribute("authUser", authUser);
             renderRequest.setAttribute("requestMethod", requestMethod);
@@ -289,20 +289,20 @@ public class WebAccessLogViewerPortlet e
     public void processAction(ActionRequest actionRequest,
             ActionResponse actionResponse) throws PortletException, IOException {
         String[] paramNames = {"action",
-                               "fromDate", 
-                               "toDate", 
-                               "ignoreDates", 
-                               "requestHost", 
-                               "authUser", 
-                               "requestMethod", 
-                               "requestedURI", 
-                               "startResult", 
+                               "fromDate",
+                               "toDate",
+                               "ignoreDates",
+                               "requestHost",
+                               "authUser",
+                               "requestMethod",
+                               "requestedURI",
+                               "startResult",
                                "maxResult"};
         // copy all action parameters to render parameters
         for(int i = 0; i < paramNames.length; i++) {
             if(actionRequest.getParameter(paramNames[i]) != null) {
                 actionResponse.setRenderParameter(
-                        paramNames[i], 
+                        paramNames[i],
                         actionRequest.getParameter(paramNames[i]));
             }
         }

Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/WebManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/WebManagerPortlet.java?rev=1075226&r1=1075225&r2=1075226&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/WebManagerPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/WebManagerPortlet.java
Mon Feb 28 07:27:56 2011
@@ -137,7 +137,7 @@ public class WebManagerPortlet extends B
                             renderRequest.setAttribute("activeRequestCountCurrent", new Long(webStats.getActiveRequestCount().getCurrent()));
                             renderRequest.setAttribute("activeRequestCountLow", new Long(webStats.getActiveRequestCount().getLowWaterMark()));
                             renderRequest.setAttribute("activeRequestCountHigh", new Long(webStats.getActiveRequestCount().getHighWaterMark()));
-                            
+
                             Long count = new Long(webStats.getRequestDuration().getCount());
                             Long totalTime = new Long(webStats.getRequestDuration().getTotalTime());
                             renderRequest.setAttribute("totalRequestCount", count);
@@ -145,7 +145,7 @@ public class WebManagerPortlet extends B
                             renderRequest.setAttribute("requestDurationMaxTime", new Long(webStats.getRequestDuration().getMaxTime()));
                             renderRequest.setAttribute("requestDurationTotalTime", totalTime);
                             // renderRequest.setAttribute("requestDurationAvg", new Long(webStats.getRequestDurationAvg().getCount()));
-                            Long avg = count == 0 ? 0: new Long(totalTime/count);
+                            long avg = count == 0 ? 0 : totalTime / count;
                             renderRequest.setAttribute("requestDurationAvg", avg);
                             renderRequest.setAttribute("response1xx", new Long(webStats.getResponses1xx().getCount()));
                             renderRequest.setAttribute("response2xx", new Long(webStats.getResponses2xx().getCount()));



Mime
View raw message