Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 207160
Collapse All | Expand All

(-)src.events/org/eclipse/tptp/logging/events/cbe/impl/EventXMLFileEventFactoryHomeImpl.java (-78 / +53 lines)
Lines 11-17 Link Here
11
import org.eclipse.tptp.logging.events.cbe.util.EventFormatter;
11
import org.eclipse.tptp.logging.events.cbe.util.EventFormatter;
12
12
13
/**********************************************************************
13
/**********************************************************************
14
 * Copyright (c) 2005, 2006 IBM Corporation and others.
14
 * Copyright (c) 2005, 2007 IBM Corporation and others.
15
 * All rights reserved.   This program and the accompanying materials
15
 * All rights reserved.   This program and the accompanying materials
16
 * are made available under the terms of the Eclipse Public License v1.0
16
 * are made available under the terms of the Eclipse Public License v1.0
17
 * which accompanies this distribution, and is available at
17
 * which accompanies this distribution, and is available at
Lines 81-87 Link Here
81
 * <p>
81
 * <p>
82
 * 
82
 * 
83
 * @author Paul E. Slauenwhite
83
 * @author Paul E. Slauenwhite
84
 * @version March 10, 2005
84
 * @version October 27, 2007
85
 * @since 1.0.1
85
 * @since 1.0.1
86
 * @see org.eclipse.tptp.logging.events.cbe.impl.AbstractEventFactoryHome
86
 * @see org.eclipse.tptp.logging.events.cbe.impl.AbstractEventFactoryHome
87
 * @see org.eclipse.tptp.logging.events.cbe.TemplateContentHandler
87
 * @see org.eclipse.tptp.logging.events.cbe.TemplateContentHandler
Lines 135-216 Link Here
135
135
136
        if ((fileName != null) && (fileName.trim().length() > 0)) {
136
        if ((fileName != null) && (fileName.trim().length() > 0)) {
137
137
138
            // Attempt to find the actual local location of the configuration
138
            //Attempt to load the configuration template file using the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader:
139
            // template file
139
	        try {
140
            // using the following class loader hierarchy:
140
	
141
            // -The current class' (e.g. EventXMLFileEventFactoryHomeImpl) class
141
                //Attempt to load the configuration template file using the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader and privileged security:
142
            // loader.
142
	            inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
143
            // -The system's class loader.
143
	
144
            // -The current thread's context class loader.
144
	                public Object run() throws Exception {
145
            try {
145
	                    return (org.eclipse.tptp.logging.events.cbe.impl.EventXMLFileEventFactoryHomeImpl.class.getClassLoader().getResourceAsStream(fileName));
146
146
	                }
147
                // Consult the current class' (e.g.
147
	            })));
148
                // EventXMLFileEventFactoryHomeImpl) class
148
	        } 
149
                // loader to find the actual local location of the configuration
149
	        catch (Throwable t) {
150
                // template file
150
            	//Ignore since insufficient security privileges for loading the configuration template file using the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader and privileged security.
151
                // using privileged security:
151
	        }
152
                inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
152
	        
153
153
            //If the configuration template file could not be loaded using the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader, attempt the file load using the system's class loader:
154
                    public Object run() throws Exception {
154
	        if(inputStream == null){
155
                        return (org.eclipse.tptp.logging.events.cbe.impl.EventXMLFileEventFactoryHomeImpl.class.getClassLoader().getResourceAsStream(fileName));
155
	        
156
                    }
156
	            try {
157
                })));
157
	
158
            } catch (Throwable t) {
158
	                //Attempt to load the configuration template file using the system's class loader and privileged security:
159
159
	                inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
160
                // Catch all exceptions since the current class' (e.g.
160
	
161
                // EventXMLFileEventFactoryHomeImpl)
161
	                    public Object run() throws Exception {
162
                // class loader may be null (e.g. current class was loaded by
162
	                        return (ClassLoader.getSystemClassLoader().getResourceAsStream(fileName));
163
                // the bootstrap
163
	                    }
164
                // class loader) or insufficient security privileges
164
	                })));
165
                // for accessing the current class' class loader and we
165
	            } 
166
                // will attempt to use the system's class loader.
166
	            catch (Throwable t) {
167
                try {
167
	            	//Ignore since insufficient security privileges for loading the configuration template file using the system's class loader and privileged security.
168
168
	            }
169
                    // Consult the system's class loader to find the
169
	            
170
                    // actual local location of the configuration template file
170
	            //If the configuration template file could not be loaded using the system's class loader, attempt the file load using the current thread's context class loader:
171
                    // using privileged security:
171
	            if(inputStream == null){
172
                    inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
172
	            
173
173
	                try {
174
                        public Object run() throws Exception {
174
	
175
                            return (ClassLoader.getSystemClassLoader().getResourceAsStream(fileName));
175
	                	//Attempt to load the configuration template file using the current thread's context class loader and privileged security:
176
                        }
176
	                    inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
177
                    })));
177
	
178
                } catch (Throwable tt) {
178
	                        public Object run() throws Exception {
179
179
	                            return (Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName));
180
                    // Catch all exceptions since the system's class loader
180
	                        }
181
                    // may be null or insufficient security privileges for
181
	                    })));
182
                    // accessing the system's class loader and we
182
	                } 
183
                    // will attempt to use the current thread's context class
183
	                catch (Throwable t) {
184
                    // loader.
184
	                	//Ignore since insufficient security privileges for loading the configuration template file using the current thread's context class loader and privileged security.
185
                    try {
185
	                }
186
186
	            }
187
                        // Consult the current thread's context class loader to
187
	        }
188
                        // find
188
	    }
189
                        // the actual local location of the configuration
190
                        // template file
191
                        // using privileged security:
192
                        inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
193
194
                            public Object run() throws Exception {
195
                                return (Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName));
196
                            }
197
                        })));
198
                    } catch (Throwable ttt) {
199
200
                        // Ignore since the current thread's context class
201
                        // loader
202
                        // may be null or insufficient security privileges for
203
                        // accessing the current thread's context class loader
204
                        // and
205
                        // the API's post condition states a null return value
206
                        // if the actual local location of the configuration
207
                        // template
208
                        // file cannot be resolved (e.g. insufficient security
209
                        // privileges).
210
                    }
211
                }
212
            }
213
        }
214
189
215
        return inputStream;
190
        return inputStream;
216
    }
191
    }
(-)src.events/org/eclipse/tptp/logging/events/cbe/impl/EventFactoryContext.java (-65 / +33 lines)
Lines 6-12 Link Here
6
import org.eclipse.tptp.logging.events.cbe.EventFactoryHome;
6
import org.eclipse.tptp.logging.events.cbe.EventFactoryHome;
7
7
8
/**********************************************************************
8
/**********************************************************************
9
 * Copyright (c) 2005, 2006 IBM Corporation and others.
9
 * Copyright (c) 2005, 2007 IBM Corporation and others.
10
 * All rights reserved.   This program and the accompanying materials
10
 * All rights reserved.   This program and the accompanying materials
11
 * are made available under the terms of the Eclipse Public License v1.0
11
 * are made available under the terms of the Eclipse Public License v1.0
12
 * which accompanies this distribution, and is available at
12
 * which accompanies this distribution, and is available at
Lines 71-77 Link Here
71
 * <p>
71
 * <p>
72
 * 
72
 * 
73
 * @author Paul E. Slauenwhite
73
 * @author Paul E. Slauenwhite
74
 * @version March 10, 2005
74
 * @version October 27, 2007
75
 * @since 1.0.1
75
 * @since 1.0.1
76
 * @see org.eclipse.tptp.logging.events.cbe.EventFactoryHome
76
 * @see org.eclipse.tptp.logging.events.cbe.EventFactoryHome
77
 */
