snowboarder1994
Goto Top

Fehler in meinem Chat Applet

Hallo,

habe ein Chat in Java bekommen und weiter programmiert. Habe das Problem, das es einfach nicht startet. Ich komme bis zum Login des Chats und dann steht auf dem Button, wo normal steht "Einloggen", das man in den Chat eintreten kann "Fehler". In der Datei ConectServer, befindet sich das drin, was das verursacht, das es Fehler anzeigt. (Auszug des Codes unten).

Woran kann dies liegen?

Hier ist mal die Url, habe es mit Firefox und Safari getestet. Im Internet Explorer o.ä. habe ich es noch nicht versucht: http://wakestars.onpw.de

Hier habe ich mal den Code des ConectServer Datei vielleicht lässt sich was rausfinden:
import java.awt.Button;
import java.awt.Choice;
import java.awt.Color;
import java.awt.TextField;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.security.Key;
import java.util.Hashtable;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

class ConnectServer extends Thread
{
  WakeStars source;
  Socket connection;
  InputStream inStream;
  DataInputStream inDataStream;
  OutputStream outStream;
  DataOutputStream outDataStream;
  String message;
  ChatFrame cf;
  boolean con;
  String key;
  String ppn = "";  
  String amsg = "";  
  Key secretKey;
  Cipher desCipherDe;
  Cipher desCipherEn;
  CipherInputStream ciIn;
  CipherOutputStream ciOut;
  boolean crypted;
  String tmp00;
  String tmp01;
  int tmp02;
  Userliste uL;
  Long lastMsg = Long.valueOf(System.currentTimeMillis());
  private boolean conFailed = false;

  String niick = "";  

  ConnectServer(WakeStars paramWakeStars)
  {
    this.source = paramWakeStars;
    this.con = false;
    this.crypted = false;
    start();
    connectServer();
  }

  public int getPasswd(String paramString) {
    return Wakestars.getCode(WakeStars.getMD5(paramString), this.key);
  }

  public boolean fileTransfer(String paramString)
  {
    try
    {
      int i = 0;
      FileInputStream localFileInputStream = new FileInputStream("I:\\" + paramString);  
      byte arrayOfByte = new byte[100];
      int j = 0;
      send("" + paramString + "" + new File(new StringBuilder().append("I:\\").append(paramString).toString()).length());  
      while (true)
      {
        j = localFileInputStream.read(arrayOfByte);
        if (j == -1)
        {
          break;
        }
        this.outStream.write(arrayOfByte, 0, j);
      }
    }
    catch (Exception localException) {
      localException.printStackTrace();
      return false;
    }
    return true;
  }

  public boolean fileTransfer(File paramFile)
  {
    try
    {
      int i = 0;
      FileInputStream localFileInputStream = new FileInputStream(paramFile);
      byte arrayOfByte = new byte[100];
      int j = 0;
      send("" + paramFile.getName() + "" + paramFile.length());  
      while (true)
      {
        j = localFileInputStream.read(arrayOfByte);
        if (j == -1)
        {
          break;
        }
        this.outStream.write(arrayOfByte, 0, j);
      }
    }
    catch (Exception localException) {
      localException.printStackTrace();
      return false;
    }
    return true;
  }

  private void errmsg(String paramString) {
    if (this.cf != null)
    {
      this.cf.absenden.setText(paramString);
      this.cf.absenden.setEditable(false);
      this.cf.absenden.setEnabled(false);
    }
  }

  public static String linkSafe(String paramString) {
    if ((paramString.indexOf('"') >= 0) || (paramString.indexOf('<') >= 0) || (paramString.indexOf('>') >= 0) || (paramString.indexOf('\\') >= 0) || (paramString.indexOf('|') >= 0))  
    {
      int i = paramString.length();
      StringBuffer localStringBuffer = new StringBuffer(i + 3);
      for (int j = 0; j < i; j++)
      {
        char c = paramString.charAt(j);
        switch (c)
        {
        case '"':  
        case '<':  
        case '>':  
        case '\\':  
        case '|':  
          localStringBuffer.append('\\');  
        }

        localStringBuffer.append(c);
      }

      return localStringBuffer.toString();
    }

    return paramString;
  }

  public void run()
  {
    StringTokenizer localStringTokenizer = null;
    while (true)
    {
      this.message = "-";  
      while (!this.con)
        try {
          Thread.sleep(500L);
        } catch (Exception localException1) {
        }
      try {
        while (this.message.equals("-")) {  
          try {
            Thread.sleep(20L); } catch (Exception localException2) {
          }this.message = (this.inDataStream.readUTF() + "");  
        }
        localStringTokenizer = new StringTokenizer(this.message, "");  
        act(localStringTokenizer);
      }
      catch (IOException localIOException)
      {
        errmsg("Verbindung zum Server wurde unterbrochen..");  
        try { Thread.sleep(2000L); } catch (Exception localException4) {
        }connectServer();
      }
      catch (NoSuchElementException localNoSuchElementException)
      {
        localNoSuchElementException.printStackTrace();
      }
      catch (Exception localException3)
      {
        localException3.printStackTrace();
      }
    }
  }

  private void act(StringTokenizer paramStringTokenizer)
  {
    String str1 = paramStringTokenizer.nextToken();
    try {
      if (str1.equals("x"))  
      {
        if (this.uL != null)
        {
          this.uL.setContext(paramStringTokenizer.nextToken().equals("T"));  
        }
      }
      else
      {
        Object localObject1;
        if (str1.equals("filetransfer"))  
        {
          localObject1 = new JFileChooser();
          ExampleFileFilter localExampleFileFilter = new ExampleFileFilter();
          localExampleFileFilter.addExtension("jpg");  
          localExampleFileFilter.addExtension("jpeg");  
          localExampleFileFilter.setDescription("Nur JPEG");  
          ((JFileChooser)localObject1).setFileFilter(localExampleFileFilter);
          int j = ((JFileChooser)localObject1).showOpenDialog(null);
          if (j == 0) {
            fileTransfer(((JFileChooser)localObject1).getSelectedFile());
          }
        }
        else if (str1.equals("dk"))  
        {
          this.key = paramStringTokenizer.nextToken();
        }
        else if (str1.equals("win"))  
        {
          this.tmp00 = paramStringTokenizer.nextToken();
          this.tmp01 = paramStringTokenizer.nextToken();
          this.tmp02 = Integer.parseInt(paramStringTokenizer.nextToken());
          switch (this.tmp02)
          {
          case 0:
            this.tmp02 = -1;
            if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 20); break;
          case 1:
            this.tmp02 = 1;
            if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 2); break;
          case 2:
            this.tmp02 = 2;
            if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 1); break;
          case 3:
            this.tmp02 = 0;
            if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 0); break;
          case 50:
            this.tmp02 = 0;
            break;
          case 51:
            this.tmp02 = 2;
          }

          if (!WakeStars.appli) JOptionPane.showMessageDialog(null, "<html><div style=\"background:url(http://89.149.208.95/chat/img/winbg.gif) no-repeat;\">" + this.tmp01 + "</div></html>", this.tmp00, this.tmp02);  
        }
        else if (str1.equals("broadcast"))  
        {
          localObject1 = paramStringTokenizer.nextToken();
          if (((String)localObject1).equals("-")) this.cf.textpanelLight.Z("°BB°_Durchsage: " + paramStringTokenizer.nextToken()); else  
            this.cf.textpanelLight.Z("°BB°_Durchsage von " + (String)localObject1 + ": " + paramStringTokenizer.nextToken());  
        }
        else if ((str1.equals("echo")) || (str1.equals("system")))  
        {
          this.cf.textpanelLight.Z(paramStringTokenizer.nextToken());
        }
        else if (str1.equals("info"))  
        {
          if (this.cf != null)
          {
            this.cf.absenden.setText(paramStringTokenizer.nextToken());
            this.cf.absenden.setEditable(false);
            this.cf.absenden.setEnabled(false);
          }
        }
        else if (str1.equals("frame"))  
        {
          new KF(this.source, paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.hasMoreTokens() ? paramStringTokenizer.nextToken() : "");  
        }
        else if (str1.equals("sync"))  
        {
          localObject1 = this.source.ht_dynframes.get(paramStringTokenizer.nextToken());
          if (localObject1 != null)
          {
            ((J)localObject1).Z(paramStringTokenizer.nextToken());
          }
        }
        else
        {
          Object localObject3;
          Object localObject4;
          Object localObject5;
          Object localObject6;
          if (str1.equals("pub"))  
          {
            if ((this.cf != null) && 
              (this.cf.channel.equals(paramStringTokenizer.nextToken())))
            {
              this.niick = paramStringTokenizer.nextToken();
              this.amsg = paramStringTokenizer.nextToken();
              localObject1 = this.amsg;
              if ((this.amsg.indexOf("http://") != -1) && (this.amsg.indexOf("|http://") == -1) && (this.amsg.indexOf(">http://") == -1))  
              {
                int i = this.amsg.indexOf("http://");  
                localObject3 = this.amsg.substring(0, i);
                localObject4 = "";  
                localObject5 = "";  
                localObject6 = "";  
                if (this.amsg.indexOf(" ", i) == -1)  
                {
                  localObject6 = this.amsg.substring(this.amsg.indexOf("http://"));  
                  localObject4 = "°>" + (String)localObject6 + "|" + (String)localObject6 + "<°";  
                }
                else {
                  localObject6 = this.amsg.substring(this.amsg.indexOf("http://"), this.amsg.indexOf(" ", i));  
                  localObject4 = "°>" + (String)localObject6 + "|" + (String)localObject6 + "<°";  
                  localObject5 = this.amsg.substring(this.amsg.indexOf(" ", i));  
                }

                localObject1 = (String)localObject3 + (String)localObject4 + (String)localObject5;
              }

              this.cf.textpanelLight.Z("_°>_h" + WakeStars.addProtection(this.niick) + "|/w " + WakeStars.addProtection(this.niick) + "<°:_ " + (String)localObject1);  
            }
          }
          else if (str1.equals("pubdo"))  
          {
            if ((this.cf != null) && 
              (this.cf.channel.equals(paramStringTokenizer.nextToken())))
            {
              this.niick = paramStringTokenizer.nextToken();
              this.cf.textpanelLight.Z("_°>_h" + this.niick + "|/w " + this.niick + "<°_ " + paramStringTokenizer.nextToken());  
            }
          }
          else if (str1.equals("channellist"))  
          {
            this.source.myChannel = this.source.channelDisplay.getSelectedIndex();
            this.source.channelDisplay.removeAll();
            ChatFrame.cChannels.removeAll();

            System.out.println("Got channels");  
            while (paramStringTokenizer.hasMoreTokens())
            {
              localObject1 = paramStringTokenizer.nextToken();

              this.source.chl.addRoom((String)localObject1);
              ChatFrame.cChannels.addItem((String)localObject1);
            }
            this.source.channelDisplay.select(this.source.myChannel);
            this.source.channelDisplay2.setText("Treffpunkt");  
          }
          else if (str1.equals("destroy"))  
          {
            this.cf.dispose();
            this.connection.close();
            if (paramStringTokenizer.hasMoreTokens())
              errmsg(paramStringTokenizer.nextToken());
            else
              errmsg("Du wurdest rausgeworfen!");  
            destroy();
          }
          else if (str1.equals("frm"))  
          {
            new RTFv2(paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), false, this);
          }
          else if (str1.equals("url"))  
          {
            this.source.chatURL(paramStringTokenizer.nextToken());
          }
          else if (str1.equals("channel"))  
          {
            localObject1 = paramStringTokenizer.nextToken();
            Object localObject2;
            if (((String)localObject1).equals("bgc"))  
            {
              localObject2 = paramStringTokenizer.nextToken();
            }
            else if (((String)localObject1).equals("bgc"))  
            {
              if (this.cf != null)
              {
                if (paramStringTokenizer.nextToken().equals(this.cf.channel))
                {
                  localObject2 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
                  this.cf.bgc = new Color(Integer.parseInt(((StringTokenizer)localObject2).nextToken()), Integer.parseInt(((StringTokenizer)localObject2).nextToken()), Integer.parseInt(((StringTokenizer)localObject2).nextToken()));
                  this.cf.invalidate();
                  this.cf.repaint();
                }
              }
            }
            else if (((String)localObject1).equals("new"))  
            {
              localObject2 = paramStringTokenizer.nextToken();
              localObject3 = new Hashtable();
              while (!((String)localObject2).equals("-"))  
              {
                ((Hashtable)localObject3).put(localObject2, new Button(paramStringTokenizer.nextToken()));
                localObject2 = paramStringTokenizer.nextToken();
              }

              if (this.cf == null)
              {
                this.cf = new ChatFrame(this, paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken().equals("T"), (Hashtable)localObject3, paramStringTokenizer.hasMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0, paramStringTokenizer.hasMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0);  
              }
              else {
                this.cf.changeChannel(paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken().equals("T"), (Hashtable)localObject3);  
                this.cf.absenden.setEnabled(true);
                this.cf.absenden.setEditable(true);
                this.cf.absenden.setText("");  
              }

            }
            else if (((String)localObject1).equals("msg"))  
            {
              if ((this.cf != null) && 
                (this.cf.channel.equals(paramStringTokenizer.nextToken())))
                this.cf.textpanelLight.Z(paramStringTokenizer.nextToken());
            }
            else if (((String)localObject1).equals("bgm"))  
            {
              WakeStars.AUDIOURL = paramStringTokenizer.nextToken();
            }
            else if (((String)localObject1).equals("user"))  
            {
              localObject2 = paramStringTokenizer.nextToken();
              localObject3 = paramStringTokenizer.nextToken();
              if ((this.cf != null) && 
                (((String)localObject3).equals(this.cf.channel)))
              {
                if (((String)localObject2).equals("icons"))  
                {
                  localObject4 = paramStringTokenizer.nextToken();
                  ((Vector)this.uL.vusericons.elementAt(this.uL.vusers.indexOf(localObject4))).removeAllElements();
                  while (paramStringTokenizer.hasMoreTokens())
                  {
                    ((Vector)this.uL.vusericons.elementAt(this.uL.vusers.indexOf(localObject4))).add(this.source.img(paramStringTokenizer.nextToken()));
                  }
                  this.uL.repaint();
                }
                else if (((String)localObject2).equals("in"))  
                {
                  localObject4 = paramStringTokenizer.nextToken();
                  localObject5 = new StringBuffer();

                  this.cf.textpanelLight.Z("°R°>> " + (String)localObject4 + " eilt herbei.");  
                  localObject6 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
                }
                else if (((String)localObject2).equals("out"))  
                {
                  localObject4 = paramStringTokenizer.nextToken();
                  localObject5 = new StringBuffer();
                  this.cf.textpanelLight.Z("°R°>> " + (String)localObject4 + " hat den Raum verlassen.");  
                  this.uL.removeUser((String)localObject4);
                  if (((String)localObject4).equals(this.cf.nickName))
                    this.cf.dispose();
                }
                else if (((String)localObject2).equals("all"))  
                {
                  this.uL.vusers.removeAllElements();
                  this.uL.vusercolors.removeAllElements();
                  this.uL.vusericons.removeAllElements();
                  localObject4 = new StringBuffer();

                  localObject6 = "";  
                  String str2 = "";  
                  while (paramStringTokenizer.hasMoreTokens()) {
                    if (this.cf == null)
                      continue;
                    localObject6 = paramStringTokenizer.nextToken();
                    if (((String)localObject6).equals("-")) {  
                      continue;
                    }
                    Vector localVector = new Vector();
                    localObject5 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
                    str2 = paramStringTokenizer.nextToken();
                    while (!str2.equals("-"))  
                    {
                      localVector.add(this.source.img(str2));
                      str2 = paramStringTokenizer.nextToken();
                    }
                    this.uL.addUser((String)localObject6, new Color(Integer.parseInt(((StringTokenizer)localObject5).nextToken()), Integer.parseInt(((StringTokenizer)localObject5).nextToken()), Integer.parseInt(((StringTokenizer)localObject5).nextToken())), localVector);
                  }

                  this.uL.repaint();
                }
              }
            }
          }
          else if (str1.equals("cc")) {  
            WakeStars.allImages = new Hashtable();
          }
          else if (str1.equals("prv"))  
          {
            this.ppn = paramStringTokenizer.nextToken();
            if (this.cf.getPrivateFrame(this.ppn) != null)
            {
              this.cf.getPrivateFrame(this.ppn).tp.Z("_°>_h" + this.ppn + "|/w " + this.ppn + "<°:_ " + paramStringTokenizer.nextToken());  
            }
            else if (this.cf != null) this.cf.textpanelLight.Z("_°RR>_h" + this.ppn + "|/w " + this.ppn + "<° (privat):_°r° " + paramStringTokenizer.nextToken());  

          }
          else if (str1.equals("prvs"))  
          {
            this.ppn = paramStringTokenizer.nextToken();
            if (this.cf.getPrivateFrame(this.ppn) != null)
            {
              this.cf.getPrivateFrame(this.ppn).tp.Z("_°>_h" + this.cf.nickName + "|/w " + this.cf.nickName + "<°:_°r° " + paramStringTokenizer.nextToken());  
            }
            else if (this.cf != null)
              this.cf.textpanelLight.Z("°RR°_Du (privat an " + this.ppn + "):_°r° " + paramStringTokenizer.nextToken());  
          }
          else if (str1.equals("snd"))  
          {
            if (WakeStars.AUDIOPLAYER != null)
              WakeStars.AUDIOPLAYER.STOP();
            WakeStars.AUDIOPLAYER = new Audio(paramStringTokenizer.nextToken(), true);
          }
        }
      }
    } catch (Exception localException) {
    }
  }

  private void conFail() {
    if (!this.conFailed)
    {
      this.conFailed = true;
      if (WakeStars.appli) WakeStars.openMsgWin("Keine Verbindung zum Server...", "Es konnte keine Verbindung zum Server hergestellt werden. Moeglicherweise wird ein Update vorgenommen. Bitte pruefen Sie auch Ihre Internetverbindung. ", 0);   
    }
  }

  public void connectServer()
  {
    try
    {
      this.source.enterButton.setLabel("Verbinden ...");  
      this.connection = new Socket();
      InetSocketAddress localInetSocketAddress = new InetSocketAddress("89-149-241-72.internetserviceteam.com", this.source.port);  
      this.connection.connect(localInetSocketAddress, 3000);
      this.outStream = this.connection.getOutputStream();
      this.outDataStream = new DataOutputStream(this.outStream);
      this.inStream = this.connection.getInputStream();
      this.inDataStream = new DataInputStream(this.inStream);
      this.connection.setSoTimeout(0);
      this.con = true;
      this.conFailed = false;
      this.source.enterButton.setLabel("Eintreten");  
      this.outStream.write("WakeStars ChatKlient\r\n".getBytes());  
      try {
        send("" + this.source.getDocumentBase()); } catch (Exception localException2) {  
        send("");  
      }
    }
    catch (SocketTimeoutException localSocketTimeoutException) {
      errmsg("Keine Verbindung zum Server!");  
      conFail();
      try { Thread.sleep(20000L); } catch (Exception localException3) {
      }connectServer();
    }
    catch (SocketException localSocketException)
    {
      errmsg("Unerwarteter Fehler beim Verbinden zum Server");  
      conFail();
      try { Thread.sleep(20000L); } catch (Exception localException4) {
      }connectServer();
    }
    catch (EOFException localEOFException)
    {
      errmsg("Die Verbindung wurde beendet.");  
      try { Thread.sleep(20000L); } catch (Exception localException5) {
      }connectServer();
    }
    catch (IOException localIOException)
    {
      errmsg("");  
      System.out.println(">" + localIOException);  
      try { Thread.sleep(20000L); } catch (Exception localException6) {
      }connectServer();
    }
    catch (Exception localException1) {
      this.source.enterButton.setLabel("FEHLER");  
    }
  }

  public boolean send(String paramString)
  {
    try {
      this.outDataStream.writeUTF(paramString);
      this.outDataStream.flush();
      this.ciOut.flush(); } catch (Exception localException) {
      return false;
    }return true;
  }

  public void F(ConnectServer paramConnectServer, String paramString1, String paramString2, int paramInt1, int paramInt2, boolean paramBoolean)
  {
    new Win(paramConnectServer.source, paramString1, paramString2, paramInt1, paramInt2, paramBoolean);
  }

  public void closeConnection()
  {
    try {
      this.connection.close();
    }
    catch (IOException localIOException)
    {
    }
  }
}

Content-Key: 157909

Url: https://administrator.de/contentid/157909

Printed on: April 19, 2024 at 01:04 o'clock

Member: maretz
maretz Jan 03, 2011 at 14:54:08 (UTC)
Goto Top
und wenn du den Code jetzt noch in nen Code-Block packst und vernünftig formatierst (-> Einrückungen usw.) dann könnte man sich das sogar angucken...
Member: MttKrb
MttKrb Jan 03, 2011 at 15:56:39 (UTC)
Goto Top
Hallo,
die Code-Formatierung müsste dringend nachgeholt werden.
Wenn das passiert ist, sind noch folgende Fragen offen:
- Welche Änderungen wurden wo gemacht?
- Lief das Programm vor den Änderungen Fehlerfrei?
- Hast du die entsprechenden Funktionen mal debuggt?

Der Code lies sich bie mir nicht kompilieren, da diverse Klassen wie u.a. "WakeStars", "ChatFrame","userListe" nicht gefunden wurden.

Gruß
Jogibaer0411
Member: Snowboarder1994
Snowboarder1994 Jan 03, 2011 at 18:00:12 (UTC)
Goto Top
Hier mal der Code:

Habe den Code so wie er ist. Kann es sein, das die Verbindung nicht aufgenommen werden kann mit dem Server aber so wie ich es in diesem Code unten sehe müsste alles richtig sein. Das ist ja die ConnectServer Datei die mit dem Server verbindet. Kann es daran liegen, das noch keine DB (Datenbank) vorhanden ist, aber diese dürfte ja jetzt noch nicht stören.
Ja, es funktionierte vorher einwandfrei.
Die diversen Klassen habe ich in einer anderen Datei.

import java.awt.Button;
import java.awt.Choice;
import java.awt.Color;
import java.awt.TextField;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.security.Key;
import java.util.Hashtable;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

class ConnectServer extends Thread
{
WakeStars source;
Socket connection;
InputStream inStream;
DataInputStream inDataStream;
OutputStream outStream;
DataOutputStream outDataStream;
String message;
ChatFrame cf;
boolean con;
String key;
String ppn = "";  
String amsg = "";  
Key secretKey;
Cipher desCipherDe;
Cipher desCipherEn;
CipherInputStream ciIn;
CipherOutputStream ciOut;
boolean crypted;
String tmp00;
String tmp01;
int tmp02;
Userliste uL;
Long lastMsg = Long.valueOf(System.currentTimeMillis());
private boolean conFailed = false;

String niick = "";  

ConnectServer(WakeStars paramWakeStars)
{
this.source = paramWakeStars;
this.con = false;
this.crypted = false;
start();
connectServer();
}

public int getPasswd(String paramString) {
return Wakestars.getCode(WakeStars.getMD5(paramString), this.key);
}

public boolean fileTransfer(String paramString)
{
try
{
int i = 0;
FileInputStream localFileInputStream = new FileInputStream("I:\\" + paramString);  
byte arrayOfByte = new byte[100];
int j = 0;
send("" + paramString + "" + new File(new StringBuilder().append("I:\\").append(paramString).toString()).length());  
while (true)
{
j = localFileInputStream.read(arrayOfByte);
if (j == -1)
{
break;
}
this.outStream.write(arrayOfByte, 0, j);
}
}
catch (Exception localException) {
localException.printStackTrace();
return false;
}
return true;
}

public boolean fileTransfer(File paramFile)
{
try
{
int i = 0;
FileInputStream localFileInputStream = new FileInputStream(paramFile);
byte arrayOfByte = new byte[100];
int j = 0;
send("" + paramFile.getName() + "" + paramFile.length());  
while (true)
{
j = localFileInputStream.read(arrayOfByte);
if (j == -1)
{
break;
}
this.outStream.write(arrayOfByte, 0, j);
}
}
catch (Exception localException) {
localException.printStackTrace();
return false;
}
return true;
}

private void errmsg(String paramString) {
if (this.cf != null)
{
this.cf.absenden.setText(paramString);
this.cf.absenden.setEditable(false);
this.cf.absenden.setEnabled(false);
}
}

public static String linkSafe(String paramString) {
if ((paramString.indexOf('"') >= 0) || (paramString.indexOf('<') >= 0) || (paramString.indexOf('>') >= 0) || (paramString.indexOf('\\') >= 0) || (paramString.indexOf('|') >= 0))  
{
int i = paramString.length();
StringBuffer localStringBuffer = new StringBuffer(i + 3);
for (int j = 0; j < i; j++)
{
char c = paramString.charAt(j);
switch (c)
{
case '"':  
case '<':  
case '>':  
case '\\':  
case '|':  
localStringBuffer.append('\\');  
}

localStringBuffer.append(c);
}

return localStringBuffer.toString();
}

return paramString;
}

public void run()
{
StringTokenizer localStringTokenizer = null;
while (true)
{
this.message = "-";  
while (!this.con)
try {
Thread.sleep(500L);
} catch (Exception localException1) {
}
try {
while (this.message.equals("-")) {  
try {
Thread.sleep(20L); } catch (Exception localException2) {
}this.message = (this.inDataStream.readUTF() + "");  
}
localStringTokenizer = new StringTokenizer(this.message, "");  
act(localStringTokenizer);
}
catch (IOException localIOException)
{
errmsg("Verbindung zum Server wurde unterbrochen..");  
try { Thread.sleep(2000L); } catch (Exception localException4) {
}connectServer();
}
catch (NoSuchElementException localNoSuchElementException)
{
localNoSuchElementException.printStackTrace();
}
catch (Exception localException3)
{
localException3.printStackTrace();
}
}
}

private void act(StringTokenizer paramStringTokenizer)
{
String str1 = paramStringTokenizer.nextToken();
try {
if (str1.equals("x"))  
{
if (this.uL != null)
{
this.uL.setContext(paramStringTokenizer.nextToken().equals("T"));  
}
}
else
{
Object localObject1;
if (str1.equals("filetransfer"))  
{
localObject1 = new JFileChooser();
ExampleFileFilter localExampleFileFilter = new ExampleFileFilter();
localExampleFileFilter.addExtension("jpg");  
localExampleFileFilter.addExtension("jpeg");  
localExampleFileFilter.setDescription("Nur JPEG");  
((JFileChooser)localObject1).setFileFilter(localExampleFileFilter);
int j = ((JFileChooser)localObject1).showOpenDialog(null);
if (j == 0) {
fileTransfer(((JFileChooser)localObject1).getSelectedFile());
}
}
else if (str1.equals("dk"))  
{
this.key = paramStringTokenizer.nextToken();
}
else if (str1.equals("win"))  
{
this.tmp00 = paramStringTokenizer.nextToken();
this.tmp01 = paramStringTokenizer.nextToken();
this.tmp02 = Integer.parseInt(paramStringTokenizer.nextToken());
switch (this.tmp02)
{
case 0:
this.tmp02 = -1;
if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 20); break;
case 1:
this.tmp02 = 1;
if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 2); break;
case 2:
this.tmp02 = 2;
if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 1); break;
case 3:
this.tmp02 = 0;
if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 0); break;
case 50:
this.tmp02 = 0;
break;
case 51:
this.tmp02 = 2;
}

if (!WakeStars.appli) JOptionPane.showMessageDialog(null, "<html><div style=\"background:url(http://89.149.208.95/chat/img/winbg.gif) no-repeat;\">" + this.tmp01 + "</div></html>", this.tmp00, this.tmp02);  
}
else if (str1.equals("broadcast"))  
{
localObject1 = paramStringTokenizer.nextToken();
if (((String)localObject1).equals("-")) this.cf.textpanelLight.Z("°BB°_Durchsage: " + paramStringTokenizer.nextToken()); else  
this.cf.textpanelLight.Z("°BB°_Durchsage von " + (String)localObject1 + ": " + paramStringTokenizer.nextToken());  
}
else if ((str1.equals("echo")) || (str1.equals("system")))  
{
this.cf.textpanelLight.Z(paramStringTokenizer.nextToken());
}
else if (str1.equals("info"))  
{
if (this.cf != null)
{
this.cf.absenden.setText(paramStringTokenizer.nextToken());
this.cf.absenden.setEditable(false);
this.cf.absenden.setEnabled(false);
}
}
else if (str1.equals("frame"))  
{
new KF(this.source, paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.hasMoreTokens() ? paramStringTokenizer.nextToken() : "");  
}
else if (str1.equals("sync"))  
{
localObject1 = this.source.ht_dynframes.get(paramStringTokenizer.nextToken());
if (localObject1 != null)
{
((J)localObject1).Z(paramStringTokenizer.nextToken());
}
}
else
{
Object localObject3;
Object localObject4;
Object localObject5;
Object localObject6;
if (str1.equals("pub"))  
{
if ((this.cf != null) && 
(this.cf.channel.equals(paramStringTokenizer.nextToken())))
{
this.niick = paramStringTokenizer.nextToken();
this.amsg = paramStringTokenizer.nextToken();
localObject1 = this.amsg;
if ((this.amsg.indexOf("http://") != -1) && (this.amsg.indexOf("|http://") == -1) && (this.amsg.indexOf(">http://") == -1))  
{
int i = this.amsg.indexOf("http://");  
localObject3 = this.amsg.substring(0, i);
localObject4 = "";  
localObject5 = "";  
localObject6 = "";  
if (this.amsg.indexOf(" ", i) == -1)  
{
localObject6 = this.amsg.substring(this.amsg.indexOf("http://"));  
localObject4 = "°>" + (String)localObject6 + "|" + (String)localObject6 + "<°";  
}
else {
localObject6 = this.amsg.substring(this.amsg.indexOf("http://"), this.amsg.indexOf(" ", i));  
localObject4 = "°>" + (String)localObject6 + "|" + (String)localObject6 + "<°";  
localObject5 = this.amsg.substring(this.amsg.indexOf(" ", i));  
}

localObject1 = (String)localObject3 + (String)localObject4 + (String)localObject5;
}

this.cf.textpanelLight.Z("_°>_h" + WakeStars.addProtection(this.niick) + "|/w " + WakeStars.addProtection(this.niick) + "<°:_ " + (String)localObject1);  
}
}
else if (str1.equals("pubdo"))  
{
if ((this.cf != null) && 
(this.cf.channel.equals(paramStringTokenizer.nextToken())))
{
this.niick = paramStringTokenizer.nextToken();
this.cf.textpanelLight.Z("_°>_h" + this.niick + "|/w " + this.niick + "<°_ " + paramStringTokenizer.nextToken());  
}
}
else if (str1.equals("channellist"))  
{
this.source.myChannel = this.source.channelDisplay.getSelectedIndex();
this.source.channelDisplay.removeAll();
ChatFrame.cChannels.removeAll();

System.out.println("Got channels");  
while (paramStringTokenizer.hasMoreTokens())
{
localObject1 = paramStringTokenizer.nextToken();

this.source.chl.addRoom((String)localObject1);
ChatFrame.cChannels.addItem((String)localObject1);
}
this.source.channelDisplay.select(this.source.myChannel);
this.source.channelDisplay2.setText("Treffpunkt");  
}
else if (str1.equals("destroy"))  
{
this.cf.dispose();
this.connection.close();
if (paramStringTokenizer.hasMoreTokens())
errmsg(paramStringTokenizer.nextToken());
else
errmsg("Du wurdest rausgeworfen!");  
destroy();
}
else if (str1.equals("frm"))  
{
new RTFv2(paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), false, this);
}
else if (str1.equals("url"))  
{
this.source.chatURL(paramStringTokenizer.nextToken());
}
else if (str1.equals("channel"))  
{
localObject1 = paramStringTokenizer.nextToken();
Object localObject2;
if (((String)localObject1).equals("bgc"))  
{
localObject2 = paramStringTokenizer.nextToken();
}
else if (((String)localObject1).equals("bgc"))  
{
if (this.cf != null)
{
if (paramStringTokenizer.nextToken().equals(this.cf.channel))
{
localObject2 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
this.cf.bgc = new Color(Integer.parseInt(((StringTokenizer)localObject2).nextToken()), Integer.parseInt(((StringTokenizer)localObject2).nextToken()), Integer.parseInt(((StringTokenizer)localObject2).nextToken()));
this.cf.invalidate();
this.cf.repaint();
}
}
}
else if (((String)localObject1).equals("new"))  
{
localObject2 = paramStringTokenizer.nextToken();
localObject3 = new Hashtable();
while (!((String)localObject2).equals("-"))  
{
((Hashtable)localObject3).put(localObject2, new Button(paramStringTokenizer.nextToken()));
localObject2 = paramStringTokenizer.nextToken();
}

if (this.cf == null)
{
this.cf = new ChatFrame(this, paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken().equals("T"), (Hashtable)localObject3, paramStringTokenizer.hasMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0, paramStringTokenizer.hasMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0);  
}
else {
this.cf.changeChannel(paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken().equals("T"), (Hashtable)localObject3);  
this.cf.absenden.setEnabled(true);
this.cf.absenden.setEditable(true);
this.cf.absenden.setText("");  
}

}
else if (((String)localObject1).equals("msg"))  
{
if ((this.cf != null) && 
(this.cf.channel.equals(paramStringTokenizer.nextToken())))
this.cf.textpanelLight.Z(paramStringTokenizer.nextToken());
}
else if (((String)localObject1).equals("bgm"))  
{
WakeStars.AUDIOURL = paramStringTokenizer.nextToken();
}
else if (((String)localObject1).equals("user"))  
{
localObject2 = paramStringTokenizer.nextToken();
localObject3 = paramStringTokenizer.nextToken();
if ((this.cf != null) && 
(((String)localObject3).equals(this.cf.channel)))
{
if (((String)localObject2).equals("icons"))  
{
localObject4 = paramStringTokenizer.nextToken();
((Vector)this.uL.vusericons.elementAt(this.uL.vusers.indexOf(localObject4))).removeAllElements();
while (paramStringTokenizer.hasMoreTokens())
{
((Vector)this.uL.vusericons.elementAt(this.uL.vusers.indexOf(localObject4))).add(this.source.img(paramStringTokenizer.nextToken()));
}
this.uL.repaint();
}
else if (((String)localObject2).equals("in"))  
{
localObject4 = paramStringTokenizer.nextToken();
localObject5 = new StringBuffer();

this.cf.textpanelLight.Z("°R°>> " + (String)localObject4 + " eilt herbei.");  
localObject6 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
}
else if (((String)localObject2).equals("out"))  
{
localObject4 = paramStringTokenizer.nextToken();
localObject5 = new StringBuffer();
this.cf.textpanelLight.Z("°R°>> " + (String)localObject4 + " hat den Raum verlassen.");  
this.uL.removeUser((String)localObject4);
if (((String)localObject4).equals(this.cf.nickName))
this.cf.dispose();
}
else if (((String)localObject2).equals("all"))  
{
this.uL.vusers.removeAllElements();
this.uL.vusercolors.removeAllElements();
this.uL.vusericons.removeAllElements();
localObject4 = new StringBuffer();

localObject6 = "";  
String str2 = "";  
while (paramStringTokenizer.hasMoreTokens()) {
if (this.cf == null)
continue;
localObject6 = paramStringTokenizer.nextToken();
if (((String)localObject6).equals("-")) {  
continue;
}
Vector localVector = new Vector();
localObject5 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
str2 = paramStringTokenizer.nextToken();
while (!str2.equals("-"))  
{
localVector.add(this.source.img(str2));
str2 = paramStringTokenizer.nextToken();
}
this.uL.addUser((String)localObject6, new Color(Integer.parseInt(((StringTokenizer)localObject5).nextToken()), Integer.parseInt(((StringTokenizer)localObject5).nextToken()), Integer.parseInt(((StringTokenizer)localObject5).nextToken())), localVector);
}

this.uL.repaint();
}
}
}
}
else if (str1.equals("cc")) {  
WakeStars.allImages = new Hashtable();
}
else if (str1.equals("prv"))  
{
this.ppn = paramStringTokenizer.nextToken();
if (this.cf.getPrivateFrame(this.ppn) != null)
{
this.cf.getPrivateFrame(this.ppn).tp.Z("_°>_h" + this.ppn + "|/w " + this.ppn + "<°:_ " + paramStringTokenizer.nextToken());  
}
else if (this.cf != null) this.cf.textpanelLight.Z("_°RR>_h" + this.ppn + "|/w " + this.ppn + "<° (privat):_°r° " + paramStringTokenizer.nextToken());  

}
else if (str1.equals("prvs"))  
{
this.ppn = paramStringTokenizer.nextToken();
if (this.cf.getPrivateFrame(this.ppn) != null)
{
this.cf.getPrivateFrame(this.ppn).tp.Z("_°>_h" + this.cf.nickName + "|/w " + this.cf.nickName + "<°:_°r° " + paramStringTokenizer.nextToken());  
}
else if (this.cf != null)
this.cf.textpanelLight.Z("°RR°_Du (privat an " + this.ppn + "):_°r° " + paramStringTokenizer.nextToken());  
}
else if (str1.equals("snd"))  
{
if (WakeStars.AUDIOPLAYER != null)
WakeStars.AUDIOPLAYER.STOP();
WakeStars.AUDIOPLAYER = new Audio(paramStringTokenizer.nextToken(), true);
}
}
}
} catch (Exception localException) {
}
}

private void conFail() {
if (!this.conFailed)
{
this.conFailed = true;
if (WakeStars.appli) WakeStars.openMsgWin("Keine Verbindung zum Server...", "Es konnte keine Verbindung zum Server hergestellt werden. Moeglicherweise wird ein Update vorgenommen. Bitte pruefen Sie auch Ihre Internetverbindung. ", 0);   
}
}

public void connectServer()
{
try
{
this.source.enterButton.setLabel("Verbinden ...");  
this.connection = new Socket();
InetSocketAddress localInetSocketAddress = new InetSocketAddress("89-149-241-72.internetserviceteam.com", this.source.port);  
this.connection.connect(localInetSocketAddress, 3000);
this.outStream = this.connection.getOutputStream();
this.outDataStream = new DataOutputStream(this.outStream);
this.inStream = this.connection.getInputStream();
this.inDataStream = new DataInputStream(this.inStream);
this.connection.setSoTimeout(0);
this.con = true;
this.conFailed = false;
this.source.enterButton.setLabel("Eintreten");  
this.outStream.write("WakeStars ChatKlient\r\n".getBytes());  
try {
send("" + this.source.getDocumentBase()); } catch (Exception localException2) {  
send("");  
}
}
catch (SocketTimeoutException localSocketTimeoutException) {
errmsg("Keine Verbindung zum Server!");  
conFail();
try { Thread.sleep(20000L); } catch (Exception localException3) {
}connectServer();
}
catch (SocketException localSocketException)
{
errmsg("Unerwarteter Fehler beim Verbinden zum Server");  
conFail();
try { Thread.sleep(20000L); } catch (Exception localException4) {
}connectServer();
}
catch (EOFException localEOFException)
{
errmsg("Die Verbindung wurde beendet.");  
try { Thread.sleep(20000L); } catch (Exception localException5) {
}connectServer();
}
catch (IOException localIOException)
{
errmsg("");  
System.out.println(">" + localIOException);  
try { Thread.sleep(20000L); } catch (Exception localException6) {
}connectServer();
}
catch (Exception localException1) {
this.source.enterButton.setLabel("FEHLER");  
}
}

public boolean send(String paramString)
{
try {
this.outDataStream.writeUTF(paramString);
this.outDataStream.flush();
this.ciOut.flush(); } catch (Exception localException) {
return false;
}return true;
}

public void F(ConnectServer paramConnectServer, String paramString1, String paramString2, int paramInt1, int paramInt2, boolean paramBoolean)
{
new Win(paramConnectServer.source, paramString1, paramString2, paramInt1, paramInt2, paramBoolean);
}

public void closeConnection()
{
try {
this.connection.close();
}
catch (IOException localIOException)
{
}
}
}
Member: maretz
maretz Jan 03, 2011 at 18:25:45 (UTC)
Goto Top
Moin,

ich versuch es ja gern nochmal im guten. Du hast ein Problem. Du gibst hier 608 Zeilen Quellcode an uns - unkommentiert, undokumentiert. Und du machst dir nicht mal die Mühe da ein wenig mit Einrücken zu arbeiten. Was ist denn jetzt für dich besser zu lesen?
public static void main(String args) {
for (int i=0;i<10;i++) {
System.out.println("test");  
if(i<9) {
System.out.println("ka");  
if(i<8) {
System.out.println("kk");  
}
}
System.out.println("ff");  
}
}

ODER

public static void main(String args) {
  for (int i=0;i<10;i++) {
    System.out.println("test");  
    if(i<9) {
      System.out.println("ka");  
      if(i<8) {
        System.out.println("kk");  
      }
    }
    System.out.println("ff");  
  }
}

Jetzt denk drüber nach - und dann formatiere bitte deinen Code. DANN sind die Leute auch gerne bereit den durchzugucken. Aber wenn du dir keine Mühe gibst - dann wird sich hier auch keiner Mühe geben wollen....
Member: Snowboarder1994
Snowboarder1994 Jan 03, 2011 at 19:36:56 (UTC)
Goto Top
Ok. Also hier nochmal alles als richtig formulierten Code.
Zeile 577 bis 580 ist das, was am Login Fehler anzeigt dort steht auch "FEHLER": http://wakestars.onpw.de/fehler1.png

Warum das Fehler anzeigt weiß ich nicht. Screen habe ich beigelegt.

Habe das Problem, das es einfach nicht startet. Ich komme bis zum Login des Chats und dann steht auf dem Button, wo normal steht "Einloggen", das man in den Chat eintreten kann "Fehler". In der Datei ConectServer, befindet sich das drin, was das verursacht, das es Fehler anzeigt. (Auszug des Codes unten)

Webseite zur Demo: http://wakestars.onpw.de

Zeile 545 sollte es sein bzw. Eintreten sollte dran stehen das ich rein komme. Weitere Fehlermeldungen sind 553 560 567 d.h. es zeigt mir den Fehler an, was er aber unter Fehler will weiß ich leider nicht, was dort der Fehler ist.
Hier nochmal die 3 Zeilen 577-580:

}
catch (Exception localException1) {
this.source.enterButton.setLabel("FEHLER");
}


import java.awt.Button;
import java.awt.Choice;
import java.awt.Color;
import java.awt.TextField;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.security.Key;
import java.util.Hashtable;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

class ConnectServer extends Thread
{
WakeStars source;
Socket connection;
InputStream inStream;
DataInputStream inDataStream;
OutputStream outStream;
DataOutputStream outDataStream;
String message;
ChatFrame cf;
boolean con;
String key;
String ppn = "";  
String amsg = "";  
Key secretKey;
Cipher desCipherDe;
Cipher desCipherEn;
CipherInputStream ciIn;
CipherOutputStream ciOut;
boolean crypted;
String tmp00;
String tmp01;
int tmp02;
Userliste uL;
Long lastMsg = Long.valueOf(System.currentTimeMillis());
private boolean conFailed = false;

String niick = "";  

ConnectServer(WakeStars paramWakeStars)
{
this.source = paramWakeStars;
this.con = false;
this.crypted = false;
start();
connectServer();
}

public int getPasswd(String paramString) {
return Wakestars.getCode(WakeStars.getMD5(paramString), this.key);
}

public boolean fileTransfer(String paramString)
{
try
{
int i = 0;
FileInputStream localFileInputStream = new FileInputStream("I:\\" + paramString);  
byte arrayOfByte = new byte[100];
int j = 0;
send("" + paramString + "" + new File(new StringBuilder().append("I:\\").append(paramString).toString()).length());  
while (true)
{
j = localFileInputStream.read(arrayOfByte);
if (j == -1)
{
break;
}
this.outStream.write(arrayOfByte, 0, j);
}
}
catch (Exception localException) {
localException.printStackTrace();
return false;
}
return true;
}

public boolean fileTransfer(File paramFile)
{
try
{
int i = 0;
FileInputStream localFileInputStream = new FileInputStream(paramFile);
byte arrayOfByte = new byte[100];
int j = 0;
send("" + paramFile.getName() + "" + paramFile.length());  
while (true)
{
j = localFileInputStream.read(arrayOfByte);
if (j == -1)
{
break;
}
this.outStream.write(arrayOfByte, 0, j);
}
}
catch (Exception localException) {
localException.printStackTrace();
return false;
}
return true;
}

private void errmsg(String paramString) {
if (this.cf != null)
{
this.cf.absenden.setText(paramString);
this.cf.absenden.setEditable(false);
this.cf.absenden.setEnabled(false);
}
}

public static String linkSafe(String paramString) {
if ((paramString.indexOf('"') >= 0) || (paramString.indexOf('<') >= 0) || (paramString.indexOf('>') >= 0) || (paramString.indexOf('\\') >= 0) || (paramString.indexOf('|') >= 0))  
{
int i = paramString.length();
StringBuffer localStringBuffer = new StringBuffer(i + 3);
for (int j = 0; j < i; j++)
{
char c = paramString.charAt(j);
switch (c)
{
case '"':  
case '<':  
case '>':  
case '\\':  
case '|':  
localStringBuffer.append('\\');  
}

localStringBuffer.append(c);
}

return localStringBuffer.toString();
}

return paramString;
}

public void run()
{
StringTokenizer localStringTokenizer = null;
while (true)
{
this.message = "-";  
while (!this.con)
try {
Thread.sleep(500L);
} catch (Exception localException1) {
}
try {
while (this.message.equals("-")) {  
try {
Thread.sleep(20L); } catch (Exception localException2) {
}this.message = (this.inDataStream.readUTF() + "");  
}
localStringTokenizer = new StringTokenizer(this.message, "");  
act(localStringTokenizer);
}
catch (IOException localIOException)
{
errmsg("Verbindung zum Server wurde unterbrochen..");  
try { Thread.sleep(2000L); } catch (Exception localException4) {
}connectServer();
}
catch (NoSuchElementException localNoSuchElementException)
{
localNoSuchElementException.printStackTrace();
}
catch (Exception localException3)
{
localException3.printStackTrace();
}
}
}

private void act(StringTokenizer paramStringTokenizer)
{
String str1 = paramStringTokenizer.nextToken();
try {
if (str1.equals("x"))  
{
if (this.uL != null)
{
this.uL.setContext(paramStringTokenizer.nextToken().equals("T"));  
}
}
else
{
Object localObject1;
if (str1.equals("filetransfer"))  
{
localObject1 = new JFileChooser();
ExampleFileFilter localExampleFileFilter = new ExampleFileFilter();
localExampleFileFilter.addExtension("jpg");  
localExampleFileFilter.addExtension("jpeg");  
localExampleFileFilter.setDescription("Nur JPEG");  
((JFileChooser)localObject1).setFileFilter(localExampleFileFilter);
int j = ((JFileChooser)localObject1).showOpenDialog(null);
if (j == 0) {
fileTransfer(((JFileChooser)localObject1).getSelectedFile());
}
}
else if (str1.equals("dk"))  
{
this.key = paramStringTokenizer.nextToken();
}
else if (str1.equals("win"))  
{
this.tmp00 = paramStringTokenizer.nextToken();
this.tmp01 = paramStringTokenizer.nextToken();
this.tmp02 = Integer.parseInt(paramStringTokenizer.nextToken());
switch (this.tmp02)
{
case 0:
this.tmp02 = -1;
if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 20); break;
case 1:
this.tmp02 = 1;
if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 2); break;
case 2:
this.tmp02 = 2;
if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 1); break;
case 3:
this.tmp02 = 0;
if (!WakeStars.appli) break; WakeStars.openMsgWin(this.tmp00, this.tmp01, 0); break;
case 50:
this.tmp02 = 0;
break;
case 51:
this.tmp02 = 2;
}

if (!WakeStars.appli) JOptionPane.showMessageDialog(null, "<html><div style=\"background:url(http://89.149.208.95/chat/img/winbg.gif) no-repeat;\">" + this.tmp01 + "</div></html>", this.tmp00, this.tmp02);  
}
else if (str1.equals("broadcast"))  
{
localObject1 = paramStringTokenizer.nextToken();
if (((String)localObject1).equals("-")) this.cf.textpanelLight.Z("°BB°_Durchsage: " + paramStringTokenizer.nextToken()); else  
this.cf.textpanelLight.Z("°BB°_Durchsage von " + (String)localObject1 + ": " + paramStringTokenizer.nextToken());  
}
else if ((str1.equals("echo")) || (str1.equals("system")))  
{
this.cf.textpanelLight.Z(paramStringTokenizer.nextToken());
}
else if (str1.equals("info"))  
{
if (this.cf != null)
{
this.cf.absenden.setText(paramStringTokenizer.nextToken());
this.cf.absenden.setEditable(false);
this.cf.absenden.setEnabled(false);
}
}
else if (str1.equals("frame"))  
{
new KF(this.source, paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.hasMoreTokens() ? paramStringTokenizer.nextToken() : "");  
}
else if (str1.equals("sync"))  
{
localObject1 = this.source.ht_dynframes.get(paramStringTokenizer.nextToken());
if (localObject1 != null)
{
((J)localObject1).Z(paramStringTokenizer.nextToken());
}
}
else
{
Object localObject3;
Object localObject4;
Object localObject5;
Object localObject6;
if (str1.equals("pub"))  
{
if ((this.cf != null) && 
(this.cf.channel.equals(paramStringTokenizer.nextToken())))
{
this.niick = paramStringTokenizer.nextToken();
this.amsg = paramStringTokenizer.nextToken();
localObject1 = this.amsg;
if ((this.amsg.indexOf("http://") != -1) && (this.amsg.indexOf("|http://") == -1) && (this.amsg.indexOf(">http://") == -1))  
{
int i = this.amsg.indexOf("http://");  
localObject3 = this.amsg.substring(0, i);
localObject4 = "";  
localObject5 = "";  
localObject6 = "";  
if (this.amsg.indexOf(" ", i) == -1)  
{
localObject6 = this.amsg.substring(this.amsg.indexOf("http://"));  
localObject4 = "°>" + (String)localObject6 + "|" + (String)localObject6 + "<°";  
}
else {
localObject6 = this.amsg.substring(this.amsg.indexOf("http://"), this.amsg.indexOf(" ", i));  
localObject4 = "°>" + (String)localObject6 + "|" + (String)localObject6 + "<°";  
localObject5 = this.amsg.substring(this.amsg.indexOf(" ", i));  
}

localObject1 = (String)localObject3 + (String)localObject4 + (String)localObject5;
}

this.cf.textpanelLight.Z("_°>_h" + WakeStars.addProtection(this.niick) + "|/w " + WakeStars.addProtection(this.niick) + "<°:_ " + (String)localObject1);  
}
}
else if (str1.equals("pubdo"))  
{
if ((this.cf != null) && 
(this.cf.channel.equals(paramStringTokenizer.nextToken())))
{
this.niick = paramStringTokenizer.nextToken();
this.cf.textpanelLight.Z("_°>_h" + this.niick + "|/w " + this.niick + "<°_ " + paramStringTokenizer.nextToken());  
}
}
else if (str1.equals("channellist"))  
{
this.source.myChannel = this.source.channelDisplay.getSelectedIndex();
this.source.channelDisplay.removeAll();
ChatFrame.cChannels.removeAll();

System.out.println("Got channels");  
while (paramStringTokenizer.hasMoreTokens())
{
localObject1 = paramStringTokenizer.nextToken();

this.source.chl.addRoom((String)localObject1);
ChatFrame.cChannels.addItem((String)localObject1);
}
this.source.channelDisplay.select(this.source.myChannel);
this.source.channelDisplay2.setText("Treffpunkt");  
}
else if (str1.equals("destroy"))  
{
this.cf.dispose();
this.connection.close();
if (paramStringTokenizer.hasMoreTokens())
errmsg(paramStringTokenizer.nextToken());
else
errmsg("Du wurdest rausgeworfen!");  
destroy();
}
else if (str1.equals("frm"))  
{
new RTFv2(paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), false, this);
}
else if (str1.equals("url"))  
{
this.source.chatURL(paramStringTokenizer.nextToken());
}
else if (str1.equals("channel"))  
{
localObject1 = paramStringTokenizer.nextToken();
Object localObject2;
if (((String)localObject1).equals("bgc"))  
{
localObject2 = paramStringTokenizer.nextToken();
}
else if (((String)localObject1).equals("bgc"))  
{
if (this.cf != null)
{
if (paramStringTokenizer.nextToken().equals(this.cf.channel))
{
localObject2 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
this.cf.bgc = new Color(Integer.parseInt(((StringTokenizer)localObject2).nextToken()), Integer.parseInt(((StringTokenizer)localObject2).nextToken()), Integer.parseInt(((StringTokenizer)localObject2).nextToken()));
this.cf.invalidate();
this.cf.repaint();
}
}
}
else if (((String)localObject1).equals("new"))  
{
localObject2 = paramStringTokenizer.nextToken();
localObject3 = new Hashtable();
while (!((String)localObject2).equals("-"))  
{
((Hashtable)localObject3).put(localObject2, new Button(paramStringTokenizer.nextToken()));
localObject2 = paramStringTokenizer.nextToken();
}

if (this.cf == null)
{
this.cf = new ChatFrame(this, paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken().equals("T"), (Hashtable)localObject3, paramStringTokenizer.hasMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0, paramStringTokenizer.hasMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0);  
}
else {
this.cf.changeChannel(paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken().equals("T"), (Hashtable)localObject3);  
this.cf.absenden.setEnabled(true);
this.cf.absenden.setEditable(true);
this.cf.absenden.setText("");  
}

}
else if (((String)localObject1).equals("msg"))  
{
if ((this.cf != null) && 
(this.cf.channel.equals(paramStringTokenizer.nextToken())))
this.cf.textpanelLight.Z(paramStringTokenizer.nextToken());
}
else if (((String)localObject1).equals("bgm"))  
{
WakeStars.AUDIOURL = paramStringTokenizer.nextToken();
}
else if (((String)localObject1).equals("user"))  
{
localObject2 = paramStringTokenizer.nextToken();
localObject3 = paramStringTokenizer.nextToken();
if ((this.cf != null) && 
(((String)localObject3).equals(this.cf.channel)))
{
if (((String)localObject2).equals("icons"))  
{
localObject4 = paramStringTokenizer.nextToken();
((Vector)this.uL.vusericons.elementAt(this.uL.vusers.indexOf(localObject4))).removeAllElements();
while (paramStringTokenizer.hasMoreTokens())
{
((Vector)this.uL.vusericons.elementAt(this.uL.vusers.indexOf(localObject4))).add(this.source.img(paramStringTokenizer.nextToken()));
}
this.uL.repaint();
}
else if (((String)localObject2).equals("in"))  
{
localObject4 = paramStringTokenizer.nextToken();
localObject5 = new StringBuffer();

this.cf.textpanelLight.Z("°R°>> " + (String)localObject4 + " eilt herbei.");  
localObject6 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
}
else if (((String)localObject2).equals("out"))  
{
localObject4 = paramStringTokenizer.nextToken();
localObject5 = new StringBuffer();
this.cf.textpanelLight.Z("°R°>> " + (String)localObject4 + " hat den Raum verlassen.");  
this.uL.removeUser((String)localObject4);
if (((String)localObject4).equals(this.cf.nickName))
this.cf.dispose();
}
else if (((String)localObject2).equals("all"))  
{
this.uL.vusers.removeAllElements();
this.uL.vusercolors.removeAllElements();
this.uL.vusericons.removeAllElements();
localObject4 = new StringBuffer();

localObject6 = "";  
String str2 = "";  
while (paramStringTokenizer.hasMoreTokens()) {
if (this.cf == null)
continue;
localObject6 = paramStringTokenizer.nextToken();
if (((String)localObject6).equals("-")) {  
continue;
}
Vector localVector = new Vector();
localObject5 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
str2 = paramStringTokenizer.nextToken();
while (!str2.equals("-"))  
{
localVector.add(this.source.img(str2));
str2 = paramStringTokenizer.nextToken();
}
this.uL.addUser((String)localObject6, new Color(Integer.parseInt(((StringTokenizer)localObject5).nextToken()), Integer.parseInt(((StringTokenizer)localObject5).nextToken()), Integer.parseInt(((StringTokenizer)localObject5).nextToken())), localVector);
}

this.uL.repaint();
}
}
}
}
else if (str1.equals("cc")) {  
WakeStars.allImages = new Hashtable();
}
else if (str1.equals("prv"))  
{
this.ppn = paramStringTokenizer.nextToken();
if (this.cf.getPrivateFrame(this.ppn) != null)
{
this.cf.getPrivateFrame(this.ppn).tp.Z("_°>_h" + this.ppn + "|/w " + this.ppn + "<°:_ " + paramStringTokenizer.nextToken());  
}
else if (this.cf != null) this.cf.textpanelLight.Z("_°RR>_h" + this.ppn + "|/w " + this.ppn + "<° (privat):_°r° " + paramStringTokenizer.nextToken());  

}
else if (str1.equals("prvs"))  
{
this.ppn = paramStringTokenizer.nextToken();
if (this.cf.getPrivateFrame(this.ppn) != null)
{
this.cf.getPrivateFrame(this.ppn).tp.Z("_°>_h" + this.cf.nickName + "|/w " + this.cf.nickName + "<°:_°r° " + paramStringTokenizer.nextToken());  
}
else if (this.cf != null)
this.cf.textpanelLight.Z("°RR°_Du (privat an " + this.ppn + "):_°r° " + paramStringTokenizer.nextToken());  
}
else if (str1.equals("snd"))  
{
if (WakeStars.AUDIOPLAYER != null)
WakeStars.AUDIOPLAYER.STOP();
WakeStars.AUDIOPLAYER = new Audio(paramStringTokenizer.nextToken(), true);
}
}
}
} catch (Exception localException) {
}
}

private void conFail() {
if (!this.conFailed)
{
this.conFailed = true;
if (WakeStars.appli) WakeStars.openMsgWin("Keine Verbindung zum Server...", "Es konnte keine Verbindung zum Server hergestellt werden. Moeglicherweise wird ein Update vorgenommen. Bitte pruefen Sie auch Ihre Internetverbindung. ", 0);   
}
}

public void connectServer()
{
try
{
this.source.enterButton.setLabel("Verbinden ...");  
this.connection = new Socket();
InetSocketAddress localInetSocketAddress = new InetSocketAddress("89-149-241-72.internetserviceteam.com", this.source.port);  
this.connection.connect(localInetSocketAddress, 3000);
this.outStream = this.connection.getOutputStream();
this.outDataStream = new DataOutputStream(this.outStream);
this.inStream = this.connection.getInputStream();
this.inDataStream = new DataInputStream(this.inStream);
this.connection.setSoTimeout(0);
this.con = true;
this.conFailed = false;
this.source.enterButton.setLabel("Eintreten");  
this.outStream.write("WakeStars ChatKlient\r\n".getBytes());  
try {
send("" + this.source.getDocumentBase()); } catch (Exception localException2) {  
send("");  
}
}
catch (SocketTimeoutException localSocketTimeoutException) {
errmsg("Keine Verbindung zum Server!");  
conFail();
try { Thread.sleep(20000L); } catch (Exception localException3) {
}connectServer();
}
catch (SocketException localSocketException)
{
errmsg("Unerwarteter Fehler beim Verbinden zum Server");  
conFail();
try { Thread.sleep(20000L); } catch (Exception localException4) {
}connectServer();
}
catch (EOFException localEOFException)
{
errmsg("Die Verbindung wurde beendet.");  
try { Thread.sleep(20000L); } catch (Exception localException5) {
}connectServer();
}
catch (IOException localIOException)
{
errmsg("");  
System.out.println(">" + localIOException);  
try { Thread.sleep(20000L); } catch (Exception localException6) {
}connectServer();
}
catch (Exception localException1) {
this.source.enterButton.setLabel("FEHLER");  
}
}
public boolean send(String paramString)
{
try {
this.outDataStream.writeUTF(paramString);
this.outDataStream.flush();
this.ciOut.flush(); } catch (Exception localException) {
return false;
}return true;
}

public void F(ConnectServer paramConnectServer, String paramString1, String paramString2, int paramInt1, int paramInt2, boolean paramBoolean)
{
new Win(paramConnectServer.source, paramString1, paramString2, paramInt1, paramInt2, paramBoolean);
}

public void closeConnection()
{
try {
this.connection.close();
}
catch (IOException localIOException)
{
}
}
}
Member: maretz
maretz Jan 03, 2011 at 19:55:39 (UTC)
Goto Top
Moin,

}
catch (Exception localException1) {
this.source.enterButton.setLabel("FEHLER");  
}

Hier tritt ja nur die Fehlerbehandlung ein. D.h. etwas ist schief gegangen - und der geht in die localException (also die Fehlerbehandlung) rein. Mir ist es aber zu kompliziert bei deinem Code die ganzen Try-Catch-Blöcke zu verfolgen....

Generell: Du kannst ja mal versuchen das so zu machen:

this.sourche.enterButton.setLabel("Fehler: "+localException1.printStackTrace());

die komplette Fehlermeldung zu bekommen. (ich bin mir grad nicht sicher: printStackTrace oder printStacktrace ). Ggf. bringt dich das schonmal weiter - du siehst dann ggf. die genaue Zeile des Fehlers und die Fehlermeldung (NPE, ...)
Member: Snowboarder1994
Snowboarder1994 Jan 03, 2011 at 20:04:36 (UTC)
Goto Top
Verstehe gerade gar nichts mehr.

Soll ich meinen Code 577-580 durch diesen ersetzen? this.sourche.enterButton.setLabel("Fehler: "+localException1.printStackTrace());


Ich könnte mal die ganzen Dateien vom Applet irgendwo hochladen, dann kannst du mal alles anschauen.
Member: maretz
maretz Jan 03, 2011 at 20:16:50 (UTC)
Goto Top
}
catch (Exception localException1) {
this.source.enterButton.setLabel("FEHLER" + localException1.printStackTrace());  
}

Damit sollte das dann eine etwas ausführlichere Meldung geben.
Member: Biber
Biber Jan 03, 2011 at 20:25:34 (UTC)
Goto Top
Moin Schneebrettler,

maretz meint bestimmt:

.....
    catch (Exception localException1) {
      localException1.printStackTrace();
    }
...
..denn der Aufrufstack wird in dem lütten Enter-Knöppken wohl eher albern aussehen.

Aber unabhängig von der Nebelstocherei:
  • Wieso weisst du denn nicht mehr, welche Änderungen du gemacht hast zwischen letzter lauffähiger Version und dem jetzigen Gestrunkele?
  • Wieso gehst du du nicht einfach eine Version zurück?
  • wieso hörst du jetzt zum ersten Mal im Leben die Begriffe "Codeformatierung", "Debuggen", "Breakpoint setzen", wenn du es dir zutraust, in Java einen Chat zusammenzuschrubbeln?

Lag der Code Weihnachten unterm Baum und stand echt dein Name dran?

Kopfschüttelnd
Biber
Member: maretz
maretz Jan 03, 2011 at 20:41:28 (UTC)
Goto Top
Moin Biber,

generell wäre deine Lösung gut - ich gehe aber davon aus dass das Applet in nem Browser ausgeführt wird - und das Debug-Features eher unbekannt sind...

Ok, man könnte auch nen schönes neues Fenster erzeugen (DAS wäre ja richtig schön - dann weiss der Benutzer wenigstens was los is) - aber das wäre mir hier zuviel zu tippen und ggf. nur unnötig viele fehler...

Was mir aber grad einfällt: Wenn man das printstacktrace so wie du im browser ausführt - haut der das dann in das browser-window? DAS hab ich noch nie probiert....
Member: Snowboarder1994
Snowboarder1994 Jan 03, 2011 at 22:06:56 (UTC)
Goto Top
Ich versuche das mal zu ersetzen, in Class umwandeln und wieder hochladen, ob dies funktioniert, bzw. was angezeigt wird.

}
catch (Exception localException1) {
this.source.enterButton.setLabel("FEHLER" + localException1.printStackTrace());
}

Die Version lag 1 1/2 Jahre auf meinem alten Computer und ich weiß nicht mehr was ich damals geändert habe, da ich in der zwischen Zeit eine PHP Community betrieben habe. Jetzt muss ich die Fehler 1 nach dem anderen abarbeiten.
Member: MttKrb
MttKrb Jan 04, 2011 at 14:11:13 (UTC)
Goto Top
Hallo,
du solltest als allererstes den Code dokumentieren und Einrücken.
ich habe das Gefühl, dass du zur Zeit selber nicht weist was dieser genau macht.
Member: Snowboarder1994
Snowboarder1994 Jan 04, 2011 at 17:01:48 (UTC)
Goto Top
Ich möchte diesen Quelltext kompilieren, das aber irgendwie der kompiler nicht zulässt er gibt folgende Fehlermeldung:
Erklärung was was ist in diesem Code folgt gleich.

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\Markus>cd C:\

C:\>javac ConnectServer.java
ConnectServer.java:31: cannot find symbol
symbol  : class RTSystems
location: class ConnectServer
  RTSystems source;
  ^
ConnectServer.java:38: cannot find symbol
symbol  : class ChatFrame
location: class ConnectServer
  ChatFrame cf;
  ^
ConnectServer.java:52: cannot find symbol
symbol  : class Userliste
location: class ConnectServer
  Userliste uL;
  ^
ConnectServer.java:58: cannot find symbol
symbol  : class RTSystems
location: class ConnectServer
  ConnectServer(RTSystems paramRTSystems)
                ^
ConnectServer.java:68: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
    return RTSystems.getCode(RTSystems.getMD5(paramString), this.key);
                             ^
ConnectServer.java:68: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
    return RTSystems.getCode(RTSystems.getMD5(paramString), this.key);
           ^
ConnectServer.java:213: cannot find symbol
symbol  : class ExampleFileFilter
location: class ConnectServer
          ExampleFileFilter localExampleFileFilter = new ExampleFileFilter();
          ^
ConnectServer.java:213: cannot find symbol
symbol  : class ExampleFileFilter
location: class ConnectServer
          ExampleFileFilter localExampleFileFilter = new ExampleFileFilter();
                                                         ^
ConnectServer.java:236: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.t
mp01, 20); break;
                 ^
ConnectServer.java:236: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.t
mp01, 20); break;
                                         ^
ConnectServer.java:239: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.t
mp01, 2); break;
                 ^
ConnectServer.java:239: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.t
mp01, 2); break;
                                         ^
ConnectServer.java:242: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.t
mp01, 1); break;
                 ^
ConnectServer.java:242: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.t
mp01, 1); break;
                                         ^
ConnectServer.java:245: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.t
mp01, 0); break;
                 ^
ConnectServer.java:245: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.t
mp01, 0); break;
                                         ^
ConnectServer.java:253: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
          if (!RTSystems.appli) JOptionPane.showMessageDialog(null, "<html><div  
style=\"background:url(http://89.149.208.95/chat/img/winbg.gif) no-repeat;\">" +  
 this.tmp01 + "</div></html>", this.tmp00, this.tmp02);  
               ^
ConnectServer.java:276: cannot find symbol
symbol  : class KF
location: class ConnectServer
          new KF(this.source, paramStringTokenizer.nextToken(), paramStringToken
izer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.pa
rseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), para
mStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringToken
izer.hasMoreTokens() ? paramStringTokenizer.nextToken() : "");  
              ^
ConnectServer.java:283: cannot find symbol
symbol  : class J
location: class ConnectServer
            ((J)localObject1).Z(paramStringTokenizer.nextToken());
              ^
ConnectServer.java:321: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
              this.cf.textpanelLight.Z("_░>_h" + RTSystems.addProtection(this.ni  
ick) + "|/w " + RTSystems.addProtection(this.niick) + "<░:_ " + (String)localObj  
ect1);
                                                 ^
ConnectServer.java:321: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
              this.cf.textpanelLight.Z("_░>_h" + RTSystems.addProtection(this.ni  
ick) + "|/w " + RTSystems.addProtection(this.niick) + "<░:_ " + (String)localObj  
ect1);

                ^
ConnectServer.java:337: package ChatFrame does not exist
            ChatFrame.cChannels.removeAll();
                     ^
ConnectServer.java:345: package ChatFrame does not exist
              ChatFrame.cChannels.addItem((String)localObject1);
                       ^
ConnectServer.java:362: cannot find symbol
symbol  : class RTFv2
location: class ConnectServer
            new RTFv2(paramStringTokenizer.nextToken(), paramStringTokenizer.nex
tToken(), paramStringTokenizer.nextToken(), false, this);
                ^
ConnectServer.java:401: cannot find symbol
symbol  : class ChatFrame
location: class ConnectServer
                this.cf = new ChatFrame(this, paramStringTokenizer.nextToken(),
paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToke
n()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringToken
izer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStrin
gTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.n
extToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(),
paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringT
okenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"),  
Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextTok
en().equals("T"), (Hashtable)localObject3, paramStringTokenizer.hasMoreTokens()  
? Integer.parseInt(paramStringTokenizer.nextToken()) : 0, paramStringTokenizer.h
asMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0);
                              ^
