rendered paste bodypublic static void toDebug(Object debug, String mess){
String CRLF = ">\r\n";
String TAB = "\t";
String report = "<"+mess+">"+CRLF;
if (debug instanceof Character){
Character bug = (Character)debug;
report += TAB +"<Instance of Character>"+CRLF;
report += TAB + "<Character><"+bug.toString()+ CRLF;
}
else if (debug instanceof Number){
report += TAB+"<Instance of Number>"+CRLF;
TAB+=TAB;
Number bug = (Number)debug;
report += TAB+"<Double><"+bug.doubleValue()+CRLF;
report += TAB+"<Float><"+bug.floatValue()+CRLF;
report += TAB+"<Integer><"+bug.intValue()+CRLF;
report += TAB+"<Long><"+bug.longValue()+CRLF;
report += TAB+"<Short><"+bug.shortValue()+CRLF;
report += TAB+"<String><"+bug.toString()+CRLF;
report += TAB+"<Byte><"+bug.byteValue()+CRLF;
}
else if (debug instanceof String){
report +=TAB+ "<Instance Of String>"+CRLF;
String bug = (String)debug;
report += TAB+TAB+"<String><"+bug.toString()+CRLF;
}
else if(debug instanceof HashMap){
report += TAB+"<Instance Of HashMap"+CRLF;
HashMap bug = (HashMap)debug;
for (Iterator bugIt = bug.entrySet().iterator();bugIt.hasNext();){
Map.Entry<String, String> bugMap = (Map.Entry<String, String>)bugIt.next();
report += TAB+TAB+"<Key,Value><"+bugMap.getKey()+"><"+bugMap.getValue()+CRLF;
}
}
else if (debug instanceof Vector){
Vector parentBug = (Vector)debug;
report += TAB+"<Vector><Size><"+parentBug.size()+CRLF;
for (Iterator bugIt = parentBug.iterator(); bugIt.hasNext();){
Object bug = (Object)bugIt.next();
if (bug instanceof HashMap){
HashMap bugMap = (HashMap)bug;
report += TAB+TAB+"<HashMap><Size><"+bugMap.size()+CRLF;
for (Iterator bugItt = bugMap.entrySet().iterator();bugIt.hasNext();){
Map.Entry<String, String> bugMapEntry = (Map.Entry<String, String>)bugItt.next();
report += TAB+TAB+TAB+"<Key,Value><"+bugMapEntry.getKey()+"><"+bugMapEntry.getValue()+CRLF;
}
}
else
{
report += TAB+TAB+"<Unknown Object>"+CRLF;
report += TAB+TAB+TAB+"<toString><"+bug.toString()+CRLF;
report += TAB+TAB+TAB+"<HashCode><"+bug.hashCode()+CRLF;
}
}
}else if(debug instanceof DBImport)
{
report += TAB+"<Data Base Import Object>" + CRLF;
DBImport bug = (DBImport)debug;
report += TAB+TAB+"<DB NAME><" +bug.dbName + CRLF;
report += TAB+TAB+"<SQL Query><"+bug.sql + CRLF;
report += TAB+TAB+"<toString><"+bug.toString()+CRLF;
}
else
{
report += TAB+debug.toString()+"<Undetected object>"+CRLF;
}
System.out.println(report+CRLF);
toReport(Pearson2.DebugFile,report);
}
public static void CreateChargeTable (String fName){
String result = new String();
String lineIn = new String();
String TAB = "\t";
String CRLF = "\n\r";
File input = new File(fName);
int len = 12;
int inc = 8;
if (input.exists()){
try
{
FileInputStream fstream = new FileInputStream(input);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
br.readLine();
while((lineIn = br.readLine())!=null){
int initPos = 750;
for (int i =0; i<10; i++){
result += lineIn.substring(initPos, initPos + len)+ TAB;
initPos += inc+len;
}
result += CRLF;
}
br.close();
}catch(Exception ee){
System.out.println(ee.getMessage());
}
toReport("c:\\code\\EclipseWorkspace\\PearsonCharge.txt",result);
}
}
public static void toReport(String fname, String arg){
try {
BufferedWriter outp = new BufferedWriter(new FileWriter(fname,true));
outp.write(arg);
outp.close();
} catch (IOException e) {
System.out.println(e.getMessage());
}
}