• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I am close to submit - eliminate a warning message

 
Mike Tilling
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

When I compile my JAVA program, will get the following warning:
"Unchecked : call to add (E) as a member of the raw type java.util.ArrayList"

How can I eliminate this warning message?

Best Regards
 
Oliver Weikopf
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use generics.

You probably define your List somthing like this:


Instead, specify what type of object you want in your List like this:


That way, javac knows you want only Objects of the MyClass Type in your List and you save yourself a lot of casting.

If you want to know more about generics, read Sun's Generics Tutorial
 
Mike Tilling
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oliver,

Many thanks for the time you took for answering my questions,

Would it be ok if you can have a look at the following quetions:




1-The client side of my application uses pictures (icons), I could not run the client after being packaged in a JAR file, the program can not access these pictures within the JAR file, what I should do to fix this problem?

2- On the server side can I always start the RMI server on the same port (1099), do I have to give the user the option to change this port, if so, will this be done via a GUI on the server side, I do not actually want to implement a GUI on the server side, do I have to?
If I have to specify the registry port number, the client will have to know the port number from the server side, isn�t this confusing?

3- It happens that the exception occurs after having the file lock or the record lock ownership (in my implementation, the lock and the unlock processes are invoked in the server side, I mean on the Data layer) do I have to treat this case, it is pretty complicated to check within the try block, if the thread has the ownership of the file or the record, when an InputOutput or RemoteException occur, do we have to simply exit the application, I think this is the easiest was, is it acceptable? In this case, when an exception occurs, the client will be informed that the server has stopped and the later needs to be restarted, how did you deal with the exceptions?

4-What does the client need to know if a BoundException occurs?


Best Regards
 
Oliver Weikopf
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mike Tilling:

1-The client side of my application uses pictures (icons), I could not run the client after being packaged in a JAR file, the program can not access these pictures within the JAR file, what I should do to fix this problem?


How do you load the images? It works fine here when I load them like this:

(in this examle, the file bs_icon.png is in a resource folder inside the jar)


2- On the server side can I always start the RMI server on the same port (1099), do I have to give the user the option to change this port, if so, will this be done via a GUI on the server side, I do not actually want to implement a GUI on the server side, do I have to?
If I have to specify the registry port number, the client will have to know the port number from the server side, isn�t this confusing?


Your decision. I allow the user to set the port via GUI on both the server and client.
And I believe you need some GUI on the server side because you need to be able to select a database file. Else you would have to assume that the db file is always in the working directory and always has the same name. Sounds a bit demanding to me.


3- It happens that the exception occurs after having the file lock or the record lock ownership (in my implementation, the lock and the unlock processes are invoked in the server side, I mean on the Data layer) do I have to treat this case, it is pretty complicated to check within the try block, if the thread has the ownership of the file or the record, when an InputOutput or RemoteException occur, do we have to simply exit the application, I think this is the easiest was, is it acceptable? In this case, when an exception occurs, the client will be informed that the server has stopped and the later needs to be restarted, how did you deal with the exceptions?


I'm afraid I don't understand. What exception occurs and why does it occur?.


4-What does the client need to know if a BoundException occurs?


Do you mean a NotBoundException?
As far as I know this will occur only on the server wehen you try to unbind and fail, right? In that case, the client doesn't need to know anything.
Does it occur in another case?

[ June 29, 2006: Message edited by: Oliver Weikopf ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic