Java Code Examples for com.alibaba.dubbo.common.io.UnsafeByteArrayOutputStream#close()

The following examples show how to use com.alibaba.dubbo.common.io.UnsafeByteArrayOutputStream#close() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Builder.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(Serializable obj, GenericObjectOutput out) throws IOException
{
	if( obj == null )
	{
		out.write0(OBJECT_NULL);
	}
	else
	{
		out.write0(OBJECT_STREAM);
		UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream();
		CompactedObjectOutputStream oos = new CompactedObjectOutputStream(bos);
		oos.writeObject(obj);
		oos.flush();
		bos.close();
		byte[] b = bos.toByteArray();
		out.writeUInt(b.length);
		out.write0(b, 0, b.length);
	}
}
 
Example 2
Source File: Builder.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(Serializable obj, GenericObjectOutput out) throws IOException {
    if (obj == null) {
        out.write0(OBJECT_NULL);
    } else {
        out.write0(OBJECT_STREAM);
        UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream();
        CompactedObjectOutputStream oos = new CompactedObjectOutputStream(bos);
        oos.writeObject(obj);
        oos.flush();
        bos.close();
        byte[] b = bos.toByteArray();
        out.writeUInt(b.length);
        out.write0(b, 0, b.length);
    }
}
 
Example 3
Source File: Builder.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(Serializable obj, GenericObjectOutput out) throws IOException
{
	if( obj == null )
	{
		out.write0(OBJECT_NULL);
	}
	else
	{
		out.write0(OBJECT_STREAM);
		UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream();
		CompactedObjectOutputStream oos = new CompactedObjectOutputStream(bos);
		oos.writeObject(obj);
		oos.flush();
		bos.close();
		byte[] b = bos.toByteArray();
		out.writeUInt(b.length);
		out.write0(b, 0, b.length);
	}
}
 
Example 4
Source File: Builder.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(Serializable obj, GenericObjectOutput out) throws IOException
{
	if( obj == null )
	{
		out.write0(OBJECT_NULL);
	}
	else
	{
		out.write0(OBJECT_STREAM);
		UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream();
		CompactedObjectOutputStream oos = new CompactedObjectOutputStream(bos);
		oos.writeObject(obj);
		oos.flush();
		bos.close();
		byte[] b = bos.toByteArray();
		out.writeUInt(b.length);
		out.write0(b, 0, b.length);
	}
}
 
Example 5
Source File: Builder.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(Serializable obj, GenericObjectOutput out) throws IOException
{
	if( obj == null )
	{
		out.write0(OBJECT_NULL);
	}
	else
	{
		out.write0(OBJECT_STREAM);
		UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream();
		CompactedObjectOutputStream oos = new CompactedObjectOutputStream(bos);
		oos.writeObject(obj);
		oos.flush();
		bos.close();
		byte[] b = bos.toByteArray();
		out.writeUInt(b.length);
		out.write0(b, 0, b.length);
	}
}
 
Example 6
Source File: DeprecatedExchangeCodec.java    From dubbox with Apache License 2.0 5 votes vote down vote up
protected void encodeRequest(Channel channel, OutputStream os, Request req) throws IOException {
    Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
    // header.
    byte[] header = new byte[HEADER_LENGTH];
    // set magic number.
    Bytes.short2bytes(MAGIC, header);

    // set request and serialization flag.
    header[2] = (byte) (FLAG_REQUEST | serialization.getContentTypeId());

    if (req.isTwoWay()) header[2] |= FLAG_TWOWAY;
    if (req.isEvent()) header[2] |= FLAG_EVENT;

    // set request id.
    Bytes.long2bytes(req.getId(), header, 4);

    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
    if (req.isEvent()) {
        encodeEventData(channel, out, req.getData());
    } else {
        encodeRequestData(channel, out, req.getData());
    }
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    checkPayload(channel, data.length);
    Bytes.int2bytes(data.length, header, 12);

    // write
    os.write(header); // write header.
    os.write(data); // write data.
}
 
