1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
///////////////////////////////////////////////////////////////////////////////
//
// JTOpen (IBM Toolbox for Java - OSS version)
//
// Filename: PersistenceException.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 2001-2010 International Business Machines Corporation and
// others. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
package com.ibm.as400.access;
/**
* Thrown when an error occurs accessing resources on the system.
*
* @author Thomas Johnson (tom.johnson@kingland.com), Kingland Systems Corporation
*/
public class PersistenceException extends Exception {
AS400Message[] messageList_ = null;
/**
* Default constructor.
*/
public PersistenceException() {
super();
}
/**
* Constructs an exception based on a list of system messages.
*
* @param messageList
* com.ibm.as400.access.AS400Message[]
*/
public PersistenceException(AS400Message[] messageList) {
this(messageList, "");
}
/**
* Constructs an exception based on a list of system messages
* and detail string.
*
* @param messageList
* com.ibm.as400.access.AS400Message[]
* @param s
* java.lang.String
*/
public PersistenceException(AS400Message[] messageList, String s) {
this(s);
setMessageList(messageList);
}
/**
* Constructs an exception with the given detail string.
*
* @param s
* java.lang.String
*/
public PersistenceException(String s) {
super(s);
}
/**
* Constructs an exception with detail provided by the given throwable.
*
* @param t
* java.lang.Throwable
*/
public PersistenceException(Throwable t) {
this(t.toString());
}
/**
* Returns the list of associated system messages; null if not available.
*
* @return
* com.ibm.as400.access.AS400Message[]
*/
public AS400Message[] getMessageList() {
return messageList_;
}
/**
* Sets the list of associated system messages.
*
* @param messageList
* com.ibm.as400.access.AS400Message[]
*/
private void setMessageList(AS400Message[] messageList) {
messageList_ = messageList;
}
/**
* Returns a string representation of the object.
*
* @return
* java.lang.String
*/
public String toString() {
StringBuffer sb = new StringBuffer(super.toString());
AS400Message[] list = getMessageList();
if (list != null)
for(int i=0; i<list.length; i++)
sb.append('\n'
).append(" "
).append(list[i].getID()
).append(" "
).append(list[i].getText());
return sb.toString();
}
}
|