JAL-2168 skip news feed if parameter "-nonews" is supplied
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 5 Aug 2016 13:53:23 +0000 (14:53 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 5 Aug 2016 13:53:23 +0000 (14:53 +0100)
src/jalview/bin/Jalview.java
src/jalview/gui/BlogReader.java

index 76ae3ff..764c92c 100755 (executable)
@@ -336,7 +336,10 @@ public class Jalview
       {
         System.err.println("CMD [-noquestionnaire] executed successfully!");
       }
-      desktop.checkForNews();
+      if (!aparser.contains("nonews"))
+      {
+        desktop.checkForNews();
+      }
     }
 
     if (!isHeadlessMode())
index edea2dc..ab9aad7 100644 (file)
@@ -41,6 +41,7 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collections;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -370,9 +371,9 @@ public class BlogReader extends JPanel
               + " and lastDate is " + lastDate);
       for (Item i : (List<Item>) chan.getItems())
       {
+        Date published = i.getPublishDate();
         boolean isread = lastDate == null ? false
-                : (i.getPublishDate() != null && !lastDate.before(i
-                        .getPublishDate()));
+                : (published != null && !lastDate.before(published));
 
         if (!updating || updateItems)
         {
@@ -382,11 +383,11 @@ public class BlogReader extends JPanel
         {
           i.setRead(isread);
         }
-        if (i.getPublishDate() != null && !i.isRead())
+        if (published != null && !i.isRead())
         {
-          if (earliest == null || earliest.after(i.getPublishDate()))
+          if (earliest == null || earliest.after(published))
           {
-            earliest = i.getPublishDate();
+            earliest = published;
           }
         }
       }