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.

Bug 215210 - Error apparent in 7.2 , not in 7.1
Summary: Error apparent in 7.2 , not in 7.1
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.2
Hardware: Macintosh (x86) Mac OS X
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-05 17:13 UTC by aimee1969
Modified: 2014-09-19 15:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
request project to show error (946.61 KB, application/zip)
2012-07-09 19:55 UTC, aimee1969
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aimee1969 2012-07-05 17:13:52 UTC
Using 7.2 beta or 7.2 RC1 , this method produces the error

The type of identify(null, resource, null) is erroneous

This problem does not occur in versions lower than 7.2 , ie 7.1

The same source tree is used in both cases as is the VM.

Java on osx 10.6.8

java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-10M3720)
Java HotSpot(TM) Client VM (build 20.8-b03-424, mixed mode)

Code 


 protected String getMimeType(String resource)
    {
        MagicMimeTypeIdentifierFactory factory = new MagicMimeTypeIdentifierFactory();
        MimeTypeIdentifier mimeTypeIdentifier = factory.get();
        return mimeTypeIdentifier.identify(null, resource, null); <--- ERROR
    }

/*
 * Copyright (c) 2005 - 2008 Aduna and Deutsches Forschungszentrum fuer Kuenstliche Intelligenz DFKI GmbH.
 * All rights reserved.
 * 
 * Licensed under the Aperture BSD-style license.
 */
package org.semanticdesktop.aperture.mime.identifier;

import org.ontoware.rdf2go.model.node.URI;

/**
 * Identifies the MIME type of a binary resource. Implementations typically use heuristics such as magic
 * numbers, file name extension, etc. to perform the identification.
 */
public interface MimeTypeIdentifier {

    /**
     * Identifies the MIME type of a binary resource based on the specified characteristics. Any of the
     * parameters may be null.
     * 
     * @param firstBytes The first bytes of the resource's binary contents. The getMinArrayLength method
     *            will return how big this array should minimally be for this MimeTypeIdentifier to do
     *            its job.
     * @param fileName The resource's file name.
     * @param uri the URI used to typically identify the resource.
     * @return the detected MIME type of the resource, or null when the MIME type could not be
     *         determined.
     * 
     * @see #getMinArrayLength()
     */
    public String identify(byte[] firstBytes, String fileName, URI uri);

    /**
     * Returns the minimum length needed by the identify method for its array parameter.
     * 
     * @see #identify(byte[], String, URI)
     */
    public int getMinArrayLength();
}
Comment 1 Petr Somol 2012-07-09 09:18:51 UTC
Jan, you might know more..
Comment 2 Jan Lahoda 2012-07-09 14:42:04 UTC
This error was added in 7.2 to mark cases when the return of of the invoked method is erroneous (missing). So we need to find out why the IDE believes the return type is erroneous - I tried to reproduce using the provided code, but the error did not appear. Is there a way to get the IDE to the broken state?

Thanks.
Comment 3 aimee1969 2012-07-09 19:55:41 UTC
Created attachment 121859 [details]
request project to show error

zip format project to show error as requested
Comment 4 Jan Lahoda 2012-07-10 13:01:27 UTC
Thank you very much for the project, I can reproduce now. The immediate cause (in the attached project) seems to be that "org.ontoware.rdf2go.model.node.URI" is inaccessible in the project that does "mimeTypeIdentifier.identify(null, resource, null)". Some versions of javac might accept such source, but some definitely don't, so I would generally recommend to avoid such situation. The error should be obviously be more specific, though.
Comment 5 Svata Dedic 2014-07-03 12:39:23 UTC
I'll try to improve the error message
Comment 6 Svata Dedic 2014-08-29 09:38:43 UTC
Fixed in jet-main#ba2c757b7ee8

The actual missing type(s) are printed in the error hint.
Comment 7 Quality Engineering 2014-09-19 15:52:25 UTC
Integrated into 'main-silver', will be available in build *201409191429* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ba2c757b7ee8
User: Svata Dedic <sdedic@netbeans.org>
Log: #215210: improved error message, the actual missing type is printed