77
 */
Lines 204-308 Link Here
204
204
205
            Class eventFactoryHomeClass = null;
205
            Class eventFactoryHomeClass = null;
206
206
207
            // Attempt to find the EventFactoryHome class using the parameter
207
            //Attempt to load the EventFactoryHome class using the parameter class loader:
208
            // (e.g. caller's)
209
            // class loader:
210
            if (classLoader != null) {
208
            if (classLoader != null) {
211
209
212
                try {
210
                try {
213
211
                    
214
                    // Consult the parameter (e.g. caller's) class loader to
212
                    //Attempt to load the EventFactoryHome class using the parameter class loader and privileged security:
215
                    // find the
216
                    // EventFactoryHome class using privileged security:
217
                    eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
213
                    eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
218
214
219
                        public Object run() throws Exception {
215
                        public Object run() throws Exception {
220
                            return (classLoader.loadClass(eventFactoryHomeType));
216
                            return (classLoader.loadClass(eventFactoryHomeType));
221
                        }
217
                        }
222
                    })));
218
                    })));
223
                } catch (Throwable t) {
219
                } 
224
                    // Ignore since insufficient security privileges for
220
                catch (Throwable t) {
225
                    // accessing the
221
                	//Ignore since insufficient security privileges for loading the EventFactoryHome class using the parameter class loader and privileged security.
226
                    // parameter (e.g. caller's) class loader and we will
227
                    // attempt to use
228
                    // the current class' class loader.
229
                }
