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 134465 - null baseOptions for "text/xml-external-parsed-entity"
Summary: null baseOptions for "text/xml-external-parsed-entity"
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Settings (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on: 90403
Blocks:
  Show dependency tree
 
Reported: 2008-05-04 02:44 UTC by err
Modified: 2008-06-25 14:58 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description err 2008-05-04 02:44:13 UTC
With a minimal NB install, IDE and Java, if I create an empty file and name it "foo.ent", I can't get the baseOptions.

The problem is that:
    String mimeType = jep.getContentType();
    BaseOptions baseOptions = MimeLookup.getLookup(MimePath.parse(mimeType)).lookup(BaseOptions.class);
is null when mimeType is "text/xml-external-parsed-entity" from the JEditorPane.

Is there some additional package to install that would fix this?

BTW, this is a jVi problem. The usage is:
    public void activateOptions(ViTextView tv) {
        String mimeType = tv.getEditorComponent().getContentType();
        BaseOptions baseOptions = MimeLookup.getLookup(
                MimePath.parse(mimeType)).lookup(BaseOptions.class);

        baseOptions.setExpandTabs(b_p_et);
        baseOptions.setSpacesPerTab(b_p_sw);
        baseOptions.setTabSize(b_p_ts);
        
        IndentEngine ie = baseOptions.getIndentEngine();
        if(ie instanceof FormatterIndentEngine) {
            FormatterIndentEngine fie = (FormatterIndentEngine) ie;
            fie.setExpandTabs(b_p_et);
            fie.setSpacesPerTab(b_p_sw);
        }
    }
I guess I should be skipping this when null baseOptions.

Product Version: NetBeans IDE 6.1 (Build 200804211638)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\erra\.netbeans\6.1
Comment 1 err 2008-05-04 03:50:39 UTC
Turns out if jVi is disabled, there are exceptions during input.

WARNING [org.openide.loaders]: Should override getLookup() in class org.netbeans.modules.xml.EntityDataObject, e.g.:
[MultiDataObject.this.]getCookieSet().getLookup()
SEVERE [global]
java.lang.ClassCastException: org.netbeans.editor.ext.ExtSyntaxSupport
        at org.netbeans.modules.xml.text.completion.XMLCompletionProvider.getAutoQueryTypes(XMLCompletionProvider.java:78)
        at org.netbeans.modules.editor.completion.CompletionImpl.insertUpdate(CompletionImpl.java:287)
        at
org.netbeans.lib.editor.util.swing.PriorityDocumentListenerList.insertUpdate(PriorityDocumentListenerList.java:70)
        at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:184)
        at org.netbeans.editor.BaseDocument.fireInsertUpdate(BaseDocument.java:1398)
        at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:645)
        at org.netbeans.editor.BaseKit$DefaultKeyTypedAction.insertString(BaseKit.java:1066)
        at org.netbeans.editor.BaseKit$DefaultKeyTypedAction.actionPerformed(BaseKit.java:1030)
        at org.netbeans.editor.ext.ExtKit$ExtDefaultKeyTypedAction.actionPerformed(ExtKit.java:1002)
        at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:290)
        at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1571)
        at javax.swing.JComponent.processKeyBinding(JComponent.java:2772)
        at javax.swing.JComponent.processKeyBindings(JComponent.java:2807)
        at javax.swing.JComponent.processKeyEvent(JComponent.java:2735)
        at java.awt.Component.processEvent(Component.java:5294)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3984)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1826)
        at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:681)
        at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:938)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:810)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:645)
        at java.awt.Component.dispatchEventImpl(Component.java:3857)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Window.dispatchEventImpl(Window.java:1791)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
[catch] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 2 Vitezslav Stejskal 2008-05-04 18:30:44 UTC
Does the problem go away with full IDE? Did you use a fresh userdir with the minimal NB? Thanks
Comment 3 err 2008-05-04 19:28:45 UTC
Min IDE, Fresh userdir, no jVi install. NewProject. NewFile>other, create "foo.ent", input characters.
Each character input into editor produces the listed stacktrace.

