Unable to read Tokens
Help~! Once again, my program can work on IDE but not on DOS
I wanted to read the data as token.... like this
while (recordTk.hasMoreTokens()){
System.out.println("Any more token?");
processStr = recordTk.nextToken();
StringTokenizer tk =new StringTokenizer(processStr,"|");
sequence = Integer.parseInt(tk.nextToken());
bidAsk = tk.nextToken();
timeStamp = tk.nextToken();
updateTime = getUpdateString(timeStamp);
tradeSize = Integer.parseInt(tk.nextToken());
tk.nextToken();
priceStr = tk.nextToken();
price = Float.parseFloat(priceStr);
DecimalFormat df =new DecimalFormat("#.000");
String priceString = df.format(price);
amtStr = tk.nextToken();
amountFloat = Float.parseFloat(amtStr);
amountFloat = price * tradeSize;
DecimalFormat df2 =new DecimalFormat("#.");
String amount = df2.format(amountFloat);
but it seems to skip the while loop. I have check the value of the token, it is '4f1d0d'. After this, i have written some codes that insert the data str to the DB but this is being skipped by DOS conveniently as well.
Pls help. hmm i also don't know why DOS and ide can work so differently.... Thanks
[1512 byte] By [
peachteaa] at [2007-11-27 4:15:47]

public void OnData(String ric, String value, short fid){
if(value!=null){
String var = "";
int sequence;
String bidAsk;
String timeStamp;
String updateTime;
int tradeSize;
float price;
float amountFloat;
//int amount;
String priceStr;
String processStr;
String amtStr = "0";
System.out.println ("hi11");
int insertResult = 0;
ArrayList<Integer> sequenceList;
System.out.println(getCurrTimeStr() + "-> Received update from " + ric);
ric=ric.substring(ric.indexOf('\\')+1);
StringTokenizer ricTk = new StringTokenizer(ric,"-");
ric = ricTk.nextToken();
StringTokenizer recordTk = new StringTokenizer(value,"\n");
System.out.println ("hi12");
System.out.println (recordTk.toString());
while (recordTk.hasMoreTokens()){
System.out.println("Any more token?");
processStr = recordTk.nextToken();
StringTokenizer tk = new StringTokenizer(processStr, "|");
sequence = Integer.parseInt(tk.nextToken());
bidAsk = tk.nextToken();
timeStamp = tk.nextToken();
updateTime = getUpdateString(timeStamp);
tradeSize = Integer.parseInt(tk.nextToken());
tk.nextToken();
priceStr = tk.nextToken();
price = Float.parseFloat(priceStr);
DecimalFormat df = new DecimalFormat("#.000");
String priceString = df.format(price);
amtStr = tk.nextToken();
amountFloat = Float.parseFloat(amtStr);
amountFloat = price * tradeSize;
DecimalFormat df2 = new DecimalFormat("#.");
String amount = df2.format(amountFloat);
boolean x = true;
System.out.println ("hi13");
if (x) {
sequenceList = ricTable.get(ric);
if(sequenceList == null){
sequenceList = new ArrayList <Integer>();
ricTable.put(ric,sequenceList);
}
boolean isInsert = true;
for(Integer i:sequenceList){
if(i.intValue()==sequence){
isInsert = false;
break;
}
}
if(isInsert){
System.out.println ("hi14");
insertResult = db.insertTimesNSales(ric,sequence,updateTime,priceString,tradeSize,bidAsk, amount);
System.out.println("Insert ric: " + ric + " sequence: " + sequence + " result: " + insertResult);
sequenceList.add(sequence);
}
}
}
System.out.println ("hi15");
String msg = ric+";"+value.replace("\n","\r\n");
if(pw!=null){
pw.println(msg);
pw.flush();
}
lastRic = ric;
lastValue = value;
lastFid = fid;
System.out.println ("hi16");
}
}
btw i googled and saw that breakIterator can be used w stringTokenizer. Do u all think it is applicable for my case? Thanks :)