buildList() from Parameters.load() fails with "\r\n" on Windows

Issue #68 resolved
Former user created an issue

Original [issue 68](https://code.google.com/p/okapi/issues/detail?id=68) created by vasilie... on 2009-05-11T18:05:14.000Z:

net.sf.okapi.common.ParametersString.java, line 132:

buildList() called from Parameters.load() doesn't work correctly on Windows with "
r
n" line breaks:

for the string sendEmptyLines.b=true in a parameters file being read, the line 132

"true".equals(line.substring(n+1)) returns false on Windows, as the line.substring(n+1) gives "true
r", and not "true".

The lines 136 and 139 will also catch
r. The reason is line 121 String[] lines = data.split("
n", 0) leaves
r in the strings after splitting them with "
n".

Stack: ParametersString.buildList(String, String) line: 131 ParametersString.fromString(String) line: 49 ParametersPT.fromString(String) line: 48 ParametersPT(BaseParameters).load(String, boolean) line: 73

Suggested workaround: add normalization of line breaks for parameter files.

Comments (4)

  1. Log in to comment