Example 7
Source File: DeprecatedExchangeCodec.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
protected void encodeRequest(Channel channel, OutputStream os, Request req) throws IOException {
    Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
    // header.
    byte[] header = new byte[HEADER_LENGTH];
    // set magic number.
    Bytes.short2bytes(MAGIC, header);

    // set request and serialization flag.
    header[2] = (byte) (FLAG_REQUEST | serialization.getContentTypeId());

    if (req.isTwoWay()) header[2] |= FLAG_TWOWAY;
    if (req.isEvent()) header[2] |= FLAG_EVENT;

    // set request id.
    Bytes.long2bytes(req.getId(), header, 4);

    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
    if (req.isEvent()) {
        encodeEventData(channel, out, req.getData());
    } else {
        encodeRequestData(channel, out, req.getData());
    }
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    checkPayload(channel, data.length);
    Bytes.int2bytes(data.length, header, 12);

    // write
    os.write(header); // write header.
    os.write(data); // write data.
}
 
Example 8
Source File: ExchangeCodecTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private byte[] getRequestBytes(Object obj, byte[] header) throws IOException{
    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(url, bos);
    out.writeObject(obj);
    
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    byte[] len = Bytes.int2bytes(data.length);
    System.arraycopy(len, 0, header, 12, 4);
    byte[] request = join(header, data);
    return request;
}
 
Example 9
Source File: DeprecatedExchangeCodec.java    From dubbox with Apache License 2.0 5 votes vote down vote up
protected void encodeRequest(Channel channel, OutputStream os, Request req) throws IOException {
    Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
    // header.
    byte[] header = new byte[HEADER_LENGTH];
    // set magic number.
    Bytes.short2bytes(MAGIC, header);

    // set request and serialization flag.
    header[2] = (byte) (FLAG_REQUEST | serialization.getContentTypeId());

    if (req.isTwoWay()) header[2] |= FLAG_TWOWAY;
    if (req.isEvent()) header[2] |= FLAG_EVENT;

    // set request id.
    Bytes.long2bytes(req.getId(), header, 4);

    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
    if (req.isEvent()) {
        encodeEventData(channel, out, req.getData());
    } else {
        encodeRequestData(channel, out, req.getData());
    }
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    checkPayload(channel, data.length);
    Bytes.int2bytes(data.length, header, 12);

    // write
    os.write(header); // write header.
    os.write(data); // write data.
}
 
Example 10
Source File: ExchangeCodecTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private byte[] getRequestBytes(Object obj, byte[] header) throws IOException{
    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(url, bos);
    out.writeObject(obj);
    
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    byte[] len = Bytes.int2bytes(data.length);
    System.arraycopy(len, 0, header, 12, 4);
    byte[] request = join(header, data);
    return request;
}
 
Example 11
Source File: ExchangeCodecTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private byte[] getRequestBytes(Object obj, byte[] header) throws IOException{
    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(url, bos);
    out.writeObject(obj);
    
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    byte[] len = Bytes.int2bytes(data.length);
    System.arraycopy(len, 0, header, 12, 4);
    byte[] request = join(header, data);
    return request;
}
 
Example 12
Source File: DeprecatedExchangeCodec.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
protected void encodeRequest(Channel channel, OutputStream os, Request req) throws IOException {
    Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
    // header.
    byte[] header = new byte[HEADER_LENGTH];
    // set magic number.
    Bytes.short2bytes(MAGIC, header);

    // set request and serialization flag.
    header[2] = (byte) (FLAG_REQUEST | serialization.getContentTypeId());

    if (req.isTwoWay()) header[2] |= FLAG_TWOWAY;
    if (req.isEvent()) header[2] |= FLAG_EVENT;

    // set request id.
    Bytes.long2bytes(req.getId(), header, 4);

    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
    if (req.isEvent()) {
        encodeEventData(channel, out, req.getData());
    } else {
        encodeRequestData(channel, out, req.getData());
    }
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    checkPayload(channel, data.length);
    Bytes.int2bytes(data.length, header, 12);

    // write
    os.write(header); // write header.
    os.write(data); // write data.
}
 
