roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1585373 - in /roller/trunk/app/src/main/java/org/apache/roller/weblogger: business/ planet/ui/ ui/rendering/model/ ui/rendering/pagers/ ui/rendering/plugins/comments/ ui/struts2/core/ ui/struts2/editor/ util/ webservices/atomprotocol/
Date Mon, 07 Apr 2014 02:22:05 GMT
Author: gmazza
Date: Mon Apr  7 02:22:05 2014
New Revision: 1585373

URL: http://svn.apache.org/r1585373
Log:
Fixed Sonar complaints about hidden fields & few more items.

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/FileContentManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsFeedModel.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsModel.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/LinkbackExtractor.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/FileContentManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/FileContentManagerImpl.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/FileContentManagerImpl.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/FileContentManagerImpl.java
Mon Apr  7 02:22:05 2014
@@ -166,8 +166,8 @@ public class FileContentManagerImpl impl
         long maxDirBytes = (long)(RollerConstants.ONE_MB_IN_BYTES * maxDirSize.doubleValue());
         
         try {
-            File storageDir = this.getRealFile(weblog, null);
-            long weblogDirSize = this.getDirSize(storageDir, true);
+            File storageDirectory = this.getRealFile(weblog, null);
+            long weblogDirSize = this.getDirSize(storageDirectory, true);
             
             return weblogDirSize > maxDirBytes;
         } catch (Exception ex) {
@@ -215,8 +215,8 @@ public class FileContentManagerImpl impl
                 WebloggerRuntimeConfig.getProperty("uploads.dir.maxsize"));
         long maxDirBytes = (long)(RollerConstants.ONE_MB_IN_BYTES * maxDirMB.doubleValue());
         try {
-            File storageDir = this.getRealFile(weblog, null);
-            long userDirSize = getDirSize(storageDir, true);
+            File storageDirectory = this.getRealFile(weblog, null);
+            long userDirSize = getDirSize(storageDirectory, true);
             if (userDirSize + size > maxDirBytes) {
                 messages.addError("error.upload.dirmax", maxDirMB.toString());
                 return false;

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java
Mon Apr  7 02:22:05 2014
@@ -97,21 +97,21 @@ public class PlanetGroups extends Planet
         
         if (!hasActionErrors()) {
             try {
-                PlanetGroup group = getGroup();
-                if(group == null) {
+                PlanetGroup planetGroup = getGroup();
+                if(planetGroup == null) {
                     log.debug("Adding New Group");
-                    group = new PlanetGroup();
-                    group.setPlanet(getPlanet());
+                    planetGroup = new PlanetGroup();
+                    planetGroup.setPlanet(getPlanet());
                 } else {
                     log.debug("Updating Existing Group");
                 }
 
                 // copy in submitted data
-                getBean().copyTo(group);
+                getBean().copyTo(planetGroup);
 
                 // save and flush
                 PlanetManager pmgr = WebloggerFactory.getWeblogger().getPlanetManager();
-                pmgr.saveGroup(group);
+                pmgr.saveGroup(planetGroup);
                 WebloggerFactory.getWeblogger().flush();
 
                 addMessage("planetGroups.success.saved");
@@ -174,11 +174,11 @@ public class PlanetGroups extends Planet
     public List<PlanetGroup> getGroups() {
         List<PlanetGroup> displayGroups = new ArrayList<PlanetGroup>();
         
-        for (PlanetGroup group : getPlanet().getGroups()) {
+        for (PlanetGroup planetGroup : getPlanet().getGroups()) {
             // The "all" group is considered a special group and cannot be
             // managed independently
-            if (!group.getHandle().equals("all")) {
-                displayGroups.add(group);
+            if (!planetGroup.getHandle().equals("all")) {
+                displayGroups.add(planetGroup);
             }
         }
         return displayGroups;

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsFeedModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsFeedModel.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsFeedModel.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsFeedModel.java
Mon Apr  7 02:22:05 2014
@@ -154,11 +154,11 @@ public class SearchResultsFeedModel impl
 		if (search.getResultsCount() > -1) {
 
 			TopFieldDocs docs = search.getResults();
-			ScoreDoc[] hits = docs.scoreDocs;
+			ScoreDoc[] hitsArr = docs.scoreDocs;
 			this.hits = search.getResultsCount();
 
 			// Convert the Hits into WeblogEntryData instances.
-			convertHitsToEntries(hits, search);
+			convertHitsToEntries(hitsArr, search);
 		}
 
 		// search completed, setup pager based on results
@@ -197,7 +197,7 @@ public class SearchResultsFeedModel impl
 		}
 
 		try {
-			TreeSet<String> categories = new TreeSet<String>();
+			TreeSet<String> categorySet = new TreeSet<String>();
 			Weblogger roller = WebloggerFactory.getWeblogger();
 			WeblogEntryManager weblogMgr = roller.getWeblogEntryManager();
 
@@ -215,7 +215,7 @@ public class SearchResultsFeedModel impl
 
 				if (!(websiteSpecificSearch && handle.equals(feedRequest.getWeblogHandle()))
                         && doc.getField(FieldConstants.CATEGORY) != null) {
-                    categories.add(doc.getField(FieldConstants.CATEGORY).stringValue());
+                    categorySet.add(doc.getField(FieldConstants.CATEGORY).stringValue());
 				}
 
 				// maybe null if search result returned inactive user
@@ -226,8 +226,8 @@ public class SearchResultsFeedModel impl
 				}
 			}
 
-			if (categories.size() > 0) {
-				this.categories = categories;
+			if (categorySet.size() > 0) {
+				this.categories = categorySet;
 			}
 		} catch (IOException e) {
 			throw new WebloggerException(e);

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsModel.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsModel.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/model/SearchResultsModel.java
Mon Apr  7 02:22:05 2014
@@ -137,11 +137,11 @@ public class SearchResultsModel extends 
 		} else {
 
 			TopFieldDocs docs = search.getResults();
-			ScoreDoc[] hits = docs.scoreDocs;
+			ScoreDoc[] hitsArr = docs.scoreDocs;
 			this.hits = search.getResultsCount();
 
 			// Convert the Hits into WeblogEntryData instances.
-			convertHitsToEntries(hits, search);
+			convertHitsToEntries(hitsArr, search);
 
 		}
 
@@ -193,7 +193,7 @@ public class SearchResultsModel extends 
 		}
 
 		try {
-			TreeSet<String> categories = new TreeSet<String>();
+			TreeSet<String> categorySet = new TreeSet<String>();
 			Weblogger roller = WebloggerFactory.getWeblogger();
 			WeblogEntryManager weblogMgr = roller.getWeblogEntryManager();
 
@@ -211,7 +211,7 @@ public class SearchResultsModel extends 
 
                 if (!(websiteSpecificSearch && handle.equals(searchRequest.getWeblogHandle()))
                         && doc.getField(FieldConstants.CATEGORY) != null) {
-                    categories.add(doc.getField(FieldConstants.CATEGORY).stringValue());
+                    categorySet.add(doc.getField(FieldConstants.CATEGORY).stringValue());
                 }
 
 				// maybe null if search result returned inactive user
@@ -223,8 +223,8 @@ public class SearchResultsModel extends 
 				}
 			}
 
-			if (categories.size() > 0) {
-				this.categories = categories;
+			if (categorySet.size() > 0) {
+				this.categories = categorySet;
 			}
 		} catch (IOException e) {
 			throw new WebloggerException(e);

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/CommentsPager.java
Mon Apr  7 02:22:05 2014
@@ -102,11 +102,11 @@ public class CommentsPager extends Abstr
                 csc.setOffset(offset);
                 csc.setMaxResults(length + 1);
 
-                List<WeblogEntryComment> comments = wmgr.getComments(csc);
+                List<WeblogEntryComment> commentsList = wmgr.getComments(csc);
                 
                 // wrap the results
                 int count = 0;
-                for (WeblogEntryComment comment : comments) {
+                for (WeblogEntryComment comment : commentsList) {
                     if (count++ < length) {
                         results.add(WeblogEntryCommentWrapper.wrap(comment, urlStrategy));
                     } else {

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/pagers/PlanetEntriesPager.java
Mon Apr  7 02:22:05 2014
@@ -92,21 +92,21 @@ public class PlanetEntriesPager extends 
                 PlanetManager planetManager = WebloggerFactory.getWeblogger().getPlanetManager();
                 Planet planet = planetManager.getWeblogger("default");
                 
-                List<SubscriptionEntry> entries;
+                List<SubscriptionEntry> subEntries;
                 if (feedURL != null) {
                     Subscription sub = planetManager.getSubscription(feedURL);
-                    entries = planetManager.getEntries(sub, offset, length+1);
+                    subEntries = planetManager.getEntries(sub, offset, length+1);
                 } else if (groupHandle != null) {
                     PlanetGroup group = planetManager.getGroup(planet, groupHandle);
-                    entries = planetManager.getEntries(group, startDate, null, offset, length+1);
+                    subEntries = planetManager.getEntries(group, startDate, null, offset,
length + 1);
                 } else {
                     PlanetGroup group = planetManager.getGroup(planet, "all");
-                    entries = planetManager.getEntries(group, startDate, null, offset, length+1);
+                    subEntries = planetManager.getEntries(group, startDate, null, offset,
length + 1);
                 }
                 
                 // wrap 'em
                 int count = 0;
-                for (SubscriptionEntry entry : entries) {
+                for (SubscriptionEntry entry : subEntries) {
                     // TODO needs pojo wrapping from planet
                     if (count++ < length) { 
                         results.add(entry);

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
Mon Apr  7 02:22:05 2014
@@ -18,6 +18,7 @@
 
 package org.apache.roller.weblogger.ui.rendering.plugins.comments;
 
+import java.util.Random;
 import java.util.ResourceBundle;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
@@ -43,8 +44,9 @@ public class MathCommentAuthenticator im
         HttpSession session = request.getSession(true);
         if (session.getAttribute("mathAnswer") == null) {
             // starting a new test
-            int value1 = (int)(Math.random()*10.0);
-            int value2 = (int)(Math.random()*100.0);
+            Random ran = new Random();
+            int value1 = ran.nextInt(10);
+            int value2 = ran.nextInt(100);
             int sum = value1 + value2;
             session.setAttribute("mathValue1", value1);
             session.setAttribute("mathValue2", value2);

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/core/Register.java
Mon Apr  7 02:22:05 2014
@@ -135,10 +135,10 @@ public class Register extends UIAction i
             boolean usingSSO = WebloggerConfig.getBooleanProperty("users.sso.enabled");
             if (usingSSO) {
                 // See if user is already logged in via Spring Security
-                User fromSSO = CustomUserRegistry.getUserDetailsFromAuthentication(getServletRequest());
-                if (fromSSO != null) {
+                User fromSSOUser = CustomUserRegistry.getUserDetailsFromAuthentication(getServletRequest());
+                if (fromSSOUser != null) {
                     // Copy user details from Spring Security, including LDAP attributes
-                    getBean().copyFrom(fromSSO);
+                    getBean().copyFrom(fromSSOUser);
                     setFromSSO(true);
                 }
                 // See if user is already logged in via CMA
@@ -327,14 +327,14 @@ public class Register extends UIAction i
             String password = WebloggerConfig.getProperty("users.sso.passwords.defaultValue",
"<unknown>");
             
             // Preserve username and password, Spring Security case
-            User fromSSO = CustomUserRegistry.getUserDetailsFromAuthentication(getServletRequest());
-            if (fromSSO != null) {
+            User fromSSOUser = CustomUserRegistry.getUserDetailsFromAuthentication(getServletRequest());
+            if (fromSSOUser != null) {
                 if (storePassword) {
-                    password = fromSSO.getPassword();
+                    password = fromSSOUser.getPassword();
                 }
                 getBean().setPasswordText(password);
                 getBean().setPasswordConfirm(password);
-                getBean().setUserName(fromSSO.getUserName());
+                getBean().setUserName(fromSSOUser.getUserName());
                 setFromSSO(true);
             }
 

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
Mon Apr  7 02:22:05 2014
@@ -130,34 +130,34 @@ public final class EntryEdit extends Ent
                 WeblogEntryManager weblogMgr = WebloggerFactory.getWeblogger()
                         .getWeblogEntryManager();
 
-                WeblogEntry entry = getEntry();
+                WeblogEntry weblogEntry = getEntry();
 
                 // set updatetime & pubtime
-                entry.setUpdateTime(new Timestamp(new Date().getTime()));
-                entry.setPubTime(getBean().getPubTime(getLocale(),
+                weblogEntry.setUpdateTime(new Timestamp(new Date().getTime()));
+                weblogEntry.setPubTime(getBean().getPubTime(getLocale(),
                         getActionWeblog().getTimeZoneInstance()));
 
                 // copy data to pojo
-                getBean().copyTo(entry);
+                getBean().copyTo(weblogEntry);
 
                 // handle pubtime auto set
-                if (entry.isPublished()) {
-                    if (entry.getPubTime() == null) {
+                if (weblogEntry.isPublished()) {
+                    if (weblogEntry.getPubTime() == null) {
                         // no time specified, use current time
-                        entry.setPubTime(entry.getUpdateTime());
+                        weblogEntry.setPubTime(weblogEntry.getUpdateTime());
                     }
 
                     // if user does not have author perms then force PENDING
                     // status
                     if (!getActionWeblog().hasUserPermission(
                             getAuthenticatedUser(), WeblogPermission.POST)) {
-                        entry.setStatus(WeblogEntry.PENDING);
+                        weblogEntry.setStatus(WeblogEntry.PENDING);
                     }
 
                     // If the entry was published to future, set status as
                     // SCHEDULED we only consider an entry future published if
                     // it is scheduled more than 1 minute into the future
-                    if (entry.getPubTime().after(
+                    if (weblogEntry.getPubTime().after(
                             new Date(System.currentTimeMillis() + MINUTE_IN_MILLIS))) {
                         getBean().setStatus(WeblogEntry.SCHEDULED);
                     }
@@ -169,7 +169,7 @@ public final class EntryEdit extends Ent
                         Collections.singletonList(GlobalPermission.ADMIN));
                 if (WebloggerFactory.getWeblogger().getUserManager()
                         .checkPermission(adminPerm, getAuthenticatedUser())) {
-                    entry.setPinnedToMain(getBean().getPinnedToMain());
+                    weblogEntry.setPinnedToMain(getBean().getPinnedToMain());
                 }
 
                 if (!StringUtils.isEmpty(getBean().getEnclosureURL())) {
@@ -180,11 +180,11 @@ public final class EntryEdit extends Ent
                                 .lookupResource(getBean().getEnclosureURL());
 
                         // set mediacast attributes
-                        entry.putEntryAttribute("att_mediacast_url",
+                        weblogEntry.putEntryAttribute("att_mediacast_url",
                                 mediacast.getUrl());
-                        entry.putEntryAttribute("att_mediacast_type",
+                        weblogEntry.putEntryAttribute("att_mediacast_type",
                                 mediacast.getContentType());
-                        entry.putEntryAttribute("att_mediacast_length", ""
+                        weblogEntry.putEntryAttribute("att_mediacast_length", ""
                                 + mediacast.getLength());
 
                     } catch (MediacastException ex) {
@@ -195,11 +195,11 @@ public final class EntryEdit extends Ent
                         // if MediaCast string is empty, clean out MediaCast
                         // attributes
                         weblogMgr.removeWeblogEntryAttribute(
-                                "att_mediacast_url", entry);
+                                "att_mediacast_url", weblogEntry);
                         weblogMgr.removeWeblogEntryAttribute(
-                                "att_mediacast_type", entry);
+                                "att_mediacast_type", weblogEntry);
                         weblogMgr.removeWeblogEntryAttribute(
-                                "att_mediacast_length", entry);
+                                "att_mediacast_length", weblogEntry);
 
                     } catch (WebloggerException e) {
                         addMessage(getText("weblogEdit.mediaCastErrorRemoving"));
@@ -208,35 +208,35 @@ public final class EntryEdit extends Ent
 
                 if (log.isDebugEnabled()) {
                     log.debug("entry bean is ...\n" + getBean().toString());
-                    log.debug("final status = " + entry.getStatus());
-                    log.debug("updtime = " + entry.getUpdateTime());
-                    log.debug("pubtime = " + entry.getPubTime());
+                    log.debug("final status = " + weblogEntry.getStatus());
+                    log.debug("updtime = " + weblogEntry.getUpdateTime());
+                    log.debug("pubtime = " + weblogEntry.getPubTime());
                 }
 
                 log.debug("Saving entry");
-                weblogMgr.saveWeblogEntry(entry);
+                weblogMgr.saveWeblogEntry(weblogEntry);
                 WebloggerFactory.getWeblogger().flush();
 
                 // notify search of the new entry
-                if (entry.isPublished()) {
-                    reindexEntry(entry);
+                if (weblogEntry.isPublished()) {
+                    reindexEntry(weblogEntry);
                 } else {
-                    removeEntryIndex(entry);
+                    removeEntryIndex(weblogEntry);
                 }
 
                 // notify caches
-                CacheManager.invalidate(entry);
+                CacheManager.invalidate(weblogEntry);
 
                 // Queue applicable pings for this update.
-                if (entry.isPublished()) {
+                if (weblogEntry.isPublished()) {
                     WebloggerFactory.getWeblogger().getAutopingManager()
-                            .queueApplicableAutoPings(entry);
+                            .queueApplicableAutoPings(weblogEntry);
                 }
 
-                if (entry.isPending()) {
+                if (weblogEntry.isPending()) {
                     // implies that entry just changed to pending
                     if (MailUtil.isMailConfigured()) {
-                        MailUtil.sendPendingEntryNotice(entry);
+                        MailUtil.sendPendingEntryNotice(weblogEntry);
                     }
                     addMessage("weblogEdit.submittedForReview");
                 } else {

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
Mon Apr  7 02:22:05 2014
@@ -126,10 +126,10 @@ public class MediaFileImageChooser exten
         String fullPath = this.currentDirectory.getPath();
         if (fullPath.length() > 1) {
             String[] directoryNames = fullPath.substring(1).split("/");
-            String directoryPath = "";
+            String dirPath = "";
             for (String directoryName : directoryNames) {
-                directoryPath = directoryPath + "/" + directoryName;
-                directoryHierarchy.add(new KeyValueObject(directoryPath, directoryName));
+                dirPath = dirPath + "/" + directoryName;
+                directoryHierarchy.add(new KeyValueObject(dirPath, directoryName));
             }
         }
         return directoryHierarchy;

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java
Mon Apr  7 02:22:05 2014
@@ -105,17 +105,17 @@ public class Referrers extends UIAction 
      */
     public String remove() {
         
-        String[] removeIds = getRemoveIds();
-        if(removeIds != null) {
+        String[] idsToRemove = getRemoveIds();
+        if (idsToRemove != null) {
             RefererManager refmgr = WebloggerFactory.getWeblogger().getRefererManager();
             
             try {
-                WeblogReferrer referer = null;
-                for (int i=0; i < removeIds.length; i++) {
-                    referer = refmgr.getReferer(removeIds[i]);
+                WeblogReferrer referer;
+                for (String idToRemove : idsToRemove) {
+                    referer = refmgr.getReferer(idToRemove);
                     
                     // make sure referrer belongs to action weblog
-                    if(getActionWeblog().equals(referer.getWebsite())) {
+                    if (getActionWeblog().equals(referer.getWebsite())) {
                         refmgr.removeReferer(referer);
                     }
                 }

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
Mon Apr  7 02:22:05 2014
@@ -86,39 +86,39 @@ public class Templates extends UIAction 
 			setTemplates(pages);
 
 			// build list of action types that may be added
-			List<String> availableActions = new ArrayList<String>();
-			availableActions.add(WeblogTemplate.ACTION_CUSTOM);
+			List<String> actionsList = new ArrayList<String>();
+			actionsList.add(WeblogTemplate.ACTION_CUSTOM);
 
 			if (WeblogTheme.CUSTOM.equals(getActionWeblog().getEditorTheme())) {
 				// if the weblog is using a custom theme then determine which
 				// action templates are still available to be created
-				availableActions.add(WeblogTemplate.ACTION_PERMALINK);
-				availableActions.add(WeblogTemplate.ACTION_SEARCH);
-				availableActions.add(WeblogTemplate.ACTION_WEBLOG);
-				availableActions.add(WeblogTemplate.ACTION_TAGSINDEX);
+				actionsList.add(WeblogTemplate.ACTION_PERMALINK);
+				actionsList.add(WeblogTemplate.ACTION_SEARCH);
+				actionsList.add(WeblogTemplate.ACTION_WEBLOG);
+				actionsList.add(WeblogTemplate.ACTION_TAGSINDEX);
 
 				for (WeblogTemplate tmpPage : getTemplates()) {
 					if (!WeblogTemplate.ACTION_CUSTOM.equals(tmpPage
 							.getAction())) {
-						availableActions.remove(tmpPage.getAction());
+						actionsList.remove(tmpPage.getAction());
 					}
 				}
 			} else {
 				// Make sure we have an option for the default web page
-				availableActions.add(WeblogTemplate.ACTION_WEBLOG);
+				actionsList.add(WeblogTemplate.ACTION_WEBLOG);
 				if (StringUtils.isEmpty(getNewTmplAction())) {
 					setNewTmplAction(WeblogTemplate.ACTION_WEBLOG);
 				}
 				for (WeblogTemplate tmpPage : getTemplates()) {
 					if (WeblogTemplate.ACTION_WEBLOG
 							.equals(tmpPage.getAction())) {
-						availableActions.remove(WeblogTemplate.ACTION_WEBLOG);
+						actionsList.remove(WeblogTemplate.ACTION_WEBLOG);
 						setNewTmplAction(null);
 						break;
 					}
 				}
 			}
-			setAvailableActions(availableActions);
+			setAvailableActions(actionsList);
 
 		} catch (WebloggerException ex) {
 			log.error("Error getting templates for weblog - "

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java
Mon Apr  7 02:22:05 2014
@@ -83,9 +83,9 @@ public class WeblogConfig extends UIActi
             
             // set the Editor Page list
             UIPluginManager pmgr = RollerContext.getUIPluginManager();
-            List editorsList = pmgr.getWeblogEntryEditors();
-            if(editorsList != null) {
-                setEditorsList(editorsList);
+            List editorList = pmgr.getWeblogEntryEditors();
+            if(editorList != null) {
+                setEditorsList(editorList);
             }
             
             // set plugins list

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/LinkbackExtractor.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/LinkbackExtractor.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/LinkbackExtractor.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/LinkbackExtractor.java
Mon Apr  7 02:22:05 2014
@@ -100,7 +100,9 @@ public class LinkbackExtractor
             mRequestURLWWW = "http://www." + mRequestURL.substring(7);
         }
 
-        // Trick gets Swing's HTML parser
+        // Trick gets Swing's HTML parser by making its protected getParser() method public
+        // Ignore inaccurate Sonar complaint about useless overriding method:
+        //    http://jira.codehaus.org/browse/SONARJAVA-287
         Parser parser = (new HTMLEditorKit() {
             public Parser getParser() {
                 return super.getParser();
@@ -112,7 +114,7 @@ public class LinkbackExtractor
         InputStreamReader isr = new InputStreamReader(is);
         BufferedReader br = new BufferedReader(isr);
         try {
-            String line = null;
+            String line;
             while ((line = br.readLine()) != null) {
                 sb.append(line);
             }

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java?rev=1585373&r1=1585372&r2=1585373&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
Mon Apr  7 02:22:05 2014
@@ -96,14 +96,14 @@ public class RollerAtomHandler implement
     protected int maxEntries = 20;
     protected String atomURL = null;
     
-    protected static boolean throttle = true;
+    protected static final boolean throttle;
     
     protected static Log log =
             LogFactory.getFactory().getInstance(RollerAtomHandler.class);
     
     static {
         throttle = WebloggerConfig
-            .getBooleanProperty("webservices.atomprotocol.oneSecondThrottle");
+            .getBooleanProperty("webservices.atomprotocol.oneSecondThrottle", true);
     }
     
     //------------------------------------------------------------ construction
@@ -301,10 +301,7 @@ public class RollerAtomHandler implement
      */
     public boolean isAtomServiceURI(AtomRequest areq) {
         String[] pathInfo = StringUtils.split(areq.getPathInfo(),"/");
-        if (pathInfo.length == 0) {
-            return true;
-        }
-        return false;
+        return pathInfo.length == 0;
     }
     
     /**
@@ -383,14 +380,14 @@ public class RollerAtomHandler implement
     /**
      * Return true if user is allowed to view an entry.
      */
-    public static  boolean canView(User u, WeblogEntry entry) {
+    public static boolean canView(User u, WeblogEntry entry) {
         return canEdit(u, entry);
     }
     
     /**
      * Return true if user is allowed to view a website.
      */
-    public static  boolean canView(User u, Weblog website) {
+    public static boolean canView(User u, Weblog website) {
         return canEdit(u, website);
     }
     



Mime
View raw message