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

(-)apichanges.xml (+20 lines)
Lines 17-22 Link Here
17
        <apidef name="filesystems">Filesystems API</apidef>
17
        <apidef name="filesystems">Filesystems API</apidef>
18
    </apidefs>
18
    </apidefs>
19
    <changes>
19
    <changes>
20
        <change id="added-FileObject-getOutputStream-without-FileLock-parameter">
21
            <api name="filesystems"/>
22
            <summary>Added additional method <code>FileObject.getOutpuStream</code>
23
            that doesn't take <code>FileLock</code> as a parameter.
24
            </summary>
25
            <version major="6" minor="6"/>
26
            <date day="3" month="5" year="2006"/>
27
            <author login="rmatous"/>
28
            <compatibility addition="yes" binary="compatible" source="compatible" semantic="compatible" deprecation="no" deletion="no" modification="no"/>
29
            <description>
30
                <p>
31
                    Although newly added method <code>FileObject.getOutpuStream</code>
32
                    doesn't take <code>FileLock</code> as a parameter, the implementation
33
                    is responsible for taking a lock before <code>OutputStream</code> is
34
                    returned and thus <code>FileAlreadyLockedException</code> exception is thrown
35
                    when <code>FileObject</code> is already locked.
36
                </p>
37
            </description>
38
            <class package="org.openide.filesystems" name="FileObject"/>
39
        </change>
20
        <change id="semantic-change-in-FileUtil.toFileObject">
40
        <change id="semantic-change-in-FileUtil.toFileObject">
21
            <api name="filesystems"/>
41
            <api name="filesystems"/>
22
            <summary>
42
            <summary>
(-)manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.filesystems
2
OpenIDE-Module: org.openide.filesystems
3
OpenIDE-Module-Specification-Version: 6.5
3
OpenIDE-Module-Specification-Version: 6.6
4
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
(-)src/org/openide/filesystems/FileObject.java (+25 lines)
Lines 17-22 Link Here
17
import java.io.File;
17
import java.io.File;
18
import java.io.FileNotFoundException;
18
import java.io.FileNotFoundException;
19
import java.io.FilterOutputStream;
19
import java.io.IOException;
20
import java.io.IOException;
20
import java.io.InputStream;
21
import java.io.InputStream;
21
import java.io.OutputStream;
22
import java.io.OutputStream;
Lines 475-480 Link Here
475
    */
476
    */
476
    public abstract OutputStream getOutputStream(FileLock lock)
477
    public abstract OutputStream getOutputStream(FileLock lock)
477
    throws IOException;
478
    throws IOException;
479
480
    /** Get output stream.
481
    * @return output stream to overwrite the contents of this file
482
    * @throws IOException if an error occures (the file is invalid, etc.)
483
    * @throws FileAlreadyLockedException if the file is already locked
484
    */
485
    public final OutputStream getOutputStream() throws FileAlreadyLockedException, IOException  {
486
        final FileLock lock = lock();
487
        final OutputStream os = getOutputStream(lock);
488
        return new FilterOutputStream(os) {
489
            public void close() throws IOException {
490
                try {
491
                    super.close();
492
                    lock.releaseLock();
493
                } catch(IOException iex) {
494
                    if (lock.isValid()) {
495
                        lock.releaseLock();
496
                    }
497
                    throw iex;
498
                }
499
            }
500
        };
501
    }
502
478
    /** Lock this file.
503
    /** Lock this file.
479
    * @return lock that can be used to perform various modifications on the file
504
    * @return lock that can be used to perform various modifications on the file

Return to bug 75826