# HG changeset patch # User cli # Date 1273655882 -7200 # Node ID 087ef6fe6a1a66241b9b4114ff92450ba136f3ab # Parent 146b3275b792ee1e4e642522fa07a893c94b2ea5 Group.getByName() removed. Channel.getByName() does no longer catch StorageBackendExceptions but throw them further. diff -r 146b3275b792 -r 087ef6fe6a1a org/sonews/daemon/command/XDaemonCommand.java --- a/org/sonews/daemon/command/XDaemonCommand.java Sun May 09 12:38:46 2010 +0200 +++ b/org/sonews/daemon/command/XDaemonCommand.java Wed May 12 11:18:02 2010 +0200 @@ -27,6 +27,7 @@ import org.sonews.storage.StorageManager; import org.sonews.feed.FeedManager; import org.sonews.feed.Subscription; +import org.sonews.storage.Channel; import org.sonews.storage.Group; import org.sonews.util.Stats; @@ -177,7 +178,7 @@ Group group = null; if(commands.length > 3) { - group = Group.getByName(commands[3]); + group = (Group)Channel.getByName(commands[3]); } if(commands[2].equalsIgnoreCase("CONNECTED_CLIENTS")) diff -r 146b3275b792 -r 087ef6fe6a1a org/sonews/storage/Channel.java --- a/org/sonews/storage/Channel.java Sun May 09 12:38:46 2010 +0200 +++ b/org/sonews/storage/Channel.java Wed May 12 11:18:02 2010 +0200 @@ -73,8 +73,9 @@ } public static Channel getByName(String name) + throws StorageBackendException { - return Group.getByName(name); + return StorageManager.current().getGroup(name); } public abstract Article getArticle(long idx) diff -r 146b3275b792 -r 087ef6fe6a1a org/sonews/storage/Group.java --- a/org/sonews/storage/Group.java Sun May 09 12:38:46 2010 +0200 +++ b/org/sonews/storage/Group.java Wed May 12 11:18:02 2010 +0200 @@ -35,24 +35,6 @@ private long id = 0; private int flags = -1; private String name = null; - - /** - * Returns a Group identified by its full name. - * @param name - * @return - */ - public static Group getByName(final String name) - { - try - { - return StorageManager.current().getGroup(name); - } - catch(StorageBackendException ex) - { - ex.printStackTrace(); - return null; - } - } /** * @return List of all groups this server handles. diff -r 146b3275b792 -r 087ef6fe6a1a org/sonews/util/Stats.java --- a/org/sonews/util/Stats.java Sun May 09 12:38:46 2010 +0200 +++ b/org/sonews/util/Stats.java Wed May 12 11:18:02 2010 +0200 @@ -59,25 +59,26 @@ */ private void addEvent(byte type, String groupname) { - if(Config.inst().get(Config.EVENTLOG, true)) + try { - Channel group = Channel.getByName(groupname); - if(group != null) + if (Config.inst().get(Config.EVENTLOG, true)) { - try + + Channel group = Channel.getByName(groupname); + if (group != null) { StorageManager.current().addEvent( - System.currentTimeMillis(), type, group.getInternalID()); + System.currentTimeMillis(), type, group.getInternalID()); } - catch(StorageBackendException ex) - { - ex.printStackTrace(); - } - } + } else { Log.get().info("Group " + groupname + " does not exist."); } + } + catch (StorageBackendException ex) + { + ex.printStackTrace(); } }