Group.getByName() removed. Channel.getByName() does no longer catch StorageBackendExceptions but throw them further.
authorcli
Wed, 12 May 2010 11:18:02 +0200
changeset 31087ef6fe6a1a
parent 30 146b3275b792
child 32 3af4237e4a15
child 33 f9bf183447d1
Group.getByName() removed. Channel.getByName() does no longer catch StorageBackendExceptions but throw them further.
org/sonews/daemon/command/XDaemonCommand.java
org/sonews/storage/Channel.java
org/sonews/storage/Group.java
org/sonews/util/Stats.java
     1.1 --- a/org/sonews/daemon/command/XDaemonCommand.java	Sun May 09 12:38:46 2010 +0200
     1.2 +++ b/org/sonews/daemon/command/XDaemonCommand.java	Wed May 12 11:18:02 2010 +0200
     1.3 @@ -27,6 +27,7 @@
     1.4  import org.sonews.storage.StorageManager;
     1.5  import org.sonews.feed.FeedManager;
     1.6  import org.sonews.feed.Subscription;
     1.7 +import org.sonews.storage.Channel;
     1.8  import org.sonews.storage.Group;
     1.9  import org.sonews.util.Stats;
    1.10  
    1.11 @@ -177,7 +178,7 @@
    1.12          Group group = null;
    1.13          if(commands.length > 3)
    1.14          {
    1.15 -          group = Group.getByName(commands[3]);
    1.16 +          group = (Group)Channel.getByName(commands[3]);
    1.17          }
    1.18  
    1.19          if(commands[2].equalsIgnoreCase("CONNECTED_CLIENTS"))
     2.1 --- a/org/sonews/storage/Channel.java	Sun May 09 12:38:46 2010 +0200
     2.2 +++ b/org/sonews/storage/Channel.java	Wed May 12 11:18:02 2010 +0200
     2.3 @@ -73,8 +73,9 @@
     2.4    }
     2.5  
     2.6    public static Channel getByName(String name)
     2.7 +    throws StorageBackendException
     2.8    {
     2.9 -    return Group.getByName(name);
    2.10 +    return StorageManager.current().getGroup(name);
    2.11    }
    2.12  
    2.13    public abstract Article getArticle(long idx)
     3.1 --- a/org/sonews/storage/Group.java	Sun May 09 12:38:46 2010 +0200
     3.2 +++ b/org/sonews/storage/Group.java	Wed May 12 11:18:02 2010 +0200
     3.3 @@ -35,24 +35,6 @@
     3.4    private long   id     = 0;
     3.5    private int    flags  = -1;
     3.6    private String name   = null;
     3.7 -  
     3.8 -  /**
     3.9 -   * Returns a Group identified by its full name.
    3.10 -   * @param name
    3.11 -   * @return
    3.12 -   */
    3.13 -  public static Group getByName(final String name)
    3.14 -  {
    3.15 -    try
    3.16 -    {
    3.17 -      return StorageManager.current().getGroup(name);
    3.18 -    }
    3.19 -    catch(StorageBackendException ex)
    3.20 -    {
    3.21 -      ex.printStackTrace();
    3.22 -      return null;
    3.23 -    }
    3.24 -  }
    3.25  
    3.26    /**
    3.27     * @return List of all groups this server handles.
     4.1 --- a/org/sonews/util/Stats.java	Sun May 09 12:38:46 2010 +0200
     4.2 +++ b/org/sonews/util/Stats.java	Wed May 12 11:18:02 2010 +0200
     4.3 @@ -59,25 +59,26 @@
     4.4     */
     4.5    private void addEvent(byte type, String groupname)
     4.6    {
     4.7 -    if(Config.inst().get(Config.EVENTLOG, true))
     4.8 +    try
     4.9      {
    4.10 -      Channel group = Channel.getByName(groupname);
    4.11 -      if(group != null)
    4.12 +      if (Config.inst().get(Config.EVENTLOG, true))
    4.13        {
    4.14 -        try
    4.15 +
    4.16 +        Channel group = Channel.getByName(groupname);
    4.17 +        if (group != null)
    4.18          {
    4.19            StorageManager.current().addEvent(
    4.20 -            System.currentTimeMillis(), type, group.getInternalID());
    4.21 +                  System.currentTimeMillis(), type, group.getInternalID());
    4.22          }
    4.23 -        catch(StorageBackendException ex)
    4.24 -        {
    4.25 -          ex.printStackTrace();
    4.26 -        }
    4.27 -      }
    4.28 +      } 
    4.29        else
    4.30        {
    4.31          Log.get().info("Group " + groupname + " does not exist.");
    4.32        }
    4.33 +    } 
    4.34 +    catch (StorageBackendException ex)
    4.35 +    {
    4.36 +      ex.printStackTrace();
    4.37      }
    4.38    }
    4.39