Don’t try to parse when no parser was found.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 16 Mar 2009 23:10:44 +0000 (00:10 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 16 Mar 2009 23:10:44 +0000 (00:10 +0100)
src/net/pterodactylus/arachne/core/URLFetcher.java

index de09f71..ea109d0 100644 (file)
@@ -121,6 +121,10 @@ class URLFetcher implements Runnable, ParserListener {
                        urlInputStream = urlConnection.getInputStream();
                        hashInputStream = new MessageDigestInputStream(urlInputStream, messageDigest);
                        Parser parser = parserFactory.getParser(contentType);
+                       if (parser == null) {
+                               logger.log(Level.INFO, "No parser found for “" + contentType + "”.");
+                               return;
+                       }
                        parser.parse(this, hashInputStream, "UTF-8");
                        hash = messageDigest.digest();
                } catch (IOException ioe1) {