Home arrow static arrow Java Programming [Archive] - difference of StringBuffer in 1.3 and 1.4
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - difference of StringBuffer in 1.3 and 1.4
This topic has 3 replies on 1 page.

Posts:2
Registered: 3/8/04
difference of StringBuffer in 1.3 and 1.4  
Jun 21, 2004 2:12 AM



 
Hi, guys:

I have a problem on StringBuffer. When I use jdk1.3.1_09, I can print StringBuffer correctly, but when I use jdk1.4.2, then exception came. Program:

//*************************************
StringBuffer first = new StringBuffer();
// put some characters in first

StringBuffer second = new StringBuffer();
// put some characters in second

StringBuffer together = new StringBuffer();
together.append(first).append(second);
System.out.println("together:"+together);
//*******************************************

I guess there is size limitation for jdk1.4, right? Little bit confused that if something is supported by jdk1.3, then why it is not supported in jdk1.4
 

Posts:1,995
Registered: 12/10/00
Re: difference of StringBuffer in 1.3 and 1.4  
Jun 21, 2004 2:15 AM (reply 1 of 3)



 
Please post the exception(class and message) , maybe even better together with the stack trace and
also state on which line exactly it is thrown

Mike
 

Posts:2
Registered: 3/8/04
Re: difference of StringBuffer in 1.3 and 1.4  
Jun 21, 2004 6:40 PM (reply 2 of 3)



 
Many thanks. I wrote a test program for StringBuffer and it works fine. Strange. but in our product, problem exists if a StringBuffer appends 2 StringBuffers which contain some java scripts. There is nothing shown if I use printStackTrace() and the only infomation given by server is: Exception raised and control is released. but by using debug infomation, i am sure the problem occurs where the StringBuffer tries to append another two StringBuffer. Little bit strange.
 

Posts:2,206
Registered: 8/15/02
Re: difference of StringBuffer in 1.3 and 1.4  
Jun 21, 2004 7:03 PM (reply 3 of 3)



 
The only way I could maybe see StringBuffers append not working in this situation is if one of the StringBuffers is null. But I have no proof. Nobe of the appends throws a specific exception.
 
This topic has 3 replies on 1 page.