X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Firc%2FConnection.java;h=fb67fe7bbaf2a349361a17eb703c13e57051b288;hb=f724f1d4c327876f6a296a976b58e413c1eaaed6;hp=f3f41f0459eb8352d078332211737ffd1f28cb01;hpb=5fcb50ba350bda007995808df3034a8b6fbc60d5;p=xudocci.git diff --git a/src/main/java/net/pterodactylus/irc/Connection.java b/src/main/java/net/pterodactylus/irc/Connection.java index f3f41f0..fb67fe7 100644 --- a/src/main/java/net/pterodactylus/irc/Connection.java +++ b/src/main/java/net/pterodactylus/irc/Connection.java @@ -36,8 +36,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.net.SocketFactory; import net.pterodactylus.irc.event.ChannelJoined; @@ -75,6 +73,7 @@ import com.google.common.primitives.Ints; import com.google.common.primitives.Longs; import com.google.common.util.concurrent.AbstractExecutionThreadService; import com.google.common.util.concurrent.Service; +import org.apache.log4j.Logger; /** * A connection to an IRC server. @@ -379,7 +378,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic while (connected) { Reply reply = connectionHandler.readReply(); eventBus.post(new ReplyReceived(this, reply)); - logger.finest(String.format("<< %s", reply)); + logger.trace(String.format("<< %s", reply)); String command = reply.command(); List parameters = reply.parameters(); @@ -480,13 +479,13 @@ public class Connection extends AbstractExecutionThreadService implements Servic char modeSymbol = parameter.charAt(closeParen + modeCharacterIndex); nickPrefixes.put(String.valueOf(modeSymbol), String.valueOf(modeCharacter)); } - logger.fine(String.format("Parsed Prefixes: %s", nickPrefixes)); + logger.debug(String.format("Parsed Prefixes: %s", nickPrefixes)); } } else if (parameter.startsWith("CHANTYPES=")) { for (int typeIndex = 10; typeIndex < parameter.length(); ++typeIndex) { channelTypes.add(parameter.charAt(typeIndex)); } - logger.fine(String.format("Parsed Channel Types: %s", channelTypes)); + logger.debug(String.format("Parsed Channel Types: %s", channelTypes)); } } @@ -515,10 +514,10 @@ public class Connection extends AbstractExecutionThreadService implements Servic } eventBus.post(new ConnectionClosed(this)); } catch (IOException ioe1) { - logger.log(Level.WARNING, "I/O error", ioe1); + logger.warn("I/O error", ioe1); eventBus.post(new ConnectionClosed(this, ioe1)); } catch (RuntimeException re1) { - logger.log(Level.SEVERE, "Runtime error", re1); + logger.error("Runtime error", re1); eventBus.post(new ConnectionClosed(this, re1)); } finally { established = false; @@ -555,7 +554,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic if (inetAddress.isPresent() && port.isPresent()) { eventBus.post(new DccSendReceived(this, client, messageWords[2], inetAddress.get(), port.get(), fileSize)); } else { - logger.warning(String.format("Received malformed DCC SEND: “%s”", message)); + logger.warn(String.format("Received malformed DCC SEND: “%s”", message)); } } else if (messageWords[1].equalsIgnoreCase("ACCEPT")) { Optional port = Optional.fromNullable(Ints.tryParse(messageWords[3])); @@ -563,7 +562,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic if (port.isPresent()) { eventBus.post(new DccAcceptReceived(this, client, messageWords[2], port.get(), position)); } else { - logger.warning(String.format("Received malformed DCC ACCEPT: “%s”", message)); + logger.warn(String.format("Received malformed DCC ACCEPT: “%s”", message)); } } } @@ -717,7 +716,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic commandBuilder.append(parameter); } - logger.finest(String.format(">> %s", commandBuilder)); + logger.trace(String.format(">> %s", commandBuilder)); outputStream.write((commandBuilder.toString() + "\r\n").getBytes("UTF-8")); outputStream.flush(); } @@ -748,6 +747,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic public void close() throws IOException { Closeables.close(outputStream, true); Closeables.close(inputStreamReader, true); + Closeables.close(inputStream, true); } }