控制台输出引起的奇怪溢出错误

每次调用这个程序后,进别的函数,或者再做点别的什么,马上控制台就报
Method............: 100cdcd4 'java/lang/StringBuffer.expandCapacity
(virtual)'
然后程序就被迫中止了,在wtk环境下跑的

private void doNews(){
  int maxnewsnum = 10;
  String newstitle = new String("");
  String[] newsElement = new String[maxnewsnum+1];
  for (int j=0;j<newsElement.length;j++){
   newsElement[j]="";
  }
 try{
  newstitle = requestUsingPOST(newstitleURL,"");
 }
 catch(IOException e){
  newstitle = "联机失败!";
 }
 System.out.println("newstitle: "+ newstitle);
 int idx = newstitle.length();
 int flag1 = 0;
 int flag2 = 0;
 int i = 0;
 while ((flag2 < idx-8)&&(i<maxnewsnum))
 {
  flag1 = newstitle.indexOf("<Item>",flag2);
  flag2 = newstitle.indexOf("</Item>",flag1);
  newsElement[i] = newstitle.substring(flag1+6,flag2);
  i++;
 }
 newsList = new List("新闻",List.IMPLICIT);
 i=0;
 while ((newsElement[i] != "")&&(i<maxnewsnum)){
  newsList.append(newsElement[i],null);
  i++;
 }
 newsElement = null;
 newstitle = null;
 newsList.addCommand(execCommand);
 newsList.addCommand(commCommand);
 newsList.addCommand(menuCommand);
 newsList.setCommandListener(this);
 currentScreen="新闻";
 display.setCurrent(newsList);
 }

经过两天多的排错,最后发现,出错的居然是System.out.println("newstitle: "+ newstitle);
这行语句,把这行注释掉后,再没有发现溢出,但是到现在也还不明白为什么控制台
输出也会导致溢出的错误呢?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值