ConnectServer.java:419: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
              RTSystems.AUDIOURL = paramStringTokenizer.nextToken();
              ^
ConnectServer.java:488: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            RTSystems.allImages = new Hashtable();
            ^
ConnectServer.java:512: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            if (RTSystems.AUDIOPLAYER != null)
                ^
ConnectServer.java:513: package RTSystems does not exist
              RTSystems.AUDIOPLAYER.STOP();
                       ^
ConnectServer.java:514: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
            RTSystems.AUDIOPLAYER = new Audio(paramStringTokenizer.nextToken(),
true);
            ^
ConnectServer.java:514: cannot find symbol
symbol  : class Audio
location: class ConnectServer
            RTSystems.AUDIOPLAYER = new Audio(paramStringTokenizer.nextToken(),
true);
                                        ^
ConnectServer.java:526: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
      if (RTSystems.appli) RTSystems.openMsgWin("Keine Verbindung zum Server..."  
, "Es konnte keine Verbindung zum Server hergestellt werden. Moeglicherweise wir  
d ein Update vorgenommen. Bitte pruefen Sie auch Ihre Internetverbindung. ", 0);  

          ^
ConnectServer.java:526: cannot find symbol
symbol  : variable RTSystems
location: class ConnectServer
      if (RTSystems.appli) RTSystems.openMsgWin("Keine Verbindung zum Server..."  
, "Es konnte keine Verbindung zum Server hergestellt werden. Moeglicherweise wir  
d ein Update vorgenommen. Bitte pruefen Sie auch Ihre Internetverbindung. ", 0);  

                           ^
ConnectServer.java:579: 'void' type not allowed here  
    this.source.enterButton.setLabel("FEHLER" + localException1.printStackTrace(  
));
                                     ^
ConnectServer.java:595: cannot find symbol
symbol  : class Win
location: class ConnectServer
    new Win(paramConnectServer.source, paramString1, paramString2, paramInt1, pa
ramInt2, paramBoolean);
        ^
Note: ConnectServer.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: ConnectServer.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
35 errors


import java.awt.Button;
import java.awt.Choice;
import java.awt.Color;
import java.awt.TextField;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.security.Key;
import java.util.Hashtable;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

class ConnectServer extends Thread
{
  RTSystems source;
  Socket connection;
  InputStream inStream;
  DataInputStream inDataStream;
  OutputStream outStream;
  DataOutputStream outDataStream;
  String message;
  ChatFrame cf;
  boolean con;
  String key;
  String ppn = "";  
  String amsg = "";  
  Key secretKey;
  Cipher desCipherDe;
  Cipher desCipherEn;
  CipherInputStream ciIn;
  CipherOutputStream ciOut;
  boolean crypted;
  String tmp00;
  String tmp01;
  int tmp02;
  Userliste uL;
  Long lastMsg = Long.valueOf(System.currentTimeMillis());
  private boolean conFailed = false;

  String niick = "";  

  ConnectServer(RTSystems paramRTSystems)
  {
    this.source = paramRTSystems;
    this.con = false;
    this.crypted = false;
    start();
    connectServer();
  }

  public int getPasswd(String paramString) {
    return RTSystems.getCode(RTSystems.getMD5(paramString), this.key);
  }

  public boolean fileTransfer(String paramString)
  {
    try
    {
      int i = 0;
      FileInputStream localFileInputStream = new FileInputStream("I:\\" + paramString);  
      byte arrayOfByte = new byte[100];
      int j = 0;
      send("" + paramString + "" + new File(new StringBuilder().append("I:\\").append(paramString).toString()).length());  
      while (true)
      {
        j = localFileInputStream.read(arrayOfByte);
        if (j == -1)
        {
          break;
        }
        this.outStream.write(arrayOfByte, 0, j);
      }
    }
    catch (Exception localException) {
      localException.printStackTrace();
      return false;
    }
    return true;
  }

  public boolean fileTransfer(File paramFile)
  {
    try
    {
      int i = 0;
      FileInputStream localFileInputStream = new FileInputStream(paramFile);
      byte arrayOfByte = new byte[100];
      int j = 0;
      send("" + paramFile.getName() + "" + paramFile.length());  
      while (true)
      {
        j = localFileInputStream.read(arrayOfByte);
        if (j == -1)
        {
          break;
        }
        this.outStream.write(arrayOfByte, 0, j);
      }
    }
    catch (Exception localException) {
      localException.printStackTrace();
      return false;
    }
    return true;
  }

  private void errmsg(String paramString) {
    if (this.cf != null)
    {
      this.cf.absenden.setText(paramString);
      this.cf.absenden.setEditable(false);
      this.cf.absenden.setEnabled(false);
    }
  }

  public static String linkSafe(String paramString) {
    if ((paramString.indexOf('"') >= 0) || (paramString.indexOf('<') >= 0) || (paramString.indexOf('>') >= 0) || (paramString.indexOf('\\') >= 0) || (paramString.indexOf('|') >= 0))  
    {
      int i = paramString.length();
      StringBuffer localStringBuffer = new StringBuffer(i + 3);
      for (int j = 0; j < i; j++)
      {
        char c = paramString.charAt(j);
        switch (c)
        {
        case '"':  
        case '<':  
        case '>':  
        case '\\':  
        case '|':  
          localStringBuffer.append('\\');  
        }

        localStringBuffer.append(c);
      }

      return localStringBuffer.toString();
    }

    return paramString;
  }

  public void run()
  {
    StringTokenizer localStringTokenizer = null;
    while (true)
    {
      this.message = "-";  
      while (!this.con)
        try {
          Thread.sleep(500L);
        } catch (Exception localException1) {
        }
      try {
        while (this.message.equals("-")) {  
          try {
            Thread.sleep(20L); } catch (Exception localException2) {
          }this.message = (this.inDataStream.readUTF() + "");  
        }
        localStringTokenizer = new StringTokenizer(this.message, "");  
        act(localStringTokenizer);
      }
      catch (IOException localIOException)
      {
        errmsg("Verbindung zum Server wurde unterbrochen..");  
        try { Thread.sleep(2000L); } catch (Exception localException4) {
        }connectServer();
      }
      catch (NoSuchElementException localNoSuchElementException)
      {
        localNoSuchElementException.printStackTrace();
      }
      catch (Exception localException3)
      {
        localException3.printStackTrace();
      }
    }
  }

  private void act(StringTokenizer paramStringTokenizer)
  {
    String str1 = paramStringTokenizer.nextToken();
    try {
      if (str1.equals("x"))  
      {
        if (this.uL != null)
        {
          this.uL.setContext(paramStringTokenizer.nextToken().equals("T"));  
        }
      }
      else
      {
        Object localObject1;
        if (str1.equals("filetransfer"))  
        {
          localObject1 = new JFileChooser();
          ExampleFileFilter localExampleFileFilter = new ExampleFileFilter();
          localExampleFileFilter.addExtension("jpg");  
          localExampleFileFilter.addExtension("jpeg");  
          localExampleFileFilter.setDescription("Nur JPEG");  
          ((JFileChooser)localObject1).setFileFilter(localExampleFileFilter);
          int j = ((JFileChooser)localObject1).showOpenDialog(null);
          if (j == 0) {
            fileTransfer(((JFileChooser)localObject1).getSelectedFile());
          }
        }
        else if (str1.equals("dk"))  
        {
          this.key = paramStringTokenizer.nextToken();
        }
        else if (str1.equals("win"))  
        {
          this.tmp00 = paramStringTokenizer.nextToken();
          this.tmp01 = paramStringTokenizer.nextToken();
          this.tmp02 = Integer.parseInt(paramStringTokenizer.nextToken());
          switch (this.tmp02)
          {
          case 0:
            this.tmp02 = -1;
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.tmp01, 20); break;
          case 1:
            this.tmp02 = 1;
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.tmp01, 2); break;
          case 2:
            this.tmp02 = 2;
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.tmp01, 1); break;
          case 3:
            this.tmp02 = 0;
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.tmp01, 0); break;
          case 50:
            this.tmp02 = 0;
            break;
          case 51:
            this.tmp02 = 2;
          }

          if (!RTSystems.appli) JOptionPane.showMessageDialog(null, "<html><div style=\"background:url(http://89.149.208.95/chat/img/winbg.gif) no-repeat;\">" + this.tmp01 + "</div></html>", this.tmp00, this.tmp02);  
        }
        else if (str1.equals("broadcast"))  
        {
          localObject1 = paramStringTokenizer.nextToken();
          if (((String)localObject1).equals("-")) this.cf.textpanelLight.Z("°BB°_Durchsage: " + paramStringTokenizer.nextToken()); else  
            this.cf.textpanelLight.Z("°BB°_Durchsage von " + (String)localObject1 + ": " + paramStringTokenizer.nextToken());  
        }
        else if ((str1.equals("echo")) || (str1.equals("system")))  
        {
          this.cf.textpanelLight.Z(paramStringTokenizer.nextToken());
        }
        else if (str1.equals("info"))  
        {
          if (this.cf != null)
          {
            this.cf.absenden.setText(paramStringTokenizer.nextToken());
            this.cf.absenden.setEditable(false);
            this.cf.absenden.setEnabled(false);
          }
        }
        else if (str1.equals("frame"))  
        {
          new KF(this.source, paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.hasMoreTokens() ? paramStringTokenizer.nextToken() : "");  
        }
        else if (str1.equals("sync"))  
        {
          localObject1 = this.source.ht_dynframes.get(paramStringTokenizer.nextToken());
          if (localObject1 != null)
          {
            ((J)localObject1).Z(paramStringTokenizer.nextToken());
          }
        }
        else
        {
          Object localObject3;
          Object localObject4;
          Object localObject5;
          Object localObject6;
          if (str1.equals("pub"))  
          {
            if ((this.cf != null) && 
              (this.cf.channel.equals(paramStringTokenizer.nextToken())))
            {
              this.niick = paramStringTokenizer.nextToken();
              this.amsg = paramStringTokenizer.nextToken();
              localObject1 = this.amsg;
              if ((this.amsg.indexOf("http://") != -1) && (this.amsg.indexOf("|http://") == -1) && (this.amsg.indexOf(">http://") == -1))  
              {
                int i = this.amsg.indexOf("http://");  
                localObject3 = this.amsg.substring(0, i);
                localObject4 = "";  
                localObject5 = "";  
                localObject6 = "";  
                if (this.amsg.indexOf(" ", i) == -1)  
                {
                  localObject6 = this.amsg.substring(this.amsg.indexOf("http://"));  
                  localObject4 = "°>" + (String)localObject6 + "|" + (String)localObject6 + "<°";  
                }
                else {
                  localObject6 = this.amsg.substring(this.amsg.indexOf("http://"), this.amsg.indexOf(" ", i));  
                  localObject4 = "°>" + (String)localObject6 + "|" + (String)localObject6 + "<°";  
                  localObject5 = this.amsg.substring(this.amsg.indexOf(" ", i));  
                }

                localObject1 = (String)localObject3 + (String)localObject4 + (String)localObject5;
              }

              this.cf.textpanelLight.Z("_°>_h" + RTSystems.addProtection(this.niick) + "|/w " + RTSystems.addProtection(this.niick) + "<°:_ " + (String)localObject1);  
            }
          }
          else if (str1.equals("pubdo"))  
          {
            if ((this.cf != null) && 
              (this.cf.channel.equals(paramStringTokenizer.nextToken())))
            {
              this.niick = paramStringTokenizer.nextToken();
              this.cf.textpanelLight.Z("_°>_h" + this.niick + "|/w " + this.niick + "<°_ " + paramStringTokenizer.nextToken());  
            }
          }
          else if (str1.equals("channellist"))  
          {
            this.source.myChannel = this.source.channelDisplay.getSelectedIndex();
            this.source.channelDisplay.removeAll();
            ChatFrame.cChannels.removeAll();

            System.out.println("Got channels");  
            while (paramStringTokenizer.hasMoreTokens())
            {
              localObject1 = paramStringTokenizer.nextToken();

              this.source.chl.addRoom((String)localObject1);
              ChatFrame.cChannels.addItem((String)localObject1);
            }
            this.source.channelDisplay.select(this.source.myChannel);
            this.source.channelDisplay2.setText("Treffpunkt");  
          }
          else if (str1.equals("destroy"))  
          {
            this.cf.dispose();
            this.connection.close();
            if (paramStringTokenizer.hasMoreTokens())
              errmsg(paramStringTokenizer.nextToken());
            else
              errmsg("Du wurdest rausgeworfen!");  
            destroy();
          }
          else if (str1.equals("frm"))  
          {
            new RTFv2(paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), false, this);
          }
          else if (str1.equals("url"))  
          {
            this.source.chatURL(paramStringTokenizer.nextToken());
          }
          else if (str1.equals("channel"))  
          {
            localObject1 = paramStringTokenizer.nextToken();
            Object localObject2;
            if (((String)localObject1).equals("bgc"))  
            {
              localObject2 = paramStringTokenizer.nextToken();
            }
            else if (((String)localObject1).equals("bgc"))  
            {
              if (this.cf != null)
              {
                if (paramStringTokenizer.nextToken().equals(this.cf.channel))
                {
                  localObject2 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
                  this.cf.bgc = new Color(Integer.parseInt(((StringTokenizer)localObject2).nextToken()), Integer.parseInt(((StringTokenizer)localObject2).nextToken()), Integer.parseInt(((StringTokenizer)localObject2).nextToken()));
                  this.cf.invalidate();
                  this.cf.repaint();
                }
              }
            }
            else if (((String)localObject1).equals("new"))  
            {
              localObject2 = paramStringTokenizer.nextToken();
              localObject3 = new Hashtable();
              while (!((String)localObject2).equals("-"))  
              {
                ((Hashtable)localObject3).put(localObject2, new Button(paramStringTokenizer.nextToken()));
                localObject2 = paramStringTokenizer.nextToken();
              }

              if (this.cf == null)
              {
                this.cf = new ChatFrame(this, paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken().equals("T"), (Hashtable)localObject3, paramStringTokenizer.hasMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0, paramStringTokenizer.hasMoreTokens() ? Integer.parseInt(paramStringTokenizer.nextToken()) : 0);  
              }
              else {
                this.cf.changeChannel(paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), Integer.parseInt(paramStringTokenizer.nextToken()), true, paramStringTokenizer.nextToken(), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken(), paramStringTokenizer.nextToken().equals("T"), paramStringTokenizer.nextToken().equals("T"), Integer.parseInt(paramStringTokenizer.nextToken()), paramStringTokenizer.nextToken().equals("T"), (Hashtable)localObject3);  
                this.cf.absenden.setEnabled(true);
                this.cf.absenden.setEditable(true);
                this.cf.absenden.setText("");  
              }

            }
            else if (((String)localObject1).equals("msg"))  
            {
              if ((this.cf != null) && 
                (this.cf.channel.equals(paramStringTokenizer.nextToken())))
                this.cf.textpanelLight.Z(paramStringTokenizer.nextToken());
            }
            else if (((String)localObject1).equals("bgm"))  
            {
              RTSystems.AUDIOURL = paramStringTokenizer.nextToken();
            }
            else if (((String)localObject1).equals("user"))  
            {
              localObject2 = paramStringTokenizer.nextToken();
              localObject3 = paramStringTokenizer.nextToken();
              if ((this.cf != null) && 
                (((String)localObject3).equals(this.cf.channel)))
              {
                if (((String)localObject2).equals("icons"))  
                {
                  localObject4 = paramStringTokenizer.nextToken();
                  ((Vector)this.uL.vusericons.elementAt(this.uL.vusers.indexOf(localObject4))).removeAllElements();
                  while (paramStringTokenizer.hasMoreTokens())
                  {
                    ((Vector)this.uL.vusericons.elementAt(this.uL.vusers.indexOf(localObject4))).add(this.source.img(paramStringTokenizer.nextToken()));
                  }
                  this.uL.repaint();
                }
                else if (((String)localObject2).equals("in"))  
                {
                  localObject4 = paramStringTokenizer.nextToken();
                  localObject5 = new StringBuffer();

                  this.cf.textpanelLight.Z("°R°>> " + (String)localObject4 + " eilt herbei.");  
                  localObject6 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
                }
                else if (((String)localObject2).equals("out"))  
                {
                  localObject4 = paramStringTokenizer.nextToken();
                  localObject5 = new StringBuffer();
                  this.cf.textpanelLight.Z("°R°>> " + (String)localObject4 + " hat den Raum verlassen.");  
                  this.uL.removeUser((String)localObject4);
                  if (((String)localObject4).equals(this.cf.nickName))
                    this.cf.dispose();
                }
                else if (((String)localObject2).equals("all"))  
                {
                  this.uL.vusers.removeAllElements();
                  this.uL.vusercolors.removeAllElements();
                  this.uL.vusericons.removeAllElements();
                  localObject4 = new StringBuffer();

                  localObject6 = "";  
                  String str2 = "";  
                  while (paramStringTokenizer.hasMoreTokens()) {
                    if (this.cf == null)
                      continue;
                    localObject6 = paramStringTokenizer.nextToken();
                    if (((String)localObject6).equals("-")) {  
                      continue;
                    }
                    Vector localVector = new Vector();
                    localObject5 = new StringTokenizer(paramStringTokenizer.nextToken(), ",");  
                    str2 = paramStringTokenizer.nextToken();
                    while (!str2.equals("-"))  
                    {
                      localVector.add(this.source.img(str2));
                      str2 = paramStringTokenizer.nextToken();
                    }
                    this.uL.addUser((String)localObject6, new Color(Integer.parseInt(((StringTokenizer)localObject5).nextToken()), Integer.parseInt(((StringTokenizer)localObject5).nextToken()), Integer.parseInt(((StringTokenizer)localObject5).nextToken())), localVector);
                  }

                  this.uL.repaint();
                }
              }
            }
          }
          else if (str1.equals("cc")) {  
            RTSystems.allImages = new Hashtable();
          }
          else if (str1.equals("prv"))  
          {
            this.ppn = paramStringTokenizer.nextToken();
            if (this.cf.getPrivateFrame(this.ppn) != null)
            {
              this.cf.getPrivateFrame(this.ppn).tp.Z("_°>_h" + this.ppn + "|/w " + this.ppn + "<°:_ " + paramStringTokenizer.nextToken());  
            }
            else if (this.cf != null) this.cf.textpanelLight.Z("_°RR>_h" + this.ppn + "|/w " + this.ppn + "<° (privat):_°r° " + paramStringTokenizer.nextToken());  

          }
          else if (str1.equals("prvs"))  
          {
            this.ppn = paramStringTokenizer.nextToken();
            if (this.cf.getPrivateFrame(this.ppn) != null)
            {
              this.cf.getPrivateFrame(this.ppn).tp.Z("_°>_h" + this.cf.nickName + "|/w " + this.cf.nickName + "<°:_°r° " + paramStringTokenizer.nextToken());  
            }
            else if (this.cf != null)
              this.cf.textpanelLight.Z("°RR°_Du (privat an " + this.ppn + "):_°r° " + paramStringTokenizer.nextToken());  
          }
          else if (str1.equals("snd"))  
          {
            if (RTSystems.AUDIOPLAYER != null)
              RTSystems.AUDIOPLAYER.STOP();
            RTSystems.AUDIOPLAYER = new Audio(paramStringTokenizer.nextToken(), true);
          }
        }
      }
    } catch (Exception localException) {
    }
  }

  private void conFail() {
    if (!this.conFailed)
    {
      this.conFailed = true;
      if (RTSystems.appli) RTSystems.openMsgWin("Keine Verbindung zum Server...", "Es konnte keine Verbindung zum Server hergestellt werden. Moeglicherweise wird ein Update vorgenommen. Bitte pruefen Sie auch Ihre Internetverbindung. ", 0);   
    }
  }

  public void connectServer()
  {
    try
    {
      this.source.enterButton.setLabel("Verbinden ...");  
      this.connection = new Socket();
      InetSocketAddress localInetSocketAddress = new InetSocketAddress("89-149-241-72.internetserviceteam.com", this.source.port);  
      this.connection.connect(localInetSocketAddress, 3000);
      this.outStream = this.connection.getOutputStream();
      this.outDataStream = new DataOutputStream(this.outStream);
      this.inStream = this.connection.getInputStream();
      this.inDataStream = new DataInputStream(this.inStream);
      this.connection.setSoTimeout(0);
      this.con = true;
      this.conFailed = false;
      this.source.enterButton.setLabel("Eintreten");  
      this.outStream.write("RTSystems ChatKlient\r\n".getBytes());  
      try {
        send("" + this.source.getDocumentBase()); } catch (Exception localException2) {  
        send("");  
      }
    }
    catch (SocketTimeoutException localSocketTimeoutException) {
      errmsg("Keine Verbindung zum Server!");  
      conFail();
      try { Thread.sleep(20000L); } catch (Exception localException3) {
      }connectServer();
    }
    catch (SocketException localSocketException)
    {
      errmsg("Unerwarteter Fehler beim Verbinden zum Server");  
      conFail();
      try { Thread.sleep(20000L); } catch (Exception localException4) {
      }connectServer();
    }
    catch (EOFException localEOFException)
    {
      errmsg("Die Verbindung wurde beendet.");  
      try { Thread.sleep(20000L); } catch (Exception localException5) {
      }connectServer();
    }
    catch (IOException localIOException)
    {
      errmsg("");  
      System.out.println(">" + localIOException);  
      try { Thread.sleep(20000L); } catch (Exception localException6) {
      }connectServer();
    } 
    catch (Exception localException1) { 
    this.source.enterButton.setLabel("FEHLER" + localException1.printStackTrace());   
  }
  }

  public boolean send(String paramString)
  {
    try {
      this.outDataStream.writeUTF(paramString);
      this.outDataStream.flush();
      this.ciOut.flush(); } catch (Exception localException) {
      return false;
    }return true;
  }

  public void F(ConnectServer paramConnectServer, String paramString1, String paramString2, int paramInt1, int paramInt2, boolean paramBoolean)
  {
    new Win(paramConnectServer.source, paramString1, paramString2, paramInt1, paramInt2, paramBoolean);
  }

  public void closeConnection()
  {
    try {
      this.connection.close();
    }
    catch (IOException localIOException)
    {
    }
  }
}

Zeile 181 ist das, was im Chat angezeigt wird, wenn die Verbindung unterbrochen wird.

Zeile 526 wird angezeigt wenn ein Update vorgenommen wird, das ist die Abfrage die ein Administrator im Chat eingeben kann, dann wird an dem Button, wo normalerweiße Login steht wo derzeit Fehler steht dieser Text angezeigt.

Zeile 534 wird angezeigt wenn man auf die Webseite kommt und der Chat bzw. der Login ist noch nicht richtig geladen, auch wird dies Verbinden angezeigt wenn man in den Chat eintritt bzw. dort verbindet er mit dem Server.

Wenn alles geladen ist, zeigt es Zeile 545 an. Wenn Fehlermeldungen aufgetaucht sind werden die Zeilen 560 567 553 oder 579 angezeigt. Was jedoch 579 bedeutet ist mir unklar, sowie auch die Zeilen 560 567 553

Zeile 450 ist diese, wenn jemand den Raum verlässt und 443 ist die Abfrage wenn jemand den Raum betritt.

--

Der restliche Text sind noch Abfragen zum Login, Dateien, Hintergründe und für das Applet selbst.


Hoffe ich konnte es gut erklären, bin nicht so gut in Erklärungen. Danke
Member: maretz
maretz Jan 04, 2011 at 17:24:09 (UTC)
Goto Top
C:\>javac ConnectServer.java 
ConnectServer.java:31: cannot find symbol 
symbol  : class RTSystems 
location: class ConnectServer 
RTSystems source; 
hast du denn die RTSystems.class in dem Ordner?

Und: Warum nimmst du dir nicht z.B. den Eclipse und baust damit? Das ist ne freie Java-IDE und macht dir solche sachen leichter... (meiner meinung nach!)
Member: Biber
Biber Jan 04, 2011 at 17:29:13 (UTC)
Goto Top
Zitat von @maretz:
hast du denn die RTSystems.class in dem Ordner?
Oder wenigstens im Classpath?
Auch ohne Eclipse - du musst doch zumindest eine ClassNotFound-Exception deuten können... was könnte dir denn diese Fehlermeldung sagen wollen???

Noch mehr kopfschüttelnd als gestern
Biber
Member: Snowboarder1994
Snowboarder1994 Jan 04, 2011 at 18:21:08 (UTC)
Goto Top
So, jetzt hat das mit dem compilieren geklappt.

Habe es nun wieder hochgeladen. Jetzt zeigt er an dem Button Fehler wo normal Eintreten stehen sollte diesen Fehler an:

Link: http://wakestars.onpw.de

Was bedeutet das, was ist da schief gegangen?
Member: maretz
maretz Jan 04, 2011 at 19:11:57 (UTC)
Goto Top
Moin,

mein Firefox zeigt leider nur nen großen schwarzen Kasten an... Also entweder ist es sozusagen das Memory-Leak (black-hole im Speicher....) - oder der Firefox behandelt da was anders (was ja möglich ist).

Kannst du nicht einfach z.B. Screenshots auch immer unter deinem Chat einbinden bei dem die Fehlermeldungen zu sehen sind (oder die Screenshots hier posten)? Würde es ggf. etwas leichter machen - zumal die Ladezeit der JVM nicht sooo prickelt auf nem kleinen Netbook is..

Und nochmal: Ich würde dir dringend empfehlen ne richige Java-IDE zu nehmen. Du machst dir das Leben leichter ;)

@Biber: Naja - nich soviel den Kopf schütteln face-smile. Ich habe ja selbst auch irgendwann mit Java angefangen - daher versuche ich das mit der simplen "alle classes in einem Ordner"-Version... Sonst hast du nen Classpath, nen schönes Lib/ext-Verzeichnis, möglicherweise noch ganz andere Verzeichnisse usw... DAS ist grad zu Anfang immer ein wenig übel ... Und grad als Anfänger (davon gehe ich hier mal aus - so 1994 für das Alter steht denke ich mal liegt das halbwegs nahe) möchte man ja erstmal alles so machen wie man es in foren liest. Frag aber mal im Forum: Was brauch ich um Java zu programmieren? Antwort: JDK und nen Editor... (Wenn man fragt: was brauche ich um KOMFORTABEL Java zu programmieren sieht die Antwort ja ganz anders aus ;) ).

Und solang ich sehe das sich der TO auch Mühe gibt finde ich persönlich das noch besser als einige andere Beiträge (die ja oftmals dann nur noch die Wände deiner Rundablage zieren dürfen... wobei einige selbst dafür eigentlich noch nicht den nötigen Nährwert hätten ;) )
Member: Snowboarder1994
Snowboarder1994 Jan 04, 2011 at 20:44:45 (UTC)
Goto Top
Moin,

so, habe jetzt mal einen Screenshot erstellt und hochgeladen:

http://wakestars.onpw.de/fehler2.png

Dies ist der Fehler.

gruß Markus
Member: Biber
Biber Jan 04, 2011 at 20:55:50 (UTC)
Goto Top
Moin Schneebrettler,

niemand möchte dir zumuten, die Fehlermeldung vielleicht von deinem Bildschirm abzuschreiben und von Hand wieder neu einzutippen in einen Forumskommentar.
Obwohl wir dann um Tage, wenn nicht Wochen schneller wären.

Was spricht denn dagegen, die Screenshots hier zu posten - der Link auf einen Screenshot/eine .png-Datei auf deinem Server ist doch ohnehin nur bis morgen oder so gültig.

Und selbst wenn morgen erst morgen sein sollte - ich kann schon heute nichts erkennen, weil meine Unternehmenspolicy sagt:

Your request to "wakestars.onpw.de" was denied because of its content categorization: "Parked Domain".

Grüße
Biber
Member: maretz
maretz Jan 04, 2011 at 21:38:13 (UTC)
Goto Top
Moin,

