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 147493 - AssertionError at org.netbeans.modules.properties.PropertiesEncoding$PropCharset.fileDataCreated
Summary: AssertionError at org.netbeans.modules.properties.PropertiesEncoding$PropChar...
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Properties (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@utilities
URL: http://statistics.netbeans.org/except...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-17 14:42 UTC by Petr Cyhelsky
Modified: 2009-02-02 11:31 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 91435


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Cyhelsky 2008-09-17 14:42:13 UTC
Product Version: NetBeans IDE Dev (Build 200809170201)
Java: 1.5.0_15; Java HotSpot(TM) Client VM 1.5.0_15-b04
System: Windows Vista version 6.0 running on x86; Cp1250; cs_CZ (nb)
User comments: browsing svn search history - with diff togglebutton toggled
STACKTRACE: 
java.lang.AssertionError
        at org.netbeans.modules.properties.PropertiesEncoding$PropCharset.fileDataCreated(PropertiesEncoding.java:168)
        at org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEventImpl(FCLSupport.java:130)
        at org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEvent(FCLSupport.java:122)
        at org.openide.filesystems.FCLSupport.dispatchEvent(FCLSupport.java:99)
        at org.openide.filesystems.FileObject$ED.dispatch(FileObject.java:915)
        at org.openide.filesystems.EventControl.invokeDispatchers(EventControl.java:203)
        at org.openide.filesystems.EventControl.exitAtomicAction(EventControl.java:177)
        at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:122)
        at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:499)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.refresh(FileObjectFactory.java:652)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj.invokeRefreshFor(RootObj.java:179)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj.setAttribute(RootObj.java:131)
        at org.openide.filesystems.FileUtil.refreshFor(FileUtil.java:155)
        at org.openide.filesystems.FileUtil.refreshAll(FileUtil.java:168)
        at org.netbeans.core.ui.warmup.MenuWarmUpTask$NbWindowsAdapter.run(MenuWarmUpTask.java:143)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
Comment 1 Exceptions Reporter 2008-09-30 16:56:35 UTC
This issue has already 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=91435
Comment 2 Jiri Vagner 2008-10-06 12:52:18 UTC
I'm not able to reproduce this issues. I was playing with svn diff and search history for a long time and everything
works correctly.

Can someone please attach a few steps to reproduce this issue?
Comment 3 Petr Cyhelsky 2008-10-06 13:56:43 UTC
My steps to reproduce are these:
create some new java project -> import it into svn repository(http) -> repeatedly make some changes and commit them
immediately -> when some history is built invoke svn|search history -> search -> switch to diff ->  expand the node
where all the new files were commited(probably second from the bottom) -click on project.xml file -> try to move around
it little bit with the up and down arrow buttons -> exception (i usually get some other exceptions here which i already
filed, so just ignore them and wait for the right one :) )
Comment 4 iberck 2009-02-02 01:27:12 UTC
I could reproduce the problem while I was developing a netbeans module.
When I was creating a properties file and then open it with the next code snippet:

package org.netbeans.modules.web.tapestry.actions;

import java.io.File;
import java.io.IOException;
import org.netbeans.api.tapestry.ComponentQuery;
import org.netbeans.api.tapestry.ComponentNotFoundException;
import org.netbeans.api.project.FileOwnerQuery;
import org.netbeans.api.project.Project;
import org.netbeans.api.tapestry.TapFileType;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.cookies.EditCookie;
import org.openide.cookies.OpenCookie;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectNotFoundException;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor;

/**
 *
 * @author iberck
 */
public class OpenComponentThread implements Runnable {

    private FileObject fo;
    private TapFileType type;

    /**
     * Switch from the current file node to the TapFileType
     *
     * @param component This is the current fileobject
     * @param type The type file: TEMPLATE, CLASS, PROPERTIES
     */
    public void openComponent(FileObject fo, final TapFileType type) {
        this.fo = fo;
        this.type = type;

        //org.netbeans.editor.Utilities.runInEventDispatchThread
        RequestProcessor.getDefault().post(this);
    }

    public void run() {
        // get the project of the active file
        Project project = FileOwnerQuery.getOwner(fo);

        // open it
        FileObject relatedComponent = null;
        try {
            relatedComponent = ComponentQuery.findComponent(project, fo, type);
        } catch (ComponentNotFoundException ex) {
            String path = ex.getMessage();

            if (type == TapFileType.PROPERTIES) {
                String key = NbBundle.getMessage(OpenComponentThread.class, "MSG_FileNotFoundCreate", path);
                NotifyDescriptor d = new NotifyDescriptor.Confirmation(key, NotifyDescriptor.YES_NO_OPTION);
                
                if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.YES_OPTION) {
                    FileObject newFile = createFileInProject(project, path);
                    openFile(newFile);
                }
            } else {
                String key = NbBundle.getMessage(OpenComponentThread.class, "MSG_FileNotFound", path);

                NotifyDescriptor.Message d =
                        new NotifyDescriptor.Message(key, NotifyDescriptor.WARNING_MESSAGE);
                DialogDisplayer.getDefault().notify(d);
            }
        }

        if (relatedComponent != null) {
            openFile(relatedComponent);
        }

    }

    private FileObject createFileInProject(Project prj, String path) {
        File f = new File(prj.getProjectDirectory().getPath() + "/" + path);

        if (!f.exists()) {
            try {
                f.getParentFile().mkdirs();
                f.createNewFile();
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            }
        } else {
            throw new AssertionError("The file '" + path + "' exists");
        }

        return FileUtil.toFileObject(f);
    }

    private void openFile(FileObject fo) {
        DataObject fileDO;
        try {
            fileDO = DataObject.find(fo);
            EditCookie editCookie = fileDO.getCookie(EditCookie.class);
            if (editCookie != null) {
                editCookie.edit();
            } else {
                OpenCookie openCookie = fileDO.getCookie(OpenCookie.class);
                if (editCookie != null) {
                    openCookie.open();
                }
            }
        } catch (DataObjectNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
}

--------------------------------------------------


java.lang.AssertionError
	at org.netbeans.modules.properties.PropertiesEncoding$PropCharset.fileDataCreated(PropertiesEncoding.java:168)
	at org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEventImpl(FCLSupport.java:130)
	at org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEvent(FCLSupport.java:122)
	at org.openide.filesystems.FCLSupport.dispatchEvent(FCLSupport.java:99)
	at org.openide.filesystems.FileObject$ED.dispatch(FileObject.java:915)
	at org.openide.filesystems.EventControl.invokeDispatchers(EventControl.java:203)
	at org.openide.filesystems.EventControl.exitAtomicAction(EventControl.java:177)
	at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:122)
	at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:502)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.refresh(FileObjectFactory.java:652)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj.invokeRefreshFor(RootObj.java:179)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj.setAttribute(RootObj.java:131)
	at org.openide.filesystems.FileUtil.refreshFor(FileUtil.java:155)
	at org.openide.filesystems.FileUtil.refreshAll(FileUtil.java:168)
	at org.netbeans.core.ui.warmup.MenuWarmUpTask$NbWindowsAdapter.run(MenuWarmUpTask.java:150)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
Comment 5 Alexey Butenko 2009-02-02 11:31:53 UTC
changeset ba7f1e6cf80b