Syntax Error, insert "AssignmentOperator Expression&amp

  • Themenstarter Themenstarter Syntax
  • Beginndatum Beginndatum
Status
Nicht offen für weitere Antworten.
S

Syntax

Gast
Hallo,

Eclipse meldet mir bei folgendem Code: Syntax Error, insert "AssignmentOperator Expression" to complete Expression :


Code:
package Network;

import java.io.*;
import java.net.Socket;

// Referenced classes of package Network:
//            J, F, NetworkListener

public class Network
    implements Runnable
{

    public void disconnect()
    {
        try
        {
            connected = false;
            nl.connectionLost(this);
            outStream.close();
            is.close();
        }
        catch(Exception exception) { }
    }

    public void setVerbose(boolean flag)
    {
        verbose = flag;
    }

    public Network(NetworkListener networklistener)
    {
        code = new J();
        connected = false;
        verbose = true;
        f = new F();
        nl = networklistener;
        try
        {
            Socket socket = new Socket("h-213.61.5.150.host.de.colt.net", 2710);
            is = socket.getInputStream();
            outStream = socket.getOutputStream();
            (new Thread(this)).start();
            sendString("t\000V8.6\000 \0000", 1);
            connected = true;
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
            connected = false;
            networklistener.connectionLost(this);
        }
    }

    public void run()
    {
        while(connected) 
        {
            String s = f.I(destroy(is));
            nl.stringRecieved(this, s);
        }
    }

    private byte[] destroy(InputStream inputstream)
    {
        byte abyte1[];
        int i;
        for(i = 0; i > 0x19000;)
        {
            i = 0;
            byte abyte0[] = new byte[5];
            abyte0[0] = (byte)inputstream.read();
            if(abyte0[0] >= 0)
            {
                i = abyte0[0] + 1;
            } else
            {
                i = (abyte0[0] & 0x1f) + 1;
                int j = ((abyte0[0] & 0x60) >>> 5) + 1;
                int k = 1;
                while(k < j) 
                {
                    i += inputstream.read() << (k - 1) * 8 + 5;
                    k++;
                }
            }
        }

        abyte1 = new byte[i];
        for(; i > 0; i--)
            abyte1[abyte1.length - i] = (byte)inputstream.read();

        return abyte1;
[b]        Throwable throwable;
        throwable;[/b]
        connected = false;
        nl.connectionLost(this);
        return new byte[2];
    }

    public void sendString(String s, int i)
    {
        if(verbose)
            nl.stringSend(this, s);
        try
        {
            byte abyte0[] = code.I(s);
            byte abyte1[] = currentTimeMillis(abyte0.length);
            byte abyte2[] = new byte[abyte1.length + abyte0.length + i];
            System.arraycopy(abyte1, 0, abyte2, i, abyte1.length);
            System.arraycopy(abyte0, 0, abyte2, abyte1.length + i, abyte0.length);
            outStream.write(abyte2);
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
    }

    private byte[] currentTimeMillis(int i)
        throws IOException
    {
        if(i > 0x19000)
            throw new IOException((new StringBuilder()).append("Too long Msg: ").append(i).toString());
        byte abyte0[] = (byte[])null;
        if(--i >= 0)
            if(i < 128)
            {
                abyte0 = new byte[1];
                abyte0[0] = (byte)i;
            } else
            {
                byte byte0;
                for(byte0 = 0; 32 << (byte0 + 1) * 8 <= i; byte0++);
                abyte0 = new byte[byte0 + 2];
                abyte0[0] = (byte)(byte0++ << 5 | 0x80 | i & 0x1f);
                for(int j = 1; j < abyte0.length; j++)
                    abyte0[j] = (byte)(i >>> 8 * (j - 1) + 5);

            }
        return abyte0;
    }

    BufferedReader breader;
    OutputStream outStream;
    InputStream is;
    PrintWriter pwriter;
    J code;
    NetworkListener nl;
    public boolean connected;
    boolean verbose;
    F f;
}

[Edit by Beni: Codetags]
 
Was soll dieser "Befehl" (es ist ja eben keiner) überhaupt machen?
Zeile 94
Code:
throwable;

Jetzt macht er garnichts -> ersatzlos löschen.
 
Wenn ich ihn lösche, kommt:


Unhandled exception type IOException
Unhandled exception type IOException
Unhandled exception type IOException
Unreachable code
 
Wenn du von einem Stream liest/schreibst, benötigst du ein Exception-Handling.

Entweder sagt du der Methode, dass sie IOExceptions weiterreichen soll (public void methode(...) throws IOException{...}) oder du machst selbst einen try-catch Block um die gefährliche Stelle:
Code:
public byte[] methode(...){
  try{
    // Normaler und gefährlicher Code
    ...
    return ergebnis;
  }
  catch( IOException ex ){
    ex.printStackTrace();
    // Fehler verarbeiten
    ...
    return ergebnis;
  }
}
 
Status
Nicht offen für weitere Antworten.

Zurück
Oben