This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 249593 - System.out.print doubles the output after 3000 characters without \n
Summary: System.out.print doubles the output after 3000 characters without \n
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7 x64
: P2 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-01 15:40 UTC by desviado
Modified: 2015-02-24 19:08 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description desviado 2015-01-01 15:40:52 UTC
If I run this simple program:

public class Test {

	private static final int LIMIT = 3000;

	public void f() {
		for (int i = 0; i < LIMIT; i++) {
			System.out.print("f");
		}
	}

	public static void main(String[] args) {
		Test novo = new Test();
		novo.f();
	}
}

It prints 6000 'f's instead of 3000.

3000 seems to be the magic number, because 2999 calls prints 2999 'f's, but more than 3000 always doubles the amount (always -> the numbers that I tested)

This is not a problem with java itself, because on the cmd prints the correct amount.

I'm using JDK 8_u25 x64 for windows 7: 
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

If any other information is needed, I'll provide it.
Good luck with hunting it down =)
Comment 1 desviado 2015-01-01 15:51:35 UTC
After some more tests (that I should have done before) the bahaviour is present onlyn when I dont add a new line in the end.

public class Test {

	private static final int LIMIT = 3000;

	public static void main(String[] args) {
		String s = "";
		for (int i = 0; i < LIMIT; i++) {
			s += 'f';
		}
		//s += '\n';
		System.out.print(s);
		//System.out.println();
	}
}

uncomenting any of these lines solves the problem
Comment 2 Jaroslav Havlin 2015-01-13 15:18:42 UTC
> It prints 6000 'f's instead of 3000.
Good catch!
Thank you for reporting and providing the sample code.

The bug was introduced in fix for issue 212526.
The text is sometimes printed twice, but in some cases parts of the output can be lost, so I'm increasing the priority.

> If any other information is needed, I'll provide it.
> Good luck with hunting it down =)
Thank you very much :-)

http://hg.netbeans.org/core-main/rev/8ae785cf8d87
Comment 3 Quality Engineering 2015-01-14 03:14:21 UTC
Integrated into 'main-silver', will be available in build *201501140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/8ae785cf8d87
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #249593: System.out.print doubles the output after 3000 characters
Comment 4 Jaroslav Havlin 2015-02-20 07:58:07 UTC
This bug may be worth integrating in the patch.
Marking as candidate.
Comment 5 Marian Mirilovic 2015-02-24 13:47:51 UTC
This is a candidate for NB 8.0.2 Patch 1 , so please integrate the bugfix into releases/release801 branch today by 10pm CET, for more information see 
http://wiki.netbeans.org/NetBeansPatchesProcess
Comment 6 Jaroslav Havlin 2015-02-24 19:08:35 UTC
Integrated into release801:

http://hg.netbeans.org/releases/rev/c4bb0bab8dc2 (grafted fix)
http://hg.netbeans.org/releases/rev/57c0bbb590c6 (spec. version and long descr.)