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 141698
Collapse All | Expand All

(-)a/core.startup/src/org/netbeans/core/startup/layers/BinaryFS.java (-1 / +4 lines)
Lines 48-53 Link Here
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.io.InputStream;
49
import java.io.InputStream;
50
import java.io.OutputStream;
50
import java.io.OutputStream;
51
import java.lang.reflect.Constructor;
51
import java.lang.reflect.Field;
52
import java.lang.reflect.Field;
52
import java.lang.reflect.Method;
53
import java.lang.reflect.Method;
53
import java.net.URL;
54
import java.net.URL;
Lines 489-495 Link Here
489
                        if (SharedClassObject.class.isAssignableFrom(cls)) {
490
                        if (SharedClassObject.class.isAssignableFrom(cls)) {
490
                            return SharedClassObject.findObject(cls.asSubclass(SharedClassObject.class), true);
491
                            return SharedClassObject.findObject(cls.asSubclass(SharedClassObject.class), true);
491
                        } else {
492
                        } else {
492
                            return cls.newInstance();
493
                            Constructor<?> init = cls.getDeclaredConstructor();
494
                            init.setAccessible(true);
495
                            return init.newInstance((Object[]) null);
493
                        }
496
                        }
494
497
495
                    case 12: // serialvalue
498
                    case 12: // serialvalue
(-)a/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java (-1 / +3 lines)
Lines 886-892 Link Here
886
                        if (SharedClassObject.class.isAssignableFrom(cls)) {
886
                        if (SharedClassObject.class.isAssignableFrom(cls)) {
887
                            return SharedClassObject.findObject(cls, true);
887
                            return SharedClassObject.findObject(cls, true);
888
                        } else {
888
                        } else {
889
                            return cls.newInstance();
889
                            Constructor<?> init = cls.getDeclaredConstructor();
890
                            init.setAccessible(true);
891
                            return init.newInstance((Object[]) null);
890
                        }
892
                        }
891
                    case 13:
893
                    case 13:
892
                        String[] arr = value.split("#", 2); // NOI18N
894
                        String[] arr = value.split("#", 2); // NOI18N
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTestHid.java (+24 lines)
Lines 426-431 Link Here
426
        return map.get("displayName");
426
        return map.get("displayName");
427
    }
427
    }
428
428
429
    public  static class Value {
430
        private Value() { }
431
    }
432
    public void testNewValueForNonPublicConstructor() throws Exception {
433
        File f = writeFile("layer3.xml",
434
                "<filesystem>\n" +
435
                "<folder name='TestModule'>\n" +
436
                "<file name='sample.txt' >" +
437
                "  <attr name='v' newvalue='org.openide.filesystems.XMLFileSystemTestHid$Value'/>" +
438
                "</file>\n" +
439
                "</folder>\n" +
440
                "</filesystem>\n"
441
                );
442
              
443
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURL());
444
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
445
        assertNotNull(fo);
446
447
        Object v = fo.getAttribute("v");
448
        assertNotNull("Attribute found", v);
449
        assertEquals("Right type", Value.class, v.getClass());
450
        
451
    }
452
429
    public void testVariousXMLAttributes() throws Exception {
453
    public void testVariousXMLAttributes() throws Exception {
430
        URL attribs = XMLFileSystemTestHid.class.getResource("test-layer-attribs.xml");
454
        URL attribs = XMLFileSystemTestHid.class.getResource("test-layer-attribs.xml");
431
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, attribs);
455
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, attribs);
(-)a/openide.loaders/src/org/openide/loaders/InstanceSupport.java (-1 / +3 lines)
Lines 216-222 Link Here
216
                    return SharedClassObject.findObject (c.asSubclass(SharedClassObject.class), true);
216
                    return SharedClassObject.findObject (c.asSubclass(SharedClassObject.class), true);
217
                } else {
217
                } else {
218
                    // create new instance
218
                    // create new instance
219
                    return c.newInstance();
219
                    Constructor<?> init = c.getDeclaredConstructor();
220
                    init.setAccessible(true);
221
                    return init.newInstance((Object[]) null);
220
                }
222
                }
221
            }
223
            }
222
        } catch (IOException ex) {
224
        } catch (IOException ex) {
(-)a/openide.loaders/test/unit/src/org/openide/loaders/InstanceDataObjectTest.java (-1 / +1 lines)
Lines 255-261 Link Here
255
    }
255
    }
256
    
256
    
257
    public static class TestDefinitions implements Runnable {
257
    public static class TestDefinitions implements Runnable {
258
        public TestDefinitions() {}
258
        TestDefinitions() {}
259
        
259
        
260
        static TestDefinitions create() {
260
        static TestDefinitions create() {
261
            return new TestDefinitions();
261
            return new TestDefinitions();

Return to bug 141698