Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C2D60200CB3 for ; Mon, 26 Jun 2017 17:52:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C1CCD160BD9; Mon, 26 Jun 2017 15:52:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E15CB160BDE for ; Mon, 26 Jun 2017 17:52:03 +0200 (CEST) Received: (qmail 15879 invoked by uid 500); 26 Jun 2017 15:52:03 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 15868 invoked by uid 99); 26 Jun 2017 15:52:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jun 2017 15:52:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 9FA98C061B for ; Mon, 26 Jun 2017 15:52:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 2yIJl-NO5k9s for ; Mon, 26 Jun 2017 15:52:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E1C155F6C8 for ; Mon, 26 Jun 2017 15:52:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 63C36E03EE for ; Mon, 26 Jun 2017 15:52:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1B48B240CF for ; Mon, 26 Jun 2017 15:52:00 +0000 (UTC) Date: Mon, 26 Jun 2017 15:52:00 +0000 (UTC) From: "Alex Korobko (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CXF-7430) The logInputStream method of the LoggingInInterceptor fails if input stream size bigger than limit and PrettyPrint option is true. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 26 Jun 2017 15:52:04 -0000 [ https://issues.apache.org/jira/browse/CXF-7430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alex Korobko updated CXF-7430: ------------------------------ Description: The logInputStream method of the LoggingInInterceptor class fails when the input stream size is bigger than the limit variable value and PrettyPrint option is set to true. The problem is: # In the logInputStream method of the LoggingInInterceptor class if the input stream is bigger than limit (the default value of the limit variable defined in the AbstractLoggingInterceptor as 48 * 1024) the input stream is truncated to the length of the limit value; # The logInputStream method of the LoggingInInterceptor class uses the writePayload method of the AbstractLoggingInterceptor to log the payload of the response; # As the PrettyPrint option is true, the writePayload method attempts to use the PrettyPrintXMLWriter class to log already truncated XML data and throws exception. It seems like the issue could be resolved if the LoggingInInterceptor class resets the PrettyPrint option to false every time if the input stream was truncated. Or the same result would be achieved if contentType parameter of the writePayload method is NOT set to 'xml' for truncated stream. Additionally, the same solution should be propagated to all usages of the writePayload method of the AbstractLoggingInterceptor class. I faced this issue in my project that uses older version of the library, but as I just found the exception could be handled by changes in code made by commit https://github.com/apache/cxf/commit/d5373a3e3d2219ce07526cfb92ff954b3382727e so it is not relevant to latest sources anymore. But I think it is not a very good way to handle it through handling exception. was: The logInputStream method of the LoggingInInterceptor class fails when the input stream size is bigger than the limit variable value and PrettyPrint option is set to true. The problem is: # In the logInputStream method of the LoggingInInterceptor class if the input stream is bigger than limit (the default value of the limit variable defined in the AbstractLoggingInterceptor as 48 * 1024) the input stream is truncated to the length of the limit value; # The logInputStream method of the LoggingInInterceptor class uses the writePayload method of the AbstractLoggingInterceptor to log the payload of the response; # As the PrettyPrint option is true, the writePayload method attempts to use the PrettyPrintXMLWriter class to log already truncated XML data and throws exception. It seems like the issue could be resolved if the LoggingInInterceptor class resets the PrettyPrint option to false every time if the input stream was truncated. Or the same result would be achieved if contentType parameter of the writePayload method is NOT set to xml for truncated stream. Additionally, the same solution should be propagated to all usages of the writePayload method of the AbstractLoggingInterceptor class. I faced this issue in my project that uses older version of the library, but as I just found the exception could be handled by changes in code made by commit https://github.com/apache/cxf/commit/d5373a3e3d2219ce07526cfb92ff954b3382727e so it is not relevant to latest sources anymore. But I think it is not a very good way to handle it through handling exception. > The logInputStream method of the LoggingInInterceptor fails if input stream size bigger than limit and PrettyPrint option is true. > ---------------------------------------------------------------------------------------------------------------------------------- > > Key: CXF-7430 > URL: https://issues.apache.org/jira/browse/CXF-7430 > Project: CXF > Issue Type: Bug > Affects Versions: 3.0.10, 3.1.7, 3.1.8, 3.0.11, 3.1.9, 3.0.12, 3.0.13 > Reporter: Alex Korobko > > The logInputStream method of the LoggingInInterceptor class fails when the input stream size is bigger than the limit variable value and PrettyPrint option is set to true. > The problem is: > # In the logInputStream method of the LoggingInInterceptor class if the input stream is bigger than limit (the default value of the limit variable defined in the AbstractLoggingInterceptor as 48 * 1024) the input stream is truncated to the length of the limit value; > # The logInputStream method of the LoggingInInterceptor class uses the writePayload method of the AbstractLoggingInterceptor to log the payload of the response; > # As the PrettyPrint option is true, the writePayload method attempts to use the PrettyPrintXMLWriter class to log already truncated XML data and throws exception. > It seems like the issue could be resolved if the LoggingInInterceptor class resets the PrettyPrint option to false every time if the input stream was truncated. Or the same result would be achieved if contentType parameter of the writePayload method is NOT set to 'xml' for truncated stream. Additionally, the same solution should be propagated to all usages of the writePayload method of the AbstractLoggingInterceptor class. > I faced this issue in my project that uses older version of the library, but as I just found the exception could be handled by changes in code made by commit https://github.com/apache/cxf/commit/d5373a3e3d2219ce07526cfb92ff954b3382727e so it is not relevant to latest sources anymore. But I think it is not a very good way to handle it through handling exception. -- This message was sent by Atlassian JIRA (v6.4.14#64029)