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

(-)a/openide.filesystems/apichanges.xml (+16 lines)
Lines 49-54 Link Here
49
        <apidef name="filesystems">Filesystems API</apidef>
49
        <apidef name="filesystems">Filesystems API</apidef>
50
    </apidefs>
50
    </apidefs>
51
    <changes>
51
    <changes>
52
        <change id="FileLock.closeable">
53
            <api name="filesystems"/>
54
            <summary>FileLock implements AutoCloseable</summary>
55
            <version major="9" minor="2"/>
56
            <date year="2014" month="10" day="21"/>
57
            <author login="sdedic"/>
58
            <compatibility addition="yes" deletion="no" deprecation="no" source="compatible" binary="compatible"/>
59
            <description>
60
                <p>
61
                    As JDK 1.7 is required, the <a href="@TOP@org/openide/filesystems/FileLock.html">FileLock</a>
62
                    can implement AutoCloseable to work well in try-with-resources constructs.
63
                </p>
64
            </description>
65
            <class package="org.openide.filesystems" name="FileLock"/>
66
            <issue number="247915"/>
67
        </change>
52
        <change id="FileSystemStatus.icons2">
68
        <change id="FileSystemStatus.icons2">
53
            <api name="filesystems"/>
69
            <api name="filesystems"/>
54
            <summary>FileSystem.Status API removed</summary>
70
            <summary>FileSystem.Status API removed</summary>
(-)a/openide.filesystems/manifest.mf (-1 / +1 lines)
Lines 2-7 Link Here
2
OpenIDE-Module: org.openide.filesystems
2
OpenIDE-Module: org.openide.filesystems
3
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
4
OpenIDE-Module-Layer: org/openide/filesystems/resources/layer.xml
4
OpenIDE-Module-Layer: org/openide/filesystems/resources/layer.xml
5
OpenIDE-Module-Specification-Version: 9.1
5
OpenIDE-Module-Specification-Version: 9.2
6
6
7
7
(-)a/openide.filesystems/src/org/openide/filesystems/FileLock.java (-3 / +14 lines)
Lines 55-68 Link Here
55
* Normally this is sufficient protection. If you really need an atomic read, you may
55
* Normally this is sufficient protection. If you really need an atomic read, you may
56
* simply lock the file, perform the read, and unlock it when done. The file will still
56
* simply lock the file, perform the read, and unlock it when done. The file will still
57
* be protected against writes, although the read operation did not request a lock.
57
* be protected against writes, although the read operation did not request a lock.
58
*
58
* <p/>
59
* The {@code FileLock} implements {@link AutoCloseable}, so it can be created within
60
* try-with-resources resource clause and the lock will be released at the end of the try block.
61
* 
59
* @see FileObject
62
* @see FileObject
60
*
63
* @since 9.2 implements {@code AutoCloseable} interface.
61
* @author Petr Hamernik, Jaroslav Tulach, Ian Formanek
64
* @author Petr Hamernik, Jaroslav Tulach, Ian Formanek
62
* @version 0.16, Jun 5, 1997
65
* @version 0.16, Jun 5, 1997
63
*
66
*
64
*/
67
*/
65
public class FileLock { // XXX JDK 7: implements AutoCloseable
68
public class FileLock implements AutoCloseable {
66
    // ========================= NONE file lock =====================================
69
    // ========================= NONE file lock =====================================
67
70
68
    /** Constant that can be used in filesystems that do not support locking.
71
    /** Constant that can be used in filesystems that do not support locking.
Lines 109-114 Link Here
109
        locked = false;
112
        locked = false;
110
    }
113
    }
111
114
115
    /**
116
     * Releases the lock. Equivalent to {@link #releaseLock} call.
117
     */
118
    @Override
119
    public final void close() {
120
        releaseLock();
121
    }
122
    
112
    //  End of the original part
123
    //  End of the original part
113
    // ============================================================================
124
    // ============================================================================
114
125

Return to bug 247915