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

(-)apichanges.xml (+16 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="FileUtil.toFileObject">
21
            <api name="filesystems"/>
22
            <summary> <code>IllegalArgumentException</code> isn't thrown anymore.</summary>
23
            <version major="6" minor="3"/>
24
            <date day="25" month="10" year="2005"/>
25
            <author login="rmatous"/>
26
            <compatibility  modification="yes"/>
27
            <description>
28
                <p>Because of performance reasons from method
29
                <code>FileUtil.toFileObject</code> was removed piece of code
30
                checking whether file was properly normalized and thus
31
                <code>IllegalArgumentException</code> can't be thrown.
32
                </p>
33
            </description>
34
            <class package="org.openide.filesystems" name="FileUtil"/>
35
        </change>
20
        <change id="no-static-file-ext-mappings">
36
        <change id="no-static-file-ext-mappings">
21
            <api name="filesystems"/>
37
            <api name="filesystems"/>
22
            <summary>Removed most static MIME type mappings</summary>
38
            <summary>Removed most static MIME type mappings</summary>
(-)src/org/openide/filesystems/FileUtil.java (-9 / +3 lines)
Lines 393-413 Link Here
393
     * If you are running with the MasterFS module enabled, that will guarantee
393
     * If you are running with the MasterFS module enabled, that will guarantee
394
     * that this method never returns null for a file which exists on disk.
394
     * that this method never returns null for a file which exists on disk.
395
     * </p>
395
     * </p>
396
     * @param file a disk file (may or may not exist)
396
     * @param file a disk file (may or may not exist). This file
397
     * must be normalized {@link #normalizeFile normalized}.
397
     * @return a corresponding file object, or null if the file does not exist
398
     * @return a corresponding file object, or null if the file does not exist
398
     *         or there is no {@link URLMapper} available to convert it
399
     *         or there is no {@link URLMapper} available to convert it
399
     * @throws IllegalArgumentException if the file is not {@link #normalizeFile normalized}
400
     * @since 4.29
400
     * @since 4.29
401
     */
401
     */
402
    public static FileObject toFileObject(File file) throws IllegalArgumentException {
402
    public static FileObject toFileObject(File file) throws IllegalArgumentException {
403
        assert file.equals(normalizeFile(file)) : file.getAbsolutePath();
403
        FileObject retVal = null;
404
        FileObject retVal = null;
404
405
        if (!file.equals(normalizeFile(file))) {
406
            throw new IllegalArgumentException(
407
                "Parameter file was not " + // NOI18N
408
                "normalized. Was " + file + " instead of " + normalizeFile(file)
409
            ); // NOI18N
410
        }
411
405
412
        try {
406
        try {
413
            URL url = fileToURL(file);
407
            URL url = fileToURL(file);

Return to bug 65714