I don't know about other IDE configurations. I've invited the reporter of the defect against jVi to take a look at this
issue.
Comment 4 Vitezslav Stejskal 2008-05-05 08:00:48 UTC
Thanks Ernie. Let's see what XML folks have to say for this.
Comment 5 Samaresh Panda 2008-05-21 17:46:33 UTC
There was a CCE issue 132850 that I fixed recently. See if that helps.
Comment 6 Samaresh Panda 2008-05-23 15:22:18 UTC
Assigning back to editor/settings.
Comment 7 err 2008-05-25 19:19:43 UTC
The problem still exists. baseOptions is null as indicated in the original description. (However the exception on each
keystroke entered into the file is gone.)

The jVi stack when null baseOptions for mimeType "text/xml-external-parsed-entity"
java.lang.NullPointerException
        at org.netbeans.modules.jvi.NbBuffer.activateOptions(NbBuffer.java:139)
        at com.raelity.jvi.ViManager.switchTo(ViManager.java:584)
        at com.raelity.jvi.ViManager.requestSwitch(ViManager.java:548)
        at org.netbeans.modules.jvi.Module$TopComponentRegistryListener.propertyChange(Module.java:784)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:270)
        at org.netbeans.core.windows.RegistryImpl.doFirePropertyChange(RegistryImpl.java:314)
        at org.netbeans.core.windows.RegistryImpl.access$100(RegistryImpl.java:63)
        at org.netbeans.core.windows.RegistryImpl$1.run(RegistryImpl.java:166)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
The registry property name is "activated"

Product Version: NetBeans IDE Dev (Build 200805221203)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\erra\.netbeans\dev
Comment 8 Vitezslav Stejskal 2008-06-02 10:31:52 UTC
Ok, there can be mime types that don't have BaseOptions. Ernie could you please check for 'null' BaseOptions and skip
the settings initialization?

I'm marking this as depending on #90403, because you jVi plugin will have to be rewritten not to use BaseOptions once
90403 is merged to trunk. I'm sorry, but #90403 is likely to cause problems in jVi plugin. I'll help as much as I can to
fix them. Please watch apireviews@ for updates on this. I'm going to ask there for a review very soon.
Comment 9 err 2008-06-08 00:19:37 UTC
Hi Vita,

I'm investigating to better understand what work is needed for jVi to live in this brave new world; I seem to be missing
some key information. As I understand it, the basic idea, at least for these indent related settings, is to lookup the
mime's Preferences.class and set some well known key to the value I want.

I see in http://wiki.netbeans.org/EditorSettingsTransitionGuidelines "TBD: where to find settings supplied from the
infrastructure.". I'm assuming the indent control settings will be available in there.

I tried downloading a current build, but I guess this new stuff isn't in there yet. Not sure what "watch apireviews@ for
updates" means, I guess this is a mailing list but I don't know which one.
Comment 10 err 2008-06-08 00:24:32 UTC
Found a reference to @apireviews and api-changes@netbeans.org, I haven't got a lot of time so I'll probably wait for
something available on trunk and then start slogging through it.
Comment 11 Vitezslav Stejskal 2008-06-09 11:39:41 UTC
> As I understand it, the basic idea, at least for these indent related settings, is to lookup the
> mime's Preferences.class and set some well known key to the value I want.

Yes, see SimpleValueNames.TAB_SIZE, EXPAND_TABS, SPACES_PER_TAB settings.


> I see in http://wiki.netbeans.org/EditorSettingsTransitionGuidelines "TBD: where to find settings supplied from the
> infrastructure.". I'm assuming the indent control settings will be available in there.

Sorry, I already put the link there. It was meant to say
editor/src/org/netbeans/modules/editor/resources/NetBeans-preferences.xml.


> I tried downloading a current build, but I guess this new stuff isn't in there yet.

No, it is not. Currently it's in a private repository clone. I'm hoping to publish it for 6.5M1, but we will see how the
review goes. If it takes longer I'll see if I can publish it somehow on hg.netbeans.org.


> Not sure what "watch apireviews@ for updates" means, I guess this is a mailing list but I don't know which one.

I'm sorry again, I should have been more specific - it's apireviews@netbeans.org. The whole API review process is
described here - http://openide.netbeans.org/tutorial/review-steps.html. Generally it's enough for you to watch issue
#90403.
Comment 12 Vitezslav Stejskal 2008-06-25 14:58:43 UTC
This should no longer be a problem. The jVi plugin was updated to use the new settings infra (MimeLookup + Preferences).