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 243971

Summary: Can we have Mime types extensions that are defined by the end user
Product: platform Reporter: ngx472 <ngx472>
Component: Data SystemsAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: SQL Mime Type Resolver java source file

Description ngx472 2014-04-21 18:12:52 UTC
Created attachment 146863 [details]
SQL Mime Type Resolver java source file

I do an SQL Editor Platform Application
Up until 7.2, I managed the SQL mime type through the SQLMimeResolver.java file attached together with layer.xml snippet which looks like this:

<folder name="MIMEResolver">
      <file name="com-sqlbrowser-module-sqlsupport-dataobject-SQLMimeResolver.instance">
        <attr name="instanceCreate" methodvalue="com.sqlbrowser.module.sqlsupport.dataobject.SQLMimeResolver.getInstance"/>
      </file>
</folder>

The interest of doing so was to have user defined extensions matching the SQL file type (Prefs.getSQLFileExtensions())

Since 8.0, The Action "File / Open" throws a Mime Type Exception

I removed my reference in the layer to my Java Mime Type handler in favor of the annotation based approach, which defines extensions as hard coded developer chosen extensions

I was wondering if having the file extensions discovered at run time would be feasible

Thanks
Comment 1 Jaroslav Havlin 2014-04-22 07:16:15 UTC
Have you tried registering your resolver using ServiceProvider?

Excerpt from javadoc:
> In the rarely case, when declarative resolvers are not sufficient, you can 
> register subclass of MIMEResolver directly by using ServiceProvider annotation.

I'm sorry, I haven't tried your code, so I don't know what exception is exactly thrown, but the ServiceProvider should be worth trying.
Comment 2 ngx472 2014-04-26 07:59:27 UTC
Thanks, worked exactly