222
                }
230
            }
223
            }
231
224
232
            // If the EventFactoryHome class could not be located using the
225
            //If the EventFactoryHome class could not be loaded using the parameter class loader, attempt the class load using the current class' (e.g. EventFactoryContext) class loader:
233
            // parameter (e.g. caller's)
234
            // class loader, the EventFactoryHome class is attempted to be
235
            // found using the following class loader hierarchy:
236
            // -The current class' (e.g. EventFactoryContext) class loader.
237
            // -The system's class loader.
238
            // -The current thread's context class loader.
239
            if (eventFactoryHomeClass == null) {
226
            if (eventFactoryHomeClass == null) {
240
227
241
                try {
228
                try {
242
229
243
                    // Consult the current class' (e.g. EventFactoryContext)
230
                    //Attempt to load the EventFactoryHome class using the current class' (e.g. EventFactoryContext) class loader and privileged security:
244
                    // class
245
                    // loader to find the EventFactoryHome class using
246
                    // privileged
247
                    // security:
248
                    eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
231
                    eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
249
232
250
                        public Object run() throws Exception {
233
                        public Object run() throws Exception {
251
                            return (org.eclipse.tptp.logging.events.cbe.impl.EventFactoryContext.class.getClassLoader().loadClass(eventFactoryHomeType));
234
                            return (org.eclipse.tptp.logging.events.cbe.impl.EventFactoryContext.class.getClassLoader().loadClass(eventFactoryHomeType));
252
                        }
235
                        }
253
                    })));
236
                    })));
254
                } catch (Throwable t) {
237
                } 
255
238
                catch (Throwable t) {
256
                    // Catch all exceptions since the current class' (e.g.
239
                	//Ignore since insufficient security privileges for loading the EventFactoryHome class using the current class' (e.g. EventFactoryContext) class loader and privileged security.
257
                    // EventFactoryContext)
240
                }
258
                    // class loader may be null (e.g. current class was loaded
241
                
259
                    // by the bootstrap
242
                //If the EventFactoryHome class could not be loaded using the current class' (e.g. EventFactoryContext) class loader, attempt the class load using the system's class loader:
260
                    // class loader) or insufficient security privileges
