ClassNotFound again :-( Java 6 Extending Dialog Please help

R

Richard Maher

Hi,

[I'm floundering - please help]

Below is the short and simple code for my 4 classes: -

LogApp.java - Applet driver code
Tier3Socket.java - Sets up and authorizes communication with the server
Tier3Logon.java - Dialog box for Username/Password
*Tier3Welcome.java - Dialog box to display Last Login time/Login failures
etc
(Tier3Socket$Message.class) - Haven't sorted out main message passing yet
(Javascript)

(*) This appears to be the troublemaker.
[Java.lang.ClassNotFoundException:LogApp]

All sourcefiles have been Javac'd and all classes have been Jar'd. (Manifest
looks good)

If I remove any reference in LogApp to Tier3Welcome (and don't archive it)
everything is great! I get a dialog box, authorization either succeeds or
fails, and everything is peachy. So what am I, and Tier3Welcome, doing
wrong? All I want to do is (on successful authorization) pop-up a second box
that displays some verification details, and asks the user to click OK.

1) Can you only Extend Dialog once per (some Java unit of work) Interfaces?
2) Is it because I using the default package
3) Is it because I'm using the command line for JAR and am not JARing all
classes in the directory?
4) Typo?
5) Name and method scoping issues?

Cheers Richard Maher

PS. Once again, I am a newbie so appologies if it's simple. BTW Windows 2000

LogApp.java
===========

import java.applet.Applet;
import java.awt.*;
import java.net.*;
import java.io.IOException;

import java.util.Date;
import java.util.Properties;

public class LogApp extends Applet
{
String Username = "";
String Password = "";
Boolean Pass = false;
Tier3Socket Pipe;

public void init()
{
if (!Authorize())
{
try
{
getAppletContext().showDocument
(new URL (getCodeBase()+"accessdenied.html"),"_top");
}
catch (Exception e) {e.printStackTrace(); }
}
}

public boolean Authorize()
{
System.out.println("Step 1");
int Port = Integer.parseInt(getParameter("PORT"));
String Appl = getParameter("APPLICATION");
System.out.println("Step 2");
Pipe = new Tier3Socket(getCodeBase().getHost(),Port);
System.out.println("Step 3");

try {Pipe.open();} catch (Exception e) {return false;}
System.out.println("Step 4");

Object ParentFrame = getParent();
while ((ParentFrame != null) &&
!(ParentFrame instanceof Frame))
{
ParentFrame = ((Component)ParentFrame).getParent();
}

Frame Creds = (Frame)ParentFrame;

Tier3Logon Logon = new Tier3Logon(Creds);

requestFocus();

if (Logon.LogonAborted)
{
System.out.println("Logon Aborted");
}
else
{
Username = Logon.InUser.getText();
Password = Logon.InPass.getText();

Pass = true;
try {Pipe.handShake(Username, Password);}
catch (Exception e)
{
Pass = false;
e.printStackTrace();
System.out.println("Logon Failed");
}
}

if (Pass && Logon.Cb.getState())
{
// Tier3Welcome Welcome = new Tier3Welcome(Creds, Appl,
Pipe.t3IdBuf);
// requestFocus();
// Welcome.dispose();
}

Logon.dispose();

System.out.println("Step 5");
return Pass;
}

public void destroy() {
try
{Pipe.close();}
catch (IOException e)
{e.printStackTrace();}

super.destroy();
}

}

Tier3Socket.java
================

import java.io.BufferedOutputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io_OutputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.lang.System;


public class Tier3Socket
{
public static final
String HOSTCHARSET="ISO-8859-1";
public static final
String T3ID = "T3$";
public static final
int MAXAPPMSG=510;
public static final
int HDRSIZ=2;
public static final
int USERSIZ=40;
public static final
int T3IDBUFSIZ=48;
public static final
int CREDBUFSIZ=80;

public byte [] t3IdBuf;

private String host;
private int port;
private Socket t3Sock;
private BufferedInputStream in;
private BufferedOutputStream out;
private byte [] MsgHdr;
private byte [] OutUser;
private byte [] OutPwd;
private byte [] CredBuf;

private String inMsg;

public class Message
{
String type;
String message;
Message (String type , String message)
{
this.type = type;
this.message = message;
}
public String getMessage()
{
return message;
}
public String getType()
{
return type;
}

}
Tier3Socket (String host, int port)
{
this.host = host;
this.port = port;

MsgHdr = new byte[HDRSIZ];
t3IdBuf = new byte[T3IDBUFSIZ];
}

public void open() throws UnknownHostException, IOException
{
t3Sock = new Socket();

t3Sock.setKeepAlive(new Boolean(true));
t3Sock.setSoTimeout(new Integer(10000));
t3Sock.setTcpNoDelay(new Boolean(true));

t3Sock.connect(new InetSocketAddress(host,port), new Integer(3));

in = new BufferedInputStream (t3Sock.getInputStream() ,MAXAPPMSG);
out = new BufferedOutputStream (t3Sock.getOutputStream(),MAXAPPMSG);
}

public void handShake(String Username, String Password) throws IOException
{
CredBuf = new byte[CREDBUFSIZ];

OutUser = Username.getBytes(HOSTCHARSET);
System.arraycopy(OutUser, 0, CredBuf, 0, OutUser.length);

OutPwd = Password.getBytes(HOSTCHARSET);
System.arraycopy(OutPwd, 0, CredBuf, USERSIZ, OutPwd.length);

out.write(CredBuf, 0, CREDBUFSIZ);
out.flush();

if (in.read(t3IdBuf) < t3IdBuf.length)
{
System.out.println("Read < " + Integer.toString(t3IdBuf.length) + "
read");
throw new IOException();
}

inMsg = new String(t3IdBuf, 0, 3, HOSTCHARSET);

if (!inMsg.equals(T3ID))
{
throw new IOException();
}

}

public void close () throws IOException
{
if (t3Sock != null && !t3Sock.isClosed())
{
try {t3Sock.close();}
catch (Exception e)
{e.printStackTrace();}
}
}

public void sendMessage (String type , String message) throws IOException
{
byte [] msgtype = type.getBytes(HOSTCHARSET);
byte [] msg = message.getBytes(HOSTCHARSET);

out.write(msgtype);
out.write(msg);
out.flush();
}

public Message readMessage () throws IOException
{

if (in.read(MsgHdr, 0, HDRSIZ) < HDRSIZ)
{
throw new IOException();
}

String wholemsg = "Hello";
String type = wholemsg.substring(0,2);
String msg = wholemsg.substring(2);
return new Message (type , msg);
}

public void initEmployeeRead (String employee) throws IOException
{
sendMessage ("20" , employee);
}

public String readNextEmployee () throws IOException
{
Message msg = readMessage ();
if (msg.getType().equals("21"))
return msg.getMessage().trim();
return null;
}
}

Tier3Logon.java
===============

import java.awt.*;
import java.awt.event.*;

public class Tier3Logon extends Dialog
implements ActionListener
{
Label Headr = new Label("Server Authentication Required",Label.LEFT);
Label User = new Label("Username:", Label.RIGHT);
Label Pass = new Label("Password:", Label.RIGHT);

TextField InUser = new TextField(40);
TextField InPass = new TextField(40);

Button Okay = new Button("OK");
Button Cncl = new Button("Cancel");

Checkbox Cb = new Checkbox("Display logon confirmation",true);

boolean LogonAborted = false;

public Tier3Logon(Frame Dframe)
{
super(Dframe,"Tier3 Logon",true);

setBackground(Color.white);

Headr.setFont(new Font("Helvetica", Font.BOLD, 14));

InPass.setEchoChar('*');

Panel Top = new Panel();
Top.setLayout(new GridLayout(1, 2, 8, 2));
Top.add(Headr);
Top.add(Cb);
add("North", Top);

Panel pc = new Panel();
pc.setLayout(new GridLayout(2, 2, 8, 2));
pc.add(User);
pc.add(InUser);
pc.add(Pass);
pc.add(InPass);
add("Center", pc);

Okay.addActionListener(this);
Cncl.addActionListener(this);

Panel pb = new Panel();
pb.add(Okay);
pb.add(Cncl);
add("South", pb);

setBounds(50, 150, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == Okay)
{
setVisible(false);
}
else
{
LogonAborted = true;
setVisible(false);
}
}
}

Tier3Welcome.java
=================

import java.awt.*;
import java.awt.event.*;

public class Tier3Welcome extends Dialog
implements ActionListener
{
Button Okay = new Button("OK");
Label Label1 = new Label();

public Tier3Welcome(Frame Wframe, String AppName, byte[] t3IdBuf)
{
super(Wframe,"Tier3 Confirmation",true);

String Line1 = "Welcome to the " + AppName + " application via TIER3
V" +
Byte.toString(t3IdBuf[3]) + "." +
Byte.toString(t3IdBuf[4]) +
" on node " + new String(t3IdBuf, 5, 6);

Label1.setAlignment(Label.LEFT);
Label1.setText(Line1);
Label1.setFont(new Font("Helvetica", Font.BOLD, 14));

Panel top = new Panel();
top.setLayout(new GridLayout(2, 1, 0, 8));
top.add(Label1);

Okay.addActionListener(this);
top.add(Okay);

add("Center", top);

setBounds(50, 150, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == Okay)
setVisible(false);
}
}
 
N

none

Richard said:
Hi,

[I'm floundering - please help]

Below is the short and simple code for my 4 classes: -

LogApp.java - Applet driver code
Tier3Socket.java - Sets up and authorizes communication with the server
Tier3Logon.java - Dialog box for Username/Password
*Tier3Welcome.java - Dialog box to display Last Login time/Login failures
etc
(Tier3Socket$Message.class) - Haven't sorted out main message passing yet
(Javascript)

(*) This appears to be the troublemaker.
[Java.lang.ClassNotFoundException:LogApp]

All sourcefiles have been Javac'd and all classes have been Jar'd. (Manifest
looks good)

If I remove any reference in LogApp to Tier3Welcome (and don't archive it)
everything is great! I get a dialog box, authorization either succeeds or
fails, and everything is peachy. So what am I, and Tier3Welcome, doing
wrong? All I want to do is (on successful authorization) pop-up a second box
that displays some verification details, and asks the user to click OK.

1) Can you only Extend Dialog once per (some Java unit of work) Interfaces?
2) Is it because I using the default package
3) Is it because I'm using the command line for JAR and am not JARing all
classes in the directory?
4) Typo?
5) Name and method scoping issues?

Cheers Richard Maher

PS. Once again, I am a newbie so appologies if it's simple. BTW Windows 2000

LogApp.java
===========

import java.applet.Applet;
import java.awt.*;
import java.net.*;
import java.io.IOException;

import java.util.Date;
import java.util.Properties;

public class LogApp extends Applet
{
String Username = "";
String Password = "";
Boolean Pass = false;
Tier3Socket Pipe;

public void init()
{
if (!Authorize())
{
try
{
getAppletContext().showDocument
(new URL (getCodeBase()+"accessdenied.html"),"_top");
}
catch (Exception e) {e.printStackTrace(); }
}
}

public boolean Authorize()
{
System.out.println("Step 1");
int Port = Integer.parseInt(getParameter("PORT"));
String Appl = getParameter("APPLICATION");
System.out.println("Step 2");
Pipe = new Tier3Socket(getCodeBase().getHost(),Port);
System.out.println("Step 3");

try {Pipe.open();} catch (Exception e) {return false;}
System.out.println("Step 4");

Object ParentFrame = getParent();
while ((ParentFrame != null) &&
!(ParentFrame instanceof Frame))
{
ParentFrame = ((Component)ParentFrame).getParent();
}

Frame Creds = (Frame)ParentFrame;

Tier3Logon Logon = new Tier3Logon(Creds);

requestFocus();

if (Logon.LogonAborted)
{
System.out.println("Logon Aborted");
}
else
{
Username = Logon.InUser.getText();
Password = Logon.InPass.getText();

Pass = true;
try {Pipe.handShake(Username, Password);}
catch (Exception e)
{
Pass = false;
e.printStackTrace();
System.out.println("Logon Failed");
}
}

if (Pass && Logon.Cb.getState())
{
// Tier3Welcome Welcome = new Tier3Welcome(Creds, Appl,
Pipe.t3IdBuf);
// requestFocus();
// Welcome.dispose();
}

Logon.dispose();

System.out.println("Step 5");
return Pass;
}

public void destroy() {
try
{Pipe.close();}
catch (IOException e)
{e.printStackTrace();}

super.destroy();
}

}

Tier3Socket.java
================

import java.io.BufferedOutputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io_OutputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.lang.System;


public class Tier3Socket
{
public static final
String HOSTCHARSET="ISO-8859-1";
public static final
String T3ID = "T3$";
public static final
int MAXAPPMSG=510;
public static final
int HDRSIZ=2;
public static final
int USERSIZ=40;
public static final
int T3IDBUFSIZ=48;
public static final
int CREDBUFSIZ=80;

public byte [] t3IdBuf;

private String host;
private int port;
private Socket t3Sock;
private BufferedInputStream in;
private BufferedOutputStream out;
private byte [] MsgHdr;
private byte [] OutUser;
private byte [] OutPwd;
private byte [] CredBuf;

private String inMsg;

public class Message
{
String type;
String message;
Message (String type , String message)
{
this.type = type;
this.message = message;
}
public String getMessage()
{
return message;
}
public String getType()
{
return type;
}

}
Tier3Socket (String host, int port)
{
this.host = host;
this.port = port;

MsgHdr = new byte[HDRSIZ];
t3IdBuf = new byte[T3IDBUFSIZ];
}

public void open() throws UnknownHostException, IOException
{
t3Sock = new Socket();

t3Sock.setKeepAlive(new Boolean(true));
t3Sock.setSoTimeout(new Integer(10000));
t3Sock.setTcpNoDelay(new Boolean(true));

t3Sock.connect(new InetSocketAddress(host,port), new Integer(3));

in = new BufferedInputStream (t3Sock.getInputStream() ,MAXAPPMSG);
out = new BufferedOutputStream (t3Sock.getOutputStream(),MAXAPPMSG);
}

public void handShake(String Username, String Password) throws IOException
{
CredBuf = new byte[CREDBUFSIZ];

OutUser = Username.getBytes(HOSTCHARSET);
System.arraycopy(OutUser, 0, CredBuf, 0, OutUser.length);

OutPwd = Password.getBytes(HOSTCHARSET);
System.arraycopy(OutPwd, 0, CredBuf, USERSIZ, OutPwd.length);

out.write(CredBuf, 0, CREDBUFSIZ);
out.flush();

if (in.read(t3IdBuf) < t3IdBuf.length)
{
System.out.println("Read < " + Integer.toString(t3IdBuf.length) + "
read");
throw new IOException();
}

inMsg = new String(t3IdBuf, 0, 3, HOSTCHARSET);

if (!inMsg.equals(T3ID))
{
throw new IOException();
}

}

public void close () throws IOException
{
if (t3Sock != null && !t3Sock.isClosed())
{
try {t3Sock.close();}
catch (Exception e)
{e.printStackTrace();}
}
}

public void sendMessage (String type , String message) throws IOException
{
byte [] msgtype = type.getBytes(HOSTCHARSET);
byte [] msg = message.getBytes(HOSTCHARSET);

out.write(msgtype);
out.write(msg);
out.flush();
}

public Message readMessage () throws IOException
{

if (in.read(MsgHdr, 0, HDRSIZ) < HDRSIZ)
{
throw new IOException();
}

String wholemsg = "Hello";
String type = wholemsg.substring(0,2);
String msg = wholemsg.substring(2);
return new Message (type , msg);
}

public void initEmployeeRead (String employee) throws IOException
{
sendMessage ("20" , employee);
}

public String readNextEmployee () throws IOException
{
Message msg = readMessage ();
if (msg.getType().equals("21"))
return msg.getMessage().trim();
return null;
}
}

Tier3Logon.java
===============

import java.awt.*;
import java.awt.event.*;

public class Tier3Logon extends Dialog
implements ActionListener
{
Label Headr = new Label("Server Authentication Required",Label.LEFT);
Label User = new Label("Username:", Label.RIGHT);
Label Pass = new Label("Password:", Label.RIGHT);

TextField InUser = new TextField(40);
TextField InPass = new TextField(40);

Button Okay = new Button("OK");
Button Cncl = new Button("Cancel");

Checkbox Cb = new Checkbox("Display logon confirmation",true);

boolean LogonAborted = false;

public Tier3Logon(Frame Dframe)
{
super(Dframe,"Tier3 Logon",true);

setBackground(Color.white);

Headr.setFont(new Font("Helvetica", Font.BOLD, 14));

InPass.setEchoChar('*');

Panel Top = new Panel();
Top.setLayout(new GridLayout(1, 2, 8, 2));
Top.add(Headr);
Top.add(Cb);
add("North", Top);

Panel pc = new Panel();
pc.setLayout(new GridLayout(2, 2, 8, 2));
pc.add(User);
pc.add(InUser);
pc.add(Pass);
pc.add(InPass);
add("Center", pc);

Okay.addActionListener(this);
Cncl.addActionListener(this);

Panel pb = new Panel();
pb.add(Okay);
pb.add(Cncl);
add("South", pb);

setBounds(50, 150, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == Okay)
{
setVisible(false);
}
else
{
LogonAborted = true;
setVisible(false);
}
}
}

Tier3Welcome.java
=================

import java.awt.*;
import java.awt.event.*;

public class Tier3Welcome extends Dialog
implements ActionListener
{
Button Okay = new Button("OK");
Label Label1 = new Label();

public Tier3Welcome(Frame Wframe, String AppName, byte[] t3IdBuf)
{
super(Wframe,"Tier3 Confirmation",true);

String Line1 = "Welcome to the " + AppName + " application via TIER3
V" +
Byte.toString(t3IdBuf[3]) + "." +
Byte.toString(t3IdBuf[4]) +
" on node " + new String(t3IdBuf, 5, 6);

Label1.setAlignment(Label.LEFT);
Label1.setText(Line1);
Label1.setFont(new Font("Helvetica", Font.BOLD, 14));

Panel top = new Panel();
top.setLayout(new GridLayout(2, 1, 0, 8));
top.add(Label1);

Okay.addActionListener(this);
top.add(Okay);

add("Center", top);

setBounds(50, 150, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == Okay)
setVisible(false);
}
}
if all files are compiled and include in your jar file it might be a
typo in your html applet/object tag (maybe the jar or codebase
attribute?). Also if you are testing this in a browser it might be wise
to clear the classloader cache via the java console after you redeploy.
i can't remember the hotkey to do this but i think its 'x'.

Tim Terry
www.devisland.net
 
R

Richard Maher

none said:
Richard said:
Hi,

[I'm floundering - please help]

Below is the short and simple code for my 4 classes: -

LogApp.java - Applet driver code
Tier3Socket.java - Sets up and authorizes communication with the server
Tier3Logon.java - Dialog box for Username/Password
*Tier3Welcome.java - Dialog box to display Last Login time/Login failures
etc
(Tier3Socket$Message.class) - Haven't sorted out main message passing yet
(Javascript)

(*) This appears to be the troublemaker.
[Java.lang.ClassNotFoundException:LogApp]

All sourcefiles have been Javac'd and all classes have been Jar'd. (Manifest
looks good)

If I remove any reference in LogApp to Tier3Welcome (and don't archive it)
everything is great! I get a dialog box, authorization either succeeds or
fails, and everything is peachy. So what am I, and Tier3Welcome, doing
wrong? All I want to do is (on successful authorization) pop-up a second box
that displays some verification details, and asks the user to click OK.

1) Can you only Extend Dialog once per (some Java unit of work) Interfaces?
2) Is it because I using the default package
3) Is it because I'm using the command line for JAR and am not JARing all
classes in the directory?
4) Typo?
5) Name and method scoping issues?

Cheers Richard Maher

PS. Once again, I am a newbie so appologies if it's simple. BTW Windows 2000

LogApp.java
===========

import java.applet.Applet;
import java.awt.*;
import java.net.*;
import java.io.IOException;

import java.util.Date;
import java.util.Properties;

public class LogApp extends Applet
{
String Username = "";
String Password = "";
Boolean Pass = false;
Tier3Socket Pipe;

public void init()
{
if (!Authorize())
{
try
{
getAppletContext().showDocument
(new URL (getCodeBase()+"accessdenied.html"),"_top");
}
catch (Exception e) {e.printStackTrace(); }
}
}

public boolean Authorize()
{
System.out.println("Step 1");
int Port = Integer.parseInt(getParameter("PORT"));
String Appl = getParameter("APPLICATION");
System.out.println("Step 2");
Pipe = new Tier3Socket(getCodeBase().getHost(),Port);
System.out.println("Step 3");

try {Pipe.open();} catch (Exception e) {return false;}
System.out.println("Step 4");

Object ParentFrame = getParent();
while ((ParentFrame != null) &&
!(ParentFrame instanceof Frame))
{
ParentFrame = ((Component)ParentFrame).getParent();
}

Frame Creds = (Frame)ParentFrame;

Tier3Logon Logon = new Tier3Logon(Creds);

requestFocus();

if (Logon.LogonAborted)
{
System.out.println("Logon Aborted");
}
else
{
Username = Logon.InUser.getText();
Password = Logon.InPass.getText();

Pass = true;
try {Pipe.handShake(Username, Password);}
catch (Exception e)
{
Pass = false;
e.printStackTrace();
System.out.println("Logon Failed");
}
}

if (Pass && Logon.Cb.getState())
{
// Tier3Welcome Welcome = new Tier3Welcome(Creds, Appl,
Pipe.t3IdBuf);
// requestFocus();
// Welcome.dispose();
}

Logon.dispose();

System.out.println("Step 5");
return Pass;
}

public void destroy() {
try
{Pipe.close();}
catch (IOException e)
{e.printStackTrace();}

super.destroy();
}

}

Tier3Socket.java
================

import java.io.BufferedOutputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io_OutputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.lang.System;


public class Tier3Socket
{
public static final
String HOSTCHARSET="ISO-8859-1";
public static final
String T3ID = "T3$";
public static final
int MAXAPPMSG=510;
public static final
int HDRSIZ=2;
public static final
int USERSIZ=40;
public static final
int T3IDBUFSIZ=48;
public static final
int CREDBUFSIZ=80;

public byte [] t3IdBuf;

private String host;
private int port;
private Socket t3Sock;
private BufferedInputStream in;
private BufferedOutputStream out;
private byte [] MsgHdr;
private byte [] OutUser;
private byte [] OutPwd;
private byte [] CredBuf;

private String inMsg;

public class Message
{
String type;
String message;
Message (String type , String message)
{
this.type = type;
this.message = message;
}
public String getMessage()
{
return message;
}
public String getType()
{
return type;
}

}
Tier3Socket (String host, int port)
{
this.host = host;
this.port = port;

MsgHdr = new byte[HDRSIZ];
t3IdBuf = new byte[T3IDBUFSIZ];
}

public void open() throws UnknownHostException, IOException
{
t3Sock = new Socket();

t3Sock.setKeepAlive(new Boolean(true));
t3Sock.setSoTimeout(new Integer(10000));
t3Sock.setTcpNoDelay(new Boolean(true));

t3Sock.connect(new InetSocketAddress(host,port), new Integer(3));

in = new BufferedInputStream (t3Sock.getInputStream() ,MAXAPPMSG);
out = new BufferedOutputStream (t3Sock.getOutputStream(),MAXAPPMSG);
}

public void handShake(String Username, String Password) throws IOException
{
CredBuf = new byte[CREDBUFSIZ];

OutUser = Username.getBytes(HOSTCHARSET);
System.arraycopy(OutUser, 0, CredBuf, 0, OutUser.length);

OutPwd = Password.getBytes(HOSTCHARSET);
System.arraycopy(OutPwd, 0, CredBuf, USERSIZ, OutPwd.length);

out.write(CredBuf, 0, CREDBUFSIZ);
out.flush();

if (in.read(t3IdBuf) < t3IdBuf.length)
{
System.out.println("Read < " + Integer.toString(t3IdBuf.length) + "
read");
throw new IOException();
}

inMsg = new String(t3IdBuf, 0, 3, HOSTCHARSET);

if (!inMsg.equals(T3ID))
{
throw new IOException();
}

}

public void close () throws IOException
{
if (t3Sock != null && !t3Sock.isClosed())
{
try {t3Sock.close();}
catch (Exception e)
{e.printStackTrace();}
}
}

public void sendMessage (String type , String message) throws IOException
{
byte [] msgtype = type.getBytes(HOSTCHARSET);
byte [] msg = message.getBytes(HOSTCHARSET);

out.write(msgtype);
out.write(msg);
out.flush();
}

public Message readMessage () throws IOException
{

if (in.read(MsgHdr, 0, HDRSIZ) < HDRSIZ)
{
throw new IOException();
}

String wholemsg = "Hello";
String type = wholemsg.substring(0,2);
String msg = wholemsg.substring(2);
return new Message (type , msg);
}

public void initEmployeeRead (String employee) throws IOException
{
sendMessage ("20" , employee);
}

public String readNextEmployee () throws IOException
{
Message msg = readMessage ();
if (msg.getType().equals("21"))
return msg.getMessage().trim();
return null;
}
}

Tier3Logon.java
===============

import java.awt.*;
import java.awt.event.*;

public class Tier3Logon extends Dialog
implements ActionListener
{
Label Headr = new Label("Server Authentication Required",Label.LEFT);
Label User = new Label("Username:", Label.RIGHT);
Label Pass = new Label("Password:", Label.RIGHT);

TextField InUser = new TextField(40);
TextField InPass = new TextField(40);

Button Okay = new Button("OK");
Button Cncl = new Button("Cancel");

Checkbox Cb = new Checkbox("Display logon confirmation",true);

boolean LogonAborted = false;

public Tier3Logon(Frame Dframe)
{
super(Dframe,"Tier3 Logon",true);

setBackground(Color.white);

Headr.setFont(new Font("Helvetica", Font.BOLD, 14));

InPass.setEchoChar('*');

Panel Top = new Panel();
Top.setLayout(new GridLayout(1, 2, 8, 2));
Top.add(Headr);
Top.add(Cb);
add("North", Top);

Panel pc = new Panel();
pc.setLayout(new GridLayout(2, 2, 8, 2));
pc.add(User);
pc.add(InUser);
pc.add(Pass);
pc.add(InPass);
add("Center", pc);

Okay.addActionListener(this);
Cncl.addActionListener(this);

Panel pb = new Panel();
pb.add(Okay);
pb.add(Cncl);
add("South", pb);

setBounds(50, 150, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == Okay)
{
setVisible(false);
}
else
{
LogonAborted = true;
setVisible(false);
}
}
}

Tier3Welcome.java
=================

import java.awt.*;
import java.awt.event.*;

public class Tier3Welcome extends Dialog
implements ActionListener
{
Button Okay = new Button("OK");
Label Label1 = new Label();

public Tier3Welcome(Frame Wframe, String AppName, byte[] t3IdBuf)
{
super(Wframe,"Tier3 Confirmation",true);

String Line1 = "Welcome to the " + AppName + " application via TIER3
V" +
Byte.toString(t3IdBuf[3]) + "." +
Byte.toString(t3IdBuf[4]) +
" on node " + new String(t3IdBuf, 5, 6);

Label1.setAlignment(Label.LEFT);
Label1.setText(Line1);
Label1.setFont(new Font("Helvetica", Font.BOLD, 14));

Panel top = new Panel();
top.setLayout(new GridLayout(2, 1, 0, 8));
top.add(Label1);

Okay.addActionListener(this);
top.add(Okay);

add("Center", top);

setBounds(50, 150, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == Okay)
setVisible(false);
}
}
if all files are compiled and include in your jar file it might be a
typo in your html applet/object tag (maybe the jar or codebase
attribute?). Also if you are testing this in a browser it might be wise
to clear the classloader cache via the java console after you redeploy.
i can't remember the hotkey to do this but i think its 'x'.

Tim Terry
www.devisland.net

Hi Tim,

Thanks for the reply.

The point is that if I remove the Tier3Welcome class then everything works
as expected. Tier3Welcome is either somehow corrupting the JAR file or the
Applet activation. Maybe a "Linker" for Java would be worthwhile :) I'm
going to knock up a DoNothin class that doesn't extend dialog an see if that
works, and I'll also give the Appletviewer a guernsey and see what happens
there. But given my plebian mastery of the Java Language I had thought that
some simple schoolboy error would be sittin' up like a fly-shit in the sugar
bowl.

