EMMA Coverage Report (generated Wed Jun 28 19:54:35 CEST 2006)
[all classes][smallsql.database]

COVERAGE SUMMARY FOR SOURCE FILE [SmallSQLException.java]

nameclass, %method, %block, %line, %
SmallSQLException.java100% (1/1)62%  (5/8)64%  (91/142)60%  (23,4/39)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SmallSQLException100% (1/1)62%  (5/8)64%  (91/142)60%  (23,4/39)
SmallSQLException (String, String, int): void 0%   (0/1)0%   (0/6)0%   (0/2)
printStackTrace (): void 0%   (0/1)0%   (0/18)0%   (0/6)
printStackTrace (PrintStream): void 0%   (0/1)0%   (0/20)0%   (0/6)
init (): void 100% (1/1)73%  (8/11)92%  (3,7/4)
getMsg (Throwable): String 100% (1/1)92%  (36/39)88%  (7/8)
printStackTrace (PrintWriter): void 100% (1/1)95%  (19/20)96%  (5,8/6)
SmallSQLException (String): void 100% (1/1)100% (12/12)100% (3/3)
SmallSQLException (Throwable): void 100% (1/1)100% (16/16)100% (4/4)

1/* =============================================================
2 * SmallSQL : a free Java DBMS library for the Java(tm) platform
3 * =============================================================
4 *
5 * (C) Copyright 2004-2006, by Volker Berlin.
6 *
7 * Project Info:  http://www.smallsql.de/
8 *
9 * This library is free software; you can redistribute it and/or modify it 
10 * under the terms of the GNU Lesser General Public License as published by 
11 * the Free Software Foundation; either version 2.1 of the License, or 
12 * (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful, but 
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
17 * License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
22 * USA.  
23 *
24 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
25 * in the United States and other countries.]
26 *
27 * ---------------
28 * SmallSQLException.java
29 * ---------------
30 * Author: Volker Berlin
31 * 
32 */
33package smallsql.database;
34 
35import java.sql.*;
36import java.io.*;
37 
38/**
39 * @author Volker Berlin
40 *
41 */
42class SmallSQLException extends SQLException {
43 
44        Throwable throwable;
45        boolean isInit;
46        
47        /**
48         * 
49         */
50        public SmallSQLException(Throwable throwable) {
51                super("[SmallSQL]" + getMsg(throwable));
52                this.throwable = throwable;
53                init();
54        }
55        public SmallSQLException(String msg) {
56                super("[SmallSQL]" + msg);
57                init();
58        }
59 
60        /*
61        public SS_SQLException(String arg0, String arg1) {
62                super(arg0, arg1);
63                init();
64        }
65        */
66        
67        private void init(){
68                this.isInit = true;
69                PrintStream ps = DriverManager.getLogStream();
70                if(ps != null) this.printStackTrace(ps);        
71        }
72        
73        private static String getMsg(Throwable throwable) {
74                String msg = throwable.getMessage();
75                if(msg == null || msg.length() < 20){
76                        String msg2 = throwable.getClass().getName();
77                        msg2 = msg2.substring(msg2.lastIndexOf('.')+1);
78                        if(msg != null)
79                                msg2 = msg2 + ':' + msg;
80                        return msg2;
81                }
82                return throwable.getMessage();
83        }
84        
85        /**
86         * @param arg0
87         * @param arg1
88         * @param arg2
89         */
90        public SmallSQLException(String arg0, String arg1, int arg2) {
91                super(arg0, arg1, arg2);
92                // TODO Auto-generated constructor stub
93        }
94        
95        public void printStackTrace(){
96                if(!isInit) return;
97                if(throwable == null)
98                        super.printStackTrace();
99                else{
100                        System.err.println(toString());
101                        throwable.printStackTrace();
102                }
103        }
104 
105        public void printStackTrace(PrintStream ps){
106                if(!isInit) return;
107                if(throwable == null)
108                        super.printStackTrace(ps);
109                else{
110                        ps.println(toString());
111                        throwable.printStackTrace(ps);
112                }
113        }
114 
115        public void printStackTrace(PrintWriter pw){
116                if(!isInit) return;
117                if(throwable == null)
118                        super.printStackTrace(pw);
119                else{
120                        pw.println(toString());
121                        throwable.printStackTrace(pw);
122                }
123        }
124 
125}

[all classes][smallsql.database]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov