Warning: Type safety: Unchecked cast from Object to Vecotr<String>

Joined
Mar 31, 2009
Messages
1
Reaction score
0
Hi,

I have tried to send Vector<String> through TCP socket with the following code:

In client side:
...
Socket socket = null;
DataOutputStream dout;
ObjectOutputStream oos;

dout = new DataOutputStream (socket.getOutputStream());
oos = new ObjectOutputStream (dout);
oos.writeObject(list);
oos.flush();
socket.close();
...

In server side:
...
DataInputStream din;
ObjectInputStream ois;
Vector<String> list;

serverSocket = new ServerSocket(PORT);
socket = serverSocket.accept();

din = new DataInputStream(socket.getInputStream());
ois = new ObjectInputStream (din);

list = (Vector<String>)ois.readObject();

socket.close();
...

However," list = (Vector<String>)ois.readObject(); " give the warning "Warning: Type safety: Unchecked cast from Object to Vecotr<String>". Could anyone give a help?
 

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

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top