|
@@ -265,7 +265,7 @@ public class Concat extends Task implements ResourceCollection { |
|
|
int ch = getReader().read(); |
|
|
int ch = getReader().read(); |
|
|
if (ch == -1) { |
|
|
if (ch == -1) { |
|
|
nextReader(); |
|
|
nextReader(); |
|
|
if (fixLastLine && isMissingEndOfLine()) { |
|
|
|
|
|
|
|
|
if (isFixLastLine() && isMissingEndOfLine()) { |
|
|
needAddSeparator = true; |
|
|
needAddSeparator = true; |
|
|
lastPos = 0; |
|
|
lastPos = 0; |
|
|
} |
|
|
} |
|
@@ -307,12 +307,12 @@ public class Concat extends Task implements ResourceCollection { |
|
|
int nRead = getReader().read(cbuf, off, len); |
|
|
int nRead = getReader().read(cbuf, off, len); |
|
|
if (nRead == -1 || nRead == 0) { |
|
|
if (nRead == -1 || nRead == 0) { |
|
|
nextReader(); |
|
|
nextReader(); |
|
|
if (fixLastLine && isMissingEndOfLine()) { |
|
|
|
|
|
|
|
|
if (isFixLastLine() && isMissingEndOfLine()) { |
|
|
needAddSeparator = true; |
|
|
needAddSeparator = true; |
|
|
lastPos = 0; |
|
|
lastPos = 0; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
if (fixLastLine) { |
|
|
|
|
|
|
|
|
if (isFixLastLine()) { |
|
|
for (int i = nRead; |
|
|
for (int i = nRead; |
|
|
i > (nRead - lastChars.length); |
|
|
i > (nRead - lastChars.length); |
|
|
--i) { |
|
|
--i) { |
|
@@ -369,6 +369,10 @@ public class Concat extends Task implements ResourceCollection { |
|
|
} |
|
|
} |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isFixLastLine() { |
|
|
|
|
|
return fixLastLine && textBuffer == null; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private class ConcatResource extends Resource { |
|
|
private class ConcatResource extends Resource { |
|
@@ -887,10 +891,8 @@ public class Concat extends Task implements ResourceCollection { |
|
|
* for "ignorable whitespace" as well.</p> |
|
|
* for "ignorable whitespace" as well.</p> |
|
|
*/ |
|
|
*/ |
|
|
private void sanitizeText() { |
|
|
private void sanitizeText() { |
|
|
if (textBuffer != null) { |
|
|
|
|
|
if (textBuffer.substring(0).trim().length() == 0) { |
|
|
|
|
|
textBuffer = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (textBuffer != null && "".equals(textBuffer.toString().trim())) { |
|
|
|
|
|
textBuffer = null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|