FileDocCategorySizeDatePackage
IntegrityException.javaAPI DocGlassfish v2 API5852Tue May 22 16:54:18 BST 2007oracle.toplink.essentials.exceptions

IntegrityException

public class IntegrityException extends ValidationException

Purpose: IntegrityExceptions is used to throw all the Descriptors exceptions.

Fields Summary
protected IntegrityChecker
integrityChecker
Constructors Summary
public IntegrityException()
INTERNAL: IntegrityExceptions is used to throw all the descriptor exceptions.

        super();
    
public IntegrityException(IntegrityChecker integrityChecker)
INTERNAL: To throw all the descriptor exceptions.

        super();
        this.integrityChecker = integrityChecker;
    
Methods Summary
public oracle.toplink.essentials.exceptions.IntegrityCheckergetIntegrityChecker()
PUBLIC: Return Integrity Checker.

        return integrityChecker;
    
public java.lang.StringgetMessage()
PUBLIC: This method is used to print out all the descriptor exceptions.

        String cr = oracle.toplink.essentials.internal.helper.Helper.cr();
        java.io.StringWriter swriter = new java.io.StringWriter();
        java.io.PrintWriter writer = new java.io.PrintWriter(swriter);
        writer.println(cr + ExceptionMessageGenerator.getHeader("DescriptorExceptionsHeader"));
        writer.println("---------------------------------------------------------");
        for (Enumeration enumtr = getIntegrityChecker().getCaughtExceptions().elements();
                 enumtr.hasMoreElements();) {
            Exception e = (Exception)enumtr.nextElement();
            if (e instanceof DescriptorException) {
                writer.println(cr + e);
            }
        }

        if (getIntegrityChecker().hasRuntimeExceptions()) {
            writer.println(cr + ExceptionMessageGenerator.getHeader("RuntimeExceptionsHeader"));
            writer.println("---------------------------------------------------------");
            for (Enumeration enumtr = getIntegrityChecker().getCaughtExceptions().elements();
                     enumtr.hasMoreElements();) {
                Exception e = (Exception)enumtr.nextElement();
                if (!(e instanceof DescriptorException)) {
                    writer.println(cr + e);
                }
            }
        }

        writer.flush();
        swriter.flush();
        return swriter.toString();
    
public voidprintStackTrace(java.io.PrintWriter writer)
PUBLIC: Print both the normal and internal stack traces.

        super.printStackTrace(writer);
        String cr = oracle.toplink.essentials.internal.helper.Helper.cr();
        writer.println(cr + ExceptionMessageGenerator.getHeader("DescriptorExceptionsHeader"));
        writer.println("---------------------------------------------------------");
        for (Enumeration enumtr = getIntegrityChecker().getCaughtExceptions().elements();
                 enumtr.hasMoreElements();) {
            Exception e = (Exception)enumtr.nextElement();
            if (e instanceof DescriptorException) {
                writer.println(cr);
                e.printStackTrace(writer);
            }
        }

        if (getIntegrityChecker().hasRuntimeExceptions()) {
            writer.println(cr + ExceptionMessageGenerator.getHeader("RuntimeExceptionsHeader"));
            writer.println("---------------------------------------------------------");
            for (Enumeration enumtr = getIntegrityChecker().getCaughtExceptions().elements();
                     enumtr.hasMoreElements();) {
                Exception e = (Exception)enumtr.nextElement();
                if (!(e instanceof DescriptorException)) {
                    writer.println(cr);
                    e.printStackTrace(writer);
                }
            }
        }

        writer.flush();