Example 13
Source File: ExchangeCodecTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private byte[] getRequestBytes(Object obj, byte[] header) throws IOException{
    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(url, bos);
    out.writeObject(obj);
    
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    byte[] len = Bytes.int2bytes(data.length);
    System.arraycopy(len, 0, header, 12, 4);
    byte[] request = join(header, data);
    return request;
}
 
Example 14
Source File: ExchangeCodecTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private byte[] getRequestBytes(Object obj, byte[] header) throws IOException{
    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(url, bos);
    out.writeObject(obj);
    
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    byte[] len = Bytes.int2bytes(data.length);
    System.arraycopy(len, 0, header, 12, 4);
    byte[] request = join(header, data);
    return request;
}
 
Example 15
Source File: DeprecatedExchangeCodec.java    From dubbox with Apache License 2.0 5 votes vote down vote up
protected void encodeRequest(Channel channel, OutputStream os, Request req) throws IOException {
    Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
    // header.
    byte[] header = new byte[HEADER_LENGTH];
    // set magic number.
    Bytes.short2bytes(MAGIC, header);

    // set request and serialization flag.
    header[2] = (byte) (FLAG_REQUEST | serialization.getContentTypeId());

    if (req.isTwoWay()) header[2] |= FLAG_TWOWAY;
    if (req.isEvent()) header[2] |= FLAG_EVENT;

    // set request id.
    Bytes.long2bytes(req.getId(), header, 4);

    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
    if (req.isEvent()) {
        encodeEventData(channel, out, req.getData());
    } else {
        encodeRequestData(channel, out, req.getData());
    }
    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    checkPayload(channel, data.length);
    Bytes.int2bytes(data.length, header, 12);

    // write
    os.write(header); // write header.
    os.write(data); // write data.
}
 
Example 16
Source File: ExchangeCodecTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
private byte[] getRequestBytes(Object obj, byte[] header) throws IOException {
    // encode request data.
    UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
    ObjectOutput out = serialization.serialize(url, bos);
    out.writeObject(obj);

    out.flushBuffer();
    bos.flush();
    bos.close();
    byte[] data = bos.toByteArray();
    byte[] len = Bytes.int2bytes(data.length);
    System.arraycopy(len, 0, header, 12, 4);
    byte[] request = join(header, data);
    return request;
}
 
Example 17
Source File: DeprecatedExchangeCodec.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
protected void encodeResponse(Channel channel, OutputStream os, Response res) throws IOException {
    try {
        Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
        // header.
        byte[] header = new byte[HEADER_LENGTH];
        // set magic number.
        Bytes.short2bytes(MAGIC, header);
        // set request and serialization flag.
        header[2] = serialization.getContentTypeId();
        if (res.isHeartbeat()) header[2] |= FLAG_EVENT;
        // set response status.
        byte status = res.getStatus();
        header[3] = status;
        // set request id.
        Bytes.long2bytes(res.getId(), header, 4);

        UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
        ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
        // encode response data or error message.
        if (status == Response.OK) {
            if (res.isHeartbeat()) {
                encodeHeartbeatData(channel, out, res.getResult());
            } else {
                encodeResponseData(channel, out, res.getResult());
            }
        } else out.writeUTF(res.getErrorMessage());
        out.flushBuffer();
        bos.flush();
        bos.close();

        byte[] data = bos.toByteArray();
        checkPayload(channel, data.length);
        Bytes.int2bytes(data.length, header, 12);
        // write
        os.write(header); // write header.
        os.write(data); // write data.
    } catch (Throwable t) {
        // 发送失败信息给Consumer,否则Consumer只能等超时了
        if (!res.isEvent() && res.getStatus() != Response.BAD_RESPONSE) {
            try {
                // FIXME 在Codec中打印出错日志?在IoHanndler的caught中统一处理?
                logger.warn("Fail to encode response: " + res + ", send bad_response info instead, cause: " + t.getMessage(), t);

                Response r = new Response(res.getId(), res.getVersion());
                r.setStatus(Response.BAD_RESPONSE);
                r.setErrorMessage("Failed to send response: " + res + ", cause: " + StringUtils.toString(t));
                channel.send(r);

                return;
            } catch (RemotingException e) {
                logger.warn("Failed to send bad_response info back: " + res + ", cause: " + e.getMessage(), e);
            }
        }

        // 重新抛出收到的异常
        if (t instanceof IOException) {
            throw (IOException) t;
        } else if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        } else if (t instanceof Error) {
            throw (Error) t;
        } else {
            throw new RuntimeException(t.getMessage(), t);
        }
    }
}
 