also dein Fehler liegt schonmal in diesem Block:
this.source.enterButton.setLabel(\"Verbinden ...\");  
      this.connection = new Socket();
      InetSocketAddress localInetSocketAddress = new InetSocketAddress(\"89-149-241-72.internetserviceteam.com\", this.source.port);  
      this.connection.connect(localInetSocketAddress, 3000);
      this.outStream = this.connection.getOutputStream();
      this.outDataStream = new DataOutputStream(this.outStream);
      this.inStream = this.connection.getInputStream();
      this.inDataStream = new DataInputStream(this.inStream);
      this.connection.setSoTimeout(0);
      this.con = true;
      this.conFailed = false;
      this.source.enterButton.setLabel(\"Eintreten\");  
      this.outStream.write(\"RTSystems ChatKlient\\r\\n\".getBytes());  

Ich würde jetzt wie folgt weitermachen: Hier mal ein paar Try-Catch-Blöcke spendieren und gucken wo genau er aussteigt....

Und nur nebenbei: Sollte jemals ein Informatik-Professor diesen Thread mit dir in Verbindung bringen dann würdest du jetzt schon durch jede Prüfung durchsemmeln....

 try {
        send(\"\" + this.source.getDocumentBase()); } catch (Exception localException2) {  
        send(\"\");  
      }

SOWAS schreib bitte ganz schnell um in folgendes:
 try {
        send(\"\" + this.source.getDocumentBase());   
} catch (Exception localException2) {
        send(\"\");  
}

Ich habe da jetzt genau EIN Return eingefügt - und schon sieht man auf den ersten Blick: Aha - diese Try-Catch gehört zusammen. Egal welchen Editor / welche IDE du nimmst - du musst idR. NICHT nach Zeilen bezahlen. Also befolge die einfache Grundregel: EINE Anweisung pro Zeile!

Dasselbe hier:
 catch (SocketTimeoutException localSocketTimeoutException) {
      errmsg(\"Keine Verbindung zum Server!\");  
      conFail();
      try { Thread.sleep(20000L); } catch (Exception localException3) {
      }connectServer();
    }

Deinen connectServer-Aufruf übersieht man recht einfach. Dein Try-Catch-Block zu erkennen ist auch was für Leute die morgen bei Fielmann ne neue Brille möchten! SO könnte dein Code auch aussehen:

 catch (SocketTimeoutException localSocketTimeoutException) {
      errmsg(\"Keine Verbindung zum Server!\");  
      conFail();

      try { 
          Thread.sleep(20000L); 
     } catch (Exception localException3) { 
// Warum du hier keine Fehlerbehandlung machst wird ein ewiges Geheimnis bleiben....
     }
     connectServer();
    }

Wieder nur ein paar Return eingefügt - und etwas eingerückt - und schwupps, der Code kann ja sogar lesbar sein!

Dann:
this.source.enterButton.setLabel(\"Verbinden ...\");  
      this.connection = new Socket();
      InetSocketAddress localInetSocketAddress = new InetSocketAddress(\"89-149-241-72.internetserviceteam.com\", this.source.port);  
      this.connection.connect(localInetSocketAddress, 3000);
      this.outStream = this.connection.getOutputStream();
      this.outDataStream = new DataOutputStream(this.outStream);
      this.inStream = this.connection.getInputStream();
      this.inDataStream = new DataInputStream(this.inStream);
      this.connection.setSoTimeout(0);
      this.con = true;
      this.conFailed = false;
      this.source.enterButton.setLabel(\"Eintreten\");  
      this.outStream.write(\"RTSystems ChatKlient\\r\\n\".getBytes());  

Java ist zwar aus einer Kaffeesorte abgeleitet - aber das heisst nicht das man ein Kaffeekränzen machen sollte. Ein Fan vieler Worte braucht man da nicht zu sein. \"this\" verwendest du idR. nur dann wenn du lokale und Klassenvariablen hast. DU hast in dieser Funktion aber keine Variable connection. Du hast auch kein \"outStream\" - du referenzierst immer die Klassenvariablen von
class ConnectServer extends Thread
{
  RTSystems source;
  Socket connection;
  InputStream inStream;
  DataInputStream inDataStream;
  OutputStream outStream;
  DataOutputStream outDataStream;
  String message;
  ChatFrame cf;
  boolean con;
  String key;
...
Da du hier in der Funktion aber keine \"lokale\" Variable outStream übergibst kannst du das \"this\" wegwerfen. Im gegensatz zum Return darfst du das wegwerfen - es macht den Code einfach besser lesbar!

Was jetzt noch dazu kommt (aber vermutlich nicht für diesen Fehler):
FileInputStream localFileInputStream = new FileInputStream(\"I:\\\\\" + paramString);  

Leider habe ich kein Laufwerk \"i\". Ich hab grad mal C und E. Und das auch nur weil ich grad unter Windows rumtobe - unter Linux hab ich nicht mal diese Laufwerke... Also: WAS zum Henker hat ein solcher Pfad in einem Betriebsystemunabhängigen Programm verloren? Das kann einfach nicht gut sein - und so wie ich auf der PNG deinen Browser einschätze könnte es sein das auch du kein Laufwerk I hast....

Nächster Punkt:
switch (c)
        {
        case \'\"\':  
        case \'<\':  
        case \'>\':  
        case \'\\\\\':  
        case \'|\':  
          localStringBuffer.append(\'\\\\\');  
        }

DAS ist nicht dein Ernst, oder? Das KANN einfach nicht dein Ernst sein - als ich das grad gesehen habe kam mir ehrlich gesagt das Frühstück wieder hoch... DAS VON LETZTER WOCHE! Also wenn du es schon Q&D machen möchtest:
if ((localStringBuffer.equals(\"<\") || (localStringBuffer.equals(\">\")....) localStringBuffer.append(\"\\\\\");  

Aber das mit einer Switch-Anweisung zu bauen die einfach nix enthält und nur wegen der fehlenden Break-Anweisung funktioniert - sorry, das is einfach nicht hinnehmbar!

Aber es geht noch weiter:
 Thread.sleep(500L);
Seid wann ist 500 ein LONG-Wert? Also selbst bei alten Sprachen mit 16-Bit-Integer ging das ganz grob von -65500 bis +65500 (Biber: Schlag mich jetzt nicht, ich will nicht nachgucken ;)). Da brauch ich kein Long für. Du schaffst dir aber ggf. dadurch selbst probleme - wenn du nämlich mal nen Vergleicher startest.

Nächster Punkt:
switch (this.tmp02)
          {
          case 0:
            this.tmp02 = -1;
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.tmp01, 20); break;
          case 1:
            this.tmp02 = 1;
            if (!RTSystems.appli) break; RTSystems.openMsgWin(this.tmp00, this.tmp01, 2); break;

Machen wir das im ersten Schritt mal schön:
switch (this.tmp02)  {
          case 0: {
                            this.tmp02 = -1;
                            if (!RTSystems.appli) {
                                                                         break; // Dieses Break dient auch nur dazu das es da ist, oder?
                            } else {
                                                                         RTSystems.openMsgWin(this.tmp00, this.tmp01, 20); 
                            }
                             break; 
          }
          case 1: { // Hier mal etwas umgeschrieben - es geht ja auch in schön....
                            this.tmp02 = 1;
                            if (RTSystems.appli) RTSystems.openMsgWin(this.tmp00, this.tmp01, 2); 
                            break;
           }

Im case1 habe ich einfach nur deine If-Anweisung umgedreht. Schon spare ich mir klammern, schon spare ich mir das 2te Break im Block - schon macht das ganze etwas mehr sinn beim Lesen... Ok, die Klammern kann man sich auch so sparen wenn nur EINE Anweisung hinter der IF bzw. im Else-Teil kommt. Aber grade als Anfänger solltest du die ruhig setzen - da ist dann deutlicher das du z.B. oben das zweite Break in jedem fall hättest....

An der Stelle mach ich jetzt erstmal feierabend... denn danach kommen localObject1-? -> ein hoch auf sprechende Variablenbezeichnungen...

Ehrlich gesagt: Ich würde überlegen - wenn du sagst du hast den Code vor 1,5 Jahren geschrieben dann wäre es ggf. gut (auch für die Übung) das ganze nochmal zu machen. Diesmal in schön und sauber, ein paar Kommentare was wo passiert können auch nicht schaden,... Denn da momentan noch durchzusehen ist recht schwer - und dauert recht lange. Und ich befürchte einfach mal das die anderen Klassen ja nicht viel besser aussehen werden, oder? Ganz nebenbei gibt es heute schöne Frameworks die dir da die Arbeit erleichtern (GWT, Spring,....) -> so das du heute z.T. deutlich bessere Optionen hättest... (wenn du es etwas oversized dimensionieren möchtest kannst du das theroetisch auch in die Google App-Engine packen -> ich glaube du kommst da mit den Resourcen locker aus die du hast....). Allerdings kostet das eben wirklich Zeit sich einzuarbeiten - aber dafür hast du am Ende nen funktionierendes Programm welches du auch warten kannst...
Member: Snowboarder1994
Snowboarder1994 Jan 05, 2011 at 16:48:49 (UTC)
Goto Top
Zitat von @maretz:
Moin,

also dein Fehler liegt schonmal in diesem Block:
> this.source.enterButton.setLabel(\"Verbinden ...\");  
>       this.connection = new Socket();
>       InetSocketAddress localInetSocketAddress = new InetSocketAddress(\"89-149-241-72.internetserviceteam.com\",  
> this.source.port);
>       this.connection.connect(localInetSocketAddress, 3000);
>       this.outStream = this.connection.getOutputStream();
>       this.outDataStream = new DataOutputStream(this.outStream);
>       this.inStream = this.connection.getInputStream();
>       this.inDataStream = new DataInputStream(this.inStream);
>       this.connection.setSoTimeout(0);
>       this.con = true;
>       this.conFailed = false;
>       this.source.enterButton.setLabel(\"Eintreten\");  
>       this.outStream.write(\"RTSystems ChatKlient\\r\\n\".getBytes());  
> 



Moin,

danke für deine Mühe, habe das mal alles überarbeitet. Wo liegt der Fehler in diesem Blog? An der falschen InetSocketAddress? Die anderen TextDateien sehen übersichtlicher aus als diese ;) zum Glück. Dann muss ich diese schon mal nicht bearbeiten.

InetSocketAddress localInetSocketAddress = new InetSocketAddress(\"89-149-241-72.internetserviceteam.com\",

Kann ich diese auch automatisch machen, das sie die Url automatisch holt und ich nicht immer ändern muss?

An dem Fehler hat sich leider nichts getan:
79c128d0c1998cb3491a7857a2e69f99


gruß Markus
Member: maretz
maretz Jan 05, 2011 at 20:00:44 (UTC)
Goto Top
Moin,

du kannst die Konfiguration z.B. über eine XML-Datei einlesen lassen. Dann sparst du dir das - nur ob du das hinbekommst kann ich nicht beurteilen... Es ist generell aber möglich und (meines Erachtens!) auch nicht sonderlich schwer...
Member: Snowboarder1994
Snowboarder1994 Jan 05, 2011 at 20:36:10 (UTC)
Goto Top
Ja werde ich schon hinbekommen. Jetzt kümmere ich mich erstmal um den Rest.

Wo liegt der Fehler in diesem Blog, so wie du oben beschrieben hast? Bzw. woran kann das liegen das diese Fehlermeldung immer noch ist? An dem Fehler wie auf http://wakestars.onpw.de/fehler2.png zu sehen ist, hat sich leider nichts getan.

this.source.enterButton.setLabel(\"Verbinden ...\");
      this.connection = new Socket();
      InetSocketAddress localInetSocketAddress = new InetSocketAddress(\"89-149-241-72.internetserviceteam.com\",
this.source.port);
      this.connection.connect(localInetSocketAddress, 3000);
      this.outStream = this.connection.getOutputStream();
      this.outDataStream = new DataOutputStream(this.outStream);
      this.inStream = this.connection.getInputStream();
      this.inDataStream = new DataInputStream(this.inStream);
      this.connection.setSoTimeout(0);
      this.con = true;
      this.conFailed = false;
      this.source.enterButton.setLabel(\"Eintreten\");
      this.outStream.write(\"RTSystems ChatKlient\\r\\n\".getBytes());
Member: maretz
maretz Jan 06, 2011 at 07:05:16 (UTC)
Goto Top
Moin,

ich warte mal bis du die punkte aus dem o.g. posting erledigt hast oder ne Begründung hast warum das nicht erfolgt...
Member: Snowboarder1994
Snowboarder1994 Jan 06, 2011 at 19:50:05 (UTC)
Goto Top
Moin, habe den Rest korrigiert, aber da wo du geschrieben hast, das sich in diesem Blog der Fehler findet steige ich aus, ich check nicht was da falsch sein sollte, außer die falsche URL was da eingetragen ist.

Um bessere Beschreibung des Fehlers kann ich doch folgendes machen:

this.source.enterButton.setLabel("FEHLER" + LocalException1.getStackTrace());

Diesen Code ersetzen in diesen oder funktioniert das nicht?

JOptionPane.showMessageDialog(null, "Fehler", LocalException1.getStackTrace() , JOptionPane.ERROR_MESSAGE);


In Zeile 5 könnte er auch liegen.

this.source.enterButton.setLabel(\"Verbinden ...\");   
      this.connection = new Socket(); 
      InetSocketAddress localInetSocketAddress = new InetSocketAddress(\"89-149-241-72.internetserviceteam.com\",   
this.source.port); 
      this.connection.connect(localInetSocketAddress, 3000); 
      this.outStream = this.connection.getOutputStream(); 
      this.outDataStream = new DataOutputStream(this.outStream); 
      this.inStream = this.connection.getInputStream(); 
      this.inDataStream = new DataInputStream(this.inStream); 
      this.connection.setSoTimeout(0); 
      this.con = true; 
      this.conFailed = false; 
      this.source.enterButton.setLabel(\"Eintreten\");   
      this.outStream.write(\"RTSystems ChatKlient\\r\\n\".getBytes());  


gruß Markus.