001/* 002 * Copyright 2009-2018 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2015-2018 Ping Identity Corporation 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 */ 021package com.unboundid.ldap.sdk.unboundidds.logs; 022 023 024 025import com.unboundid.util.LDAPSDKException; 026import com.unboundid.util.NotMutable; 027import com.unboundid.util.ThreadSafety; 028import com.unboundid.util.ThreadSafetyLevel; 029 030import static com.unboundid.util.Validator.*; 031 032 033 034/** 035 * This class defines an exception that may be thrown if a problem occurs while 036 * attempting to parse a log message. 037 * <BR> 038 * <BLOCKQUOTE> 039 * <B>NOTE:</B> This class, and other classes within the 040 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 041 * supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661 042 * server products. These classes provide support for proprietary 043 * functionality or for external specifications that are not considered stable 044 * or mature enough to be guaranteed to work in an interoperable way with 045 * other types of LDAP servers. 046 * </BLOCKQUOTE> 047 */ 048@NotMutable() 049@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 050public final class LogException 051 extends LDAPSDKException 052{ 053 /** 054 * The serial version UID for this serializable class. 055 */ 056 private static final long serialVersionUID = -5936254058683765082L; 057 058 059 060 // The malformed log message that triggered this exception. 061 private final String logMessage; 062 063 064 065 /** 066 * Creates a new log exception with the provided information. 067 * 068 * @param logMessage The malformed log message string that triggered this 069 * exception. It must not be {@code null}. 070 * @param explanation A message explaining the problem that occurred. It 071 * must not be {@code null}. 072 */ 073 public LogException(final String logMessage, final String explanation) 074 { 075 this(logMessage, explanation, null); 076 } 077 078 079 080 /** 081 * Creates a new log exception with the provided information. 082 * 083 * @param logMessage The malformed log message string that triggered this 084 * exception. It must not be {@code null}. 085 * @param explanation A message explaining the problem that occurred. It 086 * must not be {@code null}. 087 * @param cause An underlying exception that triggered this exception. 088 */ 089 public LogException(final String logMessage, final String explanation, 090 final Throwable cause) 091 { 092 super(explanation, cause); 093 094 ensureNotNull(logMessage, explanation); 095 096 this.logMessage = logMessage; 097 } 098 099 100 101 /** 102 * Retrieves the malformed log message string that triggered this exception. 103 * 104 * @return The malformed log message string that triggered this exception. 105 */ 106 public String getLogMessage() 107 { 108 return logMessage; 109 } 110}