• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

handling remote exception at client

 
Theo van Loon
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

i'm near ending my application all seems to work properly, except that remote exceptions seems to cause difficulty.

In my clientguicontroller i do the search.
Stripped code looks something like this :


Errormessage is shown as it should be but thereafter is set the result(which is null) in the TableModel amd afterwards i get this exception :

java.lang.NullPointerException
at suncertify.client.ContractorTableModel.getRowCount(ContractorTableModel.java:73)
at javax.swing.JTable.getRowCount(JTable.java:1716)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:939)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
at javax.swing.JComponent.paintComponent(JComponent.java:541)
at javax.swing.JComponent.paint(JComponent.java:808)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JViewport.paint(JViewport.java:722)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1021)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:557)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4794)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4740)
at javax.swing.JComponent.paint(JComponent.java:798)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
at java.awt.Container.paint(Container.java:1312)
at sun.awt.RepaintArea.paint(RepaintArea.java:177)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
at java.awt.Component.dispatchEventImpl(Component.java:3678)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)


When i conduct a search which has a result of null it wotks fine. Does anyone know how i can overcome this problem?

THANKS!!
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11914
209
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Theo,

If I had to guess, I would suspect that your "search which has a result of null it wotks fine" is correctly initialising the results variable in the line:



Obviously, when the exception is thrown, this line does not complete.

However when the exception is thrown, your code snippet indicates that you display an error message, then continue to use the invalid results variable to set your table model.

You might want to rethink what should logically happen in the case of a remote exception.

Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic