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 (-7 / +9 lines)
Lines 393-414 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) {
403
        FileObject retVal = null;
403
        boolean asserts = false;
404
404
        assert asserts = true;
405
        if (!file.equals(normalizeFile(file))) {
405
        if (asserts && !file.equals(normalizeFile(file))) {
406
            throw new IllegalArgumentException(
406
            throw new IllegalArgumentException(
407
                "Parameter file was not " + // NOI18N
407
                "Parameter file was not " + // NOI18N
408
                "normalized. Was " + file + " instead of " + normalizeFile(file)
408
                "normalized. Was " + file + " instead of " + normalizeFile(file)
409
            ); // NOI18N
409
            ); // NOI18N
410
        }
410
        }
411
411
412
        FileObject retVal = null;
413
412
        try {
414
        try {
413
            URL url = fileToURL(file);
415
            URL url = fileToURL(file);
414
416
Lines 428-434 Link Here
428
430
429
        return retVal;
431
        return retVal;
430
    }
432
    }
431
433
        
432
    static URL fileToURL(File file) throws MalformedURLException {
434
    static URL fileToURL(File file) throws MalformedURLException {
433
        URL retVal = null;
435
        URL retVal = null;
434
436

Return to bug 65714