Skip to content

Exception Handling: Errors from getContentAsStream() are logged too often #2712

@predic8

Description

@predic8

When body.getContentAsStream() throws an Exception like javax.net.ssl.SSLException it gets logged as ERROR and there are several stacktraces.

  • Maybe we should not log this as ERROR. The cause is not a problem in Membrane, just the behaviour of others.
  • We should know what is going on.
	public InputStream getBodyAsStream() {
		try {
			return body.getContentAsStream();
		} catch (IOException e) {
			log.error("Could not get body as stream", e);
			throw new ReadingBodyException(e);
		}
	}

	public InputStream getBodyAsStreamDecoded() {
		// TODO: this logic should be split up into configurable decoding modules
		// TODO: decoding result should be cached
		try {
			Message m = xopr.getReconstitutedMessage(this);
			if (m != null)
				return m.getBodyAsStream(); // we know decoding is not necessary any more
			return MessageUtil.getContentAsStream(this);
		} catch (Exception e) {
			log.error("Could not decode body stream", e);
			throw new RuntimeException("Could not decode body stream", e);
		}
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions