[
https://issues.apache.org/jira/browse/SLING-9129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrei Dulvac reassigned SLING-9129:
------------------------------------
Assignee: Andrei Dulvac
> 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
> Time Spent: 50m
> 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)