File tree Expand file tree Collapse file tree
src/main/java/one/edee/babylon/entity Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,10 +112,15 @@ public PropertiesMap getMutationProperties(String mutation) {
112112 }
113113
114114 private String normalizeContent (String value ) {
115- String lineSeparator = System .lineSeparator ();
116- if (lineSeparator .equals (IOUtils .LINE_SEPARATOR_WINDOWS ))
117- return value ;
118- return value == null ? null : value .replace (lineSeparator , IOUtils .LINE_SEPARATOR_WINDOWS );
115+ if (value == null )
116+ return null ;
117+
118+ // First replace lone \r not followed by \n
119+ value = value .replaceAll ("\r (?!\n )" , IOUtils .LINE_SEPARATOR_WINDOWS );
120+
121+ // Then replace lone \n not preceded by \r
122+ value = value .replaceAll ("(?<!\r )\n " , IOUtils .LINE_SEPARATOR_WINDOWS );
123+ return value ;
119124 }
120125
121126 public boolean containsKey (String key ) {
You can’t perform that action at this time.
0 commit comments