java - StringBuffer is seem double the String Names -
can please tell me why happening sometimes, looks of in files short names:
stringbuffer rbuffer = new stringbuffer(""); file realname = new file(filename[2]); system.out.println(" # realname "+realname); //todo delete returns: realname c:\users\ricar\workspace\tergum\bin\tergum\me\**tbfs.class** rbuffer.append(realname.getname()); system.out.println(" # rbuffer "+rbuffer); //todo delete retuns: rbuffer **tbfs.classtbfs.class**
longer names ok short names when stringbuffer seem double is.
sorry forgot add buffering realname
many thanks
in request more details, here belive happens:
both variables of codes initiated "null" it's new:
here bigger snip of code , happens:
while ((lineinsrc = dbbuffer.readline()) != null){ matcher m = filepattern.matcher(lineinsrc); string[] filename = lineinsrc.split(csvsplitbysrc); realname = new file(filename[2]); while (m.find()) { system.out.println(" # realname "+realname); //todo delete rbuffer.append(realname.getname()); } } try { file newfile = new file(npresult.tostring()+"/"+rbuffer); system.out.println(" # newfile "+newfile); //todo delete system.out.println(" # rbuffer "+rbuffer); //todo delete }
hundreds of more lines... irelevant failed...
the code you've provided not yield problematic result.
it may possible have section in code accidentally print rbuffer
. can either search or show whole code section. if work ide
eclipse
, can double-click rbuffer
, highlight occurrences of variable you. thus, you're able find additional accidental prints fast.
summarized, if run code, output follows:
realname tbfs.class rbuffer tbfs.class
not, said, tbfs.classtbfs.class
. should check other code sections of program, error elsewhere.
Comments
Post a Comment