Project Report: fawkez

Packagesummary org.jcoderz.commons

org.jcoderz.commons.LogEvent

LineHitsNoteSource
1  /*
2   * $Id: LogEvent.java 1492 2009-06-06 13:36:19Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33  package org.jcoderz.commons;
34  
35  
36  import java.io.Serializable;
37  import java.util.List;
38  import java.util.Set;
39  
40  
41  /**
42   * This is the Base class for log events.
43   *
44   * <p>The base class of this LogEvent is Throwable but instances
45   * of this class are not expected to be thrown.</p>
46   *
47   * <p>Most functionality is implemented and documented by the
48   * {@link org.jcoderz.commons.LoggableImpl} which is used a member of
49   * objects of this class.</p>
50   *
51   * @see org.jcoderz.commons
52   * @author Andreas Mandel
53   */
54  public class LogEvent
55        extends Throwable
56        implements Loggable
57  {
58     static final long serialVersionUID = 2L;
59  
60     /** The loggable implementation. */
61     private final LoggableImpl mLoggable;
62  
63     /**
64      * Constructor getting an log message info.
65      *
66      * @param messageInfo the log message info for this exception
67      */
68     public LogEvent (LogMessageInfo messageInfo)
69     {
70100       super(messageInfo.getSymbol());
71100       mLoggable = new LoggableImpl(this, messageInfo);
72100    }
73  
74     /**
75      * Constructor getting an log message info and a root exception.
76      *
77      * @param messageInfo the log message info for this exception
78      * @param cause the problem that caused this exception to be thrown
79      */
80     public LogEvent (LogMessageInfo messageInfo, Throwable cause)
81     {
82100       super(messageInfo.getSymbol(), cause);
83100       mLoggable = new LoggableImpl(this, messageInfo, cause);
84100    }
85  
86     /** {@inheritDoc} */
87     public Throwable initCause (Throwable cause)
88     {
890       super.initCause(cause);
900       mLoggable.initCause(cause);
910       return this;
92     }
93  
94     /** {@inheritDoc} */
95     public final void addParameter (String name, Serializable value)
96     {
97100       mLoggable.addParameter(name, value);
98100    }
99  
100     /** {@inheritDoc} */
101     public String getInstanceId ()
102     {
103100       return mLoggable.getInstanceId();
104     }
105  
106     /** {@inheritDoc} */
107     public final String getMessage ()
108     {
109100       return mLoggable.getMessage();
110     }
111  
112     /** {@inheritDoc} */
113     public final void log ()
114     {
115100       mLoggable.log();
116100    }
117  
118     /** {@inheritDoc} */
119     public Throwable getCause ()
120     {
121100       return mLoggable.getCause();
122     }
123  
124     /** {@inheritDoc} */
125     public long getEventTime ()
126     {
127100       return mLoggable.getEventTime();
128     }
129  
130     /** {@inheritDoc} */
131     public LogMessageInfo getLogMessageInfo ()
132     {
133100       return mLoggable.getLogMessageInfo();
134     }
135  
136     /** {@inheritDoc} */
137     public String getNodeId ()
138     {
139100       return mLoggable.getNodeId();
140     }
141  
142     /** {@inheritDoc} */
143     public List getParameter (String name)
144     {
145100       return mLoggable.getParameter(name);
146     }
147  
148     /** {@inheritDoc} */
149     public Set getParameterNames ()
150     {
151100       return mLoggable.getParameterNames();
152     }
153  
154     /** {@inheritDoc} */
155     public long getThreadId ()
156     {
157100       return mLoggable.getThreadId();
158     }
159  
160     /** {@inheritDoc} */
161     public String getTrackingNumber ()
162     {
163100       return mLoggable.getTrackingNumber();
164     }
165  
166     /** {@inheritDoc} */
167     public String getSourceClass ()
168     {
169100       return mLoggable.getSourceClass();
170     }
171  
172     /** {@inheritDoc} */
173     public String getSourceMethod ()
174     {
175100       return mLoggable.getSourceMethod();
176     }
177  
178     /** {@inheritDoc} */
179     public String getThreadName ()
180     {
181100        return mLoggable.getThreadName();
182     }
183  
184     /** {@inheritDoc} */
185     public String toString ()
186     {
187100       return mLoggable.toString();
188     }
189  
190     /** {@inheritDoc} */
191     public String toDetailedString ()
192     {
1930       return mLoggable.toDetailedString();
194     }
195  
196  
197     LoggableImpl getExceptionImpl ()
198     {
1990       return mLoggable;
200     }
201  }

Findings in this File

f (1) Copied and pasted code. 286 equal tokens (115 lines) found in 2 locations. See also: org.jcoderz.commons.BaseException:93 Delegation code can not be externalized further.