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