<commit_before>package org.projectodd.stilts.stomp.server.protocol.websockets;

import java.io.IOException;

import org.jboss.logging.Logger;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;

public class DisorderlyCloseHandler extends SimpleChannelUpstreamHandler {

    private static Logger log = Logger.getLogger( DisorderlyCloseHandler.class );

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
        Throwable cause = e.getCause();

        if (cause instanceof IOException ) {
            if (ctx.getAttachment() == null) {
            	String exceptionMessage = cause.getMessage();
                ctx.setAttachment( Boolean.TRUE );
                ctx.sendUpstream( new DisorderlyCloseEvent( ctx.getChannel() ) );
                ctx.getChannel().disconnect();
            	if (exceptionMessage != null && exceptionMessage.contains("reset by peer")) {
            		log.info(ctx.getChannel() + " connection reset by peer. disconnect channel and send "
            				+ "DisorderlyCloseEvent upstream.");
            	} else {
                	log.warn(ctx.getChannel() + "disconnect channel and send DisorderlyCloseEvent upstream due to "
                			+ "IOException: ", cause);            		
            	}
            }
        } else {
            ctx.sendUpstream( e );
        }
    }

}
<commit_msg>IOException 발생시 disconnect가 아닌 close를 호출하도록 함<commit_after>package org.projectodd.stilts.stomp.server.protocol.websockets;

import java.io.IOException;

import org.jboss.logging.Logger;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;

public class DisorderlyCloseHandler extends SimpleChannelUpstreamHandler {

    private static Logger log = Logger.getLogger( DisorderlyCloseHandler.class );

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
        Throwable cause = e.getCause();

        if (cause instanceof IOException ) {
            if (ctx.getAttachment() == null) {
            	String exceptionMessage = cause.getMessage();
                ctx.setAttachment( Boolean.TRUE );
                ctx.sendUpstream( new DisorderlyCloseEvent( ctx.getChannel() ) );
                ctx.getChannel().close();
            	if (exceptionMessage != null && exceptionMessage.contains("reset by peer")) {
            		log.info(ctx.getChannel() + " connection reset by peer. close channel and send "
            				+ "DisorderlyCloseEvent upstream.");
            	} else if (exceptionMessage != null && exceptionMessage.contains("Connection timed out")) {
            		log.info(ctx.getChannel() + " connection timed out. close channel and send "
            				+ "DisorderlyCloseEvent upstream.");
            	} else {
                	log.warn(ctx.getChannel() + "close channel and send DisorderlyCloseEvent upstream due to "
                			+ "IOException: ", cause);            		
            	}
            }
        } else {
            ctx.sendUpstream( e );
        }
    }

}

{'fraction_non_alphanumeric': 0.0950920245398773, 'fraction_numerical': 0.0, 'mean_word_length': 2.461783439490446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4447578', 'n_tokens_mistral': 886, 'n_tokens_neox': 847, 'n_words': 191}