X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FFcpConnectionHandler.java;h=d22e279bd737cb5e9ef56a97d9a59d82d5f607a5;hb=e0d4c56493b97a16514ca865cad0ae42a2d8a5a2;hp=a8132c31f8a3b03a547d7a45d642e026958b17f1;hpb=930a13cd3640422a0fd23e2952cacf798286f0bc;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/FcpConnectionHandler.java b/src/net/pterodactylus/fcp/FcpConnectionHandler.java index a8132c3..d22e279 100644 --- a/src/net/pterodactylus/fcp/FcpConnectionHandler.java +++ b/src/net/pterodactylus/fcp/FcpConnectionHandler.java @@ -1,6 +1,5 @@ /* - * jSite2 - FcpConnectionHandler.java - - * Copyright © 2008 David Roden + * jFCPlib - FcpConnectionHandler.java - Copyright © 2008 David Roden * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,9 +25,8 @@ import java.nio.charset.Charset; /** * Handles an FCP connection to a node. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - * @version $Id$ */ class FcpConnectionHandler implements Runnable { @@ -47,7 +45,7 @@ class FcpConnectionHandler implements Runnable { /** * Creates a new connection handler that operates on the given connection * and input stream. - * + * * @param fcpConnection * The underlying FCP connection * @param remoteInputStream @@ -84,7 +82,7 @@ class FcpConnectionHandler implements Runnable { fcpMessage = new FcpMessage(line); continue; } - if ("EndMessage".equals(line)) { + if ("EndMessage".equalsIgnoreCase(line) || "Data".equalsIgnoreCase(line)) { fcpConnection.handleMessage(fcpMessage); fcpMessage = null; } @@ -97,8 +95,8 @@ class FcpConnectionHandler implements Runnable { String value = line.substring(equalSign + 1); assert fcpMessage != null: "fcp message is null"; fcpMessage.setField(field, value); - } catch (IOException e) { - throwable = null; + } catch (IOException ioe1) { + throwable = ioe1; break; } } @@ -121,7 +119,7 @@ class FcpConnectionHandler implements Runnable { /** * Reads bytes from {@link #remoteInputStream} until ‘\r’ or ‘\n’ are * encountered and decodes the read bytes using UTF-8. - * + * * @return The decoded line * @throws IOException * if an I/O error occurs