You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Andrei Dulvac (Jira)" <ji...@apache.org> on 2020/04/02 14:36:00 UTC
[jira] [Resolved] (SLING-9129) ResourceUtils add extra line break
at the end of the file
[ https://issues.apache.org/jira/browse/SLING-9129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrei Dulvac resolved SLING-9129.
----------------------------------
Fix Version/s: Apache Sling Testing Clients 1.2.8
Resolution: Fixed
> ResourceUtils add extra line break at the end of the file
> ---------------------------------------------------------
>
> Key: SLING-9129
> URL: https://issues.apache.org/jira/browse/SLING-9129
> Project: Sling
> Issue Type: Bug
> Components: Apache Sling Testing Clients
> Affects Versions: Apache Sling Testing Clients 1.2.6
> Reporter: Thierry Ygé
> Assignee: Andrei Dulvac
> Priority: Major
> Fix For: Apache Sling Testing Clients 1.2.8
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> This method [https://github.com/apache/sling-org-apache-sling-testing-clients/blob/master/src/main/java/org/apache/sling/testing/clients/util/ResourceUtil.java#L49-L65]
> is adding extra line break at the end of the file it read which is not expected.
> Best would be that it doesn't read line by line but using IOUtils.toString(InputStream.class, "utf-8"), that would make sure it preserve the original file characters (including line breaks style if that would be required in a test).
>
> Mainly the cultprit code is at line [https://github.com/apache/sling-org-apache-sling-testing-clients/blob/master/src/main/java/org/apache/sling/testing/clients/util/ResourceUtil.java#L57]
> The line break append all the time even at last line, which is why it add this extra line. quickfix would be as suggested above or adding a condition so that it does only add line break before it append the next line (so if the StringBuffer is not empty)
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)