This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 85737
Collapse All | Expand All

(-)serverplugins/weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLDeploymentManager.java (-47 / +51 lines)
Lines 159-177 Link Here
159
            return new WLDeployer(uri).deploy(target, file, file2, getHost(), getPort());
159
            return new WLDeployer(uri).deploy(target, file, file2, getHost(), getPort());
160
        } else {
160
        } else {
161
            //weblogic jsr88 version
161
            //weblogic jsr88 version
162
            modifiedLoader();
162
            ClassLoader currentLoader = modifiedLoader();
163
            try {
163
            try {
164
                return new DelegatingProgressObject(dm.distribute(target, file, file2));
164
                return new DelegatingProgressObject(dm.distribute(target, file, file2));
165
            } finally {
165
            } finally {
166
                originalLoader();
166
                originalLoader(currentLoader);
167
            }
167
            }
168
        }
168
        }
169
    }
169
    }
170
    
170
    
171
    private ClassLoader swapLoader;
171
//    private ClassLoader swapLoader;
172
    
172
    
173
    private void modifiedLoader() {
173
    private ClassLoader modifiedLoader() {
174
        swapLoader = Thread.currentThread().getContextClassLoader();
174
        ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
175
        String serverRoot = getInstanceProperties().getProperty(WLPluginProperties.SERVER_ROOT_ATTR);
175
        String serverRoot = getInstanceProperties().getProperty(WLPluginProperties.SERVER_ROOT_ATTR);
176
        // if serverRoot is null, then we are in a server instance registration process, thus this call
176
        // if serverRoot is null, then we are in a server instance registration process, thus this call
177
        // is made from InstanceProperties creation -> WLPluginProperties singleton contains 
177
        // is made from InstanceProperties creation -> WLPluginProperties singleton contains 
Lines 180-188 Link Here
180
            serverRoot = WLPluginProperties.getInstance().getInstallLocation();
180
            serverRoot = WLPluginProperties.getInstance().getInstallLocation();
181
181
182
        Thread.currentThread().setContextClassLoader(WLDeploymentFactory.getWLClassLoader(serverRoot));
182
        Thread.currentThread().setContextClassLoader(WLDeploymentFactory.getWLClassLoader(serverRoot));
183
        return currentLoader;
183
    }
184
    }
184
    private void originalLoader() {
185
    
185
        Thread.currentThread().setContextClassLoader(swapLoader);
186
    private void originalLoader(ClassLoader currentLoader) {
187
        if (currentLoader != null) {
188
            Thread.currentThread().setContextClassLoader(currentLoader);
189
        }
186
    }
190
    }
187
    
191
    