243
                if(eventFactoryHomeClass == null){
261
                    // for accessing the current class' class loader and we
244
                    
262
                    // will attempt to use the system's class loader.
245
                	try {
263
                    try {
264
246
265
                        // Consult the system's class loader to find the
247
                        //Attempt to load the EventFactoryHome class using the system's class loader and privileged security:
266
                        // EventFactoryHome class using privileged security:
267
                        eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
248
                        eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
268
249
269
                            public Object run() throws Exception {
250
                            public Object run() throws Exception {
270
                                return (ClassLoader.getSystemClassLoader().loadClass(eventFactoryHomeType));
251
                                return (ClassLoader.getSystemClassLoader().loadClass(eventFactoryHomeType));
271
                            }
252
                            }
272
                        })));
253
                        })));
273
                    } catch (Throwable tt) {
254
                    } 
255
                    catch (Throwable t) {
256
                    	//Ignore since insufficient security privileges for loading the EventFactoryHome class using the system's class loader and privileged security.
257
                    }
258
                
259
                    //If the EventFactoryHome class could not be loaded using the system's class loader, attempt the class load using the current thread's context class loader:
260
                    if(eventFactoryHomeClass == null){
261
                        
262
                    	try {
274
263
275
                        // Catch all exceptions since the system's class loader
264
                            //Attempt to load the EventFactoryHome class using the system's class loader:
276
                        // may be null or insufficient security privileges for
277
                        // accessing the system's class loader and we
278
                        // will attempt to use the current thread's context
279
                        // class
280
                        // loader.
281
                        try {
282
283
                            // Consult the current thread's context class loader
284
                            // to find
285
                            // the EventFactoryHome class using privileged
286
                            // security:
287
                            eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
265
                            eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
288
266
289
                                public Object run() throws Exception {
267
                                public Object run() throws Exception {
290
                                    return (Thread.currentThread().getContextClassLoader().loadClass(eventFactoryHomeType));
268
                                    return (Thread.currentThread().getContextClassLoader().loadClass(eventFactoryHomeType));
291
                                }
269
                                }
292
                            })));
270
                            })));
293
                        } catch (Throwable ttt) {
271
                        } 
294
272
                        catch (Throwable t) {
295
                            // Ignore since the current thread's context class
273
                        	//Ignore since insufficient security privileges for loading the EventFactoryHome class using the system's class loader.
296
                            // loader
297
                            // may be null or insufficient security privileges
298
                            // for
299
                            // accessing the current thread's context class
300
                            // loader and
301
                            // the API's post condition states a null return
302
                            // value
303
                            // if the EventFactoryHome cannot be resolved and/or
304
                            // instantiated (e.g. insufficient security
305
                            // privileges).
306
                        }
274
                        }
307
                    }
275
                    }
308
                }
276
                }
(-)src.cbe101/org/eclipse/hyades/logging/events/cbe/impl/EventFactoryContext.java (-46 / +27 lines)
Lines 6-12 Link Here
6
import org.eclipse.hyades.logging.events.cbe.EventFactoryHome;
6
import org.eclipse.hyades.logging.events.cbe.EventFactoryHome;
7
7
8
/*******************************************************************************
8
/*******************************************************************************
9
 * Copyright (c) 2005, 2006 IBM Corporation and others. All rights reserved. This program and the
9
 * Copyright (c) 2005, 2007 IBM Corporation and others. All rights reserved. This program and the
10
 * accompanying materials are made available under the terms of the Eclipse
10
 * accompanying materials are made available under the terms of the Eclipse
11
 * Public License v1.0 which accompanies this distribution, and is available at
11
 * Public License v1.0 which accompanies this distribution, and is available at
12
 * http://www.eclipse.org/legal/epl-v10.html
12
 * http://www.eclipse.org/legal/epl-v10.html
Lines 69-75 Link Here
69
 * <p>
69
 * <p>
70
 * 
70
 * 
71
 * @author Paul E Slauenwhite
71
 * @author Paul E Slauenwhite
72
 * @version 1.0.1
72
 * @version October 27, 2007
73
 * @since 1.0.1
73
 * @since 1.0.1
74
 * @see org.eclipse.hyades.logging.events.cbe.EventFactoryHome
74
 * @see org.eclipse.hyades.logging.events.cbe.EventFactoryHome
75
 */
