Skip to content

For exception in de.bytefish.pgbulkinsert.pgsql.handlers.BaseValueHandler #85

@tangyibo

Description

@tangyibo

In method handle() of class BaseValueHandler, when IOException happend, the exception is not point out explicitly, so I think like this:

public abstract class BaseValueHandler<T> implements IValueHandler<T> {

    @Override
    public void handle(DataOutputStream buffer, final T value) {
		try {
			if (value == null) {
				buffer.writeInt(-1);
				return;
			}
			internalHandle(buffer, value);
		} catch (Exception e) {
			if (e instanceof IOException) {
				if (null != e.getCause()) {
					throw new BinaryWriteFailedException(e.getCause());
				}
			} else {
				throw new BinaryWriteFailedException(e);
			}
		}
	}

    protected abstract void internalHandle(DataOutputStream buffer, final T value) throws Exception;
}

do you agree with me? thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions