Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. while (true) {
  2. try {
  3. if (scanner.hasNext()) {
  4. String message = scanner.nextLine();
  5. String message2 = Client.decrypt(message, key);
  6. ChatGUI.display(message2);
  7. if (message2.equals("ONLINE")) {
  8.  
  9. ArrayList<String> online = (ArrayList<String>) obIn.readObject();
  10. Client.addOnlineUsers(online);
  11. System.out.println(online);
  12.  
  13. public static void addOnlineUsers(ArrayList<String> online) {
  14. Storage.setOnlineUsers(online); //it's a simple setter
  15. ChatGUI.setOnline();
  16.  
  17. public static void setOnline() {
  18. onlineUsers.setListData(Client.getOnlineUsers().toArray());
  19. }
  20.  
  21. public void sendNewUserOnline() throws Exception{
  22. String notify = "ONLINE";
  23. for (ConnectionPair conPair : connection) {
  24. PrintWriter out = conPair.getWriter();
  25. SecretKey clientKey = conPair.getClientAesKey();
  26. String encMessage = encrypt(notify, clientKey);
  27. out.println(encMessage);
  28. out.flush();
  29.  
  30. ObjectOutputStream obOut = conPair.getObOut();
  31. obOut.writeObject(online);
  32. obOut.flush();
  33. }
  34. }
  35.  
  36. java.io.StreamCorruptedException: invalid type code: 35
  37. at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1374)
  38. at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
  39. at test.ClientService.run(ClientService.java:40)
  40. at java.lang.Thread.run(Thread.java:722)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement