fix for uncaught exception in RSSReader

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5482 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 05c235de32
commit bed38a5f8c

@ -21,6 +21,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import de.anomic.http.httpRequestHeader; import de.anomic.http.httpRequestHeader;
@ -52,6 +53,7 @@ public class FeedReader_p {
// int maxitems=Integer.parseInt(post.get("max", "0")); // int maxitems=Integer.parseInt(post.get("max", "0"));
// int offset=Integer.parseInt(post.get("offset", "0")); //offset to the first displayed item // int offset=Integer.parseInt(post.get("offset", "0")); //offset to the first displayed item
try {
final RSSFeed feed = new RSSReader(url.toString()).getFeed(); final RSSFeed feed = new RSSReader(url.toString()).getFeed();
prop.putHTML("page_title", feed.getChannel().getTitle()); prop.putHTML("page_title", feed.getChannel().getTitle());
@ -74,6 +76,9 @@ public class FeedReader_p {
} }
prop.put("page_items", feed.size()); prop.put("page_items", feed.size());
prop.put("page", "1"); prop.put("page", "1");
} catch (IOException e) {
e.printStackTrace();
}
} }
// return rewrite properties // return rewrite properties

@ -1236,25 +1236,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
// check for interruption // check for interruption
checkInterruption(); checkInterruption();
// enqueue to indexing queue
this.indexingDocumentProcessor.enQueue(new indexingQueueEntry(queueEntry, null, null)); this.indexingDocumentProcessor.enQueue(new indexingQueueEntry(queueEntry, null, null));
/*
// THE FOLLOWING CAN BE CONCURRENT ->
// parse and index the resource
indexingQueueEntry document = parseDocument(new indexingQueueEntry(queueEntry, null, null));
// do condensing
indexingQueueEntry condensement = condenseDocument(document);
// do a web structure analysis
indexingQueueEntry analysis = webStructureAnalysis(condensement);
// <- CONCURRENT UNTIL HERE, THEN SERIALIZE AGAIN
// store the result
storeDocumentIndex(analysis);
*/
return true; return true;
} catch (final InterruptedException e) { } catch (final InterruptedException e) {
log.logInfo("DEQUEUE: Shutdown detected."); log.logInfo("DEQUEUE: Shutdown detected.");

@ -30,6 +30,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParserFactory;
@ -57,25 +58,29 @@ public class RSSReader extends DefaultHandler {
parsingItem = false; parsingItem = false;
} }
public RSSReader(final String path) { public RSSReader(final String path) throws IOException {
this(); this();
try {
final SAXParserFactory factory = SAXParserFactory.newInstance(); final SAXParserFactory factory = SAXParserFactory.newInstance();
try {
final SAXParser saxParser = factory.newSAXParser(); final SAXParser saxParser = factory.newSAXParser();
saxParser.parse(path, this); saxParser.parse(path, this);
} catch (final Exception e) { } catch (SAXException e) {
e.printStackTrace(); throw new IOException (e.getMessage());
} catch (ParserConfigurationException e) {
throw new IOException (e.getMessage());
} }
} }
public RSSReader(final InputStream stream) { public RSSReader(final InputStream stream) throws IOException {
this(); this();
try {
final SAXParserFactory factory = SAXParserFactory.newInstance(); final SAXParserFactory factory = SAXParserFactory.newInstance();
try {
final SAXParser saxParser = factory.newSAXParser(); final SAXParser saxParser = factory.newSAXParser();
saxParser.parse(stream, this); saxParser.parse(stream, this);
} catch (final Exception e) { } catch (SAXException e) {
e.printStackTrace(); throw new IOException (e.getMessage());
} catch (ParserConfigurationException e) {
throw new IOException (e.getMessage());
} }
} }

Loading…
Cancel
Save