Commits

Chris Thunes committed 4af476d

Replace System.out.print and printStackTrace with proper logging

  • Participants
  • Parent commits b2d2732

Comments (0)

Files changed (23)

File brewtab-irc/pom.xml

     </dependency>
 
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>

File brewtab-irc/src/main/java/com/brewtab/irc/IRCChannel.java

         this.name = name;
         this.joined = new CountDownLatch(1);
         this.listeners = new LinkedList<IRCChannelListener>();
-        this.names = null;
+        this.names = new ArrayList<String>();
 
         /*
          * Build a compound filter collecting messages sent regarding this

File brewtab-irc/src/main/java/com/brewtab/irc/IRCClient.java

 import org.jboss.netty.channel.ChannelFuture;
 import org.jboss.netty.channel.ChannelFutureListener;
 import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.messages.IRCMessage;
 import com.brewtab.irc.messages.IRCMessageType;
 import com.brewtab.irc.protocol.IRCChannelPipelineFactory;
 
 public class IRCClient implements IRCConnectionManager {
+    private static final Logger log = LoggerFactory.getLogger(IRCClient.class);
+
     /* Netty objects */
     private ChannelFactory channelFactory;
     private ClientBootstrap bootstrap;
 
         @Override
         public void run() {
-            this.handler.handleMessage(this.message);
+            try {
+                this.handler.handleMessage(this.message);
+            } catch (Exception e) {
+                log.error("Caught exception from message handler", e);
+            }
         }
     }
 
         return null;
     }
 
+    public IRCPrivateChat getPrivateChat(String nick) {
+        return new IRCPrivateChat(this, nick);
+    }
+
     @Override
     public void onConnect(IRCChannelHandler connection) {
         this.channelHandler = connection;
          * With the underly connection closed we can safely shutdown the thread
          * pool
          */
-        System.out.println("IRCClient.onClose");
+        log.debug("on close");
         synchronized (this.handlers) {
             this.threadPool.shutdown();
         }
 
     @Override
     public void onShutdown() {
-        System.out.println("IRCClient.onShutdown");
+        log.debug("on shutdown");
         this.bootstrap.releaseExternalResources();
     }
 

File brewtab-irc/src/main/java/com/brewtab/irc/protocol/IRCChannelHandler.java

 import org.jboss.netty.channel.ExceptionEvent;
 import org.jboss.netty.channel.MessageEvent;
 import org.jboss.netty.channel.SimpleChannelHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.IRCConnectionManager;
 import com.brewtab.irc.messages.IRCMessage;
  * @author Christopher Thunes <cthunes@brewtab.com>
  */
 public class IRCChannelHandler extends SimpleChannelHandler implements IRCMessagePipe {
+    private static final Logger log = LoggerFactory.getLogger(IRCChannelHandler.class);
+
     /** The connection manager which requests are passed to */
     private IRCConnectionManager connectionManager;
 
 
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
-        System.err.println("Exception caught: " + e.getCause().getMessage());
-        e.getCause().printStackTrace();
+        log.error("Exception caught", e.getCause());
         ctx.getChannel().close();
     }
 

File brewtab-irc/src/main/java/com/brewtab/irc/protocol/IRCMessageDecoder.java

 import org.jboss.netty.channel.Channel;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.messages.IRCInvalidMessageException;
 import com.brewtab.irc.messages.IRCMessage;
  *      http://www.irchelp.org/irchelp/rfc/rfc.html</a>
  */
 public class IRCMessageDecoder extends OneToOneDecoder {
+    private static final Logger log = LoggerFactory.getLogger(IRCMessageDecoder.class);
+
     @Override
     protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) {
         String message = (String) msg;
         try {
             return IRCMessage.fromString(message);
-        } catch (IRCInvalidMessageException except) {
-            System.err.println("Received unknown/invalid message, " + except.getMessage());
+        } catch (IRCInvalidMessageException e) {
+            log.warn("Received unknown/invalid message", e);
             return null;
         }
     }

File brewtab-irc/src/main/java/com/brewtab/irc/protocol/IRCMessageEncoder.java

 
             return buffer.toString();
         } else {
-            System.err.println("Did not receive IRCMessage to encode");
-            return null;
+            throw new IllegalArgumentException("msg must be one of IRCMessage or IRCMessage[]");
         }
     }
 }