75
 */
Lines 201-214 Link Here
201
201
202
            Class eventFactoryHomeClass = null;
202
            Class eventFactoryHomeClass = null;
203
203
204
            //Attempt to find the EventFactoryHome class using the parameter (e.g. caller's) 
204
            //Attempt to load the EventFactoryHome class using the parameter class loader:
205
            //class loader:
206
            if (classLoader != null) {
205
            if (classLoader != null) {
207
206
208
                try {
207
                try {
209
                    
208
                    
210
                    //Consult the parameter (e.g. caller's) class loader to find the
209
                    //Attempt to load the EventFactoryHome class using the parameter class loader and privileged security:
211
                    //EventFactoryHome class using privileged security:
212
                    eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
210
                    eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
213
211
214
                        public Object run() throws Exception {
212
                        public Object run() throws Exception {
Lines 217-241 Link Here
217
                    })));
215
                    })));
218
                } 
216
                } 
219
                catch (Throwable t) {
217
                catch (Throwable t) {
220
                    //Ignore since insufficient security privileges for accessing the
218
                	//Ignore since insufficient security privileges for loading the EventFactoryHome class using the parameter class loader and privileged security.
221
                    //parameter (e.g. caller's) class loader and we will attempt to use 
222
                    //the current class' class loader.
223
                }
219
                }
224
            }
220
            }
225
221
226
            //If the EventFactoryHome class could not be located using the parameter (e.g. caller's) 
222
            //If the EventFactoryHome class could not be loaded using the parameter class loader, attempt the class load using the current class' (e.g. EventFactoryContext) class loader:
227
            //class loader, the EventFactoryHome class is attempted to be
228
            //found using the following class loader hierarchy:
229
            //-The current class' (e.g. EventFactoryContext) class loader.
230
            //-The system's class loader.
231
            //-The current thread's context class loader.
232
            if (eventFactoryHomeClass == null) {
223
            if (eventFactoryHomeClass == null) {
233
224
234
                try {
225
                try {
235
226
236
                    //Consult the current class' (e.g. EventFactoryContext) class 
227
                    //Attempt to load the EventFactoryHome class using the current class' (e.g. EventFactoryContext) class loader and privileged security:
237
                    //loader to find the EventFactoryHome class using privileged 
238
                    //security:
239
                    eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
228
                    eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
240
229
241
                        public Object run() throws Exception {
230
                        public Object run() throws Exception {
Lines 244-259 Link Here
244
                    })));
233
                    })));
245
                } 
234
                } 
246
                catch (Throwable t) {
235
                catch (Throwable t) {
236
                	//Ignore since insufficient security privileges for loading the EventFactoryHome class using the current class' (e.g. EventFactoryContext) class loader and privileged security.
237
                }
238
                
239
                //If the EventFactoryHome class could not be loaded using the current class' (e.g. EventFactoryContext) class loader, attempt the class load using the system's class loader:
240
                if(eventFactoryHomeClass == null){
241
                    
242
                	try {
247
243
248
                    //Catch all exceptions since the current class' (e.g. EventFactoryContext)
244
                        //Attempt to load the EventFactoryHome class using the system's class loader and privileged security:
249
                    //class loader may be null (e.g. current class was loaded by the bootstrap
250
                    //class loader) or insufficient security privileges 
251
                    //for accessing the current class' class loader and we 
252
                    //will attempt to use the system's class loader.
253
                    try {
254
255
                        //Consult the system's class loader to find the
256
                        //EventFactoryHome class using privileged security:
257
                        eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
245
                        eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
258
246
259
                            public Object run() throws Exception {
247
                            public Object run() throws Exception {
Lines 261-277 Link Here
261
                            }
249
                            }
262
                        })));
250
                        })));
263
                    } 
251
                    } 
264
                    catch (Throwable tt) {
252
                    catch (Throwable t) {
265
253
                    	//Ignore since insufficient security privileges for loading the EventFactoryHome class using the system's class loader and privileged security.
266
                        //Catch all exceptions since the system's class loader
254
                    }
267
                        //may be null or insufficient security privileges for 
255
                
268
                        //accessing the system's class loader and we 
256
                    //If the EventFactoryHome class could not be loaded using the system's class loader, attempt the class load using the current thread's context class loader:
269
                        //will attempt to use the current thread's context class 
257
                    if(eventFactoryHomeClass == null){
270
                        //loader.
258
                        
271
                        try {
259
                    	try {
272
260
273
                            //Consult the current thread's context class loader to find 
261
                            //Attempt to load the EventFactoryHome class using the system's class loader:
274
                            //the EventFactoryHome class using privileged security:
275
                            eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
262
                            eventFactoryHomeClass = ((Class) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
276
263
277
                                public Object run() throws Exception {
264
                                public Object run() throws Exception {
Lines 279-297 Link Here
279
                                }
266
                                }
280
                            })));
267
                            })));
281
                        } 
268
                        } 
282
                        catch (Throwable ttt) {
269
                        catch (Throwable t) {
283
270
                        	//Ignore since insufficient security privileges for loading the EventFactoryHome class using the system's class loader.
284
                            //Ignore since the current thread's context class loader
285
                            //may be null or insufficient security privileges for 
286
                            //accessing the current thread's context class loader and
287
                            //the API's post condition states a null return value 
288
                            //if the EventFactoryHome cannot be resolved and/or 
289
                            //instantiated (e.g. insufficient security privileges).
290
                        }
271
                        }
291
                    }
272
                    }
292
                }
273
                }
293
            }
274
            }
294
275
            
