int f, s, e;
StringBuffer oReport = new StringBuffer(4096);
String sLine, sOpCode = null, sEntity = null;
TreeMap oOpen = new TreeMap();
Integer oCount;
LineNumberReader lnr;
FileReader oReader = new FileReader(sFile);
BufferedReader oBuffer = new BufferedReader(oReader);
LineNumberReader oLines = new LineNumberReader(oBuffer);
while ((sLine = oLines.readLine())!=null) {
f = 0;
s = -1;
while ((s=sLine.indexOf(';',s+1))!=-1) {
f++;
switch (f) {
case 2:
sOpCode = sLine.substring(s, sLine.indexOf(';', s+1));
break;
case 4:
sEntity = sLine.substring(s, sLine.indexOf(';', s+1));
if (sOpCode.equals("ODBC") || sOpCode.equals("OJSP")) {
oCount = (Integer) oOpen.get(sEntity);
if (oCount==null) {
oCount = new Integer(1);
oOpen.put(sEntity, oCount);
}
else {
oCount = new Integer(oCount.intValue()+1);
oOpen.remove(sEntity);
oOpen.put(sEntity, oCount);
}
} // fi (sOpCode==ODBC)
else if (sOpCode.equals("CDBC") || sOpCode.equals("CJSP")) {
oCount = (Integer) oOpen.get(sEntity);
if (oCount==null) {
oCount = new Integer(-1);
oOpen.put(sEntity, oCount);
}
else {
oCount = new Integer(oCount.intValue()-1);
oOpen.remove(sEntity);
oOpen.put(sEntity, oCount);
}
}
break;
} // switch(f)
} // wend
if (f%10==0) System.out.print('.');
} // wend
System.out.print("\n");
oReader.close();
oLines.close();
oBuffer.close();
Iterator oKeys = oOpen.keySet().iterator();
while (oKeys.hasNext()) {
sEntity = (String) oKeys.next();
oCount = (Integer) oOpen.get(sEntity);
if (oCount.intValue()!=0) {
oReport.append(sEntity + " open/close mismatch " + oCount.toString() + "\n");
}
} // wend