Merge "Issue #2721 Fix error when activeSites.txt contains blank lines." into development

Former-commit-id: 6b51b05bdf [formerly e665fa251dab6afb16d5a3863aac0815e84a00d4]
Former-commit-id: f3a6acaf48
This commit is contained in:
Ron Anderson 2014-03-10 18:07:17 -05:00 committed by Gerrit Code Review
commit 7b272e271c

View file

@ -48,13 +48,13 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.raytheon.uf.edex.site.SiteActivationMessage.Action; import com.raytheon.uf.edex.site.SiteActivationMessage.Action;
/** /**
* *
* Site Aware Registry * Site Aware Registry
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 30, 2010 rjpeter Initial creation * Nov 30, 2010 rjpeter Initial creation
@ -63,9 +63,10 @@ import com.raytheon.uf.edex.site.SiteActivationMessage.Action;
* Nov 1, 2012 15417 ryu Modified getActiveSites to include * Nov 1, 2012 15417 ryu Modified getActiveSites to include
* home site only if activated. * home site only if activated.
* Dec 11, 2012 14360 ryu No printing stack trace on activation exception * Dec 11, 2012 14360 ryu No printing stack trace on activation exception
* * Mar 10, 2014 2721 randerso Fix error when activeSites.txt contains blank lines.
*
* </pre> * </pre>
* *
* @author rjpeter * @author rjpeter
* @version 1.0 * @version 1.0
*/ */
@ -101,7 +102,7 @@ public class SiteAwareRegistry {
/** /**
* registers/adds site activation listeners * registers/adds site activation listeners
* *
* @param sa * @param sa
* the listener to register / add to the list * the listener to register / add to the list
*/ */
@ -135,7 +136,7 @@ public class SiteAwareRegistry {
/** /**
* get the set of strings for the active sites * get the set of strings for the active sites
* *
* @return the requested array of Strings this is a string array to make it * @return the requested array of Strings this is a string array to make it
* work with dwr frontend, most of the other stuff is Set<String> * work with dwr frontend, most of the other stuff is Set<String>
*/ */
@ -157,7 +158,7 @@ public class SiteAwareRegistry {
/** /**
* Checks to see if the given site is active * Checks to see if the given site is active
* *
* @param site * @param site
* The site to check * The site to check
* @return True if the site is active, else false * @return True if the site is active, else false
@ -183,7 +184,7 @@ public class SiteAwareRegistry {
/** /**
* activate the site specified in each listener * activate the site specified in each listener
* *
* @param siteID * @param siteID
*/ */
public void activateSite(String siteID) { public void activateSite(String siteID) {
@ -204,7 +205,7 @@ public class SiteAwareRegistry {
/** /**
* deactivate the site specified in each listener * deactivate the site specified in each listener
* *
* @param siteID * @param siteID
*/ */
public void deactivateSite(String siteID) { public void deactivateSite(String siteID) {
@ -224,7 +225,7 @@ public class SiteAwareRegistry {
/** /**
* cycle the site specified in each listener * cycle the site specified in each listener
* *
* @param siteID * @param siteID
*/ */
public void cycleSite(String siteID) { public void cycleSite(String siteID) {
@ -297,7 +298,10 @@ public class SiteAwareRegistry {
in = new BufferedReader(new FileReader(file)); in = new BufferedReader(new FileReader(file));
String site; String site;
while ((site = in.readLine()) != null) { while ((site = in.readLine()) != null) {
activeSites.add(site); site = site.trim();
if (!site.isEmpty()) {
activeSites.add(site);
}
} }
} }
} catch (IOException e) { } catch (IOException e) {