Tier3Welcome (above) is only about 40 lines long; any chance of having a
quick look at it (and probably Tier3Logon)?

A deplorable example of a procedural programmer trying to grapple with the
inherent beauty of an OO language? An ingnorance of constructors, super()
(and String equality comparisons) seldom exhibited outside of Java 1A? Or a
crappy language that should do a lot better at compile/link time error
detection than a loathesome runtime ClassNotFound :)

Regards Richard Maher

PS. "Welcome" a reserved word/method? My inability to come to terms with
lowercasing the first letter of my objects leading to ambiguity?
 
R

Richard Maher

Hi,

Here's a bit more information to (hopefully) narrow it down for soemone.

The *bogus* ClassNotFound error is triggered from Tier3Welcome.java after
the first attempted access of the "t3IdBuf" byte array in the following
command: -
String Line1 = "Welcome to the " + AppName + " application via TIER3 V" +
Byte.toString(t3IdBuf[3]) + "." + Byte.toString(t3IdBuf[4]) +
" on node " + new String(t3IdBuf, 5, 6);

Is what I am doing illegal? (And if so why don't I get a JAVAC error?)

I changed Tier3Socket.handshake() to return an array to local storage in
LogApp.class and passed that to the constructor for Tier3Welcome, but still
no joy.

I tried "myString = Byte.toString(t3IdBuf[3]) " outside of the Line1
contatanation and it still told me LogApp class not found :-(

In summary, this is what I'd hoped would happen: -

The init() method in the LogApp applet invokes the Tier3Socket.handshake()
method
The public byte array t3IdBuf is populated
LogApp passes Tier3Socket.t3IdBuf to Tier3Welcome for further scrutiny
A lovely pop-up window appears

Sounds pretty bloody straight-forward doesn't it?

Please, please, please - what am I doing wrong???

"Access/protection violation at line X" - Fantastic!
"Your inheritance is buggering your polymorphism" - I can fix that
"ClassNotFound LogApp " - You're havin' a laugh
"Unexpected eof on socket" - Now you're really taking the piss :-(

This is Java 1.SIX right?

Cheers Richard Maher

Richard Maher said:
Hi,

[I'm floundering - please help]

Below is the short and simple code for my 4 classes: -

LogApp.java - Applet driver code
Tier3Socket.java - Sets up and authorizes communication with the server
Tier3Logon.java - Dialog box for Username/Password
*Tier3Welcome.java - Dialog box to display Last Login time/Login failures
etc
(Tier3Socket$Message.class) - Haven't sorted out main message passing yet
(Javascript)

(*) This appears to be the troublemaker.
[Java.lang.ClassNotFoundException:LogApp]

All sourcefiles have been Javac'd and all classes have been Jar'd. (Manifest
looks good)

If I remove any reference in LogApp to Tier3Welcome (and don't archive it)
everything is great! I get a dialog box, authorization either succeeds or
fails, and everything is peachy. So what am I, and Tier3Welcome, doing
wrong? All I want to do is (on successful authorization) pop-up a second box
that displays some verification details, and asks the user to click OK.

1) Can you only Extend Dialog once per (some Java unit of work) Interfaces?
2) Is it because I using the default package
3) Is it because I'm using the command line for JAR and am not JARing all
classes in the directory?
4) Typo?
5) Name and method scoping issues?