Example 18
Source File: DeprecatedExchangeCodec.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
protected void encodeResponse(Channel channel, OutputStream os, Response res) throws IOException {
    try {
        Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
        // header.
        byte[] header = new byte[HEADER_LENGTH];
        // set magic number.
        Bytes.short2bytes(MAGIC, header);
        // set request and serialization flag.
        header[2] = serialization.getContentTypeId();
        if (res.isHeartbeat()) header[2] |= FLAG_EVENT;
        // set response status.
        byte status = res.getStatus();
        header[3] = status;
        // set request id.
        Bytes.long2bytes(res.getId(), header, 4);

        UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
        ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
        // encode response data or error message.
        if (status == Response.OK) {
            if (res.isHeartbeat()) {
                encodeHeartbeatData(channel, out, res.getResult());
            } else {
                encodeResponseData(channel, out, res.getResult());
            }
        } else out.writeUTF(res.getErrorMessage());
        out.flushBuffer();
        bos.flush();
        bos.close();

        byte[] data = bos.toByteArray();
        checkPayload(channel, data.length);
        Bytes.int2bytes(data.length, header, 12);
        // write
        os.write(header); // write header.
        os.write(data); // write data.
    } catch (Throwable t) {
        // 发送失败信息给Consumer,否则Consumer只能等超时了
        if (!res.isEvent() && res.getStatus() != Response.BAD_RESPONSE) {
            try {
                // FIXME 在Codec中打印出错日志?在IoHanndler的caught中统一处理?
                logger.warn("Fail to encode response: " + res + ", send bad_response info instead, cause: " + t.getMessage(), t);

                Response r = new Response(res.getId(), res.getVersion());
                r.setStatus(Response.BAD_RESPONSE);
                r.setErrorMessage("Failed to send response: " + res + ", cause: " + StringUtils.toString(t));
                channel.send(r);

                return;
            } catch (RemotingException e) {
                logger.warn("Failed to send bad_response info back: " + res + ", cause: " + e.getMessage(), e);
            }
        }

        // 重新抛出收到的异常
        if (t instanceof IOException) {
            throw (IOException) t;
        } else if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        } else if (t instanceof Error) {
            throw (Error) t;
        } else {
            throw new RuntimeException(t.getMessage(), t);
        }
    }
}
 