File brewtab-ircbot/pom.xml

     </dependency>
 
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>org.htmlparser</groupId>
       <artifactId>htmlparser</artifactId>
     </dependency>

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/Bot.java

 import java.sql.Connection;
 import java.sql.DriverManager;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCClient;
 import com.brewtab.irc.IRCMessageHandler;
 import com.brewtab.irclog.IRCLogger;
 
 public class Bot {
+    private static final Logger log = LoggerFactory.getLogger(Bot.class);
+
     public static void main(String[] args) throws Exception {
         InetSocketAddress addr = new InetSocketAddress("irc.brewtab.com", 6667);
 
         client.addHandler(IRCMessageFilters.PASS, new IRCMessageHandler() {
             @Override
             public void handleMessage(IRCMessage message) {
-                System.out.println("root>>> " + message.toString().trim());
+                log.debug("raw message: {}", message.toString().trim());
             }
         });
 
 
         /* Wait for client object's connection to exit and close */
         client.getConnection().awaitClosed();
-        System.out.println("Exiting");
+        log.info("exiting");
     }
 }

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/BotChannelListener.java

 import java.util.HashMap;
 import java.util.Set;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCChannelListener;
 import com.brewtab.irc.IRCUser;
 import com.brewtab.ircbot.applets.BotApplet;
 
 public class BotChannelListener implements IRCChannelListener, BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(BotChannelListener.class);
+
     private HashMap<String, BotApplet> applets;
 
     public BotChannelListener() {
                     try {
                         applet.run(channel, from, command, args, unparsedArgs);
                     } catch (Exception e) {
-                        e.printStackTrace();
+                        log.error("applet threw exception", e);
                     }
                 }
             } else if (message.startsWith(myNick + ": ")) {

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/BashApplet.java

 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Node;
 import org.jsoup.nodes.TextNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCUser;
 
 public class BashApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(BashApplet.class);
+
     private Thread quoteFetcher;
     private ArrayBlockingQueue<String[]> quotes;
 
         try {
             doc = Jsoup.connect("http://bash.org/?random1").get();
         } catch (IOException e) {
-            e.printStackTrace();
+            log.error("could not get page", e);
             return;
         }
 
                 try {
                     this.quotes.put(quote.toArray(new String[0]));
                 } catch (InterruptedException e) {
-                    e.printStackTrace();
+                    log.warn("interrupted while populating quotes");
+                    return;
                 }
             }
         }
             String[] quote = this.quotes.take();
             channel.writeMultiple(quote);
         } catch (InterruptedException e) {
-            e.printStackTrace();
+            log.warn("interrupted while retreiving quote");
         }
     }
 }

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/GoogleSuggestsApplet.java

 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFactory;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 
 import com.brewtab.ircbot.util.URLBuilder;
 
 public class GoogleSuggestsApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(GoogleSuggestsApplet.class);
+
     private DocumentBuilder documentBuilder;
     private XPath xpath;
     private int counter;
         try {
             this.documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
         } catch (ParserConfigurationException e) {
-            e.printStackTrace();
+            throw new RuntimeException(e);
         }
 
         this.xpath = XPathFactory.newInstance().newXPath();
         try {
             url = new URLBuilder("http://google.com/complete/search");
         } catch (MalformedURLException e) {
-            e.printStackTrace();
-            return;
+            throw new RuntimeException(e);
         }
 
         url.setParameter("output", "toolbar");
                 channel.write("No suggestions found");
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("exception while extracting suggestion from page", e);
             return;
         }
     }

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/GroupHugApplet.java

 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCUser;
 
 public class GroupHugApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(GroupHugApplet.class);
+
     private String url;
     private LinkedBlockingQueue<String> confessions;
     private SynchronousQueue<String> errorMessage;
             return;
         } catch (IOException e) {
             this.errorMessage.put("Caught exception while connecting to grouphug.us: " + e.getClass() + e.getMessage());
-            e.printStackTrace();
+            log.error("exception while retrieving page", e);
             return;
         }
 

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/HttpGetApplet.java

 
 import org.jsoup.Connection;
 import org.jsoup.Jsoup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCUser;
 
 public class HttpGetApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(HttpGetApplet.class);
+
     private String url;
 
     public HttpGetApplet(String url) {
             }
         } catch (IOException e) {
             channel.write("Unknown error occured");
-            e.printStackTrace();
+            log.error("error retrieving page", e);
             return;
         }
     }

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/SpellApplet.java

 import java.io.InputStreamReader;
 import java.io.PrintWriter;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCUser;
 
 public class SpellApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(SpellApplet.class);
+
     Process ispellProcess;
     PrintWriter ispellOut;
     BufferedReader ispellIn;
         try {
             this.ispellProcess = (new ProcessBuilder("ispell", "-a")).start();
         } catch (IOException e) {
-            throw new RuntimeException("Could start ispell process");
+            throw new RuntimeException(e);
         }
 
         this.ispellIn = new BufferedReader(new InputStreamReader(this.ispellProcess.getInputStream()));
         try {
             this.ispellIn.readLine();
         } catch (IOException e) {
-            e.printStackTrace();
-            throw new RuntimeException("Error reading from ispell process");
+            throw new RuntimeException(e);
         }
     }
 
             try {
                 line = this.ispellIn.readLine().trim();
             } catch (IOException e) {
-                e.printStackTrace();
+                log.error("error while reading from ispell", e);
                 return;
             }
 

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/TextsFromLastNightApplet.java

 import org.htmlparser.lexer.Lexer;
 import org.htmlparser.util.ParserException;
 import org.htmlparser.util.Translate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCUser;
 
 public class TextsFromLastNightApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(TextsFromLastNightApplet.class);
+
     private URL url;
     private LinkedBlockingQueue<String> texts;
     private SynchronousQueue<String> errorMessage;
                 try {
                     TextsFromLastNightApplet.this.populateTexts();
                 } catch (InterruptedException e) {
-                    // TODO: Log
+                    log.warn("populator thread interrupted, exiting");
                     return;
                 }
             }
         try {
             this.url = new URL(urlString);
         } catch (MalformedURLException e) {
-            e.printStackTrace();
+            throw new RuntimeException(e);
         }
 
         this.texts = new LinkedBlockingQueue<String>(10);
             connection = (HttpURLConnection) this.url.openConnection();
             lexer = new Lexer(connection);
         } catch (IOException e) {
+            log.warn("could not open connection", e);
             this.errorMessage.put("Could not establish a connection to textsfromlastnight.com");
             return;
 
         } catch (ParserException e) {
+            log.error("parse error", e);
             this.errorMessage.put("Parser error");
             return;
-
         }
 
         Node node = null;
                         if (node instanceof Text) {
                             String text = ((Text) node).getText();
                             text = Translate.decode(text);
-                            try {
-                                this.texts.put(text);
-                            } catch (InterruptedException e) {
-                                Thread.currentThread().interrupt();
-                                return;
-                            }
+                            this.texts.put(text);
                         }
                     }
                 }
 
             } catch (ParserException e) {
+                log.error("parse error", e);
                 this.errorMessage.put("Parser error");
                 return;
             }

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/UrbanDictionaryApplet.java

 import org.jsoup.nodes.Node;
 import org.jsoup.nodes.TextNode;
 import org.jsoup.select.Elements;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCUser;
 import com.brewtab.ircbot.util.URLBuilder;
 
 public class UrbanDictionaryApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(UrbanDictionaryApplet.class);
+
     private String textWithBreaks(Element element) {
         StringBuilder buffer = new StringBuilder();
 
             }
         } catch (IOException e) {
             channel.write("Unknown error occured");
-            e.printStackTrace();
+            log.error("caught exception while loading page", e);
             return;
         }
 
                     channel.write("Can not get definition");
                 }
             } catch (Exception e) {
-                e.printStackTrace();
+                log.error("caught exception while parsing", e);
             }
         }
     }

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/WikiApplet.java

 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCUser;
 import com.brewtab.ircbot.util.URLBuilder;
 
 public class WikiApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(WikiApplet.class);
+
     @Override
     public void run(IRCChannel channel, IRCUser from, String command, String[] args, String unparsed) {
         Document doc;
                 }
             }
         } catch (MalformedURLException e) {
-            e.printStackTrace();
+            log.error("malformed url", e);
             return;
         } catch (IOException e) {
+            log.warn("could not retrieve article", e);
             channel.write("No such article");
             return;
         }
                     channel.write("Can not get article summary");
                 }
             } catch (Exception e) {
-                e.printStackTrace();
+                log.error("could not parse document", e);
             }
         }
     }

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/applets/WolframAlphaApplet.java

 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathFactory;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.ircbot.util.URLBuilder;
 
 public class WolframAlphaApplet implements BotApplet {
+    private static final Logger log = LoggerFactory.getLogger(WolframAlphaApplet.class);
+
     private DocumentBuilder documentBuilder;
     private XPath xpath;
     private String appid;
         try {
             this.documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
         } catch (ParserConfigurationException e) {
-            e.printStackTrace();
+            throw new RuntimeException(e);
         }
 
         this.xpath = XPathFactory.newInstance().newXPath();
         try {
             url = new URLBuilder("http://api.wolframalpha.com/v2/query");
         } catch (MalformedURLException e) {
-            e.printStackTrace();
-            return;
+            throw new RuntimeException(e);
         }
 
         url.setParameter("appid", this.appid);
                 channel.write("Could not interpret query");
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("caught exception while parsing results", e);
             return;
         }
     }

File brewtab-ircbot/src/main/java/com/brewtab/ircbot/util/URLBuilder.java

         try {
             return URLEncoder.encode(s, "UTF8");
         } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
             throw new RuntimeException("Runtime does not support UTF8 encoding");
         }
     }
         try {
             return URLDecoder.decode(s, "UTF8");
         } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
             throw new RuntimeException("Runtime does not support UTF8 encoding");
         }
     }

File brewtab-ircbot/src/main/java/com/brewtab/irclog/IRCLogger.java

 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.brewtab.irc.IRCChannel;
 import com.brewtab.irc.IRCChannelListener;
 import com.brewtab.irc.IRCUser;
 
 public class IRCLogger implements IRCChannelListener {
+    private static final Logger log = LoggerFactory.getLogger(IRCLogger.class);
+
     private Connection db;
     private PreparedStatement eventStatement;
     private PreparedStatement messageStatement;
                     }
                 }
             } else {
-                System.err.println("Unknown line: " + line);
+                IRCLogger.log.warn("Unknown line: {}", line);
             }
             line = reader.readLine();
         }
         try {
             this.logJoin(this.getCurrentTimestamp(), channel.getName(), user.getNick());
         } catch (SQLException e) {
-            e.printStackTrace();
+            log.error("SQL error while logging join", e);
         }
     }
 
         try {
             this.logPart(this.getCurrentTimestamp(), channel.getName(), user.getNick());
         } catch (SQLException e) {
-            e.printStackTrace();
+            log.error("SQL error while loggin part", e);
         }
     }
 
         try {
             this.logQuit(this.getCurrentTimestamp(), channel.getName(), user.getNick());
         } catch (SQLException e) {
-            e.printStackTrace();
+            log.error("SQL error while logging quit", e);
         }
     }
 
         try {
             this.logMessage(this.getCurrentTimestamp(), channel.getName(), from.getNick(), message);
         } catch (SQLException e) {
-            e.printStackTrace();
+            log.error("SQL error while logging message", e);
         }
     }
 }

File brewtab-ircbot/src/main/java/com/brewtab/irclog/IRCStatistics.java

 import java.util.ArrayList;
 import java.util.List;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class IRCStatistics {
+    private static final Logger log = LoggerFactory.getLogger(IRCStatistics.class);
+
     public static int SEARCH_STARTSWITH = 1;
     public static int SEARCH_CONTAINS = 2;
     public static int SEARCH_MATCHES = 3;
 
             return null;
         } catch (SQLException e) {
-            e.printStackTrace();
+            log.error("sql error", e);
             return null;
         }
     }
 
             return null;
         } catch (SQLException e) {
-            e.printStackTrace();
+            log.error("sql error", e);
             return null;
         }
     }
 
             return messages;
         } catch (SQLException e) {
-            e.printStackTrace();
+            log.error("sql error", e);
             return null;
         }
     }

File brewtab-ircbot/src/main/java/com/brewtab/weather/WeatherService.java

 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
 public class WeatherService {
+    private static final Logger log = LoggerFactory.getLogger(WeatherService.class);
+
     private DocumentBuilderFactory domBuilderFactory;
     private XPath xpath;
 
             this.neighborhoodExpr = this.xpath.compile("neighborhood/text()");
             this.distanceExpr = this.xpath.compile("distance_km/text()");
         } catch (XPathExpressionException e) {
-            // -
+            log.error("caught exception compiling XPath queries", e);
+            throw new RuntimeException(e);
         }
     }
 
         try {
             return (String) expr.evaluate(node, XPathConstants.STRING);
         } catch (XPathExpressionException e) {
-            e.printStackTrace();
+            log.error("error while evaluating XPath query", e);
             return "";
         }
     }
         } catch (SAXException e) {
             throw new WeatherException("Error parsing response");
         } catch (Exception e) {
-            e.printStackTrace();
-            throw new WeatherException("Unexpected exception. Stack trace dumped");
+            log.error("unexpected exception while searching for locations", e);
+            throw new WeatherException("Unexpected exception");
         }
     }
 
         } catch (SAXException e) {
             throw new WeatherException("Error parsing response");
         } catch (Exception e) {
-            e.printStackTrace();
-            throw new WeatherException("Unexpected exception. Stack trace dumped");
+            log.error("unexpected exception while searching for locations", e);
+            throw new WeatherException("Unexpected exception");
         }
     }
 }
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+    <!-- Shared dependency versions -->
+    <slf4j-version>1.7.2</slf4j-version>
   </properties>
 
   <build>
   <dependencyManagement>
     <dependencies>
       <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>${slf4j-version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+        <version>${slf4j-version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>log4j</artifactId>
+        <version>1.2.17</version>
+      </dependency>
+
+      <dependency>
+        <groupId>com.google.guava</groupId>
+        <artifactId>guava</artifactId>
+        <version>13.0.1</version>
+      </dependency>
+
+      <dependency>
         <groupId>org.htmlparser</groupId>
         <artifactId>htmlparser</artifactId>
         <version>2.1</version>