295
            if (eventFactoryHomeClass != null) {
276
            if (eventFactoryHomeClass != null) {
296
277
297
                try {
278
                try {
(-)src.cbe101/org/eclipse/hyades/logging/events/cbe/impl/EventXMLFileEventFactoryHomeImpl.java (-37 / +21 lines)
Lines 11-17 Link Here
11
import org.eclipse.hyades.logging.events.cbe.util.EventFormatter;
11
import org.eclipse.hyades.logging.events.cbe.util.EventFormatter;
12
12
13
/*******************************************************************************
13
/*******************************************************************************
14
 * Copyright (c) 2005, 2006 IBM Corporation and others. All rights reserved. This program and the
14
 * Copyright (c) 2005, 2007 IBM Corporation and others. All rights reserved. This program and the
15
 * accompanying materials are made available under the terms of the Eclipse
15
 * accompanying materials are made available under the terms of the Eclipse
16
 * Public License v1.0 which accompanies this distribution, and is available at
16
 * Public License v1.0 which accompanies this distribution, and is available at
17
 * http://www.eclipse.org/legal/epl-v10.html
17
 * http://www.eclipse.org/legal/epl-v10.html
Lines 79-85 Link Here
79
 * <p>
79
 * <p>
80
 * 
80
 * 
81
 * @author Paul E Slauenwhite
81
 * @author Paul E Slauenwhite
82
 * @version 1.0.1
82
 * @version October 27, 2007
83
 * @since 1.0.1
83
 * @since 1.0.1
84
 * @see org.eclipse.hyades.logging.events.cbe.impl.AbstractEventFactoryHome
84
 * @see org.eclipse.hyades.logging.events.cbe.impl.AbstractEventFactoryHome
85
 * @see org.eclipse.hyades.logging.events.cbe.TemplateContentHandler
85
 * @see org.eclipse.hyades.logging.events.cbe.TemplateContentHandler
Lines 134-149 Link Here
134
        
134
        
135
        if ((fileName != null) && (fileName.trim().length() > 0)) {
135
        if ((fileName != null) && (fileName.trim().length() > 0)) {
136
136
137
	        //Attempt to find the actual local location of the configuration template file
137
            //Attempt to load the configuration template file using the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader:
138
	        //using the following class loader hierarchy:
139
	        //-The current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader.
140
	        //-The system's class loader.
141
	        //-The current thread's context class loader.
142
	        try {
138
	        try {
143
	
139
	
144
	            //Consult the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class 
140
                //Attempt to load the configuration template file using the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader and privileged security:
145
	            //loader to find the actual local location of the configuration template file 
146
	            //using privileged security:
147
	            inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
141
	            inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
148
	
142
	
149
	                public Object run() throws Exception {
143
	                public Object run() throws Exception {
Lines 152-168 Link Here
152
	            })));
146
	            })));
153
	        } 
147
	        } 
154
	        catch (Throwable t) {
148
	        catch (Throwable t) {
155
	
149
            	//Ignore since insufficient security privileges for loading the configuration template file using the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader and privileged security.
156
	            //Catch all exceptions since the current class' (e.g. EventXMLFileEventFactoryHomeImpl)
150
	        }
157
	            //class loader may be null (e.g. current class was loaded by the bootstrap
151
	        
158
	            //class loader) or insufficient security privileges 
152
            //If the configuration template file could not be loaded using the current class' (e.g. EventXMLFileEventFactoryHomeImpl) class loader, attempt the file load using the system's class loader:
159
	            //for accessing the current class' class loader and we 
153
	        if(inputStream == null){
160
	            //will attempt to use the system's class loader.
154
	        
161
	            try {
155
	            try {
162
	
156
	
163
	                //Consult the system's class loader to find the
157
	                //Attempt to load the configuration template file using the system's class loader and privileged security:
164
	                //actual local location of the configuration template file 
165
	                //using privileged security:
166
	                inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
158
	                inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
167
	
159
	
168
	                    public Object run() throws Exception {
160
	                    public Object run() throws Exception {
Lines 170-187 Link Here
170
	                    }
162
	                    }
171
	                })));
163
	                })));
172
	            } 
164
	            } 
173
	            catch (Throwable tt) {
165
	            catch (Throwable t) {
174
	
166
	            	//Ignore since insufficient security privileges for loading the configuration template file using the system's class loader and privileged security.
175
	                //Catch all exceptions since the system's class loader
167
	            }
176
	                //may be null or insufficient security privileges for 
168
	            
177
	                //accessing the system's class loader and we 
169
	            //If the configuration template file could not be loaded using the system's class loader, attempt the file load using the current thread's context class loader:
178
	                //will attempt to use the current thread's context class 
170
	            if(inputStream == null){
179
	                //loader.
171
	            
180
	                try {
172
	                try {
181
	
173
	
182
	                    //Consult the current thread's context class loader to find 
174
	                	//Attempt to load the configuration template file using the current thread's context class loader and privileged security:
183
	                    //the actual local location of the configuration template file
184
	                    //using privileged security:
185
	                    inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
175
	                    inputStream = ((InputStream) (AccessController.doPrivileged(new PrivilegedExceptionAction() {
186
	
176
	
187
	                        public Object run() throws Exception {
177
	                        public Object run() throws Exception {
Lines 189-202 Link Here
189
	                        }
179
	                        }
190
	                    })));
180
	                    })));
191
	                } 
181
	                } 
192
	                catch (Throwable ttt) {
182
	                catch (Throwable t) {
193
	
183
	                	//Ignore since insufficient security privileges for loading the configuration template file using the current thread's context class loader and privileged security.
194
	                    //Ignore since the current thread's context class loader
195
	                    //may be null or insufficient security privileges for 
196
	                    //accessing the current thread's context class loader and
197
	                    //the API's post condition states a null return value 
198
	                    //if the actual local location of the configuration template 
199
	                    //file cannot be resolved (e.g. insufficient security privileges).
200
	                }
184
	                }
201
	            }
185
	            }
202
	        }
186
	        }

Return to bug 207160