Cheers Richard Maher

PS. Once again, I am a newbie so appologies if it's simple. BTW Windows 2000

LogApp.java
===========

import java.applet.Applet;
import java.awt.*;
import java.net.*;
import java.io.IOException;

import java.util.Date;
import java.util.Properties;

public class LogApp extends Applet
{
String Username = "";
String Password = "";
Boolean Pass = false;
Tier3Socket Pipe;

public void init()
{
if (!Authorize())
{
try
{
getAppletContext().showDocument
(new URL (getCodeBase()+"accessdenied.html"),"_top");
}
catch (Exception e) {e.printStackTrace(); }
}
}

public boolean Authorize()
{
System.out.println("Step 1");
int Port = Integer.parseInt(getParameter("PORT"));
String Appl = getParameter("APPLICATION");
System.out.println("Step 2");
Pipe = new Tier3Socket(getCodeBase().getHost(),Port);
System.out.println("Step 3");

try {Pipe.open();} catch (Exception e) {return false;}
System.out.println("Step 4");

Object ParentFrame = getParent();
while ((ParentFrame != null) &&
!(ParentFrame instanceof Frame))
{
ParentFrame = ((Component)ParentFrame).getParent();
}

Frame Creds = (Frame)ParentFrame;

Tier3Logon Logon = new Tier3Logon(Creds);

requestFocus();

if (Logon.LogonAborted)
{
System.out.println("Logon Aborted");
}
else
{
Username = Logon.InUser.getText();
Password = Logon.InPass.getText();

Pass = true;
try {Pipe.handShake(Username, Password);}
catch (Exception e)
{
Pass = false;
e.printStackTrace();
System.out.println("Logon Failed");
}
}

if (Pass && Logon.Cb.getState())
{
// Tier3Welcome Welcome = new Tier3Welcome(Creds, Appl,
Pipe.t3IdBuf);
// requestFocus();
// Welcome.dispose();
}

Logon.dispose();

System.out.println("Step 5");
return Pass;
}

public void destroy() {
try
{Pipe.close();}
catch (IOException e)
{e.printStackTrace();}

super.destroy();
}

}

Tier3Socket.java
================

import java.io.BufferedOutputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io_OutputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.lang.System;


public class Tier3Socket
{
public static final
String HOSTCHARSET="ISO-8859-1";
public static final
String T3ID = "T3$";
public static final
int MAXAPPMSG=510;
public static final
int HDRSIZ=2;
public static final
int USERSIZ=40;
public static final
int T3IDBUFSIZ=48;
public static final
int CREDBUFSIZ=80;

public byte [] t3IdBuf;

private String host;
private int port;
private Socket t3Sock;
private BufferedInputStream in;
private BufferedOutputStream out;
private byte [] MsgHdr;
private byte [] OutUser;
private byte [] OutPwd;
private byte [] CredBuf;

private String inMsg;

public class Message
{
String type;
String message;
Message (String type , String message)
{
this.type = type;
this.message = message;
}
public String getMessage()
{
return message;
}
public String getType()
{
return type;
}

}
Tier3Socket (String host, int port)
{
this.host = host;
this.port = port;

MsgHdr = new byte[HDRSIZ];
t3IdBuf = new byte[T3IDBUFSIZ];
}

public void open() throws UnknownHostException, IOException
{
t3Sock = new Socket();

t3Sock.setKeepAlive(new Boolean(true));
t3Sock.setSoTimeout(new Integer(10000));
t3Sock.setTcpNoDelay(new Boolean(true));

t3Sock.connect(new InetSocketAddress(host,port), new Integer(3));

in = new BufferedInputStream (t3Sock.getInputStream() ,MAXAPPMSG);
out = new BufferedOutputStream (t3Sock.getOutputStream(),MAXAPPMSG);
}

public void handShake(String Username, String Password) throws IOException
{
CredBuf = new byte[CREDBUFSIZ];

OutUser = Username.getBytes(HOSTCHARSET);
System.arraycopy(OutUser, 0, CredBuf, 0, OutUser.length);

OutPwd = Password.getBytes(HOSTCHARSET);
System.arraycopy(OutPwd, 0, CredBuf, USERSIZ, OutPwd.length);

out.write(CredBuf, 0, CREDBUFSIZ);
out.flush();

if (in.read(t3IdBuf) < t3IdBuf.length)
{
System.out.println("Read < " + Integer.toString(t3IdBuf.length) + "
read");
throw new IOException();
}

inMsg = new String(t3IdBuf, 0, 3, HOSTCHARSET);

if (!inMsg.equals(T3ID))
{
throw new IOException();
}

}

public void close () throws IOException
{
if (t3Sock != null && !t3Sock.isClosed())
{
try {t3Sock.close();}
catch (Exception e)
{e.printStackTrace();}
}
}

public void sendMessage (String type , String message) throws IOException
{
byte [] msgtype = type.getBytes(HOSTCHARSET);
byte [] msg = message.getBytes(HOSTCHARSET);

out.write(msgtype);
out.write(msg);
out.flush();
}

public Message readMessage () throws IOException
{

if (in.read(MsgHdr, 0, HDRSIZ) < HDRSIZ)
{
throw new IOException();
}

String wholemsg = "Hello";
String type = wholemsg.substring(0,2);
String msg = wholemsg.substring(2);
return new Message (type , msg);
}

public void initEmployeeRead (String employee) throws IOException
{
sendMessage ("20" , employee);
}

public String readNextEmployee () throws IOException
{
Message msg = readMessage ();
if (msg.getType().equals("21"))
return msg.getMessage().trim();
return null;
}
}

Tier3Logon.java
===============

import java.awt.*;
import java.awt.event.*;

public class Tier3Logon extends Dialog
implements ActionListener
{
Label Headr = new Label("Server Authentication Required",Label.LEFT);
Label User = new Label("Username:", Label.RIGHT);
Label Pass = new Label("Password:", Label.RIGHT);

TextField InUser = new TextField(40);
TextField InPass = new TextField(40);

Button Okay = new Button("OK");
Button Cncl = new Button("Cancel");

Checkbox Cb = new Checkbox("Display logon confirmation",true);

boolean LogonAborted = false;

public Tier3Logon(Frame Dframe)
{
super(Dframe,"Tier3 Logon",true);

setBackground(Color.white);

Headr.setFont(new Font("Helvetica", Font.BOLD, 14));

InPass.setEchoChar('*');

Panel Top = new Panel();
Top.setLayout(new GridLayout(1, 2, 8, 2));
Top.add(Headr);
Top.add(Cb);
add("North", Top);

Panel pc = new Panel();
pc.setLayout(new GridLayout(2, 2, 8, 2));
pc.add(User);
pc.add(InUser);
pc.add(Pass);
pc.add(InPass);
add("Center", pc);

Okay.addActionListener(this);
Cncl.addActionListener(this);

Panel pb = new Panel();
pb.add(Okay);
pb.add(Cncl);
add("South", pb);

setBounds(50, 150, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == Okay)
{
setVisible(false);
}
else
{
LogonAborted = true;
setVisible(false);
}
}
}

Tier3Welcome.java
=================

import java.awt.*;
import java.awt.event.*;

public class Tier3Welcome extends Dialog
implements ActionListener
{
Button Okay = new Button("OK");
Label Label1 = new Label();

public Tier3Welcome(Frame Wframe, String AppName, byte[] t3IdBuf)
{
super(Wframe,"Tier3 Confirmation",true);

String Line1 = "Welcome to the " + AppName + " application via TIER3
V" +
Byte.toString(t3IdBuf[3]) + "." +
Byte.toString(t3IdBuf[4]) +
" on node " + new String(t3IdBuf, 5, 6);

Label1.setAlignment(Label.LEFT);
Label1.setText(Line1);
Label1.setFont(new Font("Helvetica", Font.BOLD, 14));

Panel top = new Panel();
top.setLayout(new GridLayout(2, 1, 0, 8));
top.add(Label1);

Okay.addActionListener(this);
top.add(Okay);

add("Center", top);

setBounds(50, 150, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == Okay)
setVisible(false);
}
}
 
L

Lew

Richard said:
Hi,

Here's a bit more information to (hopefully) narrow it down for soemone.

The *bogus* ClassNotFound error is triggered from Tier3Welcome.java after
the first attempted access of the "t3IdBuf" byte array in the following
command: -
String Line1 = "Welcome to the " + AppName + " application via TIER3 V" +
Byte.toString(t3IdBuf[3]) + "." + Byte.toString(t3IdBuf[4]) +
" on node " + new String(t3IdBuf, 5, 6);

I am a little confused by the unconventional use of upper-case letters at the
beginning of variable names. I keep expecting these to be class references.

Not that that affects your bug, but it makes the example harder to follow.

- Lew
 
L

Lew

Richard said:
2) Is it because I using the default package

