unhandled exception when disconnected - Bug fixed.

cusax-fix
Yana Stamcheva 20 years ago
parent 5762489915
commit 2e360ffd40

@ -28,7 +28,9 @@
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
@ -80,7 +82,7 @@ public ContactListPanel(MainFrame mainFrame) {
this.treePanel.setBackground(Color.WHITE);
this.setHorizontalScrollBarPolicy
(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
public void initTree(MetaContactListService contactListService) {
@ -498,7 +500,12 @@ public void messageDelivered(MessageDeliveredEvent evt) {
* Shows message to the user when message delivery failed.
*/
public void messageDeliveryFailed(MessageDeliveryFailedEvent evt) {
//TODO: Show message to the user when message delivery failed.
String msg = Messages.getString("msgNotDelivered",
evt.getDestinationContact().getDisplayName());
String title = Messages.getString("msgDeliveryFailure");
JOptionPane.showMessageDialog(this, msg, title,
JOptionPane.WARNING_MESSAGE);
}
/**

@ -28,4 +28,16 @@ public static String getString(String key) {
return '!' + key + '!';
}
}
public static String getString(String key, String param) {
try {
String sourceString = RESOURCE_BUNDLE.getString(key);
return sourceString.replaceAll("?", param);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}

@ -37,6 +37,9 @@ last=Last
launchOnStartUp=Launch on start up
login=Login
moveToGroup=Move to group
msgDeliveryFailure=Message delivery failure
msgNotDelivered=Message to ? could not be delivered due to a network problem.
msgSendConnectionProblem=You are currently offline. Check your network connection.
networkFailure=Network failure
next=Next
no=No

@ -20,6 +20,7 @@
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.customcontrols.AntialiasedPanel;
@ -90,8 +91,18 @@ public void actionPerformed(ActionEvent e) {
.getMainFrame().getWaitToBeDeliveredMsgs()
.put(msg.getMessageUID(), this.chatPanel);
im.sendInstantMessage(chatPanel.getDefaultContact()
.getDefaultContact(), msg);
try{
im.sendInstantMessage(chatPanel.getDefaultContact()
.getDefaultContact(), msg);
}
catch(IllegalStateException ex){
String errorMsg = Messages.getString("msgSendConnectionProblem");
String title = Messages.getString("msgDeliveryFailure");
JOptionPane.showMessageDialog(this, errorMsg, title,
JOptionPane.WARNING_MESSAGE);
}
}
}

Loading…
Cancel
Save