Package org.chaidb.db.exception

Source Code of org.chaidb.db.exception.ErrorCodeTest

/*
* Copyright (C) 2006  http://www.chaidb.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
*/

package org.chaidb.db.exception;

import java.lang.reflect.Field;

/**
* User: kurt
* Date: 2006-12-1
* Time: 17:11:48
*/
public class ErrorCodeTest {
    public static void main(String[] args) {
        new ErrorCodeTest().run();
    }

    private void run() {
        try {
            boolean noerror = true;
            Class ec = Class.forName("org.chaidb.db.exception.ErrorCode");
            Field[] eclist = ec.getFields();
            for (int i = 0; i < eclist.length; i++) {
                Field field = eclist[i];
                Integer f = (Integer) field.get(null);
                String msg = ErrorCode.getMessage(f.intValue());
                if (msg == null || msg.length() == 0) {
                    System.out.println("No message for:" + f.intValue());
                    if (noerror) {
                        noerror = false;
                    }
                }
            }
            if (noerror) {
                System.out.println("All codes passed.");
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}
TOP

Related Classes of org.chaidb.db.exception.ErrorCodeTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.