-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
19
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Duplicate of https://bugs.java.com/bugdatabase/view_bug?bug_id=8294410
with source code to reproduce.
---------- BEGIN SOURCE ----------
public class Main {
public static void main(String[] args) throws java.io.IOException {
System.out.println("First separator's length = " + System.getProperty("line.separator").length() + ".");
System.out.print("First multiline string will be small. It's length = ");
System.out.println(getString().length() + ".");
System.out.println();
System.setProperty("line.separator", "e".repeat(100));
System.out.println("Second separator's length = " + System.getProperty("line.separator").length() + ".");
System.out.print("Second multiline string should be huge. It's length = ");
System.out.println(getString().length() + ".");
}
public static String getString() throws java.io.IOException {
try (java.io.PipedOutputStream pipeOut = new java.io.PipedOutputStream();
java.io.PipedInputStream pipeIn = new java.io.PipedInputStream();
java.io.PrintStream outputStream = new java.io.PrintStream(pipeOut);
) {
pipeOut.connect(pipeIn);
outputStream.println("q");
outputStream.println("w");
outputStream.close();
return new String(pipeIn.readAllBytes());
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
Duplicate of https://bugs.java.com/bugdatabase/view_bug?bug_id=8294410
with source code to reproduce.
---------- BEGIN SOURCE ----------
public class Main {
public static void main(String[] args) throws java.io.IOException {
System.out.println("First separator's length = " + System.getProperty("line.separator").length() + ".");
System.out.print("First multiline string will be small. It's length = ");
System.out.println(getString().length() + ".");
System.out.println();
System.setProperty("line.separator", "e".repeat(100));
System.out.println("Second separator's length = " + System.getProperty("line.separator").length() + ".");
System.out.print("Second multiline string should be huge. It's length = ");
System.out.println(getString().length() + ".");
}
public static String getString() throws java.io.IOException {
try (java.io.PipedOutputStream pipeOut = new java.io.PipedOutputStream();
java.io.PipedInputStream pipeIn = new java.io.PipedInputStream();
java.io.PrintStream outputStream = new java.io.PrintStream(pipeOut);
) {
pipeOut.connect(pipeIn);
outputStream.println("q");
outputStream.println("w");
outputStream.close();
return new String(pipeIn.readAllBytes());
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8294410 PrintStream does not allow the line separator to be overridden
-
- Open
-