My environment: Windows 2000 XEmacs 21.4 jde-2.2.7.1. semantic-1.4beta5/6 eieio-0.16 speedbar-0.13 I try to load file and I get error message: "Wrong type argument: number-char-or-marker-p, nil" This happens after loading the prj.el. After the error the buffer isn't opened. Yes. I can't even see the file. I have used JDE quite heavily for two months and nothing like this has happened before. I have attached the problematic file, RemoteDebugger.java. ------ Kalle Raita <[EMAIL PROTECTED]> ---------------------- 040 - 723 1441
import java.net.*; import java.io.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; import channel.*; /** * Application class of the RemoteDebugger. This is used to run the program and it contains * (for now) most of the UI stuff. Not any more. * * @author <a href="mailto:[EMAIL PROTECTED]">Kalle Raita</a> * @version 1.0 */ public class RemoteDebugger extends JFrame implements Runnable { /** Gives visualizers a common preferred size */ public static Dimension visualizerSize = new Dimension(300,150); private ServerSocket soc; private JMenuBar menuBar; private Vector sessions = new Vector(); private int mouseX, mouseY; private boolean dragging = false; private DebuggerUI ui; private OptionManager appl; private FrameUpdater fru; /** Trafic watcher instance to be used with the remote debugger. */ private TraficWatcher watch = new TraficWatcher(); /** Channel tree of the remote debugger */ private ChannelTree tree; private JPanel channels = new JPanel(); /** Mouse adapter of the frame */ public DebuggerMouseAdapter adap; private JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); private JPanel prevControl = null; /** Port used for communication of the remote debugger. */ public static final int PORT = 4787; public RemoteDebugger() { this(null); } /** * Creates a new <code>RemoteDebugger</code> instance. * */ public RemoteDebugger(ChannelTree tree) { (new InitializationThread()).start(); try { soc = new ServerSocket(PORT); soc.setSoTimeout(1); } catch (IOException e) { System.out.println("Error while starting server " + e.getMessage()); } appl = new OptionManager("application.ini"); Integer rows = appl.getIntegerOption("window.visualizers.rows"); channels.setLayout(new GridLayout((rows == null)?4:rows.intValue() ,4,3,3)); // Cols (second argument) does nothing! if (tree == null) { prepareTree(); } // end of if (tree == null) else { this.tree = tree; } // end of else addWindowListener(new WinAdap()); adap = new DebuggerMouseAdapter(this, this.tree); setGlassPane(adap); getGlassPane().setVisible(true); getContentPane().setLayout(new BorderLayout(7,7)); split.setLeftComponent(this.tree); split.setRightComponent(channels); getContentPane().add(split, BorderLayout.CENTER); menuBar = new JMenuBar(); this.setJMenuBar(menuBar); ui = new DebuggerUI(this); ui.initMainUI(); ui.initChannelTreeUI(this.tree); prepareWindow(); Integer wait = appl.getIntegerOption("window.refreshWait"); fru = new FrameUpdater((wait==null)?250:wait.intValue()); fru.addTarget(this.getContentPane()); fru.start(); show(); } /** * Starts the server listening process. * */ public void serverLoop() { if (soc == null) { System.out.println("Stale socket -> exiting"); System.exit(0); } DebugSession session; System.out.println("Entering server loop"); while (true) { try { Socket con = soc.accept(); con.setTcpNoDelay(true); con.setTcpNoDelay(true); System.out.println("New client!"); watch.in("--- NEW CONNECTION FROM: " + con.getInetAddress() + " ---"); session = new DebugSession(this, con.getInputStream(), con.getOutputStream(), null); sessions.add(session); new Thread(session).start(); System.out.println("Thread Started!"); } catch (InterruptedIOException ei) { try { Thread.sleep(500); } catch (InterruptedException e) { } // end of try-catch } // end of catch catch (IOException e) { System.out.println("Failure while connecting: " + e.getMessage()); } } } /** *@see javax.swing.JFrame */ public void paint(Graphics g) { super.paint(g); if (dragging) { g.fillOval(mouseX, mouseY, 50, 50); } } public static void main (String[] args) { RemoteDebugger rd = new RemoteDebugger(); System.out.println("Hi!"); rd.serverLoop(); } public void run() { serverLoop(); } /** * Window adapter class, that will listen for the window closing * */ protected class WinAdap extends WindowAdapter { public void windowClosing(WindowEvent e) { dispose(); System.exit(0); } } /** * Gets the user interface object associated with this debugger. * * @return a <code>DebuggerUI</code> of this RemoteDebugger. * */ public DebuggerUI getUI() { return ui; } /** * Gets the OptionManager of this application. * * @return an <code>OptionManager</code> value */ public OptionManager getOptionManager() { return appl; } /** * Session calls this after it has confirmed contact * with real client. * * @param ses a <code>DebugSession</code> that just connected. * */ public void addSession(DebugSession ses) { tree.addSessionObject(null,ses); } /** * Removes references to the given <code>DebugSession</code>. This enables * it to be garbage collected. * * @param ses a <code>DebugSession</code> to be removed */ public void killSession(DebugSession ses) { if (ses == null) return; sessions.remove(ses); tree.removeSessionObject(null,ses); } /** * Informs debugger, that new channel is connected. This enables * <code>RemoteDebugger</code> to perform possible UI actions * associated with new channel * * @param ses the <code>Session</code> that accepted the channel. * @param chan the <code>Channel</code> just accepted. */ public void addChannel(DebugSession ses, Channel chan) { tree.addSessionObject(ses, chan); } /** * Removes channel from the debug session. This is used to notify * UI about change in the connectivity of the SessionObjects. * * @param ses a <code>DebugSession</code> value * @param chan a <code>Channel</code> value */ public void removeChannel(DebugSession ses, Channel chan) { tree.removeSessionObject(ses, chan); } /** * Informs RemoteDebugger that a channel composition is made. This enables * RD to show GUI representation of composition. Composite is the father object * and subject is the child in hierarchy. * * @param composite a <code>CompositeChannel</code> value * @param subject a <code>SessionObject</code> value */ public void composeChannels(CompositeChannel composite, SessionObject subject){ tree.addSessionObject(composite, subject); } /** * Dismantles composition between given objects. This is used ot notify * GUI about the change in the model. * * @param composition a <code>CompositeChannel</code> value * @param subject a <code>SessionObject</code> value */ public void removeComposition(CompositeChannel composition, SessionObject subject) { tree.removeSessionObject(composition, subject); } /** * Adds menu to the menubar of the main window. * * @param a <code>JMenu</code> to be added. * */ public void addMenuToMenuBar(JMenu menu) { menuBar.add(menu); } /** * Adds a item to the menu of given name. * * @param name Name of the menu. (<code>String</code>). * @param item a <code>JMenuItem</code> to be added. */ public void addToMenuBarMenu(String name, JMenuItem item) { int menus = menuBar.getMenuCount(); int i = 0; while (i < menus) { if (menuBar.getMenu(i).getText().equals(name)) { menuBar.getMenu(i).add(item); } } } /** * Shows or hides traffic watch. * * @param state True shows watch, false hides it. * */ public void showTrafficWatch(boolean state) { if (state) { this.getContentPane().add(watch, BorderLayout.SOUTH); } else { this.getContentPane().remove(watch); } this.validate(); repaint(); } /** * Adds given visualizer on the screen. * * @param vis a <code>Visualizer</code> to be added. * */ public void addVisualizer(Visualizer vis) { channels.add((JComponent)vis); validate(); repaint(); } /** * Removes given visualizer from the screen. * * @param vis a <code>Visualizer</code> value */ public void removeVisualizer (Visualizer vis) { channels.remove((JComponent) vis); ((JComponent) vis).setVisible(false); vis.close(); validate(); repaint(); } /** * Gets selected channel. This is used for determining the target * of some operations. It should be noticed that this doesn't * in any way decide the selection method. * * @return a <code>Channel</code> selected in some way. * @deprecated Prefer {@link #getSelected()} */ public Channel getSelectedChannel() { Object res = tree.getSelected(); if (res instanceof Channel) { return (Channel) res; } return null; } /** * Gets the SessionObject selected by some means in * UI. * * @return a <code>SessionObject</code> or null if none selected. */ public SessionObject getSelected() { Object res = tree.getSelected(); if (!(res instanceof SessionObject)) { return null; } // end of if (!(object instanceof SessionObject)) return (SessionObject) res; } /** * Gets the fathers of the SessionObject. * * @param sesobj a <code>SessionObject</code> value * @return a <code>SessionObject</code>, the father or null if has none. */ public SessionObject[] getFathersOf(SessionObject sesobj) { return tree.getFathersOf(sesobj); } /** * This gets the father of the selected SessionObject. DebugSessions * doesn't have fathers, but they can be tested anyway. * * @return a <code>SessionObject</code> or null if no father is found. */ public SessionObject getFatherOfSelected() { return (SessionObject) tree.getFatherOfSelected(); } public void dispose() { Enumeration e = sessions.elements(); while (e.hasMoreElements()) { DebugSession temp = (DebugSession) e.nextElement(); temp.close(); } // end of while (e.hasMoreElements()) Point loc = getLocationOnScreen(); appl.setOption("window.x", String.valueOf(loc.x)); appl.setOption("window.y", String.valueOf(loc.y)); Dimension size = getSize(); appl.setOption("window.width", String.valueOf(size.width)); appl.setOption("window.height", String.valueOf(size.height)); appl.setOption("window.divider", String.valueOf(split.getDividerLocation())); appl.writeOptions(); super.dispose(); } /** * Gets the frame updater of this RemoteDebugger UI. Frame updater * is used to control the frame rate of the debugger. High framerate * can lead to slowing down of the debuggee if run on the same host. * * @return a <code>FrameUpdater</code> or null if non exists. */ public FrameUpdater getFrameUpdater() { return fru; } /** * Prepares window for showing by reading windows parameters * from <code>OptionManager appl</code>. * */ private void prepareWindow() { Integer winX = appl.getIntegerOption("window.x"); Integer winY = appl.getIntegerOption("window.y"); if (winX == null) { winX = new Integer(0); } // end of if (winX == null) if (winY == null) { winY = new Integer(0); } // end of if (winY == null) setLocation(winX.intValue(), winY.intValue()); Integer width = appl.getIntegerOption("window.width"); Integer height = appl.getIntegerOption("window.height"); setSize((width==null)?0:width.intValue(), (height==null)?0:height.intValue()); Integer dividerLoc = appl.getIntegerOption("window.divider"); if (dividerLoc != null) { split.setDividerLocation(dividerLoc.intValue()); } // end of if (dividerLoc != null) } /** * Prepares ChannelTree. Responsible for reading icon names, * loading icons and giving them to the ChannelTree. * */ private void prepareTree() { Hashtable icons = new Hashtable(); Enumeration keys = appl.getKeys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if (key.endsWith(".pic")) { String value = appl.getStringOption(key); if (value != null) { icons.put(key.substring(0,key.length()-4), new ImageIcon(value)); } // end of if (value != null) } } // end of while (keys.hasMoreElements()) tree = new ChannelTree(icons); } /** * Shows given JPanel in place reserved for visualizer * controls or removes current panel. * * @param targ a <code>JPanel</code> to be shown or null * space is to be emptied. */ public void setControlPane(JPanel targ) { if (prevControl != null) { getContentPane().remove(prevControl); } // end of if (prevControl != null) if (targ != null) { getContentPane().add(targ, BorderLayout.SOUTH); } // end of if (targ != null) prevControl = targ; this.validate(); repaint(); } } class InitializationThread extends Thread { public InitializationThread() { } public void run() { GraphicVisualizerControls.initialize(); } }
