<commit_before>package org.msgpack.rpc.client;

import java.io.IOException;

public class Future {
	protected Object error;
	protected Object result;
    protected boolean isJoined;
	
    public Future() {
        this.error = null;
        this.result = null;
        this.isJoined = false;
    }

    public synchronized void join() {
    	try {
    		while (error == null && result == null)
    			this.wait();
    	} catch (Exception e) {
    		e.printStackTrace();
    		error = e;
    	}
    	isJoined = true;
    }
    
    public void setResult(Object result) {
    	set(null, result);
    }

    public void setError(Object error) {
    	if (error instanceof String)
    		error = new IOException((String)error);
    	set(error, null);
    }

    protected synchronized void set(Object error, Object result) {
    	this.error = error;
        this.result = result;
        this.notifyAll();
    }

    public synchronized Object getResult() throws Exception {
    	if (!isJoined)
    		throw new IOException("Calling getResult() without join()");
        return result;
    }
    
    public synchronized Object getError() throws Exception {
       	if (!isJoined)
    		throw new IOException("Calling getResult() without join()");
    	return error;
    }
}<commit_msg>java: change Future interface. throws Exception when calling getResult().<commit_after>package org.msgpack.rpc.client;

import java.io.IOException;

public class Future {
	protected Exception error;
	protected Object result;
    protected boolean isJoined;
	
    public Future() {
        this.error = null;
        this.result = null;
        this.isJoined = false;
    }

    public synchronized void join() {
    	try {
    		while (error == null && result == null)
    			this.wait();
    	} catch (Exception e) {
    		e.printStackTrace();
    		error = e;
    	}
    	isJoined = true;
    }
    
    public void setResult(Object result) {
    	set(null, result);
    }

    public void setError(Object error) {
    	Exception e;
    	if (error instanceof String)
    		e = new IOException((String)error);
    	else if (error instanceof Exception)
    		e = (Exception)error;
    	else
    		e = new IOException("Unknown Error");
    	set(e, null);
    }

    protected synchronized void set(Exception error, Object result) {
    	this.error = error;
        this.result = result;
        this.notifyAll();
    }

    public synchronized Object getResult() throws Exception {
    	if (!isJoined)
    		throw new IOException("Calling getResult() without join()");
    	if (error != null)
    		throw error;
        return result;
    }
}
{'fraction_non_alphanumeric': 0.10229007633587786, 'fraction_numerical': 0.0, 'mean_word_length': 2.3732303732303732, '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': '5483', 'n_tokens_mistral': 780, 'n_tokens_neox': 764, 'n_words': 223}