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

(-)fs/src/org/openide/filesystems/FileObject.java (-2 / +5 lines)
Lines 794-801 Link Here
794
     *  listeners.
794
     *  listeners.
795
     */
795
     */
796
    static boolean isPriorityListener(FileChangeListener fcl) {
796
    static boolean isPriorityListener(FileChangeListener fcl) {
797
        return (fcl instanceof PriorityFileChangeListener) || 
797
        if (fcl instanceof PriorityFileChangeListener) {
798
                fcl.getClass().getName().indexOf("MasterFileObject$FileChangeListenerImpl") == -1;//NOI18N
798
            return true;
799
        } else {
800
            return false;
801
        }
799
    }
802
    }
800
803
801
    interface PriorityFileChangeListener extends FileChangeListener {}
804
    interface PriorityFileChangeListener extends FileChangeListener {}
(-)fs/test/unit/src/org/openide/filesystems/FileObjectTestHid.java (-1 / +29 lines)
Lines 74-85 Link Here
74
        //assertGC("", ref);
74
        //assertGC("", ref);
75
    }
75
    }
76
    
76
    
77
    public void  testEventsDelivery81746() throws Exception {
77
    public void testEventsDelivery81746() throws Exception {
78
        doEventsDelivery81746(1);
79
    }
80
81
    public void testEventsDeliveryInInnerAtomicActions82459() throws Exception {
82
        doEventsDelivery81746(2);
83
    }
84
    
85
    private void doEventsDelivery81746(final int howDeep) throws Exception {
78
        checkSetUp();
86
        checkSetUp();
79
        final FileObject fold = getTestFolder1(root);
87
        final FileObject fold = getTestFolder1(root);
80
        if (fold.getFileSystem().isReadOnly()) {
88
        if (fold.getFileSystem().isReadOnly()) {
81
            return;
89
            return;
82
        }
90
        }
91
        class L extends FileChangeAdapter {
92
            public int cnt;
93
            
94
            public void fileDataCreated(FileEvent fe) {
95
                cnt++;
96
            }
97
        }
98
        
83
        final FileChangeListener noFileDataCreatedListener = new FileChangeAdapter(){
99
        final FileChangeListener noFileDataCreatedListener = new FileChangeAdapter(){
84
            public void fileDataCreated(FileEvent fe) {
100
            public void fileDataCreated(FileEvent fe) {
85
                fail();
101
                fail();
Lines 96-105 Link Here
96
            }
112
            }
97
        };
113
        };
98
        
114
        
115
        final L countingL = new L();
99
        try {
116
        try {
100
            fold.getFileSystem().addFileChangeListener(listener1);
117
            fold.getFileSystem().addFileChangeListener(listener1);
118
            fold.addFileChangeListener(countingL);
119
            fold.getFileSystem().addFileChangeListener(countingL);
101
            fold.getFileSystem().runAtomicAction(new FileSystem.AtomicAction(){
120
            fold.getFileSystem().runAtomicAction(new FileSystem.AtomicAction(){
121
                private int stillDeep = howDeep;
122
                
102
                public void run() throws java.io.IOException {
123
                public void run() throws java.io.IOException {
124
                    if (--stillDeep > 0) {
125
                        fold.getFileSystem().runAtomicAction(this);
126
                        assertEquals("No events in inner actions", 0, countingL.cnt);
127
                        return;
128
                    }
129
                    
130
                    
103
                    fold.createData("file1");
131
                    fold.createData("file1");
104
                    fold.createData("file2");
132
                    fold.createData("file2");
105
                }
133
                }
(-)loaders/src/org/openide/loaders/FolderLookup.java (-1 / +1 lines)
Lines 361-367 Link Here
361
                                // folder recognizer thread is waiting for more then
361
                                // folder recognizer thread is waiting for more then
362
                                // 10s in waitFinished, which signals that there 
362
                                // 10s in waitFinished, which signals that there 
363
                                // is a very high possibility of a deadlock
363
                                // is a very high possibility of a deadlock
364
                                fl.err().fine("Preventing deadlock #65543: Do not call FolderLookup from inside DataObject operations!"); // NOI18N
364
                                fl.err().log(Level.INFO, "Preventing deadlock #65543: Do not call FolderLookup from inside DataObject operations!", new Exception("Thread dump")); // NOI18N
365
                                return;
365
                                return;
366
                            }
366
                            }
367
                        }
367
                        }
(-)masterfs/src/org/netbeans/modules/masterfs/Delegate.java (-1 / +12 lines)
Lines 37-42 Link Here
37
import org.openide.filesystems.FileUtil;
37
import org.openide.filesystems.FileUtil;
38
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.WriteLockUtils;
38
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.WriteLockUtils;
39
import org.openide.util.Exceptions;
39
import org.openide.util.Exceptions;
40
import org.openide.util.WeakListeners;
40
41
41
/**
42
/**
42
 * @author Radek Matous
43
 * @author Radek Matous
Lines 210-216 Link Here
210
211
211
            delegate = fo;
212
            delegate = fo;
212
            if (fo != null) {
213
            if (fo != null) {
213
                weakListener = FileUtil.weakFileChangeListener(fListener, fo);
214
                // the following is not typesafe, it is not nice,
215
                // and very likely it is not even correct, however until
216
                // there is a proper API for "priority listeners" in openide/fs
217
                // there is not much to do about this
218
                Class realClass;
219
                try {
220
                    realClass = Class.forName("org.openide.filesystems.FileObject$PriorityFileChangeListener");
221
                } catch (ClassNotFoundException ex) {
222
                    throw (IllegalStateException)new IllegalStateException(ex.getMessage()).initCause(ex);
223
                }
224
                weakListener = (FileChangeListener)WeakListeners.create(realClass, FileChangeListener.class, fListener, fo);
214
                fo.addFileChangeListener(weakListener);
225
                fo.addFileChangeListener(weakListener);
215
            }
226
            }
216
        }
227
        }

Return to bug 82459