Example 19
Source File: DeprecatedExchangeCodec.java    From dubbox with Apache License 2.0 4 votes vote down vote up
protected void encodeResponse(Channel channel, OutputStream os, Response res) throws IOException {
    try {
        Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
        // header.
        byte[] header = new byte[HEADER_LENGTH];
        // set magic number.
        Bytes.short2bytes(MAGIC, header);
        // set request and serialization flag.
        header[2] = serialization.getContentTypeId();
        if (res.isHeartbeat()) header[2] |= FLAG_EVENT;
        // set response status.
        byte status = res.getStatus();
        header[3] = status;
        // set request id.
        Bytes.long2bytes(res.getId(), header, 4);

        UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
        ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
        // encode response data or error message.
        if (status == Response.OK) {
            if (res.isHeartbeat()) {
                encodeHeartbeatData(channel, out, res.getResult());
            } else {
                encodeResponseData(channel, out, res.getResult());
            }
        } else out.writeUTF(res.getErrorMessage());
        out.flushBuffer();
        bos.flush();
        bos.close();

        byte[] data = bos.toByteArray();
        checkPayload(channel, data.length);
        Bytes.int2bytes(data.length, header, 12);
        // write
        os.write(header); // write header.
        os.write(data); // write data.
    } catch (Throwable t) {
        // 发送失败信息给Consumer,否则Consumer只能等超时了
        if (!res.isEvent() && res.getStatus() != Response.BAD_RESPONSE) {
            try {
                // FIXME 在Codec中打印出错日志?在IoHanndler的caught中统一处理?
                logger.warn("Fail to encode response: " + res + ", send bad_response info instead, cause: " + t.getMessage(), t);

                Response r = new Response(res.getId(), res.getVersion());
                r.setStatus(Response.BAD_RESPONSE);
                r.setErrorMessage("Failed to send response: " + res + ", cause: " + StringUtils.toString(t));
                channel.send(r);

                return;
            } catch (RemotingException e) {
                logger.warn("Failed to send bad_response info back: " + res + ", cause: " + e.getMessage(), e);
            }
        }

        // 重新抛出收到的异常
        if (t instanceof IOException) {
            throw (IOException) t;
        } else if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        } else if (t instanceof Error) {
            throw (Error) t;
        } else {
            throw new RuntimeException(t.getMessage(), t);
        }
    }
}
 
Example 20
Source File: DeprecatedExchangeCodec.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
protected void encodeResponse(Channel channel, OutputStream os, Response res) throws IOException {
    try {
        Serialization serialization = CodecSupport.getSerialization(channel.getUrl());
        // header.
        byte[] header = new byte[HEADER_LENGTH];
        // set magic number.
        Bytes.short2bytes(MAGIC, header);
        // set request and serialization flag.
        header[2] = serialization.getContentTypeId();
        if (res.isHeartbeat()) header[2] |= FLAG_EVENT;
        // set response status.
        byte status = res.getStatus();
        header[3] = status;
        // set request id.
        Bytes.long2bytes(res.getId(), header, 4);

        UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(1024);
        ObjectOutput out = serialization.serialize(channel.getUrl(), bos);
        // encode response data or error message.
        if (status == Response.OK) {
            if (res.isHeartbeat()) {
                encodeHeartbeatData(channel, out, res.getResult());
            } else {
                encodeResponseData(channel, out, res.getResult());
            }
        } else out.writeUTF(res.getErrorMessage());
        out.flushBuffer();
        bos.flush();
        bos.close();

        byte[] data = bos.toByteArray();
        checkPayload(channel, data.length);
        Bytes.int2bytes(data.length, header, 12);
        // write
        os.write(header); // write header.
        os.write(data); // write data.
    } catch (Throwable t) {
        // send error message to Consumer, otherwise, Consumer will wait until timeout.
        if (!res.isEvent() && res.getStatus() != Response.BAD_RESPONSE) {
            try {
                // FIXME log error info in Codec and put all error handle logic in IoHanndler?
                logger.warn("Fail to encode response: " + res + ", send bad_response info instead, cause: " + t.getMessage(), t);

                Response r = new Response(res.getId(), res.getVersion());
                r.setStatus(Response.BAD_RESPONSE);
                r.setErrorMessage("Failed to send response: " + res + ", cause: " + StringUtils.toString(t));
                channel.send(r);

                return;
            } catch (RemotingException e) {
                logger.warn("Failed to send bad_response info back: " + res + ", cause: " + e.getMessage(), e);
            }
        }

        // Rethrow exception
        if (t instanceof IOException) {
            throw (IOException) t;
        } else if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        } else if (t instanceof Error) {
            throw (Error) t;
        } else {
            throw new RuntimeException(t.getMessage(), t);
        }
    }
}