188
    /**
192
    /**
Lines 217-227 Link Here
217
        if (WLDebug.isEnabled()) // debug output
221
        if (WLDebug.isEnabled()) // debug output
218
            WLDebug.notify("redeploy(" + targetModuleID + ", " +       // NOI18N
222
            WLDebug.notify("redeploy(" + targetModuleID + ", " +       // NOI18N
219
                    inputStream + ", " + inputStream2 + ")");          // NOI18N
223
                    inputStream + ", " + inputStream2 + ")");          // NOI18N
220
        modifiedLoader();
224
        ClassLoader currentLoader = modifiedLoader();
221
        try {
225
        try {
222
            return new DelegatingProgressObject(dm.redeploy(targetModuleID, inputStream, inputStream2));
226
            return new DelegatingProgressObject(dm.redeploy(targetModuleID, inputStream, inputStream2));
223
        } finally {
227
        } finally {
224
            originalLoader();
228
            originalLoader(currentLoader);
225
        }
229
        }
226
    }
230
    }
227
231
Lines 235-245 Link Here
235
        if (WLDebug.isEnabled()) // debug output
239
        if (WLDebug.isEnabled()) // debug output
236
            WLDebug.notify("distribute(" + target + ", " +             // NOI18N
240
            WLDebug.notify("distribute(" + target + ", " +             // NOI18N
237
                    inputStream + ", " + inputStream2 + ")");          // NOI18N
241
                    inputStream + ", " + inputStream2 + ")");          // NOI18N
238
        modifiedLoader();
242
        ClassLoader currentLoader = modifiedLoader();
239
        try {
243
        try {
240
            return new DelegatingProgressObject(dm.distribute(target, inputStream, inputStream2));
244
            return new DelegatingProgressObject(dm.distribute(target, inputStream, inputStream2));
241
        } finally {
245
        } finally {
242
            originalLoader();
246
            originalLoader(currentLoader);
243
        }
247
        }
244
    }
248
    }
245
249
Lines 252-262 Link Here
252
            throws IllegalStateException {
256
            throws IllegalStateException {
253
        if (WLDebug.isEnabled()) // debug output
257
        if (WLDebug.isEnabled()) // debug output
254
            WLDebug.notify("undeploy(" + targetModuleID + ")");        // NOI18N
258
            WLDebug.notify("undeploy(" + targetModuleID + ")");        // NOI18N
255
        modifiedLoader();
259
        ClassLoader currentLoader = modifiedLoader();
256
        try {
260
        try {
257
            return new DelegatingProgressObject(dm.undeploy(targetModuleID));
261
            return new DelegatingProgressObject(dm.undeploy(targetModuleID));
258
        } finally {
262
        } finally {
259
            originalLoader();
263
            originalLoader(currentLoader);
260
        }
264
        }
261
    }
265
    }
262
266
Lines 270-280 Link Here
270
        if (WLDebug.isEnabled()) // debug output
274
        if (WLDebug.isEnabled()) // debug output
271
            WLDebug.notify("stop(" + targetModuleID + ")");            // NOI18N
275
            WLDebug.notify("stop(" + targetModuleID + ")");            // NOI18N
272
                
276
                
273
        modifiedLoader();
277
        ClassLoader currentLoader = modifiedLoader();
274
        try {
278
        try {
275
            return new DelegatingProgressObject(dm.stop(targetModuleID));
279
            return new DelegatingProgressObject(dm.stop(targetModuleID));
276
        } finally {
280
        } finally {
277
            originalLoader();
281
            originalLoader(currentLoader);
278
        }
282
        }
279
    }
283
    }
280
284
Lines 288-298 Link Here
288
        if (WLDebug.isEnabled()) // debug output
292
        if (WLDebug.isEnabled()) // debug output
289
            WLDebug.notify("start(" + targetModuleID + ")");           // NOI18N
293
            WLDebug.notify("start(" + targetModuleID + ")");           // NOI18N
290
        
294
        
291
        modifiedLoader();
295
        ClassLoader currentLoader = modifiedLoader();
292
        try {
296
        try {
293
            return new DelegatingProgressObject(dm.start(targetModuleID));
297
            return new DelegatingProgressObject(dm.start(targetModuleID));
294
        } finally {
298
        } finally {
295
            originalLoader();
299
            originalLoader(currentLoader);
296
        }
300
        }
297
    }
301
    }
298
302
Lines 307-318 Link Here
307
            WLDebug.notify("getAvailableModules(" + moduleType +       // NOI18N
311
            WLDebug.notify("getAvailableModules(" + moduleType +       // NOI18N
308
                    ", " + target + ")");                              // NOI18N
312
                    ", " + target + ")");                              // NOI18N
309
        
313
        
310
        modifiedLoader();
314
        ClassLoader currentLoader = modifiedLoader();
311
        try {
315
        try {
312
            TargetModuleID t[] = dm.getAvailableModules(moduleType, target);
316
            TargetModuleID t[] = dm.getAvailableModules(moduleType, target);
313
            return t;
317
            return t;
314
        } finally {
318
        } finally {
315
            originalLoader();
319
            originalLoader(currentLoader);
316
        }
320
        }
317
    }
321
    }
318
322
Lines 327-333 Link Here
327
            WLDebug.notify("getNonRunningModules(" + moduleType +      // NOI18N
331
            WLDebug.notify("getNonRunningModules(" + moduleType +      // NOI18N
328
                    ", " + target + ")");                              // NOI18N
332
                    ", " + target + ")");                              // NOI18N
329
        
333
        
330
        modifiedLoader();
334
        ClassLoader currentLoader = modifiedLoader();
331
        try {
335
        try {
332
            TargetModuleID t[] = dm.getNonRunningModules(moduleType, target);
336
            TargetModuleID t[] = dm.getNonRunningModules(moduleType, target);
333
            for (int i=0; i < t.length; i++) {
337
            for (int i=0; i < t.length; i++) {
Lines 335-341 Link Here
335
            }
339
            }
336
            return t;
340
            return t;
337
        } finally {
341
        } finally {
338
            originalLoader();
342
            originalLoader(currentLoader);
339
        }
343
        }
340
    }
344
    }
341
345
Lines 350-356 Link Here
350
            WLDebug.notify("getRunningModules(" + moduleType +         // NOI18N
354
            WLDebug.notify("getRunningModules(" + moduleType +         // NOI18N
351
                    ", " + target + ")");                              // NOI18N
355
                    ", " + target + ")");                              // NOI18N
352
        
356
        
353
        modifiedLoader();
357
        ClassLoader currentLoader = modifiedLoader();
354
        try {
358
        try {
355
            TargetModuleID t[] = dm.getRunningModules(moduleType, target);
359
            TargetModuleID t[] = dm.getRunningModules(moduleType, target);
356
            for (int i=0; i < t.length; i++) {
360
            for (int i=0; i < t.length; i++) {
Lines 358-364 Link Here
358
            }
362
            }
359
            return t;
363
            return t;
360
        } finally {
364
        } finally {
361
            originalLoader();
365
            originalLoader(currentLoader);
362
        }
366
        }
363
    }
367
    }
364
368
Lines 374-384 Link Here
374
            WLDebug.notify("redeploy(" + targetModuleID + ", " +       // NOI18N
378
            WLDebug.notify("redeploy(" + targetModuleID + ", " +       // NOI18N
375
                    file + ", " + file2 + ")");                        // NOI18N
379
                    file + ", " + file2 + ")");                        // NOI18N
376
        
380
        
377
        modifiedLoader();
381
        ClassLoader currentLoader = modifiedLoader();
378
        try {
382
        try {
379
            return new DelegatingProgressObject(dm.redeploy(targetModuleID, file, file2));
383
            return new DelegatingProgressObject(dm.redeploy(targetModuleID, file, file2));
380
        } finally {
384
        } finally {
381
            originalLoader();
385
            originalLoader(currentLoader);
382
        }
386
        }
383
    }
387
    }
384
    
388
    
Lines 391-401 Link Here
391
        if (WLDebug.isEnabled()) // debug output
395
        if (WLDebug.isEnabled()) // debug output
392
            WLDebug.notify("setLocale(" + locale + ")");               // NOI18N
396
            WLDebug.notify("setLocale(" + locale + ")");               // NOI18N
393
        
397
        
394
        modifiedLoader();
398
        ClassLoader currentLoader = modifiedLoader();
395
        try {
399
        try {
396
            dm.setLocale(locale);
400
            dm.setLocale(locale);
397
        } finally {
401
        } finally {
398
            originalLoader();
402
            originalLoader(currentLoader);
399
        }
403
        }
400
    }
404
    }
401
405
Lines 408-418 Link Here
408
        if (WLDebug.isEnabled()) // debug output
412
        if (WLDebug.isEnabled()) // debug output
409
            WLDebug.notify("isLocaleSupported(" + locale + ")");       // NOI18N
413
            WLDebug.notify("isLocaleSupported(" + locale + ")");       // NOI18N
410
        
414
        
411
        modifiedLoader();
415
        ClassLoader currentLoader = modifiedLoader();
412
        try {
416
        try {
413
            return dm.isLocaleSupported(locale);
417
            return dm.isLocaleSupported(locale);
414
        } finally {
418
        } finally {
415
            originalLoader();
419
            originalLoader(currentLoader);
416
        }
420
        }
417
    }
421
    }
418
422
Lines 428-438 Link Here
428
            WLDebug.notify("setDConfigBeanVersion(" +                  // NOI18N
432
            WLDebug.notify("setDConfigBeanVersion(" +                  // NOI18N
429
                    dConfigBeanVersionType + ")");                     // NOI18N
433
                    dConfigBeanVersionType + ")");                     // NOI18N
430
        
434
        
431
        modifiedLoader();
435
        ClassLoader currentLoader = modifiedLoader();
432
        try {
436
        try {
433
            dm.setDConfigBeanVersion(dConfigBeanVersionType);
437
            dm.setDConfigBeanVersion(dConfigBeanVersionType);
434
        } finally {
438
        } finally {
435
            originalLoader();
439
            originalLoader(currentLoader);
436
        }
440
        }
437
    }
441
    }
438
442
Lines 447-457 Link Here
447
            WLDebug.notify("isDConfigBeanVersionSupported(" +          // NOI18N
451
            WLDebug.notify("isDConfigBeanVersionSupported(" +          // NOI18N
448
                    dConfigBeanVersionType + ")");                     // NOI18N
452
                    dConfigBeanVersionType + ")");                     // NOI18N
449
        
453
        
450
        modifiedLoader();
454
        ClassLoader currentLoader = modifiedLoader();
451
        try {
455
        try {
452
            return dm.isDConfigBeanVersionSupported(dConfigBeanVersionType);
456
            return dm.isDConfigBeanVersionSupported(dConfigBeanVersionType);
453
        } finally {
457
        } finally {
454
            originalLoader();
458
            originalLoader(currentLoader);
455
        }
459
        }
456
    }
460
    }
457
461
Lines 464-470 Link Here
464
        if (WLDebug.isEnabled()) // debug output
468
        if (WLDebug.isEnabled()) // debug output
465
            WLDebug.notify("release()");                               // NOI18N
469
            WLDebug.notify("release()");                               // NOI18N
466
        
470
        
467
        modifiedLoader();
471
        ClassLoader currentLoader = modifiedLoader();
468
        try {
472
        try {
469
            if (dm != null) {
473
            if (dm != null) {
470
                // delegate the call and clear the stored deployment manager
474
                // delegate the call and clear the stored deployment manager
Lines 479-485 Link Here
479
                }
483
                }
480
            }
484
            }
481
        } finally {
485
        } finally {
482
            originalLoader();
486
            originalLoader(currentLoader);
483
        }
487
        }
484
    }
488
    }
485
489
Lines 492-502 Link Here
492
        if (WLDebug.isEnabled()) // debug output
496
        if (WLDebug.isEnabled()) // debug output
493
            WLDebug.notify("isRedeploySupported()");                   // NOI18N
497
            WLDebug.notify("isRedeploySupported()");                   // NOI18N
494
        
498
        
495
        modifiedLoader();
499
        ClassLoader currentLoader = modifiedLoader();
496
        try {
500
        try {
497
            return dm.isRedeploySupported();
501
            return dm.isRedeploySupported();
498
        } finally {
502
        } finally {
499
            originalLoader();
503
            originalLoader(currentLoader);
500
        }
504
        }
501
    }
505
    }
502
506
Lines 509-519 Link Here
509
        if (WLDebug.isEnabled()) // debug output
513
        if (WLDebug.isEnabled()) // debug output
510
            WLDebug.notify("getCurrentLocale()");                      // NOI18N
514
            WLDebug.notify("getCurrentLocale()");                      // NOI18N
511
        
515
        
512
        modifiedLoader();
516
        ClassLoader currentLoader = modifiedLoader();
513
        try {
517
        try {
514
            return dm.getCurrentLocale();
518
            return dm.getCurrentLocale();
515
        } finally {
519
        } finally {
516
            originalLoader();
520
            originalLoader(currentLoader);
517
        }
521
        }
518
    }
522
    }
519
523
Lines 526-536 Link Here
526
        if (WLDebug.isEnabled()) // debug output
530
        if (WLDebug.isEnabled()) // debug output
527
            WLDebug.notify("getDConfigBeanVersion()");                 // NOI18N
531
            WLDebug.notify("getDConfigBeanVersion()");                 // NOI18N
528
532
529
        modifiedLoader();
533
        ClassLoader currentLoader = modifiedLoader();
530
        try {
534
        try {
531
            return dm.getDConfigBeanVersion();
535
            return dm.getDConfigBeanVersion();
532
        } finally {
536
        } finally {
533
            originalLoader();
537
            originalLoader(currentLoader);
534
        }
538
        }
535
    }
539
    }
536
540
Lines 543-553 Link Here
543
        if (WLDebug.isEnabled()) // debug output
547
        if (WLDebug.isEnabled()) // debug output
544
            WLDebug.notify("getDefaultLocale()");                      // NOI18N
548
            WLDebug.notify("getDefaultLocale()");                      // NOI18N
545
        
549
        
546
        modifiedLoader();
550
        ClassLoader currentLoader = modifiedLoader();
547
        try {
551
        try {
548
            return dm.getDefaultLocale();
552
            return dm.getDefaultLocale();
549
        } finally {
553
        } finally {
550
            originalLoader();
554
            originalLoader(currentLoader);
551
        }
555
        }
552
    }
556
    }
553
557
Lines 560-570 Link Here
560
        if (WLDebug.isEnabled()) // debug output
564
        if (WLDebug.isEnabled()) // debug output
561
            WLDebug.notify("getSupportedLocales()");                   // NOI18N
565
            WLDebug.notify("getSupportedLocales()");                   // NOI18N
562
        
566
        
563
        modifiedLoader();
567
        ClassLoader currentLoader = modifiedLoader();
564
        try {
568
        try {
565
            return dm.getSupportedLocales();
569
            return dm.getSupportedLocales();
566
        } finally {
570
        } finally {
567
            originalLoader();
571
            originalLoader(currentLoader);
568
        }
572
        }
569
    }
573
    }
570
574
Lines 577-587 Link Here
577
        if (WLDebug.isEnabled()) // debug output
581
        if (WLDebug.isEnabled()) // debug output
578
            WLDebug.notify("getTargets()");                            // NOI18N
582
            WLDebug.notify("getTargets()");                            // NOI18N
579
        
583
        
580
        modifiedLoader();
584
        ClassLoader currentLoader = modifiedLoader();
581
        try {
585
        try {
582
            return dm.getTargets();
586
            return dm.getTargets();
583
        } finally {
587
        } finally {
584
            originalLoader();
588
            originalLoader(currentLoader);
585
        }
589
        }
586
    }
590
    }
587
    
591
    

Return to bug 85737