What happens if you move the classes into a real package?

It is bad practice to release classes in the default package, but I don't see
that this influences your problem.
3) Is it because I'm using the command line for JAR and am not JARing all
classes in the directory?

That depends on the classes you omit. Are you sure LogApp is in the version of
the JAR that manifests the bug? (Pun intended.)

What does the JAR manifest have?
1) Can you only Extend [sic] Dialog once per (some Java unit of work) Interfaces [sic]?

I do not know how to parse the word "Interfaces" in this question.

You can extend any class or interface by any number of other types. There can
be a zillion classes in your app that extend Dialog.

I have been unable to discern the source of the
"ClassNotFoundException:LogApp" error. I have looked over your posted code,
but nothing leaps out at me there.

- Lew
 
C

Chris Uppal

Richard said:
(*) This appears to be the troublemaker.
[Java.lang.ClassNotFoundException:LogApp]

All sourcefiles have been Javac'd and all classes have been Jar'd.
(Manifest looks good)

I don't see anything obviously wrong which would cause that error. Can you
post the exact output of
jar -tvf <whatever>.jar
(replacing <whatever> as suitable, of course ;-) plus the contents of the
META-INF/MANIFEST.MF file ? Might as well post your applet tag (or whatever)
while you are at it.


By the way:
t3Sock.setKeepAlive(new Boolean(true));
t3Sock.setSoTimeout(new Integer(10000));
t3Sock.setTcpNoDelay(new Boolean(true));

The parameter to, for instance, Socket.setKeepAlive() is a boolean, not a
Boolean, so that code should read:

t3Sock.setKeepAlive(true);
t3Sock.setSoTimeout(10000);
t3Sock.setTcpNoDelay(true);

You seem to be making that mistake a lot. It may be that your eyes are not yet
tuned to Java's rules and conventions about how to use case in identifiers. If
that's why you are missing these errors then (a) you should make a serious
attempt to /make/ yourself sensitive to case (and it will help to drop the
habit of using Capitalised variable names except for ALL_CAPS static final
variables -- don't argue, just do it ;-) and (b) if you are using an IDE such
as Eclipse which has the ability to warn about autoboxing, then turn that
warning on (or, if it is on already, stop ignoring it!).

But that won't be causing your problem with LogApp, it's just a side-issue.

-- chris
 
R

Richard Maher

Hi Lew
I have been unable to discern the source of the
"ClassNotFoundException:LogApp" error. I have looked over your posted code,
but nothing leaps out at me there.

Thanks for taking the time to review it!

It looks like another case of MS IE not liking this Mickey Mouse webserver I
have sending the Applets back. OTOH the Appletviewer absolutely loves it!
The failure at the t3IdBuf [] array turned out to be a red-herring and
coincided with the JAR file increasing to 7244 bytes. Somewhere between 7231
and 7244 bytes (fragmentation,MTU,Bluemoon) something happens that makes IE
barf at my JAR file (as presented by my server). So do I : -

a) Install and configure a full blown webserver
b) Use FTP for the time-being and forget about it
c) Bring forward the writing of my own Applet-uploader with lovely things
like Linger and Deaccess
d) Find some simple lever to pull that would tell IE to be as reasonable as
the Appletviewer

Someone mentioned in a previous thread that switching to the SUN's JVM for
Windows should solve the problem as it should perform the same code as the
Appletviewer (when retrieving the Applet via the Object tag); Is this true?
Is the JVM or the Browser responsible for retrieving Applets/Objects?

On that note, how do you switch default JVMs? I've gone into the control
pannel and everyting I see says Java1.6 from Sun. Do I really have to run
the MSJVM removal tool?

Cheers Richard Maher

PS. I promise to try to get my casingRight :) 25 years in case-insensitive
environments makes you a little blase about it.

Lew said:
Richard said:
2) Is it because I using the default package

What happens if you move the classes into a real package?

It is bad practice to release classes in the default package, but I don't see
that this influences your problem.
3) Is it because I'm using the command line for JAR and am not JARing all
classes in the directory?

