1 29 30 package org.webdocwf.util.loader; 31 32 import java.io.*; 33 import java.sql.*; 34 import java.util.*; 35 36 42 public class LocationOfException { 43 44 private static int introNumber=0; 45 private static int dtdNumber=0; 46 private static int jdbcNumber=0; 47 private static Vector fileLineNumber=new Vector(); 48 private static String fileName=""; 49 private static int exceptionNumber=0; 50 private static String baseFile=""; 51 private static int createDropNumber=0; 52 53 54 55 59 public LocationOfException(String baseFileName) { 60 baseFile=baseFileName; 61 } 62 63 67 public static void setIntroNumber(int lineNumber){ 68 introNumber=lineNumber; 69 } 70 71 75 public static void setDtdNumber(int lineNumber){ 76 dtdNumber=lineNumber; 77 } 78 79 83 public static void setJdbcNumber(int lineNumber){ 84 jdbcNumber=lineNumber; 85 } 86 87 92 public static void setFileLineNumber(int lineNumber, String fileName){ 93 fileLineNumber.add(String.valueOf(lineNumber)); 94 fileLineNumber.add(fileName); 95 } 96 97 102 public static int getLineNumber(int number){ 103 int temp1=introNumber+dtdNumber+jdbcNumber; 104 if(number<introNumber){ 105 fileName=baseFile; 106 }else if(number>introNumber && number<=introNumber+dtdNumber){ 107 fileName="Dtd file which match "+baseFile; 108 }else if(number>introNumber+dtdNumber && number<=temp1){ 109 fileName=baseFile; 110 exceptionNumber=jdbcNumber-(temp1-number)+3; 111 }else{ 112 for(int i=0;i<fileLineNumber.size();i=i+2){ 113 if(number>temp1 && number<temp1+Integer.parseInt(fileLineNumber.get(i).toString())){ 114 fileName=fileLineNumber.get(i+1).toString(); 115 exceptionNumber=Integer.parseInt(fileLineNumber.get(i).toString())- 116 ((temp1+Integer.parseInt(fileLineNumber.get(i).toString()))-number); 117 break; 118 }else{ 119 temp1+=Integer.parseInt(fileLineNumber.get(i).toString()); 120 } 121 } 122 } 123 return exceptionNumber-1; 124 } 125 126 130 public static String getFileName(){ 131 return fileName; 132 } 133 } | Popular Tags |