Commit bad5859d authored by guus's avatar guus

* Updating 'clientControl' plugin to make use of SLF4J instead of custom logging (OF-53).

* Applied java generics.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11440 b35dd754-fafc-0310-a699-88a17e54d16e
parent bfdfcae7
...@@ -44,6 +44,13 @@ ...@@ -44,6 +44,13 @@
Client Control Plugin Changelog Client Control Plugin Changelog
</h1> </h1>
<p><b>1.1.0</b> -- December 1, 2009</p>
<ul>
<li>Now requires Openfire 3.6.5.</li>
<li>Applied Java generics.</li>
<li>[<a href='http://www.igniterealtime.org/issues/browse/OF-53'>OF-53</a>] - Replace custom logging implementation with a third party library.</li>
</ul>
<p><b>1.0.3</b> -- August 27, 2008</p> <p><b>1.0.3</b> -- August 27, 2008</p>
<ul> <ul>
<li>Upgraded for Openfire 3.6.0 API.</li> <li>Upgraded for Openfire 3.6.0 API.</li>
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
<name>Client Control</name> <name>Client Control</name>
<description>Controls clients allowed to connect and available features</description> <description>Controls clients allowed to connect and available features</description>
<author>Jive Software</author> <author>Jive Software</author>
<version>1.0.3</version> <version>1.1.0</version>
<date>8/27/2008</date> <date>12/1/2009</date>
<minServerVersion>3.6.0</minServerVersion> <minServerVersion>3.6.5</minServerVersion>
<databaseKey>clientcontrol</databaseKey> <databaseKey>clientcontrol</databaseKey>
<databaseVersion>0</databaseVersion> <databaseVersion>0</databaseVersion>
......
...@@ -19,12 +19,6 @@ ...@@ -19,12 +19,6 @@
package org.jivesoftware.openfire.plugin.spark; package org.jivesoftware.openfire.plugin.spark;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.database.JiveID;
import org.jivesoftware.database.SequenceManager;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.NotFoundException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
...@@ -38,6 +32,13 @@ import java.util.Iterator; ...@@ -38,6 +32,13 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.database.JiveID;
import org.jivesoftware.database.SequenceManager;
import org.jivesoftware.util.NotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Represents a Bookmark. Each bookmark can apply to a set of users and groups, or to * Represents a Bookmark. Each bookmark can apply to a set of users and groups, or to
* everyone in the system. There are two types of bookmarks:<ul> * everyone in the system. There are two types of bookmarks:<ul>
...@@ -63,6 +64,8 @@ import java.util.Map; ...@@ -63,6 +64,8 @@ import java.util.Map;
@JiveID(55) @JiveID(55)
public class Bookmark { public class Bookmark {
private static final Logger Log = LoggerFactory.getLogger(Bookmark.class);
private static final String INSERT_BOOKMARK = private static final String INSERT_BOOKMARK =
"INSERT INTO ofBookmark(bookmarkID, bookmarkType, bookmarkName, bookmarkValue, " + "INSERT INTO ofBookmark(bookmarkID, bookmarkType, bookmarkName, bookmarkValue, " +
"isGlobal) VALUES (?,?,?,?,?)"; "isGlobal) VALUES (?,?,?,?,?)";
...@@ -70,8 +73,8 @@ public class Bookmark { ...@@ -70,8 +73,8 @@ public class Bookmark {
"INSERT INTO ofBookmarkPerm(bookmarkID, bookmarkType, name) VALUES(?,?,?)"; "INSERT INTO ofBookmarkPerm(bookmarkID, bookmarkType, name) VALUES(?,?,?)";
private static final String LOAD_BOOKMARK_PERMISSIONS = private static final String LOAD_BOOKMARK_PERMISSIONS =
"SELECT bookmarkType, name FROM ofBookmarkPerm WHERE bookmarkID=?"; "SELECT bookmarkType, name FROM ofBookmarkPerm WHERE bookmarkID=?";
private static final String SAVE_BOOKMARK_PERMISSIONS = // private static final String SAVE_BOOKMARK_PERMISSIONS =
"UPDATE ofBookmarkPerm SET bookmarkType=?, name=? WHERE bookmarkID=?"; // "UPDATE ofBookmarkPerm SET bookmarkType=?, name=? WHERE bookmarkID=?";
private static final String DELETE_BOOKMARK_PERMISSIONS = private static final String DELETE_BOOKMARK_PERMISSIONS =
"DELETE from ofBookmarkPerm WHERE bookmarkID=?"; "DELETE from ofBookmarkPerm WHERE bookmarkID=?";
private static final String SAVE_BOOKMARK = private static final String SAVE_BOOKMARK =
...@@ -120,7 +123,7 @@ public class Bookmark { ...@@ -120,7 +123,7 @@ public class Bookmark {
insertBookmarkPermissions(); insertBookmarkPermissions();
} }
catch (Exception e) { catch (Exception e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
} }
...@@ -360,7 +363,7 @@ public class Bookmark { ...@@ -360,7 +363,7 @@ public class Bookmark {
* *
* @return an Iterator for the names of the extended properties. * @return an Iterator for the names of the extended properties.
*/ */
public Iterator getPropertyNames() { public Iterator<String> getPropertyNames() {
if (properties == null) { if (properties == null) {
loadPropertiesFromDb(); loadPropertiesFromDb();
} }
...@@ -418,7 +421,7 @@ public class Bookmark { ...@@ -418,7 +421,7 @@ public class Bookmark {
deleteBookmarkPermissions(); deleteBookmarkPermissions();
} }
catch (SQLException e) { catch (SQLException e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
// Persist users // Persist users
...@@ -428,7 +431,7 @@ public class Bookmark { ...@@ -428,7 +431,7 @@ public class Bookmark {
insertBookmarkPermission(USERS, user); insertBookmarkPermission(USERS, user);
} }
catch (SQLException e) { catch (SQLException e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
} }
} }
...@@ -439,7 +442,7 @@ public class Bookmark { ...@@ -439,7 +442,7 @@ public class Bookmark {
insertBookmarkPermission(GROUPS, group); insertBookmarkPermission(GROUPS, group);
} }
catch (SQLException e) { catch (SQLException e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
} }
} }
...@@ -514,7 +517,7 @@ public class Bookmark { ...@@ -514,7 +517,7 @@ public class Bookmark {
groups = groupList; groups = groupList;
} }
catch (SQLException sqle) { catch (SQLException sqle) {
Log.error(sqle); Log.error(sqle.getMessage(), sqle);
} }
finally { finally {
DbConnectionManager.closeConnection(rs, pstmt, con); DbConnectionManager.closeConnection(rs, pstmt, con);
...@@ -547,7 +550,7 @@ public class Bookmark { ...@@ -547,7 +550,7 @@ public class Bookmark {
pstmt.close(); pstmt.close();
} }
catch (SQLException sqle) { catch (SQLException sqle) {
Log.error(sqle); Log.error(sqle.getMessage(), sqle);
} }
finally { finally {
DbConnectionManager.closeConnection(rs, pstmt, con); DbConnectionManager.closeConnection(rs, pstmt, con);
...@@ -573,7 +576,7 @@ public class Bookmark { ...@@ -573,7 +576,7 @@ public class Bookmark {
} }
catch (SQLException sqle) { catch (SQLException sqle) {
abortTransaction = true; abortTransaction = true;
Log.error(sqle); Log.error(sqle.getMessage(), sqle);
} }
finally { finally {
DbConnectionManager.closeTransactionConnection(con, abortTransaction); DbConnectionManager.closeTransactionConnection(con, abortTransaction);
...@@ -600,7 +603,7 @@ public class Bookmark { ...@@ -600,7 +603,7 @@ public class Bookmark {
rs.close(); rs.close();
} }
catch (SQLException sqle) { catch (SQLException sqle) {
Log.error(sqle); Log.error(sqle.getMessage(), sqle);
} }
finally { finally {
DbConnectionManager.closeConnection(pstmt, con); DbConnectionManager.closeConnection(pstmt, con);
...@@ -623,7 +626,7 @@ public class Bookmark { ...@@ -623,7 +626,7 @@ public class Bookmark {
pstmt.executeUpdate(); pstmt.executeUpdate();
} }
catch (SQLException sqle) { catch (SQLException sqle) {
Log.error(sqle); Log.error(sqle.getMessage(), sqle);
abortTransaction = true; abortTransaction = true;
} }
finally { finally {
...@@ -647,7 +650,7 @@ public class Bookmark { ...@@ -647,7 +650,7 @@ public class Bookmark {
pstmt.executeUpdate(); pstmt.executeUpdate();
} }
catch (SQLException sqle) { catch (SQLException sqle) {
Log.error(sqle); Log.error(sqle.getMessage(), sqle);
abortTransaction = true; abortTransaction = true;
} }
finally { finally {
...@@ -670,7 +673,7 @@ public class Bookmark { ...@@ -670,7 +673,7 @@ public class Bookmark {
pstmt.execute(); pstmt.execute();
} }
catch (SQLException sqle) { catch (SQLException sqle) {
Log.error(sqle); Log.error(sqle.getMessage(), sqle);
abortTransaction = true; abortTransaction = true;
} }
finally { finally {
......
...@@ -16,8 +16,10 @@ ...@@ -16,8 +16,10 @@
package org.jivesoftware.openfire.plugin.spark; package org.jivesoftware.openfire.plugin.spark;
import java.util.Collection;
import java.util.Iterator;
import org.dom4j.Element; import org.dom4j.Element;
import org.jivesoftware.util.Log;
import org.jivesoftware.openfire.group.Group; import org.jivesoftware.openfire.group.Group;
import org.jivesoftware.openfire.group.GroupManager; import org.jivesoftware.openfire.group.GroupManager;
import org.jivesoftware.openfire.group.GroupNotFoundException; import org.jivesoftware.openfire.group.GroupNotFoundException;
...@@ -27,13 +29,12 @@ import org.jivesoftware.openfire.interceptor.PacketRejectedException; ...@@ -27,13 +29,12 @@ import org.jivesoftware.openfire.interceptor.PacketRejectedException;
import org.jivesoftware.openfire.session.Session; import org.jivesoftware.openfire.session.Session;
import org.jivesoftware.openfire.user.UserManager; import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.user.UserNotFoundException; import org.jivesoftware.openfire.user.UserNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.IQ; import org.xmpp.packet.IQ;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import java.util.Collection;
import java.util.Iterator;
/** /**
* Intercepts Bookmark Storage requests and appends all server based Bookmarks to * Intercepts Bookmark Storage requests and appends all server based Bookmarks to
* the result. * the result.
...@@ -42,6 +43,8 @@ import java.util.Iterator; ...@@ -42,6 +43,8 @@ import java.util.Iterator;
*/ */
public class BookmarkInterceptor implements PacketInterceptor { public class BookmarkInterceptor implements PacketInterceptor {
private static final Logger Log = LoggerFactory.getLogger(BookmarkInterceptor.class);
/** /**
* Initializes the BookmarkInterceptor and needed Server instances. * Initializes the BookmarkInterceptor and needed Server instances.
*/ */
...@@ -138,7 +141,7 @@ public class BookmarkInterceptor implements PacketInterceptor { ...@@ -138,7 +141,7 @@ public class BookmarkInterceptor implements PacketInterceptor {
} }
} }
catch (GroupNotFoundException e) { catch (GroupNotFoundException e) {
Log.debug(e); Log.debug(e.getMessage(), e);
} }
} }
} }
...@@ -200,7 +203,7 @@ public class BookmarkInterceptor implements PacketInterceptor { ...@@ -200,7 +203,7 @@ public class BookmarkInterceptor implements PacketInterceptor {
} }
catch (Exception e) { catch (Exception e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
} }
} }
...@@ -224,9 +227,9 @@ public class BookmarkInterceptor implements PacketInterceptor { ...@@ -224,9 +227,9 @@ public class BookmarkInterceptor implements PacketInterceptor {
private static Element urlExists(Element element, String url) { private static Element urlExists(Element element, String url) {
// Iterate through current elements to see if this url already exists. // Iterate through current elements to see if this url already exists.
// If one does not exist, then add the bookmark. // If one does not exist, then add the bookmark.
final Iterator urlBookmarks = element.elementIterator("url"); final Iterator<Element> urlBookmarks = element.elementIterator("url");
while (urlBookmarks.hasNext()) { while (urlBookmarks.hasNext()) {
Element urlElement = (Element)urlBookmarks.next(); Element urlElement = urlBookmarks.next();
String urlValue = urlElement.attributeValue("url"); String urlValue = urlElement.attributeValue("url");
if (urlValue.equalsIgnoreCase(url)) { if (urlValue.equalsIgnoreCase(url)) {
return urlElement; return urlElement;
...@@ -246,9 +249,9 @@ public class BookmarkInterceptor implements PacketInterceptor { ...@@ -246,9 +249,9 @@ public class BookmarkInterceptor implements PacketInterceptor {
private Element conferenceExists(Element element, String roomJID) { private Element conferenceExists(Element element, String roomJID) {
// Iterate through current elements to see if the conference bookmark // Iterate through current elements to see if the conference bookmark
// already exists. // already exists.
final Iterator conferences = element.elementIterator("conference"); final Iterator<Element> conferences = element.elementIterator("conference");
while (conferences.hasNext()) { while (conferences.hasNext()) {
final Element conferenceElement = (Element)conferences.next(); final Element conferenceElement = conferences.next();
String jidValue = conferenceElement.attributeValue("jid"); String jidValue = conferenceElement.attributeValue("jid");
if (jidValue != null && roomJID != null && jidValue.equalsIgnoreCase(roomJID)) { if (jidValue != null && roomJID != null && jidValue.equalsIgnoreCase(roomJID)) {
......
...@@ -16,10 +16,6 @@ ...@@ -16,10 +16,6 @@
package org.jivesoftware.openfire.plugin.spark; package org.jivesoftware.openfire.plugin.spark;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.NotFoundException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
...@@ -28,6 +24,11 @@ import java.util.ArrayList; ...@@ -28,6 +24,11 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.util.NotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Manages global bookmarks. Bookmarks are defined by * Manages global bookmarks. Bookmarks are defined by
* <a href="http://www.jabber.org/jeps/jep-0048.html">JEP-0048</a>. Users can define and * <a href="http://www.jabber.org/jeps/jep-0048.html">JEP-0048</a>. Users can define and
...@@ -39,6 +40,8 @@ import java.util.List; ...@@ -39,6 +40,8 @@ import java.util.List;
*/ */
public class BookmarkManager { public class BookmarkManager {
private static final Logger Log = LoggerFactory.getLogger(BookmarkManager.class);
private static final String DELETE_BOOKMARK = "DELETE FROM ofBookmark where bookmarkID=?"; private static final String DELETE_BOOKMARK = "DELETE FROM ofBookmark where bookmarkID=?";
private static final String SELECT_BOOKMARKS = "SELECT bookmarkID from ofBookmark"; private static final String SELECT_BOOKMARKS = "SELECT bookmarkID from ofBookmark";
...@@ -77,12 +80,12 @@ public class BookmarkManager { ...@@ -77,12 +80,12 @@ public class BookmarkManager {
bookmarks.add(bookmark); bookmarks.add(bookmark);
} }
catch (NotFoundException nfe) { catch (NotFoundException nfe) {
Log.error(nfe); Log.error(nfe.getMessage(), nfe);
} }
} }
} }
catch (SQLException e) { catch (SQLException e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
finally { finally {
DbConnectionManager.closeConnection(rs, pstmt, con); DbConnectionManager.closeConnection(rs, pstmt, con);
...@@ -107,7 +110,7 @@ public class BookmarkManager { ...@@ -107,7 +110,7 @@ public class BookmarkManager {
pstmt.execute(); pstmt.execute();
} }
catch (SQLException e) { catch (SQLException e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
finally { finally {
DbConnectionManager.closeConnection(pstmt, con); DbConnectionManager.closeConnection(pstmt, con);
......
...@@ -16,27 +16,33 @@ ...@@ -16,27 +16,33 @@
package org.jivesoftware.openfire.plugin.spark; package org.jivesoftware.openfire.plugin.spark;
import org.jivesoftware.openfire.plugin.spark.manager.SparkVersionManager; import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicInteger;
import org.dom4j.Element; import org.dom4j.Element;
import org.jivesoftware.openfire.SessionManager; import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.event.SessionEventDispatcher; import org.jivesoftware.openfire.event.SessionEventDispatcher;
import org.jivesoftware.openfire.event.SessionEventListener; import org.jivesoftware.openfire.event.SessionEventListener;
import org.jivesoftware.openfire.plugin.spark.manager.SparkVersionManager;
import org.jivesoftware.openfire.session.ClientSession; import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.openfire.session.Session; import org.jivesoftware.openfire.session.Session;
import org.jivesoftware.openfire.stats.StatisticsManager; import org.jivesoftware.openfire.stats.StatisticsManager;
import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.component.Component; import org.xmpp.component.Component;
import org.xmpp.component.ComponentException; import org.xmpp.component.ComponentException;
import org.xmpp.component.ComponentManager; import org.xmpp.component.ComponentManager;
import org.xmpp.component.ComponentManagerFactory; import org.xmpp.component.ComponentManagerFactory;
import org.xmpp.packet.*; import org.xmpp.packet.IQ;
import org.xmpp.packet.JID;
import java.util.ArrayList; import org.xmpp.packet.Message;
import java.util.List; import org.xmpp.packet.Packet;
import java.util.StringTokenizer; import org.xmpp.packet.PacketError;
import java.util.TimerTask; import org.xmpp.packet.StreamError;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* Handles querying and notifications of enabled client features within the server, as well * Handles querying and notifications of enabled client features within the server, as well
...@@ -46,6 +52,8 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -46,6 +52,8 @@ import java.util.concurrent.atomic.AtomicInteger;
*/ */
public class SparkManager implements Component { public class SparkManager implements Component {
private static final Logger Log = LoggerFactory.getLogger(SparkManager.class);
private static final String INVALID_DISCONNECTS_KEY = "disconnects"; private static final String INVALID_DISCONNECTS_KEY = "disconnects";
private static final String SPARK_CLIENTS_KEY = "spark"; private static final String SPARK_CLIENTS_KEY = "spark";
...@@ -89,7 +97,7 @@ public class SparkManager implements Component { ...@@ -89,7 +97,7 @@ public class SparkManager implements Component {
componentManager.addComponent(serviceName, this); componentManager.addComponent(serviceName, this);
} }
catch (Exception e) { catch (Exception e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
// Add VersionManager. This component is cluster-safe. // Add VersionManager. This component is cluster-safe.
...@@ -97,7 +105,7 @@ public class SparkManager implements Component { ...@@ -97,7 +105,7 @@ public class SparkManager implements Component {
componentManager.addComponent(SparkVersionManager.SERVICE_NAME, new SparkVersionManager()); componentManager.addComponent(SparkVersionManager.SERVICE_NAME, new SparkVersionManager());
} }
catch (Exception e) { catch (Exception e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
// Add SessionListener // Add SessionListener
...@@ -253,7 +261,7 @@ public class SparkManager implements Component { ...@@ -253,7 +261,7 @@ public class SparkManager implements Component {
componentManager.removeComponent(serviceName); componentManager.removeComponent(serviceName);
} }
catch (ComponentException e) { catch (ComponentException e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
taskEngine = null; taskEngine = null;
...@@ -315,7 +323,7 @@ public class SparkManager implements Component { ...@@ -315,7 +323,7 @@ public class SparkManager implements Component {
componentManager.sendPacket(this, packet); componentManager.sendPacket(this, packet);
} }
catch (ComponentException e) { catch (ComponentException e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
} }
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package org.jivesoftware.openfire.plugin.spark; package org.jivesoftware.openfire.plugin.spark;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
...@@ -247,22 +246,22 @@ public final class SparkUtil { ...@@ -247,22 +246,22 @@ public final class SparkUtil {
public static String getTimeFromLong(long diff) { public static String getTimeFromLong(long diff) {
final String HOURS = "h"; final String HOURS = "h";
final String MINUTES = "min"; final String MINUTES = "min";
final String SECONDS = "sec"; //final String SECONDS = "sec";
final long MS_IN_A_DAY = 1000 * 60 * 60 * 24; final long MS_IN_A_DAY = 1000 * 60 * 60 * 24;
final long MS_IN_AN_HOUR = 1000 * 60 * 60; final long MS_IN_AN_HOUR = 1000 * 60 * 60;
final long MS_IN_A_MINUTE = 1000 * 60; final long MS_IN_A_MINUTE = 1000 * 60;
final long MS_IN_A_SECOND = 1000; final long MS_IN_A_SECOND = 1000;
Date currentTime = new Date(); //Date currentTime = new Date();
long numDays = diff / MS_IN_A_DAY; //long numDays = diff / MS_IN_A_DAY;
diff = diff % MS_IN_A_DAY; diff = diff % MS_IN_A_DAY;
long numHours = diff / MS_IN_AN_HOUR; long numHours = diff / MS_IN_AN_HOUR;
diff = diff % MS_IN_AN_HOUR; diff = diff % MS_IN_AN_HOUR;
long numMinutes = diff / MS_IN_A_MINUTE; long numMinutes = diff / MS_IN_A_MINUTE;
diff = diff % MS_IN_A_MINUTE; diff = diff % MS_IN_A_MINUTE;
long numSeconds = diff / MS_IN_A_SECOND; //long numSeconds = diff / MS_IN_A_SECOND;
diff = diff % MS_IN_A_SECOND; diff = diff % MS_IN_A_SECOND;
long numMilliseconds = diff; //long numMilliseconds = diff;
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
if (numHours > 0) { if (numHours > 0) {
...@@ -288,8 +287,8 @@ public final class SparkUtil { ...@@ -288,8 +287,8 @@ public final class SparkUtil {
/** /**
* Build a List of all elements in an Iterator. * Build a List of all elements in an Iterator.
*/ */
public static List iteratorAsList(Iterator i) { public static <E> List<E> iteratorAsList(Iterator<E> i) {
ArrayList list = new ArrayList(10); ArrayList<E> list = new ArrayList<E>(10);
while (i.hasNext()) { while (i.hasNext()) {
list.add(i.next()); list.add(i.next());
} }
...@@ -299,18 +298,18 @@ public final class SparkUtil { ...@@ -299,18 +298,18 @@ public final class SparkUtil {
/** /**
* Creates an Iterator that is the reverse of a ListIterator. * Creates an Iterator that is the reverse of a ListIterator.
*/ */
public static Iterator reverseListIterator(ListIterator i) { public static <E> Iterator<E> reverseListIterator(ListIterator<E> i) {
return new ReverseListIterator(i); return new ReverseListIterator<E>(i);
} }
} }
/** /**
* An Iterator that is the reverse of a ListIterator. * An Iterator that is the reverse of a ListIterator.
*/ */
class ReverseListIterator implements Iterator { class ReverseListIterator<E> implements Iterator<E> {
private ListIterator listIterator; private ListIterator<E> listIterator;
ReverseListIterator(ListIterator i) { ReverseListIterator(ListIterator<E> i) {
listIterator = i; listIterator = i;
while (listIterator.hasNext()) listIterator.next(); while (listIterator.hasNext()) listIterator.next();
} }
...@@ -319,7 +318,7 @@ class ReverseListIterator implements Iterator { ...@@ -319,7 +318,7 @@ class ReverseListIterator implements Iterator {
return listIterator.hasPrevious(); return listIterator.hasPrevious();
} }
public Object next() { public E next() {
return listIterator.previous(); return listIterator.previous();
} }
......
...@@ -20,10 +20,13 @@ ...@@ -20,10 +20,13 @@
package org.jivesoftware.openfire.plugin.spark.manager; package org.jivesoftware.openfire.plugin.spark.manager;
import java.io.File;
import org.dom4j.Element; import org.dom4j.Element;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.util.JiveGlobals;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.component.Component; import org.xmpp.component.Component;
import org.xmpp.component.ComponentException; import org.xmpp.component.ComponentException;
import org.xmpp.component.ComponentManager; import org.xmpp.component.ComponentManager;
...@@ -33,8 +36,6 @@ import org.xmpp.packet.JID; ...@@ -33,8 +36,6 @@ import org.xmpp.packet.JID;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import org.xmpp.packet.PacketError; import org.xmpp.packet.PacketError;
import java.io.File;
/** /**
* Provides support for server administrators to control the global updating of the Jive Spark IM client. * Provides support for server administrators to control the global updating of the Jive Spark IM client.
* (<a href="http://www.igniterealtime.org/projects/spark/index.jsp">Spark</a>).<p> * (<a href="http://www.igniterealtime.org/projects/spark/index.jsp">Spark</a>).<p>
...@@ -48,6 +49,8 @@ import java.io.File; ...@@ -48,6 +49,8 @@ import java.io.File;
*/ */
public class SparkVersionManager implements Component { public class SparkVersionManager implements Component {
private static final Logger Log = LoggerFactory.getLogger(SparkVersionManager.class);
private ComponentManager componentManager; private ComponentManager componentManager;
public static String SERVICE_NAME = "updater"; public static String SERVICE_NAME = "updater";
...@@ -231,7 +234,7 @@ public class SparkVersionManager implements Component { ...@@ -231,7 +234,7 @@ public class SparkVersionManager implements Component {
componentManager.sendPacket(this, packet); componentManager.sendPacket(this, packet);
} }
catch (ComponentException e) { catch (ComponentException e) {
Log.error(e); Log.error(e.getMessage(), e);
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment