001 /* 002 * Copyright 2009-2015 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005 /* 006 * Copyright (C) 2015 UnboundID Corp. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021 package com.unboundid.ldap.sdk.unboundidds.logs; 022 023 024 025 import com.unboundid.util.LDAPSDKException; 026 import com.unboundid.util.NotMutable; 027 import com.unboundid.util.ThreadSafety; 028 import com.unboundid.util.ThreadSafetyLevel; 029 030 import static com.unboundid.util.Validator.*; 031 032 033 034 /** 035 * <BLOCKQUOTE> 036 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID 037 * LDAP SDK for Java. It is not available for use in applications that 038 * include only the Standard Edition of the LDAP SDK, and is not supported for 039 * use in conjunction with non-UnboundID products. 040 * </BLOCKQUOTE> 041 * This class defines an exception that may be thrown if a problem occurs while 042 * attempting to parse a log message. 043 */ 044 @NotMutable() 045 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 046 public final class LogException 047 extends LDAPSDKException 048 { 049 /** 050 * The serial version UID for this serializable class. 051 */ 052 private static final long serialVersionUID = -5936254058683765082L; 053 054 055 056 // The malformed log message that triggered this exception. 057 private final String logMessage; 058 059 060 061 /** 062 * Creates a new log exception with the provided information. 063 * 064 * @param logMessage The malformed log message string that triggered this 065 * exception. It must not be {@code null}. 066 * @param explanation A message explaining the problem that occurred. It 067 * must not be {@code null}. 068 */ 069 public LogException(final String logMessage, final String explanation) 070 { 071 this(logMessage, explanation, null); 072 } 073 074 075 076 /** 077 * Creates a new log exception with the provided information. 078 * 079 * @param logMessage The malformed log message string that triggered this 080 * exception. It must not be {@code null}. 081 * @param explanation A message explaining the problem that occurred. It 082 * must not be {@code null}. 083 * @param cause An underlying exception that triggered this exception. 084 */ 085 public LogException(final String logMessage, final String explanation, 086 final Throwable cause) 087 { 088 super(explanation, cause); 089 090 ensureNotNull(logMessage, explanation); 091 092 this.logMessage = logMessage; 093 } 094 095 096 097 /** 098 * Retrieves the malformed log message string that triggered this exception. 099 * 100 * @return The malformed log message string that triggered this exception. 101 */ 102 public String getLogMessage() 103 { 104 return logMessage; 105 } 106 }