roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1520953 [1/2] - in /roller/trunk/app/src/main/java/org/apache/roller: planet/util/ util/ weblogger/ weblogger/business/ weblogger/business/jpa/ weblogger/business/startup/ weblogger/pojos/ weblogger/util/ weblogger/webservices/atomprotocol/
Date Mon, 09 Sep 2013 02:49:45 GMT
Author: gmazza
Date: Mon Sep  9 02:49:44 2013
New Revision: 1520953

URL: http://svn.apache.org/r1520953
Log:
Various Sonar complaints fixed.

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/planet/util/MailUtil.java
    roller/trunk/app/src/main/java/org/apache/roller/util/DateUtil.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/FileContentManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPARefererManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/Weblog.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/MailUtil.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/util/Utilities.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/planet/util/MailUtil.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/planet/util/MailUtil.java?rev=1520953&r1=1520952&r2=1520953&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/planet/util/MailUtil.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/planet/util/MailUtil.java Mon Sep  9 02:49:44 2013
@@ -28,289 +28,299 @@ import javax.mail.Transport;
 import javax.mail.Address;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
+
 import org.apache.commons.lang.StringUtils;
 
 public class MailUtil extends Object {
-   
-	private static Log mLogger = 
-		LogFactory.getFactory().getInstance(MailUtil.class);
+
+    private static Log mLogger =
+            LogFactory.getFactory().getInstance(MailUtil.class);
 
     // agangolli: Incorporated suggested changes from Ken Blackler.
 
     /**
      * This method is used to send a Message with a pre-defined
      * mime-type.
-     * 
-     * @param from e-mail address of sender
-     * @param to e-mail address(es) of recipients
-     * @param subject subject of e-mail
-     * @param content the body of the e-mail
+     *
+     * @param from     e-mail address of sender
+     * @param to       e-mail address(es) of recipients
+     * @param subject  subject of e-mail
+     * @param content  the body of the e-mail
      * @param mimeType type of message, i.e. text/plain or text/html
      * @throws MessagingException the exception to indicate failure
      */
-    public static void sendMessage
-    (
-    	Session session,
-        String from,
-        String[] to,
-        String[] cc,
-        String[] bcc,
-        String subject,
-        String content,
-        String mimeType
-    ) 
-    throws MessagingException
-    {
+    public static void sendMessage (
+            Session session,
+            String from,
+            String[] to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content,
+            String mimeType
+    )
+            throws MessagingException {
         MimeMessage message = new MimeMessage(session);
 
         // n.b. any default from address is expected to be determined by caller.
-        if (! StringUtils.isEmpty(from)) {
-			InternetAddress sentFrom = new InternetAddress(from);
-			message.setFrom(sentFrom);
-			if (mLogger.isDebugEnabled()) mLogger.debug("e-mail from: " + sentFrom);
-        }
-
-		if (to!=null)
-		{
-			InternetAddress[] sendTo = new InternetAddress[to.length];
-	
-			for (int i = 0; i < to.length; i++) 
-			{
-				sendTo[i] = new InternetAddress(to[i]);
-				if (mLogger.isDebugEnabled()) mLogger.debug("sending e-mail to: " + to[i]);
-			}
-			message.setRecipients(Message.RecipientType.TO, sendTo);
-		}
-
-		if (cc != null) 
-		{
-			InternetAddress[] copyTo = new InternetAddress[cc.length];
-
-			for (int i = 0; i < cc.length; i++) 
-			{
-				copyTo[i] = new InternetAddress(cc[i]);
-				if (mLogger.isDebugEnabled()) mLogger.debug("copying e-mail to: " + cc[i]);
-			}
-			message.setRecipients(Message.RecipientType.CC, copyTo);
-		}	        
-
-		if (bcc != null) 
-		{
-			InternetAddress[] copyTo = new InternetAddress[bcc.length];
-
-			for (int i = 0; i < bcc.length; i++) 
-			{
-				copyTo[i] = new InternetAddress(bcc[i]);
-				if (mLogger.isDebugEnabled()) mLogger.debug("blind copying e-mail to: " + bcc[i]);
-			}
-			message.setRecipients(Message.RecipientType.BCC, copyTo);
-		}	        
+        if (!StringUtils.isEmpty(from)) {
+            InternetAddress sentFrom = new InternetAddress(from);
+            message.setFrom(sentFrom);
+            if (mLogger.isDebugEnabled()) {
+                mLogger.debug("e-mail from: " + sentFrom);
+            }
+        }
+
+        if (to != null) {
+            InternetAddress[] sendTo = new InternetAddress[to.length];
+
+            for (int i = 0; i < to.length; i++) {
+                sendTo[i] = new InternetAddress(to[i]);
+                if (mLogger.isDebugEnabled()) {
+                    mLogger.debug("sending e-mail to: " + to[i]);
+                }
+            }
+            message.setRecipients(Message.RecipientType.TO, sendTo);
+        }
+
+        if (cc != null) {
+            InternetAddress[] copyTo = new InternetAddress[cc.length];
+
+            for (int i = 0; i < cc.length; i++) {
+                copyTo[i] = new InternetAddress(cc[i]);
+                if (mLogger.isDebugEnabled()) {
+                    mLogger.debug("copying e-mail to: " + cc[i]);
+                }
+            }
+            message.setRecipients(Message.RecipientType.CC, copyTo);
+        }
+
+        if (bcc != null) {
+            InternetAddress[] copyTo = new InternetAddress[bcc.length];
+
+            for (int i = 0; i < bcc.length; i++) {
+                copyTo[i] = new InternetAddress(bcc[i]);
+                if (mLogger.isDebugEnabled()) {
+                    mLogger.debug("blind copying e-mail to: " + bcc[i]);
+                }
+            }
+            message.setRecipients(Message.RecipientType.BCC, copyTo);
+        }
         message.setSubject((subject == null) ? "(no subject)" : subject, "UTF-8");
         message.setContent(content, mimeType);
-        message.setSentDate(new java.util.Date()); 
+        message.setSentDate(new java.util.Date());
 
-		// First collect all the addresses together.
+        // First collect all the addresses together.
         Address[] remainingAddresses = message.getAllRecipients();
         int nAddresses = remainingAddresses.length;
         boolean bFailedToSome = false;
-        
+
         SendFailedException sendex = new SendFailedException("Unable to send message to some recipients");
-        
-		// Try to send while there remain some potentially good addresses
-		do
-        {
-			// Avoid a loop if we are stuck
-			nAddresses = remainingAddresses.length;
-
-			try
-			{
-				// Send to the list of remaining addresses, ignoring the addresses attached to the message
-		        Transport.send(message,remainingAddresses);
-			}
-			catch(SendFailedException ex)
-			{
-				bFailedToSome=true;
-				sendex.setNextException(ex);
-				
-				// Extract the remaining potentially good addresses
-				remainingAddresses=ex.getValidUnsentAddresses();
-			}
-        } while (remainingAddresses!=null && remainingAddresses.length>0 && remainingAddresses.length!=nAddresses);
-        
-        if (bFailedToSome) throw sendex;
+
+        // Try to send while there remain some potentially good addresses
+        do {
+            // Avoid a loop if we are stuck
+            nAddresses = remainingAddresses.length;
+
+            try {
+                // Send to the list of remaining addresses, ignoring the addresses attached to the message
+                Transport.send(message, remainingAddresses);
+            } catch (SendFailedException ex) {
+                bFailedToSome = true;
+                sendex.setNextException(ex);
+
+                // Extract the remaining potentially good addresses
+                remainingAddresses = ex.getValidUnsentAddresses();
+            }
+        }
+        while (remainingAddresses != null && remainingAddresses.length > 0 && remainingAddresses.length != nAddresses);
+
+        if (bFailedToSome) {
+            throw sendex;
+        }
     }
 
     /**
      * This method is used to send a Text Message.
-     * 
-     * @param from e-mail address of sender
-     * @param to e-mail addresses of recipients
+     *
+     * @param from    e-mail address of sender
+     * @param to      e-mail addresses of recipients
      * @param subject subject of e-mail
      * @param content the body of the e-mail
      * @throws MessagingException the exception to indicate failure
      */
     public static void sendTextMessage
     (
-    	Session session,
-        String from,
-        String[] to,
-        String[] cc,
-        String[] bcc,
-        String subject,
-        String content
-    ) 
-    throws MessagingException
-    {
+            Session session,
+            String from,
+            String[] to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content
+    )
+            throws MessagingException {
         sendMessage(session, from, to, cc, bcc, subject, content, "text/plain; charset=utf-8");
     }
-    
-	/**
-	 * This method overrides the sendTextMessage to specify
-	 * one receiver and mulitple cc recipients.
-	 * 
-	 * @param from e-mail address of sender
-	 * @param to e-mail addresses of recipients
-	 * @param subject subject of e-mail
-	 * @param content the body of the e-mail
-	 * @throws MessagingException the exception to indicate failure
-	 */
-	public static void sendTextMessage
-	(
-		Session session,
-		String from,
-		String to,
-		String[] cc,
-        String[] bcc,
-		String subject,
-		String content
-	) 
-	throws MessagingException
-	{
+
+    /**
+     * This method overrides the sendTextMessage to specify
+     * one receiver and mulitple cc recipients.
+     *
+     * @param from    e-mail address of sender
+     * @param to      e-mail addresses of recipients
+     * @param subject subject of e-mail
+     * @param content the body of the e-mail
+     * @throws MessagingException the exception to indicate failure
+     */
+    public static void sendTextMessage
+    (
+            Session session,
+            String from,
+            String to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content
+    )
+            throws MessagingException {
         String[] recipient = null;
-		if (to!=null) recipient = new String[] {to};
+        if (to != null) {
+            recipient = new String[]{to};
+        }
+
+        sendMessage(session, from, recipient, cc, bcc, subject, content, "text/plain; charset=utf-8");
+    }
 
-		sendMessage(session, from, recipient, cc, bcc, subject, content, "text/plain; charset=utf-8");
-	}
-	
     /**
-	 * This method overrides the sendTextMessage to specify
-	 * only one receiver and cc recipients, rather than 
-	 * an array of recipients.
-     * 
-     * @param from e-mail address of sender
-     * @param to e-mail address of recipient
-     * @param cc e-mail address of cc recipient
+     * This method overrides the sendTextMessage to specify
+     * only one receiver and cc recipients, rather than
+     * an array of recipients.
+     *
+     * @param from    e-mail address of sender
+     * @param to      e-mail address of recipient
+     * @param cc      e-mail address of cc recipient
      * @param subject subject of e-mail
      * @param content the body of the e-mail
      * @throws MessagingException the exception to indicate failure
      */
     public static void sendTextMessage
     (
-    	Session session,
-        String from,
-        String to,
-        String cc,
-        String bcc,
-        String subject,
-        String content
-    ) 
-    throws MessagingException
-    {
+            Session session,
+            String from,
+            String to,
+            String cc,
+            String bcc,
+            String subject,
+            String content
+    )
+            throws MessagingException {
         String[] recipient = null;
         String[] copy = null;
         String[] bcopy = null;
 
-		if (to!=null) recipient = new String[] {to};
-		if (cc!=null) copy = new String[] {cc};
-		if (bcc!=null) bcopy = new String[] {bcc};
+        if (to != null) {
+            recipient = new String[]{to};
+        }
+        if (cc != null) {
+            copy = new String[]{cc};
+        }
+        if (bcc != null) {
+            bcopy = new String[]{bcc};
+        }
 
         sendMessage(session, from, recipient, copy, bcopy, subject, content, "text/plain; charset=utf-8");
     }
-    
+
     /**
      * This method is used to send a HTML Message
-     * 
-     * @param from e-mail address of sender
-     * @param to e-mail address(es) of recipients
+     *
+     * @param from    e-mail address of sender
+     * @param to      e-mail address(es) of recipients
      * @param subject subject of e-mail
      * @param content the body of the e-mail
      * @throws MessagingException the exception to indicate failure
      */
     public static void sendHTMLMessage
     (
-    	Session session,
-        String from,
-        String[] to,
-        String[] cc,
-        String[] bcc,
-        String subject,
-        String content
-    ) 
-    throws MessagingException
-    {
+            Session session,
+            String from,
+            String[] to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content
+    )
+            throws MessagingException {
         sendMessage(session, from, to, cc, bcc, subject, content, "text/html; charset=utf-8");
     }
-    
+
     /**
      * This method overrides the sendHTMLMessage to specify
      * only one sender, rather than an array of senders.
-     * 
-     * @param from e-mail address of sender
-     * @param to e-mail address of recipients
+     *
+     * @param from    e-mail address of sender
+     * @param to      e-mail address of recipients
      * @param subject subject of e-mail
      * @param content the body of the e-mail
      * @throws MessagingException the exception to indicate failure
      */
-	public static void sendHTMLMessage
+    public static void sendHTMLMessage
     (
-    	Session session,
-        String from,
-        String to,
-        String cc,
-        String bcc,
-        String subject,
-        String content
-    ) 
-    throws MessagingException
-    {
+            Session session,
+            String from,
+            String to,
+            String cc,
+            String bcc,
+            String subject,
+            String content
+    )
+            throws MessagingException {
         String[] recipient = null;
         String[] copy = null;
         String[] bcopy = null;
 
-		if (to!=null) recipient = new String[] {to};
-		if (cc!=null) copy = new String[] {cc};
-		if (bcc!=null) bcopy = new String[] {bcc};
+        if (to != null) {
+            recipient = new String[]{to};
+        }
+        if (cc != null) {
+            copy = new String[]{cc};
+        }
+        if (bcc != null) {
+            bcopy = new String[]{bcc};
+        }
 
         sendMessage(session, from, recipient, copy, bcopy, subject, content, "text/html; charset=utf-8");
     }
-    
-	/**
-	 * This method overrides the sendHTMLMessage to specify
-	 * one receiver and mulitple cc recipients.
-	 * 
-	 * @param from e-mail address of sender
-	 * @param to e-mail address of recipient
-	 * @param cc e-mail addresses of recipients
-	 * @param subject subject of e-mail
-	 * @param content the body of the e-mail
-	 * @throws MessagingException the exception to indicate failure
-	 */
-	public static void sendHTMLMessage
-	(
-		Session session,
-		String from,
-		String to,
-		String[] cc,
-		String[] bcc,
-		String subject,
-		String content
-	) 
-	throws MessagingException
-	{
+
+    /**
+     * This method overrides the sendHTMLMessage to specify
+     * one receiver and mulitple cc recipients.
+     *
+     * @param from    e-mail address of sender
+     * @param to      e-mail address of recipient
+     * @param cc      e-mail addresses of recipients
+     * @param subject subject of e-mail
+     * @param content the body of the e-mail
+     * @throws MessagingException the exception to indicate failure
+     */
+    public static void sendHTMLMessage
+    (
+            Session session,
+            String from,
+            String to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content
+    )
+            throws MessagingException {
         String[] recipient = null;
-		if (to!=null) recipient = new String[] {to};
+        if (to != null) {
+            recipient = new String[]{to};
+        }
 
-		sendMessage(session, from, recipient, cc, bcc, subject, content, "text/html; charset=utf-8");
-	}
+        sendMessage(session, from, recipient, cc, bcc, subject, content, "text/html; charset=utf-8");
+    }
 }
 

Modified: roller/trunk/app/src/main/java/org/apache/roller/util/DateUtil.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/util/DateUtil.java?rev=1520953&r1=1520952&r2=1520953&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/util/DateUtil.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/util/DateUtil.java Mon Sep  9 02:49:44 2013
@@ -35,22 +35,22 @@ import org.apache.commons.lang.StringUti
  */
 public abstract class DateUtil {
     
-    public static final long millisInDay = 86400000;
+    public static final long MILLIS_IN_DAY = 86400000;
     
     // a bunch of date formats
-    private static final String formatDefaultDate = "dd.MM.yyyy";
-    private static final String formatDefaultDateMinimal = "d.M.yy";
-    private static final String formatDefaultTimestamp = "yyyy-MM-dd HH:mm:ss.SSS";
+    private static final String FORMAT_DEFAULT_DATE = "dd.MM.yyyy";
+    private static final String FORMAT_DEFAULT_DATE_MINIMAL = "d.M.yy";
+    private static final String FORMAT_DEFAULT_TIMESTAMP = "yyyy-MM-dd HH:mm:ss.SSS";
     
-    private static final String formatFriendlyTimestamp = "dd.MM.yyyy HH:mm:ss";
+    private static final String FORMAT_FRIENDLY_TIMESTAMP = "dd.MM.yyyy HH:mm:ss";
     
-    private static final String format6chars = "yyyyMM";
-    private static final String format8chars = "yyyyMMdd";
+    private static final String FORMAT_6CHARS = "yyyyMM";
+    private static final String FORMAT_8CHARS = "yyyyMMdd";
     
-    private static final String formatIso8601 = "yyyy-MM-dd'T'HH:mm:ssZ";
-    private static final String formatIso8601Day = "yyyy-MM-dd";
+    private static final String FORMAT_ISO_8601 = "yyyy-MM-dd'T'HH:mm:ssZ";
+    private static final String FORMAT_ISO_8601_DAY = "yyyy-MM-dd";
     
-    private static final String formatRfc822 = "EEE, d MMM yyyy HH:mm:ss Z";
+    private static final String FORMAT_RFC_822 = "EEE, d MMM yyyy HH:mm:ss Z";
     
     
     /**
@@ -69,7 +69,9 @@ public abstract class DateUtil {
      * midnight (00m 00h 00s)
      */
     public static Date getStartOfDay(Date day, Calendar cal) {
-        if (day == null) day = new Date();
+        if (day == null) {
+            day = new Date();
+        }
         cal.setTime(day);
         cal.set(Calendar.HOUR_OF_DAY, cal.getMinimum(Calendar.HOUR_OF_DAY));
         cal.set(Calendar.MINUTE,      cal.getMinimum(Calendar.MINUTE));
@@ -90,7 +92,9 @@ public abstract class DateUtil {
     
     
     public static Date getEndOfDay(Date day,Calendar cal) {
-        if (day == null) day = new Date();
+        if (day == null) {
+            day = new Date();
+        }
         cal.setTime(day);
         cal.set(Calendar.HOUR_OF_DAY, cal.getMaximum(Calendar.HOUR_OF_DAY));
         cal.set(Calendar.MINUTE,      cal.getMaximum(Calendar.MINUTE));
@@ -114,7 +118,9 @@ public abstract class DateUtil {
      * If a null day is passed in, a new Date is created.
      */
     public static Date getStartOfHour(Date day, Calendar cal) {
-        if (day == null) day = new Date();
+        if (day == null) {
+            day = new Date();
+        }
         cal.setTime(day);
         cal.set(Calendar.MINUTE,      cal.getMinimum(Calendar.MINUTE));
         cal.set(Calendar.SECOND,      cal.getMinimum(Calendar.SECOND));
@@ -160,7 +166,9 @@ public abstract class DateUtil {
      * If a null day is passed in, a new Date is created.
      */
     public static Date getStartOfMinute(Date day, Calendar cal) {
-        if (day == null) day = new Date();
+        if (day == null) {
+            day = new Date();
+        }
         cal.setTime(day);
         cal.set(Calendar.SECOND,      cal.getMinimum(Calendar.SECOND));
         cal.set(Calendar.MILLISECOND, cal.getMinimum(Calendar.MILLISECOND));
@@ -200,7 +208,9 @@ public abstract class DateUtil {
     
     
     public static Date getStartOfMonth(Date day, Calendar cal) {
-        if (day == null) day = new Date();
+        if (day == null) {
+            day = new Date();
+        }
         cal.setTime(day);
         
         // set time to start of day
@@ -227,7 +237,9 @@ public abstract class DateUtil {
     
     
     public static Date getEndOfMonth(Date day,Calendar cal) {
-        if (day == null) day = new Date();
+        if (day == null) {
+            day = new Date();
+        }
         cal.setTime(day);
         
         // set time to end of day
@@ -252,10 +264,12 @@ public abstract class DateUtil {
     /**
      * Returns a Date set just to Noon, to the closest possible millisecond
      * of the day. If a null day is passed in, a new Date is created.
-     * nnoon (00m 12h 00s)
+     * noon (00m 12h 00s)
      */
     public static Date getNoonOfDay(Date day, Calendar cal) {
-        if (day == null) day = new Date();
+        if (day == null) {
+            day = new Date();
+        }
         cal.setTime(day);
         cal.set(Calendar.HOUR_OF_DAY, 12);
         cal.set(Calendar.MINUTE,      cal.getMinimum(Calendar.MINUTE));
@@ -357,46 +371,46 @@ public abstract class DateUtil {
      **/
     public static SimpleDateFormat friendlyDateFormat(boolean minimalFormat) {
         if (minimalFormat) {
-            return new SimpleDateFormat(formatDefaultDateMinimal);
+            return new SimpleDateFormat(FORMAT_DEFAULT_DATE_MINIMAL);
         }
         
-        return new SimpleDateFormat(formatDefaultDate);
+        return new SimpleDateFormat(FORMAT_DEFAULT_DATE);
     }
     
     
     // returns full timestamp format
     public static SimpleDateFormat defaultTimestampFormat() {
-        return new SimpleDateFormat(formatDefaultTimestamp);
+        return new SimpleDateFormat(FORMAT_DEFAULT_TIMESTAMP);
     }
     
     
     // convenience method returns long friendly timestamp format
     public static SimpleDateFormat friendlyTimestampFormat() {
-        return new SimpleDateFormat(formatFriendlyTimestamp);
+        return new SimpleDateFormat(FORMAT_FRIENDLY_TIMESTAMP);
     }
     
     
     // convenience method returns minimal date format
     public static SimpleDateFormat get8charDateFormat() {
-        return new SimpleDateFormat(format8chars);
+        return new SimpleDateFormat(FORMAT_8CHARS);
     }
     
     
     // convenience method returns minimal date format
     public static SimpleDateFormat get6charDateFormat() {
-        return new SimpleDateFormat(format6chars);
+        return new SimpleDateFormat(FORMAT_6CHARS);
     }
     
     
     // convenience method returns minimal date format
     public static SimpleDateFormat getIso8601DateFormat() {
-        return new SimpleDateFormat(formatIso8601);
+        return new SimpleDateFormat(FORMAT_ISO_8601);
     }
     
     
     // convenience method returns minimal date format
     public static SimpleDateFormat getIso8601DayDateFormat() {
-        return new SimpleDateFormat(formatIso8601Day);
+        return new SimpleDateFormat(FORMAT_ISO_8601_DAY);
     }
     
     
@@ -404,7 +418,7 @@ public abstract class DateUtil {
     public static SimpleDateFormat getRfc822DateFormat() {
         // http://www.w3.org/Protocols/rfc822/Overview.html#z28
         // Using Locale.US to fix ROL-725 and ROL-628
-        return new SimpleDateFormat(formatRfc822, Locale.US);
+        return new SimpleDateFormat(FORMAT_RFC_822, Locale.US);
     }
     
     
@@ -476,7 +490,9 @@ public abstract class DateUtil {
     
     // This is a hack, but it seems to work
     public static String formatIso8601(Date date) {
-        if (date == null) return "";
+        if (date == null) {
+            return "";
+        }
         
         // Add a colon 2 chars before the end of the string
         // to make it a valid ISO-8601 date.

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java?rev=1520953&r1=1520952&r2=1520953&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java Mon Sep  9 02:49:44 2013
@@ -124,8 +124,9 @@ public final class TestUtils {
         // query for the user to make sure we return the persisted object
         User user = mgr.getUserByUserName(userName);
 
-        if (user == null)
+        if (user == null) {
             throw new WebloggerException("error inserting new user");
+        }
 
         return user;
     }
@@ -176,8 +177,9 @@ public final class TestUtils {
         // query for the new weblog and return it
         Weblog weblog = mgr.getWeblogByHandle(handle);
 
-        if (weblog == null)
+        if (weblog == null) {
             throw new WebloggerException("error setting up weblog");
+        }
 
         return weblog;
     }
@@ -237,8 +239,9 @@ public final class TestUtils {
         // query for object
         WeblogCategory cat = mgr.getWeblogCategory(testCat.getId());
 
-        if (cat == null)
+        if (cat == null) {
             throw new WebloggerException("error setting up weblog category");
+        }
 
         return cat;
     }
@@ -291,8 +294,9 @@ public final class TestUtils {
         // query for object
         WeblogEntry entry = mgr.getWeblogEntry(testEntry.getId());
 
-        if (entry == null)
+        if (entry == null) {
             throw new WebloggerException("error setting up weblog entry");
+        }
 
         return entry;
     }
@@ -342,8 +346,9 @@ public final class TestUtils {
         // query for object
         WeblogEntryComment comment = mgr.getComment(testComment.getId());
 
-        if (comment == null)
+        if (comment == null) {
             throw new WebloggerException("error setting up comment");
+        }
 
         return comment;
     }
@@ -386,8 +391,9 @@ public final class TestUtils {
         // query for it
         PingTarget ping = pingMgr.getPingTarget(testPing.getId());
 
-        if (ping == null)
+        if (ping == null) {
             throw new WebloggerException("error setting up ping target");
+        }
 
         return ping;
     }
@@ -428,8 +434,9 @@ public final class TestUtils {
         // query for it
         autoPing = mgr.getAutoPing(autoPing.getId());
 
-        if (autoPing == null)
+        if (autoPing == null) {
             throw new WebloggerException("error setting up auto ping");
+        }
 
         return autoPing;
     }
@@ -472,8 +479,9 @@ public final class TestUtils {
         // query for it
         testCount = mgr.getHitCount(testCount.getId());
 
-        if (testCount == null)
+        if (testCount == null) {
             throw new WebloggerException("error setting up hit count");
+        }
 
         return testCount;
     }
@@ -503,11 +511,12 @@ public final class TestUtils {
 
         BookmarkManager mgr = WebloggerFactory.getWeblogger()
                 .getBookmarkManager();
-        WeblogBookmarkFolder root = mgr.getRootFolder(weblog);
 
-        WeblogBookmarkFolder folderParent = root;
+        WeblogBookmarkFolder folderParent;
         if (parent != null) {
             folderParent = parent;
+        } else {
+            folderParent = mgr.getRootFolder(weblog);
         }
         WeblogBookmarkFolder testFolder = new WeblogBookmarkFolder(
                 folderParent, name, null, weblog);
@@ -516,11 +525,8 @@ public final class TestUtils {
         // flush to db
         WebloggerFactory.getWeblogger().flush();
 
-        // query for object
-        WeblogBookmarkFolder cat = mgr.getFolder(testFolder.getId());
-
-        if (testFolder == null)
-            throw new WebloggerException("error setting up weblog folder");
+        // query to make sure we return the persisted object
+        testFolder = mgr.getFolder(testFolder.getId());
 
         return testFolder;
     }
@@ -594,8 +600,9 @@ public final class TestUtils {
         // query to make sure we return the persisted object
         Planet planet = mgr.getWeblogger(handle);
 
-        if (planet == null)
+        if (planet == null) {
             throw new WebloggerException("error inserting new planet");
+        }
 
         return planet;
     }
@@ -639,8 +646,9 @@ public final class TestUtils {
         // query to make sure we return the persisted object
         PlanetGroup group = mgr.getGroupById(testGroup.getId());
 
-        if (group == null)
+        if (group == null) {
             throw new WebloggerException("error inserting new group");
+        }
 
         return group;
     }
@@ -682,8 +690,9 @@ public final class TestUtils {
         // query to make sure we return the persisted object
         Subscription sub = mgr.getSubscriptionById(testSub.getId());
 
-        if (sub == null)
+        if (sub == null) {
             throw new WebloggerException("error inserting new subscription");
+        }
 
         return sub;
     }
@@ -731,8 +740,9 @@ public final class TestUtils {
         // query to make sure we return the persisted object
         SubscriptionEntry entry = mgr.getEntryById(testEntry.getId());
 
-        if (entry == null)
+        if (entry == null) {
             throw new WebloggerException("error inserting new entry");
+        }
 
         return entry;
     }

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=1520953&r1=1520952&r2=1520953&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 Sep  9 02:49:44 2013
@@ -44,25 +44,27 @@ public class FileContentManagerImpl impl
 	
     private static Log log = LogFactory.getLog(FileContentManagerImpl.class);
     
-    private String storage_dir = null;
+    private String storageDir = null;
 
     /**
      * Create file content manager.
      */
     public FileContentManagerImpl() {
         
-        String storagedir = WebloggerConfig.getProperty("mediafiles.storage.dir");
+        String inStorageDir = WebloggerConfig.getProperty("mediafiles.storage.dir");
         
         // Note: System property expansion is now handled by WebloggerConfig.
         
-        if (storagedir == null || storagedir.trim().length() < 1)
-            storagedir = System.getProperty("user.home")
-                + File.separator+"roller_data"+File.separator+"mediafiles";
+        if (inStorageDir == null || inStorageDir.trim().length() < 1) {
+            inStorageDir = System.getProperty("user.home")
+                    + File.separator+"roller_data"+File.separator+"mediafiles";
+        }
         
-        if (! storagedir.endsWith(File.separator))
-            storagedir += File.separator;
+        if (!inStorageDir.endsWith(File.separator)) {
+            inStorageDir += File.separator;
+        }
         
-        this.storage_dir = storagedir.replace('/',File.separatorChar);
+        this.storageDir = inStorageDir.replace('/',File.separatorChar);
     }
     
     public void initialize() {
@@ -72,7 +74,7 @@ public class FileContentManagerImpl impl
 
 
     /**
-     * @see org.apache.roller.weblogger.model.FileContentManager#getFileContent(weblog, java.lang.String)
+     * @see org.apache.roller.weblogger.business.FileContentManager#getFileContent(Weblog, String)
      */
     public FileContent getFileContent(Weblog weblog, String fileId) 
             throws FileNotFoundException, FilePathException {
@@ -91,8 +93,8 @@ public class FileContentManagerImpl impl
     }
     
     /**
-     * @see org.apache.roller.weblogger.model.FileContentManager#saveFileContent(weblog, java.lang.String, 
-     * java.lang.String, java.io.InputStream, boolean)
+     * @see org.apache.roller.weblogger.business.FileContentManager#saveFileContent(Weblog, String,
+     * java.io.InputStream)
      */
     public void saveFileContent(Weblog weblog, 
                          String fileId, 
@@ -128,7 +130,7 @@ public class FileContentManagerImpl impl
     
     
     /**
-     * @see org.apache.roller.weblogger.model.FileContentManager#deleteFile(weblog, java.lang.String)
+     * @see org.apache.roller.weblogger.business.FileContentManager#deleteFile(Weblog, String)
      */
     public void deleteFile(Weblog weblog, String fileId) 
             throws FileNotFoundException, FilePathException, FileIOException {
@@ -149,15 +151,15 @@ public class FileContentManagerImpl impl
     }
     
     /**
-     * @see org.apache.roller.weblogger.model.FileContentManager#overQuota(weblog)
+     * @see org.apache.roller.weblogger.business.FileContentManager#overQuota(Weblog)
      */
     public boolean overQuota(Weblog weblog) {
         
         String maxDir = WebloggerRuntimeConfig.getProperty("uploads.dir.maxsize");
         String maxFile = WebloggerRuntimeConfig.getProperty("uploads.file.maxsize");
-        BigDecimal maxDirSize = new BigDecimal(maxDir); // in megabytes
-        BigDecimal maxFileSize = new BigDecimal(maxFile); // in megabytes
-        
+        // maxDirSize in megabytes
+        BigDecimal maxDirSize = new BigDecimal(maxDir);
+
         long maxDirBytes = (long)(1024000 * maxDirSize.doubleValue());
         
         try {
@@ -178,8 +180,8 @@ public class FileContentManagerImpl impl
     
     
     /**
-     * @see org.apache.roller.weblogger.model.FileContentManager#canSave(
-     * weblog, java.lang.String, java.lang.String, long, messages)
+     * @see org.apache.roller.weblogger.business.FileContentManager#canSave(
+     * Weblog, String, String, long, RollerMessages)
      */
     public boolean canSave(Weblog weblog,
     		           String fileName,
@@ -297,7 +299,9 @@ public class FileContentManagerImpl impl
         if (allowFiles != null && allowFiles.length > 0) {
             for (int y=0; y<allowFiles.length; y++) {
                 // oops, this allowed rule is a content-type, skip it
-                if (allowFiles[y].indexOf('/') != -1) continue;
+                if (allowFiles[y].indexOf('/') != -1) {
+                    continue;
+                }
                 if (fileName.toLowerCase().endsWith(
                         allowFiles[y].toLowerCase())) {
                     allowFile = true;
@@ -310,7 +314,9 @@ public class FileContentManagerImpl impl
         if (allowFiles != null && allowFiles.length > 0) {
             for (int y=0; y<allowFiles.length; y++) {
                 // oops, this allowed rule is NOT a content-type, skip it
-                if (allowFiles[y].indexOf('/') == -1) continue;
+                if (allowFiles[y].indexOf('/') == -1) {
+                    continue;
+                }
                 if (matchContentType(allowFiles[y], contentType)) {
                     allowFile = true;
                     break;
@@ -324,7 +330,9 @@ public class FileContentManagerImpl impl
         if (forbidFiles != null && forbidFiles.length > 0) {
             for (int x=0; x<forbidFiles.length; x++) {
                 // oops, this forbid rule is a content-type, skip it
-                if (forbidFiles[x].indexOf('/') != -1) continue;
+                if (forbidFiles[x].indexOf('/') != -1) {
+                    continue;
+                }
                 if (fileName.toLowerCase().endsWith(
                         forbidFiles[x].toLowerCase())) {
                     allowFile = false;
@@ -338,7 +346,9 @@ public class FileContentManagerImpl impl
         if (forbidFiles != null && forbidFiles.length > 0) {
             for (int x=0; x<forbidFiles.length; x++) {
                 // oops, this forbid rule is NOT a content-type, skip it
-                if (forbidFiles[x].indexOf('/') == -1) continue;
+                if (forbidFiles[x].indexOf('/') == -1) {
+                    continue;
+                }
                 if (matchContentType(forbidFiles[x], contentType)) {
                     allowFile = false;
                     break;
@@ -354,12 +364,17 @@ public class FileContentManagerImpl impl
      * Super simple contentType range rule matching
      */
     private boolean matchContentType(String rangeRule, String contentType) {
-        if (rangeRule.equals("*/*")) return true;
-        if (rangeRule.equals(contentType)) return true;
+        if (rangeRule.equals("*/*")) {
+            return true;
+        }
+        if (rangeRule.equals(contentType)) {
+            return true;
+        }
         String ruleParts[] = rangeRule.split("/");
         String typeParts[] = contentType.split("/");
-        if (ruleParts[0].equals(typeParts[0]) && ruleParts[1].equals("*")) 
+        if (ruleParts[0].equals(typeParts[0]) && ruleParts[1].equals("*")) {
             return true;
+        }
         
         return false;
     }
@@ -372,7 +387,7 @@ public class FileContentManagerImpl impl
             throws FileNotFoundException, FilePathException {
         
         // make sure uploads area exists for this weblog
-        File weblogDir = new File(this.storage_dir + weblog.getHandle());
+        File weblogDir = new File(this.storageDir + weblog.getHandle());
         if(!weblogDir.exists()) {
             weblogDir.mkdirs();
         }

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPARefererManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPARefererManagerImpl.java?rev=1520953&r1=1520952&r2=1520953&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPARefererManagerImpl.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPARefererManagerImpl.java Mon Sep  9 02:49:44 2013
@@ -56,7 +56,7 @@ public class JPARefererManagerImpl imple
     protected static final String DAYHITS = "dayHits";
     protected static final String TOTALHITS = "totalHits";
     
-    private static final Comparator statCountCountReverseComparator = 
+    private static final Comparator STAT_COUNT_COUNT_REVERSE_COMPARATOR =
             Collections.reverseOrder(StatCountCountComparator.getInstance());
     
     /** The strategy for this manager. */
@@ -109,7 +109,9 @@ public class JPARefererManagerImpl imple
         String spamwords = WebloggerRuntimeConfig.getProperty("spam.blacklist");
         String[] blacklist = StringUtils.split(
                 StringUtils.deleteWhitespace(spamwords),",");
-        if (blacklist.length == 0) return;
+        if (blacklist.length == 0) {
+            return;
+        }
         List referers = getBlackListedReferer(blacklist);
         for (Iterator iterator = referers.iterator(); iterator.hasNext();) {
             WeblogReferrer referer= (WeblogReferrer) iterator.next();
@@ -122,12 +124,18 @@ public class JPARefererManagerImpl imple
      */
     public void applyRefererFilters(Weblog website)
             throws WebloggerException {
-        if (null == website) throw new WebloggerException("website is null");
-        if (null == website.getBlacklist()) return;
+        if (null == website) {
+            throw new WebloggerException("website is null");
+        }
+        if (null == website.getBlacklist()) {
+            return;
+        }
         
         String[] blacklist = StringUtils.split(
                 StringUtils.deleteWhitespace(website.getBlacklist()),",");
-        if (blacklist.length == 0) return;
+        if (blacklist.length == 0) {
+            return;
+        }
         List referers = getBlackListedReferer(website, blacklist);
         for (Iterator iterator = referers.iterator(); iterator.hasNext();) {
             WeblogReferrer referer= (WeblogReferrer) iterator.next();
@@ -167,8 +175,10 @@ public class JPARefererManagerImpl imple
      */
     public List getHotWeblogs(int sinceDays, int offset, int length)
             throws WebloggerException {
-        
-        String msg = "Getting hot weblogs";
+
+        if (log.isDebugEnabled()) {
+            log.debug("Getting hot weblogs");
+        }
         List results = new ArrayList();
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
@@ -206,7 +216,7 @@ public class JPARefererManagerImpl imple
         }
         // Original query ordered by desc hits.
         // JPA QL doesn't allow queries to be ordered by agregates; do it in memory
-        Collections.sort(results, statCountCountReverseComparator);
+        Collections.sort(results, STAT_COUNT_COUNT_REVERSE_COMPARATOR);
 
         return results;
     }
@@ -277,11 +287,13 @@ public class JPARefererManagerImpl imple
     public List getReferersToDate(Weblog website, String date)
             throws WebloggerException {
 
-        if (website==null )
+        if (website==null) {
             throw new WebloggerException("website is null");
+        }
         
-        if (date==null )
+        if (date==null) {
             throw new WebloggerException("Date is null");
+        }
         
         Query q = strategy.getNamedQuery(
             "WeblogReferrer.getByWebsite&DateString&DuplicateOrderByTotalHitsDesc");
@@ -298,8 +310,9 @@ public class JPARefererManagerImpl imple
      * @throws org.apache.roller.weblogger.WebloggerException
      */
     public List getReferersToEntry(String entryid) throws WebloggerException {
-        if (null == entryid)
+        if (null == entryid) {
             throw new WebloggerException("entryid is null");
+        }
         //TODO: DataMapperPort: Change calling code to pass WeblogEntry instead of id
         // we should change calling code to pass instance of WeblogEntry instead
         // of extracting and passing id. Once that is done, change the code below to
@@ -368,17 +381,19 @@ public class JPARefererManagerImpl imple
         log.debug("processing referrer ["+referrerUrl+
                 "] accessing ["+requestUrl+"]");
 
-        if (weblogHandle == null)
+        if (weblogHandle == null) {
             return;
+        }
 
-        String selfSiteFragment = "/"+weblogHandle;
         Weblog weblog = null;
         WeblogEntry entry = null;
 
         // lookup the weblog now
         try {
             weblog = roller.getWeblogManager().getWeblogByHandle(weblogHandle);
-            if (weblog == null) return;
+            if (weblog == null) {
+                return;
+            }
 
             // now lookup weblog entry if possible
             if (entryAnchor != null) {
@@ -428,8 +443,8 @@ public class JPARefererManagerImpl imple
                 // Referer was found in database, so bump up hit count
                 WeblogReferrer ref = (WeblogReferrer)matchRef.get(0);
 
-                ref.setDayHits(new Integer(ref.getDayHits().intValue() + 1));
-                ref.setTotalHits(new Integer(ref.getTotalHits().intValue() + 1));
+                ref.setDayHits(ref.getDayHits() + 1);
+                ref.setTotalHits(ref.getTotalHits() + 1);
 
                 log.debug("Incrementing hit count on existing referer: " +
                     referrerUrl);
@@ -439,7 +454,7 @@ public class JPARefererManagerImpl imple
             } else if (matchRef.size() == 0) {
 
                 // Referer was not found in database, so new Referer object
-                Integer one = new Integer(1);
+                Integer one = 1;
                 WeblogReferrer ref =
                         new WeblogReferrer(
                         null,
@@ -583,7 +598,7 @@ public class JPARefererManagerImpl imple
                                 maxweight = weight;
                             }
 
-                            if (referer.getVisible().booleanValue()) {
+                            if (referer.getVisible()) {
                                 // If any are visible then chosen
                                 // replacement must be visible as well.
                                 visible = Boolean.TRUE;
@@ -596,7 +611,7 @@ public class JPARefererManagerImpl imple
                         for (Iterator rdItr = refs.iterator();rdItr.hasNext();) {
                             WeblogReferrer referer = (WeblogReferrer) rdItr.next();
 
-                            if (referer != chosen) {
+                            if (!referer.equals(chosen)) {
                                 referer.setDuplicate(Boolean.TRUE);
                             } else {
                                 referer.setDuplicate(Boolean.FALSE);
@@ -667,16 +682,16 @@ public class JPARefererManagerImpl imple
         assert blacklist.length > 0;
         StringBuffer queryString = new StringBuffer("SELECT r FROM WeblogReferrer r WHERE (");
         //Search for any matching entry from blacklist[]
-        final String OR = " OR ";
+        final String orKeyword = " OR ";
         for (int i = 0; i < blacklist.length; i++) {
             String ignoreWord = blacklist[i];
             //TODO: DataMapper port: original code use "like ignore case" as follows
             // or.add(Expression.ilike("refererUrl","%"+ignoreWord+"%"));
             // There is no equivalent for it in JPA
-            queryString.append("r.refererUrl like '%").append(ignoreWord.trim()).append("%'").append(OR);
+            queryString.append("r.refererUrl like '%").append(ignoreWord.trim()).append("%'").append(orKeyword);
         }
         // Get rid of last OR
-        queryString.delete(queryString.length() - OR.length(), queryString.length());
+        queryString.delete(queryString.length() - orKeyword.length(), queryString.length());
         queryString.append(" ) ");
         return queryString;
     }

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java?rev=1520953&r1=1520952&r2=1520953&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java Mon Sep  9 02:49:44 2013
@@ -78,14 +78,14 @@ public class JPAWeblogEntryManagerImpl i
     private Hashtable entryAnchorToIdMap = new Hashtable();
     
     /* inline creation of reverse comparator, anonymous inner class */
-    private static final Comparator reverseComparator = new ReverseComparator();
+    private static final Comparator REVERSE_COMPARATOR = new ReverseComparator();
     
-    private static final Comparator tagStatNameComparator = new TagStatComparator();
+    private static final Comparator TAG_STAT_NAME_COMPARATOR = new TagStatComparator();
     
-    private static final Comparator tagStatCountReverseComparator =
+    private static final Comparator TAG_STAT_COUNT_REVERSE_COMPARATOR =
             Collections.reverseOrder(TagStatCountComparator.getInstance());
     
-    private static final Comparator statCountCountReverseComparator =
+    private static final Comparator STAT_COUNT_COUNT_REVERSE_COMPARATOR =
             Collections.reverseOrder(StatCountCountComparator.getInstance());
     
     
@@ -415,14 +415,8 @@ public class JPAWeblogEntryManagerImpl i
 		}
 
         Query query = null;
-        List results = null;
         WeblogCategory category = null;
         
-        if (catName != null && !catName.trim().equals("/")) {
-            category = getWeblogCategoryByPath(current.getWebsite(), null,
-                    catName);
-        }
-                
         List params = new ArrayList();
         int size = 0;
         StringBuffer queryString = new StringBuffer();
@@ -480,8 +474,9 @@ public class JPAWeblogEntryManagerImpl i
      */
     public WeblogCategory getRootWeblogCategory(Weblog website)
     throws WebloggerException {
-        if (website == null)
+        if (website == null) {
             throw new WebloggerException("website is null");
+        }
         
         Query q = strategy.getNamedQuery(
                 "WeblogCategory.getByWebsite&ParentNull");
@@ -498,10 +493,13 @@ public class JPAWeblogEntryManagerImpl i
      */
     public List getWeblogCategories(Weblog website, boolean includeRoot)
     throws WebloggerException {
-        if (website == null)
+        if (website == null) {
             throw new WebloggerException("website is null");
+        }
         
-        if (includeRoot) return getWeblogCategories(website);
+        if (includeRoot) {
+            return getWeblogCategories(website);
+        }
         
         Query q = strategy.getNamedQuery(
                 "WeblogCategory.getByWebsite&ParentNotNull");
@@ -514,8 +512,9 @@ public class JPAWeblogEntryManagerImpl i
      */
     public List getWeblogCategories(Weblog website)
     throws WebloggerException {
-        if (website == null)
+        if (website == null) {
             throw new WebloggerException("website is null");
+        }
         
         Query q = strategy.getNamedQuery(
                 "WeblogCategory.getByWebsite");
@@ -544,7 +543,9 @@ public class JPAWeblogEntryManagerImpl i
         WeblogCategory cat = null;
         if (StringUtils.isNotEmpty(catName) && website != null) {
             cat = getWeblogCategoryByPath(website, catName);
-            if (cat == null) catName = null;
+            if (cat == null) {
+                catName = null;
+            }
         }
         if (catName != null && catName.trim().equals("/")) {
             catName = null;
@@ -561,7 +562,9 @@ public class JPAWeblogEntryManagerImpl i
             queryString.append("SELECT e FROM WeblogEntry e JOIN e.tags t WHERE ");
             queryString.append("(");
             for(int i = 0; i < tags.size(); i++) {
-                if (i != 0) queryString.append(" OR ");
+                if (i != 0) {
+                    queryString.append(" OR ");
+                }
                 params.add(size++, tags.get(i));
                 queryString.append(" t.name = ?").append(size);                
             }
@@ -723,11 +726,13 @@ public class JPAWeblogEntryManagerImpl i
     public WeblogEntry getWeblogEntryByAnchor(Weblog website,
             String anchor) throws WebloggerException {
         
-        if (website == null)
+        if (website == null) {
             throw new WebloggerException("Website is null");
+        }
         
-        if (anchor == null)
+        if (anchor == null) {
             throw new WebloggerException("Anchor is null");
+        }
         
         // mapping key is combo of weblog + anchor
         String mappingKey = website.getHandle()+":"+anchor;
@@ -1111,7 +1116,7 @@ public class JPAWeblogEntryManagerImpl i
             int     offset,
             int     length) throws WebloggerException {
         
-        TreeMap map = new TreeMap(reverseComparator);
+        TreeMap map = new TreeMap(REVERSE_COMPARATOR);
         
         List entries = getWeblogEntries( 
                 website,
@@ -1138,8 +1143,9 @@ public class JPAWeblogEntryManagerImpl i
             WeblogEntry entry = (WeblogEntry) wbItr.next();
             Date sDate = DateUtil.getNoonOfDay(entry.getPubTime(), cal);
             if (stringsOnly) {
-                if (map.get(sDate) == null)
+                if (map.get(sDate) == null) {
                     map.put(sDate, formatter.format(sDate));
+                }
             } else {
                 List dayEntries = (List) map.get(sDate);
                 if (dayEntries == null) {
@@ -1160,7 +1166,9 @@ public class JPAWeblogEntryManagerImpl i
             int length) throws WebloggerException {
         Query query = null;
         List queryResults = null;        
-        if (endDate == null) endDate = new Date();
+        if (endDate == null) {
+            endDate = new Date();
+        }
         
         if (website != null) {
             if (startDate != null) {
@@ -1214,7 +1222,7 @@ public class JPAWeblogEntryManagerImpl i
         }
         // Original query ordered by desc count.
         // JPA QL doesn't allow queries to be ordered by agregates; do it in memory
-        Collections.sort(results, statCountCountReverseComparator);
+        Collections.sort(results, STAT_COUNT_COUNT_REVERSE_COMPARATOR);
         
         return results;
     }
@@ -1263,7 +1271,7 @@ public class JPAWeblogEntryManagerImpl i
         Query q = strategy.getNamedUpdate(
                 "WeblogEntry.updateAllowComments&CommentDaysByWebsite");
         q.setParameter(1, website.getDefaultAllowComments());
-        q.setParameter(2, new Integer(website.getDefaultCommentDays()));
+        q.setParameter(2, website.getDefaultCommentDays());
         q.setParameter(3, website);
         q.executeUpdate();
     }
@@ -1334,7 +1342,7 @@ public class JPAWeblogEntryManagerImpl i
         }
         
         // sort results by name, because query had to sort by total
-        Collections.sort(results, tagStatNameComparator);
+        Collections.sort(results, TAG_STAT_NAME_COMPARATOR);
         
         return results;
     }
@@ -1395,9 +1403,9 @@ public class JPAWeblogEntryManagerImpl i
         }
         
         if (sortByName) {
-            Collections.sort(results, tagStatNameComparator);
+            Collections.sort(results, TAG_STAT_NAME_COMPARATOR);
         } else {
-            Collections.sort(results, tagStatCountReverseComparator);
+            Collections.sort(results, TAG_STAT_COUNT_REVERSE_COMPARATOR);
         }
         
         return results;
@@ -1420,15 +1428,15 @@ public class JPAWeblogEntryManagerImpl i
         //Append tags as parameter markers to avoid potential escaping issues
         //The IN clause would be of form (?1, ?2, ?3, ..)
         ArrayList params = new ArrayList(tags.size() + 1);
-        final String PARAM_SEPERATOR = ", ";
+        final String PARAM_SEPARATOR = ", ";
         int i;
         for (i=0; i < tags.size(); i++) {
-            queryString.append('?').append(i+1).append(PARAM_SEPERATOR);
+            queryString.append('?').append(i+1).append(PARAM_SEPARATOR);
             params.add(tags.get(i));
         }
         
-        // Remove the trailing PARAM_SEPERATOR
-        queryString.delete(queryString.length() - PARAM_SEPERATOR.length(),
+        // Remove the trailing PARAM_SEPARATOR
+        queryString.delete(queryString.length() - PARAM_SEPARATOR.length(),
                 queryString.length());
         // Close the brace of IN clause
         queryString.append(')');
@@ -1532,7 +1540,7 @@ public class JPAWeblogEntryManagerImpl i
         // delete all bad counts
         Query removeq = strategy.getNamedUpdate(
                 "WeblogEntryTagAggregate.removeByTotalLessEqual");
-        removeq.setParameter(1, new Integer(0));
+        removeq.setParameter(1, 0);
         removeq.executeUpdate();
     }
     

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java?rev=1520953&r1=1520952&r2=1520953&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java Mon Sep  9 02:49:44 2013
@@ -67,7 +67,7 @@ public class JPAWeblogManagerImpl implem
     /** The logger instance for this class. */
     private static Log log = LogFactory.getLog(JPAWeblogManagerImpl.class);
     
-    private static final Comparator statCountCountReverseComparator =
+    private static final Comparator STAT_COUNT_COUNT_REVERSE_COMPARATOR =
             Collections.reverseOrder(StatCountCountComparator.getInstance());
     
     private final Weblogger roller;
@@ -75,11 +75,7 @@ public class JPAWeblogManagerImpl implem
     
     // cached mapping of weblogHandles -> weblogIds
     private Map weblogHandleToIdMap = new Hashtable();
-    
-    // cached mapping of userNames -> userIds
-    private Map userNameToIdMap = new Hashtable();
-    
-    
+
     @com.google.inject.Inject
     protected JPAWeblogManagerImpl(Weblogger roller, JPAPersistenceStrategy strat) {
         log.debug("Instantiating JPA Weblog Manager");
@@ -118,10 +114,8 @@ public class JPAWeblogManagerImpl implem
     throws  WebloggerException {
         
         UserManager        umgr = roller.getUserManager();
-        WeblogManager      wmgr = roller.getWeblogManager();
         WeblogEntryManager emgr = roller.getWeblogEntryManager();
         BookmarkManager    bmgr = roller.getBookmarkManager();
-        MediaFileManager   mmgr = roller.getMediaFileManager();
 
         //remove theme Assocs
 
@@ -160,10 +154,9 @@ public class JPAWeblogManagerImpl implem
         // delete all bad counts
         Query removeCounts = strategy.getNamedUpdate(
                 "WeblogEntryTagAggregate.removeByTotalLessEqual");
-        removeCounts.setParameter(1, new Integer(0));
+        removeCounts.setParameter(1, 0);
         removeCounts.executeUpdate();
         
-        
         // Remove the website's ping queue entries
         Query q = strategy.getNamedQuery("PingQueueEntry.getByWebsite");
         q.setParameter(1, website);
@@ -272,7 +265,7 @@ public class JPAWeblogManagerImpl implem
     }
     
     /**
-     * @see org.apache.roller.weblogger.model.UserManager#storePage(org.apache.roller.weblogger.pojos.WeblogTemplate)
+     * @see org.apache.roller.weblogger.business.WeblogManager#savePage(WeblogTemplate)
      */
     public void savePage(WeblogTemplate page) throws WebloggerException {
         this.strategy.store(page);
@@ -331,7 +324,9 @@ public class JPAWeblogManagerImpl implem
                         splitcats[i],    // name
                         splitcats[i],    // description
                         null );          // image
-                if (i == 0) firstCat = c;
+                if (i == 0) {
+                    firstCat = c;
+                }
                 rootCat.getWeblogCategories().add(c);
                 this.strategy.store(c);
             }
@@ -350,7 +345,7 @@ public class JPAWeblogManagerImpl implem
                 null, "root", "root", newWeblog);
         this.strategy.store(root);
         
-        Integer zero = new Integer(0);
+        Integer zero = 0;
         String blogroll = WebloggerConfig.getProperty("newuser.blogroll");
         if (blogroll != null) {
             String[] splitroll = blogroll.split(",");
@@ -409,8 +404,9 @@ public class JPAWeblogManagerImpl implem
     public Weblog getWeblogByHandle(String handle, Boolean enabled)
     throws WebloggerException {
         
-        if (handle==null )
+        if (handle==null ) {
             throw new WebloggerException("Handle cannot be null");
+        }
         
         // check cache first
         // NOTE: if we ever allow changing handles then this needs updating
@@ -471,23 +467,31 @@ public class JPAWeblogManagerImpl implem
 
         if (startDate != null) {
             Timestamp start = new Timestamp(startDate.getTime());
-            if (whereClause.length() > 0) whereClause.append(" AND ");
+            if (whereClause.length() > 0) {
+                whereClause.append(" AND ");
+            }
             params.add(size++, start);
             whereClause.append(" w.dateCreated > ?" + size);
         }
         if (endDate != null) {
             Timestamp end = new Timestamp(endDate.getTime());
-            if (whereClause.length() > 0) whereClause.append(" AND ");
+            if (whereClause.length() > 0) {
+                whereClause.append(" AND ");
+            }
             params.add(size++, end);
             whereClause.append(" w.dateCreated < ?" + size);
         }
         if (enabled != null) {
-            if (whereClause.length() > 0) whereClause.append(" AND ");
+            if (whereClause.length() > 0) {
+                whereClause.append(" AND ");
+            }
             params.add(size++, enabled);
             whereClause.append(" w.enabled = ?" + size);
         }
         if (active != null) {
-            if (whereClause.length() > 0) whereClause.append(" AND ");
+            if (whereClause.length() > 0) {
+                whereClause.append(" AND ");
+            }
             params.add(size++, active);
             whereClause.append(" w.active = ?" + size);
         }      
@@ -562,7 +566,9 @@ public class JPAWeblogManagerImpl implem
 
     public WeblogTemplate getPage(String id) throws WebloggerException {
         // Don't hit database for templates stored on disk
-        if (id != null && id.endsWith(".vm")) return null;
+        if (id != null && id.endsWith(".vm")) {
+            return null;
+        }
         
         return (WeblogTemplate)this.strategy.load(WeblogTemplate.class,id);
     }
@@ -573,12 +579,14 @@ public class JPAWeblogManagerImpl implem
     public WeblogTemplate getPageByLink(Weblog website, String pagelink)
     throws WebloggerException {
         
-        if (website == null)
+        if (website == null) {
             throw new WebloggerException("userName is null");
-        
-        if (pagelink == null)
+        }
+
+        if (pagelink == null) {
             throw new WebloggerException("Pagelink is null");
-        
+        }
+
         Query query = strategy.getNamedQuery("WeblogTemplate.getByWebsite&Link");
         query.setParameter(1, website);
         query.setParameter(2, pagelink);
@@ -590,17 +598,18 @@ public class JPAWeblogManagerImpl implem
     }
     
     /**
-     * @see org.apache.roller.weblogger.model.UserManager#getPageByAction(Weblog, java.lang.String)
+     * @see org.apache.roller.weblogger.business.WeblogManager#getPageByAction(Weblog, String)
      */
     public WeblogTemplate getPageByAction(Weblog website, String action)
             throws WebloggerException {
         
-        if (website == null)
+        if (website == null) {
             throw new WebloggerException("website is null");
-        
-        if (action == null)
+        }
+
+        if (action == null) {
             throw new WebloggerException("Action name is null");
-        
+        }
         
         Query query = strategy.getNamedQuery("WeblogTemplate.getByAction"); 
         query.setParameter(1, website);
@@ -613,16 +622,18 @@ public class JPAWeblogManagerImpl implem
     }
     
     /**
-     * @see org.apache.roller.weblogger.model.UserManager#getPageByName(Weblog, java.lang.String)
+     * @see org.apache.roller.weblogger.business.WeblogManager#getPageByName(Weblog, java.lang.String)
      */
     public WeblogTemplate getPageByName(Weblog website, String pagename)
     throws WebloggerException {
         
-        if (website == null)
+        if (website == null) {
             throw new WebloggerException("website is null");
+        }
         
-        if (pagename == null)
+        if (pagename == null) {
             throw new WebloggerException("Page name is null");
+        }
         
         Query query = strategy.getNamedQuery("WeblogTemplate.getByWebsite&Name");
         query.setParameter(1, website);
@@ -635,11 +646,12 @@ public class JPAWeblogManagerImpl implem
     }
 
     public WeblogThemeTemplateCode getTemplateCodeByType(String templateId, String type) throws WebloggerException{
-         if(templateId == null)
-             throw new WebloggerException("Template Name is null");
+        if(templateId == null) {
+            throw new WebloggerException("Template Name is null");
+        }
 
-        if(type == null){
-            throw  new WebloggerException("Type is null");
+        if (type == null) {
+            throw new WebloggerException("Type is null");
         }
 
         Query query = strategy.getNamedQuery("WeblogThemeTemplateCode.getTemplateCodeByType");
@@ -653,11 +665,12 @@ public class JPAWeblogManagerImpl implem
     }
 
     /**
-     * @see org.apache.roller.weblogger.model.UserManager#getPages(Weblog)
+     * @see org.apache.roller.weblogger.business.WeblogManager#getPages(Weblog)
      */
     public List getPages(Weblog website) throws WebloggerException {
-        if (website == null)
+        if (website == null) {
             throw new WebloggerException("website is null");
+        }
         Query q = strategy.getNamedQuery(
                 "WeblogTemplate.getByWebsiteOrderByName");
         q.setParameter(1, website);
@@ -700,7 +713,9 @@ public class JPAWeblogManagerImpl implem
         
         Query query = null;
         
-        if (endDate == null) endDate = new Date();
+        if (endDate == null) {
+            endDate = new Date();
+        }
         
         if (startDate != null) {
             Timestamp start = new Timestamp(startDate.getTime());
@@ -736,7 +751,7 @@ public class JPAWeblogManagerImpl implem
         }
         // Original query ordered by desc # comments.
         // JPA QL doesn't allow queries to be ordered by agregates; do it in memory
-        Collections.sort(results, statCountCountReverseComparator);
+        Collections.sort(results, STAT_COUNT_COUNT_REVERSE_COMPARATOR);
         
         return results;
     }
@@ -749,7 +764,7 @@ public class JPAWeblogManagerImpl implem
         List results = strategy.getNamedQuery(
                 "Weblog.getCountAllDistinct").getResultList();
         
-        ret = ((Long)results.get(0)).longValue();
+        ret = (Long)results.get(0);
         
         return ret;
     }

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java?rev=1520953&r1=1520952&r2=1520953&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java Mon Sep  9 02:49:44 2013
@@ -80,7 +80,11 @@ public class DatabaseInstaller {
         } catch (Exception e) {
             throw new RuntimeException("Error checking for tables", e);
         } finally {
-            try { if (con != null) con.close(); } catch (Exception ignored) {}
+            try {
+                if (con != null) {
+                    con.close();
+                }
+            } catch (Exception ignored) {}
         }
         
         return true;
@@ -178,7 +182,11 @@ public class DatabaseInstaller {
             throw new StartupException("Error running SQL script", ioe);
 
         } finally {
-            try { if (con != null) con.close(); } catch (Exception ignored) {}
+            try {
+                if (con != null) {
+                    con.close();
+                }
+            } catch (Exception ignored) {}
         }
     }
     
@@ -237,7 +245,11 @@ public class DatabaseInstaller {
         } catch (SQLException e) {
             throw new StartupException("ERROR obtaining connection");
         } finally {
-            try { if (con != null) con.close(); } catch (Exception ignored) {}
+            try {
+                if (con != null) {
+                    con.close();
+                }
+            } catch (Exception ignored) {}
         }
     }
 
@@ -261,7 +273,9 @@ public class DatabaseInstaller {
             }
         } catch(Exception ex) {
             log.error("ERROR running 400 database upgrade script", ex);
-            if (runner != null) messages.addAll(runner.getMessages());
+            if (runner != null) {
+                messages.addAll(runner.getMessages());
+            }
             
             errorMessage("Problem upgrading database to version 400", ex);
             throw new StartupException("Problem upgrading database to version 400", ex);
@@ -317,7 +331,9 @@ public class DatabaseInstaller {
                 updateParent.executeUpdate();
             }
             
-            if (!con.getAutoCommit()) con.commit();
+            if (!con.getAutoCommit()) {
+                con.commit();
+            }
            
             successMessage("Done populating parentid columns.");
             
@@ -466,7 +482,9 @@ public class DatabaseInstaller {
                 log.debug("Updated "+folderNumUpdated+" Lx folder paths");
             } while(folderNumUpdated > 0);
             
-            if (!con.getAutoCommit()) con.commit();
+            if (!con.getAutoCommit()) {
+                con.commit();
+            }
            
             successMessage("Done populating path columns.");
             
@@ -521,7 +539,9 @@ public class DatabaseInstaller {
                 renameExternalGroup.executeUpdate();
             }
             
-            if (!con.getAutoCommit()) con.commit();
+            if (!con.getAutoCommit()) {
+                con.commit();
+            }
            
             successMessage("Planet group 'external' merged into group 'all'.");
             
@@ -568,7 +588,9 @@ public class DatabaseInstaller {
             }
             }
             
-            if (!con.getAutoCommit()) con.commit();
+            if (!con.getAutoCommit()) {
+                con.commit();
+            }
            
             successMessage("Comments successfully updated to use new comment plugins.");
             
@@ -658,7 +680,9 @@ public class DatabaseInstaller {
             updateCommentsPlugins.setString(1, plugins);
             updateCommentsPlugins.executeUpdate();
             
-            if (!con.getAutoCommit()) con.commit();
+            if (!con.getAutoCommit()) {
+                con.commit();
+            }
            
             successMessage("Comments successfully updated to use new comment plugins.");
             
@@ -690,7 +714,9 @@ public class DatabaseInstaller {
             }
         } catch(Exception ex) {
             log.error("ERROR running 500 database upgrade script", ex);
-            if (runner != null) messages.addAll(runner.getMessages());
+            if (runner != null) {
+                messages.addAll(runner.getMessages());
+            }
             
             errorMessage("Problem upgrading database to version 500", ex);
             throw new StartupException("Problem upgrading database to version 500", ex);
@@ -712,7 +738,9 @@ public class DatabaseInstaller {
             }
         } catch(Exception ex) {
             log.error("ERROR running 510 database upgrade script", ex);
-            if (runner != null) messages.addAll(runner.getMessages());
+            if (runner != null) {
+                messages.addAll(runner.getMessages());
+            }
             
             errorMessage("Problem upgrading database to version 510", ex);
             throw new StartupException("Problem upgrading database to version 510", ex);
@@ -783,8 +811,9 @@ public class DatabaseInstaller {
                 // we have someone upgrading from 1.2.x
                 rs = stmt.executeQuery("select count(*) from roller_properties");
                 if(rs.next()) {
-                    if(rs.getInt(1) > 0)
+                    if(rs.getInt(1) > 0) {
                         dbversion = 120;
+                    }
                 }
             }
             
@@ -792,7 +821,11 @@ public class DatabaseInstaller {
             // that's strange ... hopefully we didn't need to upgrade
             log.error("Couldn't lookup current database version", e);           
         } finally {
-            try { if (con != null) con.close(); } catch (Exception ignored) {}
+            try {
+                if (con != null) {
+                    con.close();
+                }
+            } catch (Exception ignored) {}
         }       
         return dbversion;
     }
@@ -807,14 +840,18 @@ public class DatabaseInstaller {
         // strip out non-digits
         vstring = vstring.replaceAll("\\Q.\\E", "");
         vstring = vstring.replaceAll("\\D", "");
-        if(vstring.length() > 3)
+        if(vstring.length() > 3) {
             vstring = vstring.substring(0, 3);
+        }
         
         // parse to an int
         try {
             int parsed = Integer.parseInt(vstring);            
-            if(parsed < 100) myversion = parsed * 10;
-            else myversion = parsed;
+            if(parsed < 100) {
+                myversion = parsed * 10;
+            } else {
+                myversion = parsed;
+            }
         } catch(Exception e) {}  
         
         return myversion;

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/Weblog.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/Weblog.java?rev=1520953&r1=1520952&r2=1520953&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/Weblog.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/pojos/Weblog.java Mon Sep  9 02:49:44 2013
@@ -87,7 +87,7 @@ public class Weblog implements Serializa
     private Boolean moderateComments = Boolean.FALSE;
     private int     entryDisplayCount = 15;
     private Date    lastModified     = new Date();
-    private String  pageModels       = new String();
+    private String  pageModels;
     private boolean enableMultiLang  = false;
     private boolean showAllLangs     = true;
     private String  customStylesheetPath = null;
@@ -95,9 +95,7 @@ public class Weblog implements Serializa
     private String  about            = null;
     private String  creator          = null;
 
-    
     // Associated objects
-    private List           permissions = new ArrayList();
     private WeblogCategory bloggerCategory = null;
     private WeblogCategory defaultCategory = null;
     
@@ -131,7 +129,7 @@ public class Weblog implements Serializa
     //------------------------------------------------------- Good citizenship
 
     public String toString() {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         buf.append("{");
         buf.append(getId());
         buf.append(", ").append(getHandle());
@@ -144,8 +142,12 @@ public class Weblog implements Serializa
     }
 
     public boolean equals(Object other) {
-        if (other == this) return true;
-        if (other instanceof Weblog != true) return false;
+        if (other == this) {
+            return true;
+        }
+        if (!(other instanceof Weblog)) {
+            return false;
+        }
         Weblog o = (Weblog)other;
         return new EqualsBuilder()
             .append(getHandle(), o.getHandle()) 
@@ -638,16 +640,11 @@ public class Weblog implements Serializa
      */
     public TimeZone getTimeZoneInstance() {
         if (getTimeZone() == null) {
-            if (TimeZone.getDefault() != null) {
-                this.setTimeZone( TimeZone.getDefault().getID() );
-            } else {
-                this.setTimeZone("America/New_York");
-            }
+            this.setTimeZone( TimeZone.getDefault().getID() );
         }
         return TimeZone.getTimeZone(getTimeZone());
     }
     
-    
     /**
      * Returns true if user has all permission action specified.
      */
@@ -680,7 +677,7 @@ public class Weblog implements Serializa
             UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
             Iterator iter = umgr.getWeblogPermissions(this).iterator();
             while (iter.hasNext()) {
-                WeblogPermission perm = (WeblogPermission) iter.next();
+                iter.next();
                 count++;
             }
             
@@ -696,7 +693,7 @@ public class Weblog implements Serializa
     public void setUserCount(int userCount) {
         // no-op
     }
-    
+
     public int getAdminUserCount() {
         int count = 0;
         try {
@@ -721,8 +718,7 @@ public class Weblog implements Serializa
     public void setAdminUserCount(int adminUserCount) {
         // no-op
     }
-    
-    
+
     /**
      * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
@@ -958,14 +954,8 @@ public class Weblog implements Serializa
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.weblogger.pojos.WeblogCategory"
      */
     public Set getWeblogCategories() {
-        Set ret = new HashSet();
-//        try {           
-            WeblogCategory category = this.getDefaultCategory();
-            ret = category.getWeblogCategories();
-//        } catch (WebloggerException e) {
-//            log.error("ERROR: fetching categories", e);
-//        }
-        return ret;
+        WeblogCategory category = this.getDefaultCategory();
+        return category.getWeblogCategories();
     }
     
     
@@ -1024,10 +1014,16 @@ public class Weblog implements Serializa
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.weblogger.pojos.WeblogEntryData"
      */
     public List getRecentWeblogEntries(String cat, int length) {  
-        if (cat != null && "nil".equals(cat)) cat = null;
-        if (length > 100) length = 100;
+        if (cat != null && "nil".equals(cat)) {
+            cat = null;
+        }
+        if (length > 100) {
+            length = 100;
+        }
         List recentEntries = new ArrayList();
-        if (length < 1) return recentEntries;
+        if (length < 1) {
+            return recentEntries;
+        }
         try {
             WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
             recentEntries = wmgr.getWeblogEntries(
@@ -1059,14 +1055,20 @@ public class Weblog implements Serializa
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.weblogger.pojos.WeblogEntryData"
      */
     public List getRecentWeblogEntriesByTag(String tag, int length) {  
-        if (tag != null && "nil".equals(tag)) tag = null;
-        if (length > 100) length = 100;
+        if (tag != null && "nil".equals(tag)) {
+            tag = null;
+        }
+        if (length > 100) {
+            length = 100;
+        }
         List recentEntries = new ArrayList();
         List tags = new ArrayList();
         if (tag != null) {
             tags.add(tag);
         }
-        if (length < 1) return recentEntries;
+        if (length < 1) {
+            return recentEntries;
+        }
         try {
             WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
             recentEntries = wmgr.getWeblogEntries(
@@ -1097,9 +1099,13 @@ public class Weblog implements Serializa
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.weblogger.pojos.WeblogEntryComment"
      */
     public List getRecentComments(int length) {   
-        if (length > 100) length = 100;
+        if (length > 100) {
+            length = 100;
+        }
         List recentComments = new ArrayList();
-        if (length < 1) return recentComments;
+        if (length < 1) {
+            return recentComments;
+        }
         try {
             WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
             recentComments = wmgr.getComments(
@@ -1148,16 +1154,14 @@ public class Weblog implements Serializa
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.weblogger.pojos.WeblogReferrer"
      */
     public List getTodaysReferrers() {
-        List referers = null;
         try {
             Weblogger roller = WebloggerFactory.getWeblogger();
             RefererManager rmgr = roller.getRefererManager();
             return rmgr.getTodaysReferers(this);
-            
         } catch (WebloggerException e) {
             log.error("PageModel getTodaysReferers()", e);
         }
-        return (referers == null ? Collections.EMPTY_LIST : referers);        
+        return Collections.EMPTY_LIST;
     }
     
     /** No-op method to please XDoclet */
@@ -1261,9 +1265,10 @@ public class Weblog implements Serializa
         try {
             //get Theme Associativity object so we can get the ThemeName for the type given
             themeAssoc = WebloggerFactory.getWeblogger().getWeblogManager().getThemeAssoc(this ,type);
-            if(themeAssoc != null)
+            if (themeAssoc != null) {
                 // get the Theme from theme manager
-              theme = WebloggerFactory.getWeblogger().getThemeManager().getTheme(themeAssoc.getName());
+                theme = WebloggerFactory.getWeblogger().getThemeManager().getTheme(themeAssoc.getName());
+            }
         } catch (WebloggerException e) {
             log.error("Error getting Weblog Theme type -"+type+"for weblog "+getHandle(),e);
         }



Mime
View raw message