That depends on the classes you omit. Are you sure LogApp is in the version of
the JAR that manifests the bug? (Pun intended.)

What does the JAR manifest have?
1) Can you only Extend [sic] Dialog once per (some Java unit of work)
Interfaces [sic]?

I do not know how to parse the word "Interfaces" in this question.

You can extend any class or interface by any number of other types. There can
be a zillion classes in your app that extend Dialog.

I have been unable to discern the source of the
"ClassNotFoundException:LogApp" error. I have looked over your posted code,
but nothing leaps out at me there.

- Lew
 
R

Richard Maher

Hi Chris,

Thanks for the reply!

Chris Uppal said:
Richard said:
(*) This appears to be the troublemaker.
[Java.lang.ClassNotFoundException:LogApp]

All sourcefiles have been Javac'd and all classes have been Jar'd.
(Manifest looks good)

I don't see anything obviously wrong which would cause that error.

Please see my previous reply to Lew in this same thread. Looks like the
Unexpected EOF on Socket was not bogus after all. Doesn't work with Internet
Explorer but works fine with Appletviewer.
Can you
post the exact output of
jar -tvf <whatever>.jar
(replacing <whatever> as suitable, of course ;-) plus the contents of the
META-INF/MANIFEST.MF file ? Might as well post your applet tag (or whatever)
while you are at it.


<HTML>
<HEAD>
<TITLE>
Example HTML page with LOGON applet
</TITLE>
</HEAD>

<BODY>

Here's the new Applet. . .
<HR>

<form>
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width= "40" height= "40" name="LogApp" id="LogApp">
<param name="archive" value="tier3.jar">
<param name="codebase"
value="http://1.2.3.6/">
<param name="code" value="LogApp">
<param name="mayscript" value="yes">
<param name="scriptable" value="true">
<param name="name" value="LogApp">
<param name="PORT" value="1024">
<param name="APPLICATION" value="DEMO">
</object>
</form>

</HTML>


C:\Java\Applets>jar -tvf tier3.jar
0 Tue Feb 06 07:36:50 GMT+08:00 2007 META-INF/
68 Tue Feb 06 07:36:50 GMT+08:00 2007 META-INF/MANIFEST.MF
2991 Tue Feb 06 07:36:48 GMT+08:00 2007 LogApp.class
2396 Tue Feb 06 07:32:04 GMT+08:00 2007 Tier3Logon.class
3846 Tue Feb 06 07:32:02 GMT+08:00 2007 Tier3Socket.class
593 Tue Feb 06 07:32:02 GMT+08:00 2007 Tier3Socket$Message.class
1299 Tue Feb 06 07:32:12 GMT+08:00 2007 DoNothing.class

By the way:


The parameter to, for instance, Socket.setKeepAlive() is a boolean, not a
Boolean, so that code should read:

t3Sock.setKeepAlive(true);
t3Sock.setSoTimeout(10000);
t3Sock.setTcpNoDelay(true);

Some of this code has been copied/plagiarized/mutilated from examples in
Sun's tutorials and from the web. I had guessed that the "new Integer(n)"
was a more formal/unambiguous form of "n". Along the lines of "Make sure
it's not a Short, I want an Integer". More than happy to drop it.

So it's oolean 'cos it's a primitive and nteger and [String] 'cos
they're classes (and nt is a primative as well? UPPERCASE for constants
and secondAndThirdEtc word casing for objects and methods. (I think?)
Anything else?
You seem to be making that mistake a lot. It may be that your eyes are not yet
tuned to Java's rules and conventions about how to use case in identifiers. If
that's why you are missing these errors then (a) you should make a serious
attempt to /make/ yourself sensitive to case (and it will help to drop the
habit of using Capitalised variable names except for ALL_CAPS static final
variables -- don't argue, just do it ;-)

Working on it.
and (b) if you are using an IDE such
as Eclipse which has the ability to warn about autoboxing, then turn that
warning on (or, if it is on already, stop ignoring it!).

Just command line, nothing flash or overly smart.
But that won't be causing your problem with LogApp, it's just a side-issue.

-- chris

I want to give this code to people of an example of how to do something so
I'm more than happy to adhere to all appropriate conventions.

Thanks for taking the time to look through the code! I will be taking your
advice on several issues.

Cheers Richard Maher

PS. If it helps anyone identify some parameter I can change to get IE to be
reasonable, the socket had to be closed with messages <=7231 bytes long or
the same rubbish EOF message was triggered. I'm using http1.0 and not 1.1
but I thought it strange that IE had to detect socket closure in order to
function correctly even though I told it 7231 bytes were coming and I'd sent
7231 bytes. Is there a buffer parameter in IE or Windows2000 TCP/IP that I
can up just to get over my applet testing?
 
C

Chris Uppal

Richard said:
Please see my previous reply to Lew in this same thread. Looks like the
Unexpected EOF on Socket was not bogus after all. Doesn't work with
Internet Explorer but works fine with Appletviewer.

It's a bit late to mention it, but I'd want to find out why that was happening.
If there's one thing that IE /should/ be able to get right, it's reading data
off a web-server! It might be worth taking a detailed look at what's happening
with Wireshark (originally named Ethereal).
So it's oolean 'cos it's a primitive and nteger and [String] 'cos
they're classes (and nt is a primative as well? UPPERCASE for constants
and secondAndThirdEtc word casing for objects and methods. (I think?)
Anything else?


That's it (assuming that by "object" you mean variable -- objects themselves
are anonymous). Most people use camel-case for identifiers, but I don't really
see anything too profoundly wrong with using C-style do_something_odd_too()
names if you /really, really/ want to. But the convention is very well
established that class names and interfaces names are /always/ start with
uppercase, and that nothing else (except constants) ever does.

(Minor qualification: Uppercase names are also used for type parameter names in
generics)

PS. If it helps anyone identify some parameter I can change to get IE to
be reasonable, the socket had to be closed with messages <=7231 bytes
long or the same rubbish EOF message was triggered. I'm using http1.0 and
not 1.1 but I thought it strange that IE had to detect socket closure in
order to function correctly even though I told it 7231 bytes were coming
and I'd sent 7231 bytes. Is there a buffer parameter in IE or Windows2000
TCP/IP that I can up just to get over my applet testing?

Ah, I hadn't noticed that before. As I recall, HTTP 1.0 didn't have a length
header -- the content was delimited by end-of-stream, so (assuming my memory is
correct) it sounds as if IE is just adhering to the standard.

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top