0 | |
From: Markus Koschany <apo@debian.org>
|
1 | |
Date: Sun, 25 Mar 2018 20:14:24 +0200
|
2 | |
Subject: CVE-2018-8088
|
3 | |
|
4 | |
Bug-Upstream: https://jira.qos.ch/browse/SLF4J-430
|
5 | |
Bug-Debian: https://bugs.debian.org/893684
|
6 | |
Forwarded: not-needed
|
7 | |
---
|
8 | |
.../src/main/java/org/slf4j/ext/EventData.java | 305 ---------------------
|
9 | |
1 file changed, 305 deletions(-)
|
10 | |
delete mode 100644 slf4j-ext/src/main/java/org/slf4j/ext/EventData.java
|
11 | |
|
12 | |
diff --git a/slf4j-ext/src/main/java/org/slf4j/ext/EventData.java b/slf4j-ext/src/main/java/org/slf4j/ext/EventData.java
|
13 | |
deleted file mode 100644
|
14 | |
index dc5b502..0000000
|
15 | |
--- a/slf4j-ext/src/main/java/org/slf4j/ext/EventData.java
|
16 | |
+++ /dev/null
|
17 | |
@@ -1,305 +0,0 @@
|
18 | |
-/**
|
19 | |
- * Copyright (c) 2004-2011 QOS.ch
|
20 | |
- * All rights reserved.
|
21 | |
- *
|
22 | |
- * Permission is hereby granted, free of charge, to any person obtaining
|
23 | |
- * a copy of this software and associated documentation files (the
|
24 | |
- * "Software"), to deal in the Software without restriction, including
|
25 | |
- * without limitation the rights to use, copy, modify, merge, publish,
|
26 | |
- * distribute, sublicense, and/or sell copies of the Software, and to
|
27 | |
- * permit persons to whom the Software is furnished to do so, subject to
|
28 | |
- * the following conditions:
|
29 | |
- *
|
30 | |
- * The above copyright notice and this permission notice shall be
|
31 | |
- * included in all copies or substantial portions of the Software.
|
32 | |
- *
|
33 | |
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
34 | |
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
35 | |
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
36 | |
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
37 | |
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
38 | |
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
39 | |
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
40 | |
- *
|
41 | |
- */
|
42 | |
-package org.slf4j.ext;
|
43 | |
-
|
44 | |
-import java.io.Serializable;
|
45 | |
-import java.io.ByteArrayInputStream;
|
46 | |
-import java.io.ByteArrayOutputStream;
|
47 | |
-import java.util.Date;
|
48 | |
-import java.util.HashMap;
|
49 | |
-import java.util.Iterator;
|
50 | |
-import java.util.Map;
|
51 | |
-import java.beans.XMLDecoder;
|
52 | |
-import java.beans.XMLEncoder;
|
53 | |
-import java.beans.ExceptionListener;
|
54 | |
-
|
55 | |
-/**
|
56 | |
- * Base class for Event Data. Event Data contains data to be logged about an
|
57 | |
- * event. Users may extend this class for each EventType they want to log.
|
58 | |
- *
|
59 | |
- * @author Ralph Goers
|
60 | |
- */
|
61 | |
-public class EventData implements Serializable {
|
62 | |
-
|
63 | |
- private static final long serialVersionUID = 153270778642103985L;
|
64 | |
-
|
65 | |
- private Map<String, Object> eventData = new HashMap<String, Object>();
|
66 | |
- public static final String EVENT_MESSAGE = "EventMessage";
|
67 | |
- public static final String EVENT_TYPE = "EventType";
|
68 | |
- public static final String EVENT_DATETIME = "EventDateTime";
|
69 | |
- public static final String EVENT_ID = "EventId";
|
70 | |
-
|
71 | |
- /**
|
72 | |
- * Default Constructor
|
73 | |
- */
|
74 | |
- public EventData() {
|
75 | |
- }
|
76 | |
-
|
77 | |
- /**
|
78 | |
- * Constructor to create event data from a Map.
|
79 | |
- *
|
80 | |
- * @param map
|
81 | |
- * The event data.
|
82 | |
- */
|
83 | |
- public EventData(Map<String, Object> map) {
|
84 | |
- eventData.putAll(map);
|
85 | |
- }
|
86 | |
-
|
87 | |
- /**
|
88 | |
- * Construct from a serialized form of the Map containing the RequestInfo
|
89 | |
- * elements
|
90 | |
- *
|
91 | |
- * @param xml
|
92 | |
- * The serialized form of the RequestInfo Map.
|
93 | |
- */
|
94 | |
- @SuppressWarnings("unchecked")
|
95 | |
- public EventData(String xml) {
|
96 | |
- ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
|
97 | |
- try {
|
98 | |
- XMLDecoder decoder = new XMLDecoder(bais);
|
99 | |
- this.eventData = (Map<String, Object>) decoder.readObject();
|
100 | |
- } catch (Exception e) {
|
101 | |
- throw new EventException("Error decoding " + xml, e);
|
102 | |
- }
|
103 | |
- }
|
104 | |
-
|
105 | |
- /**
|
106 | |
- * Serialize all the EventData items into an XML representation.
|
107 | |
- *
|
108 | |
- * @return an XML String containing all the EventData items.
|
109 | |
- */
|
110 | |
- public String toXML() {
|
111 | |
- return toXML(eventData);
|
112 | |
- }
|
113 | |
-
|
114 | |
- /**
|
115 | |
- * Serialize all the EventData items into an XML representation.
|
116 | |
- *
|
117 | |
- * @param map the Map to transform
|
118 | |
- * @return an XML String containing all the EventData items.
|
119 | |
- */
|
120 | |
- public static String toXML(Map<String, Object> map) {
|
121 | |
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
122 | |
- try {
|
123 | |
- XMLEncoder encoder = new XMLEncoder(baos);
|
124 | |
- encoder.setExceptionListener(new ExceptionListener() {
|
125 | |
- public void exceptionThrown(Exception exception) {
|
126 | |
- exception.printStackTrace();
|
127 | |
- }
|
128 | |
- });
|
129 | |
- encoder.writeObject(map);
|
130 | |
- encoder.close();
|
131 | |
- return baos.toString();
|
132 | |
- } catch (Exception e) {
|
133 | |
- e.printStackTrace();
|
134 | |
- return null;
|
135 | |
- }
|
136 | |
- }
|
137 | |
-
|
138 | |
- /**
|
139 | |
- * Retrieve the event identifier.
|
140 | |
- *
|
141 | |
- * @return The event identifier
|
142 | |
- */
|
143 | |
- public String getEventId() {
|
144 | |
- return (String) this.eventData.get(EVENT_ID);
|
145 | |
- }
|
146 | |
-
|
147 | |
- /**
|
148 | |
- * Set the event identifier.
|
149 | |
- *
|
150 | |
- * @param eventId
|
151 | |
- * The event identifier.
|
152 | |
- */
|
153 | |
- public void setEventId(String eventId) {
|
154 | |
- if (eventId == null) {
|
155 | |
- throw new IllegalArgumentException("eventId cannot be null");
|
156 | |
- }
|
157 | |
- this.eventData.put(EVENT_ID, eventId);
|
158 | |
- }
|
159 | |
-
|
160 | |
- /**
|
161 | |
- * Retrieve the message text associated with this event, if any.
|
162 | |
- *
|
163 | |
- * @return The message text associated with this event or null if there is
|
164 | |
- * none.
|
165 | |
- */
|
166 | |
- public String getMessage() {
|
167 | |
- return (String) this.eventData.get(EVENT_MESSAGE);
|
168 | |
- }
|
169 | |
-
|
170 | |
- /**
|
171 | |
- * Set the message text associated with this event.
|
172 | |
- *
|
173 | |
- * @param message
|
174 | |
- * The message text.
|
175 | |
- */
|
176 | |
- public void setMessage(String message) {
|
177 | |
- this.eventData.put(EVENT_MESSAGE, message);
|
178 | |
- }
|
179 | |
-
|
180 | |
- /**
|
181 | |
- * Retrieve the date and time the event occurred.
|
182 | |
- *
|
183 | |
- * @return The Date associated with the event.
|
184 | |
- */
|
185 | |
- public Date getEventDateTime() {
|
186 | |
- return (Date) this.eventData.get(EVENT_DATETIME);
|
187 | |
- }
|
188 | |
-
|
189 | |
- /**
|
190 | |
- * Set the date and time the event occurred in case it is not the same as when
|
191 | |
- * the event was logged.
|
192 | |
- *
|
193 | |
- * @param eventDateTime
|
194 | |
- * The event Date.
|
195 | |
- */
|
196 | |
- public void setEventDateTime(Date eventDateTime) {
|
197 | |
- this.eventData.put(EVENT_DATETIME, eventDateTime);
|
198 | |
- }
|
199 | |
-
|
200 | |
- /**
|
201 | |
- * Set the type of event that occurred.
|
202 | |
- *
|
203 | |
- * @param eventType
|
204 | |
- * The type of the event.
|
205 | |
- */
|
206 | |
- public void setEventType(String eventType) {
|
207 | |
- this.eventData.put(EVENT_TYPE, eventType);
|
208 | |
- }
|
209 | |
-
|
210 | |
- /**
|
211 | |
- * Retrieve the type of the event.
|
212 | |
- *
|
213 | |
- * @return The event type.
|
214 | |
- */
|
215 | |
- public String getEventType() {
|
216 | |
- return (String) this.eventData.get(EVENT_TYPE);
|
217 | |
- }
|
218 | |
-
|
219 | |
- /**
|
220 | |
- * Add arbitrary attributes about the event.
|
221 | |
- *
|
222 | |
- * @param name
|
223 | |
- * The attribute's key.
|
224 | |
- * @param obj
|
225 | |
- * The data associated with the key.
|
226 | |
- */
|
227 | |
- public void put(String name, Serializable obj) {
|
228 | |
- this.eventData.put(name, obj);
|
229 | |
- }
|
230 | |
-
|
231 | |
- /**
|
232 | |
- * Retrieve an event attribute.
|
233 | |
- *
|
234 | |
- * @param name
|
235 | |
- * The attribute's key.
|
236 | |
- * @return The value associated with the key or null if the key is not
|
237 | |
- * present.
|
238 | |
- */
|
239 | |
- public Serializable get(String name) {
|
240 | |
- return (Serializable) this.eventData.get(name);
|
241 | |
- }
|
242 | |
-
|
243 | |
- /**
|
244 | |
- * Populate the event data from a Map.
|
245 | |
- *
|
246 | |
- * @param data
|
247 | |
- * The Map to copy.
|
248 | |
- */
|
249 | |
- public void putAll(Map<String, Object> data) {
|
250 | |
- this.eventData.putAll(data);
|
251 | |
- }
|
252 | |
-
|
253 | |
- /**
|
254 | |
- * Returns the number of attributes in the EventData.
|
255 | |
- *
|
256 | |
- * @return the number of attributes in the EventData.
|
257 | |
- */
|
258 | |
- public int getSize() {
|
259 | |
- return this.eventData.size();
|
260 | |
- }
|
261 | |
-
|
262 | |
- /**
|
263 | |
- * Returns an Iterator over all the entries in the EventData.
|
264 | |
- *
|
265 | |
- * @return an Iterator that can be used to access all the event attributes.
|
266 | |
- */
|
267 | |
- public Iterator<Map.Entry<String, Object>> getEntrySetIterator() {
|
268 | |
- return this.eventData.entrySet().iterator();
|
269 | |
- }
|
270 | |
-
|
271 | |
- /**
|
272 | |
- * Retrieve all the attributes in the EventData as a Map. Changes to this map
|
273 | |
- * will be reflected in the EventData.
|
274 | |
- *
|
275 | |
- * @return The Map of attributes in this EventData instance.
|
276 | |
- */
|
277 | |
- public Map<String, Object> getEventMap() {
|
278 | |
- return this.eventData;
|
279 | |
- }
|
280 | |
-
|
281 | |
- /**
|
282 | |
- * Convert the EventData to a String.
|
283 | |
- *
|
284 | |
- * @return The EventData as a String.
|
285 | |
- */
|
286 | |
- @Override
|
287 | |
- public String toString() {
|
288 | |
- return toXML();
|
289 | |
- }
|
290 | |
-
|
291 | |
- /**
|
292 | |
- * Compare two EventData objects for equality.
|
293 | |
- *
|
294 | |
- * @param o
|
295 | |
- * The Object to compare.
|
296 | |
- * @return true if the objects are the same instance or contain all the same
|
297 | |
- * keys and their values.
|
298 | |
- */
|
299 | |
- @SuppressWarnings("unchecked")
|
300 | |
- @Override
|
301 | |
- public boolean equals(Object o) {
|
302 | |
- if (this == o) {
|
303 | |
- return true;
|
304 | |
- }
|
305 | |
- if (!(o instanceof EventData || o instanceof Map)) {
|
306 | |
- return false;
|
307 | |
- }
|
308 | |
- Map<String, Object> map = (o instanceof EventData) ? ((EventData) o).getEventMap() : (Map<String, Object>) o;
|
309 | |
-
|
310 | |
- return this.eventData.equals(map);
|
311 | |
- }
|
312 | |
-
|
313 | |
- /**
|
314 | |
- * Compute the hashCode for this EventData instance.
|
315 | |
- *
|
316 | |
- * @return The hashcode for this EventData instance.
|
317 | |
- */
|
318 | |
- @Override
|
319 | |
- public int hashCode() {
|
320 | |
- return this.eventData.hashCode();
|
321 | |
- }
|
322 | |
-}
|
323 | |
\ No newline at end of file
|