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 51055 - InvalidObjectException returned when adding a previously defined class to a package
Summary: InvalidObjectException returned when adding a previously defined class to a p...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-01 22:14 UTC by OCSOCoder
Modified: 2004-11-11 15:44 UTC (History)
0 users

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 OCSOCoder 2004-11-01 22:14:01 UTC
IDE returns...

javax.jmi.reflect.InvalidObjectException: Object 
with MOFID 1D98C369-2C21-11D9-88B4-
57BA38E9AA77:000000000000094A no longer exists.
	at 
org.netbeans.mdr.handlers.BaseObjectHandler._getD
elegate(BaseObjectHandler.java:322)
	at 
org.netbeans.mdr.handlers.InstanceHandler.getInst
anceDelegate(InstanceHandler.java:48)
	at 
org.netbeans.mdr.handlers.InstanceHandler.refClas
s(InstanceHandler.java:283)
	at 
org.netbeans.mdr.util.EventNotifier$Instance.coll
ectListeners(EventNotifier.java:560)
	at 
org.netbeans.mdr.util.EventNotifier$Abstract.fire
PlannedChange(EventNotifier.java:409)
	at 
org.netbeans.mdr.handlers.InstanceHandler.refDele
te(InstanceHandler.java:304)
	at 
org.netbeans.modules.javacore.scanning.JavaUpdate
r.makeIndex(JavaUpdater.java:238)
	at 
org.netbeans.modules.javacore.scanning.JavaUpdate
r.computeIndex(JavaUpdater.java:57)
	at 
org.netbeans.modules.javacore.jmiimpl.javamodel.R
esourceImpl.directUpdate(ResourceImpl.java:536)
	at 
org.netbeans.modules.javacore.jmiimpl.javamodel.R
esourceImpl.checkUpToDate(ResourceImpl.java:479)
	at 
org.netbeans.modules.javacore.jmiimpl.javamodel.R
esourceImpl.updateFromDataObject
(ResourceImpl.java:385)
	at 
org.netbeans.modules.javacore.ExclusiveMutex.pars
eIfNeeded(ExclusiveMutex.java:218)
	at 
org.netbeans.modules.javacore.ExclusiveMutex.ente
r(ExclusiveMutex.java:137)
	at 
org.netbeans.mdr.NBMDRepositoryImpl.beginTrans
(NBMDRepositoryImpl.java:232)
	at 
org.netbeans.modules.java.JavaEditor$2.run
(JavaEditor.java:226)
	at org.openide.util.Task.run
(Task.java:136)
	at 
org.openide.util.RequestProcessor$Task.run
(RequestProcessor.java:330)
[catch] at 
org.openide.util.RequestProcessor$Processor.run
(RequestProcessor.java:686)

when I attempted to compile various source files 
in an application package; they all have similar 
coding.

Sample source follows:

/*
 * vehDataTable.java
 * Created on October 27, 2004
 * By Adam J. Bader
 * Information Technology
 * Okaloosa County Sheriff's Office
 */

/*
 * A custom table to store and display Vehicles
 * From the main class, it will show all 
vehicles that fulfill a search
 * From a subclass, it will show all vehicles 
related to the record being viewed 
 */

package casetrack;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Collections;
import java.util.Vector;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;

class vehDataTable extends AbstractTableModel
{  
    static private int vehNoWidth = 75;
    static private int vehManufacturerWidth = 
150;
    static private int vehModelWidth = 150;
    static private int vehModelYearWidth = 75;
    static private int vehVINWidth = 125;
    static private int vehTagWidth = 75;    
    
    // The columns are created in an array for 
quick reference during program execution
    static final public dataColumns columns[] = 
    {
        new dataColumns("ID", 
vehNoWidth,JLabel.LEFT),
        new dataColumns("Manufacturer", 
vehManufacturerWidth,JLabel.LEFT),
        new dataColumns("Model", 
vehModelWidth,JLabel.LEFT),
        new dataColumns("Year", 
vehModelYearWidth,JLabel.LEFT),
        new dataColumns("VIN", 
vehVINWidth,JLabel.LEFT),
        new dataColumns("Tag", 
vehTagWidth,JLabel.LEFT)                
    };
    
    // The vehicle data is stored in a vector 
for quick sorting; hashtables will mess up
    // the sort order and arrays don't work well 
for memory and large #s of fields.
    protected Vector vehicles;
    
    // By default, the program sorts by VIN
    protected int sortCol = 4;
    protected boolean sortAsc = true;
    protected int modelIndex = 4;
    
    // And we pass in a reference to the actual 
JTable being extended by this class
    protected JTable m_table;
    
    public void addVehicle(vehDataFields vDF)
    {
        vehicles.add(vDF);
        this.fireTableDataChanged();
    }
    
    public void removeVehicle(int entry)
    {
        vehicles.removeElementAt(entry);
        this.fireTableDataChanged();        
    }
    
    public void removeAll()
    {
        vehicles.removeAllElements();
        this.fireTableDataChanged();        
    }    
    
    // Overrides the abstract function
    public String getColumnName(int column) {
        String str = columns[column].dTitle;
        if (column == sortCol)
            str += sortAsc ? " " : " ";
        return str;
    }

    // a custom function to re-sort the vehicle 
vector when the user decides to sort on a 
different column
    public void reSort(){
        Collections.sort(vehicles, new 
vehComparator(modelIndex, sortAsc));
        m_table.tableChanged(new TableModelEvent
(vehDataTable.this));
    }
    
    // The columnListener listens for mouse 
clicks on the table headers
    class ColumnListener extends MouseAdapter
    {
        public ColumnListener(JTable table){
            m_table = table;
        }
        
        // When the mouse is clicked, the 
program checks to see which column
        // has been selected
        public void mouseClicked(MouseEvent e) {
            TableColumnModel colModel = 
m_table.getColumnModel();
            int columnModelIndex = 
colModel.getColumnIndexAtX(e.getX());
            modelIndex = colModel.getColumn
(columnModelIndex).getModelIndex();
            
            // update the model index in case 
there is an OOB problem
            if(modelIndex < 0)
                modelIndex = sortCol;
            
            // If the column selected is the 
same as the column presently being
            // sorted on, we'll reverse the sort 
order
            if(sortCol == modelIndex)
                sortAsc = !sortAsc;
            else
                // otherwise, we'll sort on the 
new column
                sortCol = modelIndex;
            
            // And call re-sort rather than 
duplicate the code
            reSort();
        }
    }
   
    // The default constructor just initializes 
an empty vector
    public vehDataTable() {
        vehicles = new Vector();      
    }
    
    // various function overrides
    public int getRowCount() {
        return vehicles == null ? 0 : 
vehicles.size();
    }
    
    public int getColumnCount() {
        return columns.length;
    }
    
    public boolean isCellEditable(int nRow, int 
nCol){
        return false;
    }
    
    public Object getValueAt(int nRow, int nCol) 
{
        if (nRow < 0 || nRow >= getRowCount())
            return "";
        vehDataFields row = (vehDataFields) 
vehicles.elementAt(nRow);
        switch (nCol)
        {
            case 0: return row.vehNo;
            case 1: return row.vehManufacturer;
            case 2: return row.vehModel;
            case 3: return row.vehModelYear;
            case 4: return row.vehVIN;
            case 5: return row.vehTag;
        }
        return "";
    }
}
Comment 1 Martin Matula 2004-11-11 15:44:21 UTC
This issue was fixed some time ago. It should work in the most recent
q-build.

Next time please attach the messages.log and any other files as an
attachment rather than copy-pasting them to the issue description.
Thanks in advance.