Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

26. May 2012, 08:09:24 pm
Xith3D CommunityGeneral CategoryGeneral Discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)DisplayOptions changes
Pages: [1]
Print
Author Topic: DisplayOptions changes  (Read 1509 times)
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« on: 06. March 2007, 01:29:16 am »

@Mathias

I found the changes in DisplayOptions. It is better to ask here an appropriate forum, than write a question in a comment in the code.

The loaded images are in media.jar, which can be found in the resources folder. They are loaded from ClassLoader, because it doesn't load them through getClass().getResource().

Which way would you suggest to handle the IOException in DisplayOptions line #793?

Marvin
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #1 on: 06. March 2007, 09:46:05 am »

You are absolutely right, sorry. It was late yesterday and I was more writing this as a reminder to myself. I stumbled over this, while trying to get stratagem to work, which died throwing an IllegalArgumentException (ImageIO did not throw the caught IOException, but the IAE instead).

Quote
The loaded images are in media.jar, which can be found in the resources folder.
I didn't find the icon in question, so I thought it might be legacy code. Maybe the media.jar should be extracted in the SVN-project, so one can find the resources via common project find and add new resources if necessary. Also I would vote for a toplevel package "org.xith3d.resources" to follow common deployment rules.

Quote
They are loaded from ClassLoader, because it doesn't load them through getClass().getResource().
I should have known that by myself but was distracted by the "missing" icon Undecided. Btw. how does the threads ContextClassloader behave different from the classes Classloader?

Quote
Which way would you suggest to handle the IOException in DisplayOptions line #793?
It should be common practice to log a warning for such exception. At best containing a hint what might be the problem (e.g. "Make sure the media.jar is on your classpath"). If that's not desirable due to performance issues (and only then) there should be a comment in the catch block containing the reason for ignoring the exception and where possible a similar hint to the problem like described above.

Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 06. March 2007, 10:19:57 am »

I didn't find the icon in question, so I thought it might be legacy code. Maybe the media.jar should be extracted in the SVN-project, so one can find the resources via common project find and add new resources if necessary. Also I would vote for a toplevel package "org.xith3d.resources" to follow common deployment rules.

I disagree. There shouldn't be more differences to a running game in the SVN than necessary. And adding resources to the media.jar should happen only very seldom. But there should be a note somewhere. Maybe in this FAQ section, that must be created some time. For the org.xith3d. prefix in the media.jar: I will do that.

Btw. how does the threads ContextClassloader behave different from the classes Classloader?

Don't know. Haven't triend this out. What should be the difference? And what should be preferred?

It should be common practice to log a warning for such exception. At best containing a hint what might be the problem (e.g. "Make sure the media.jar is on your classpath"). If that's not desirable due to performance issues (and only then) there should be a comment in the catch block containing the reason for ignoring the exception and where possible a similar hint to the problem like described above.

100% agreed. I will change that.

Marvin
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #3 on: 06. March 2007, 10:28:01 am »

I disagree. There shouldn't be more differences to a running game in the SVN than necessary. And adding resources to the media.jar should happen only very seldom.
I don't like packaged content in a source repository, but hey...

But there should be a note somewhere. Maybe in this FAQ section, that must be created some time. For the org.xith3d. prefix in the media.jar: I will do that.
OK, a note and the prefix is totally sufficient. Thanks.

Don't know. Haven't triend this out. What should be the difference? And what should be preferred?
Don't know, that's why I asked Wink

100% agreed. I will change that.
Smiley

Mathias
Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 06. March 2007, 10:31:54 am »

I don't like packaged content in a source repository, but hey...

And I don't like binary content in the source package hierarchy Wink. And this would be the only way to make it loadable the same way as if it is in a jar.

Marvin
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #5 on: 06. March 2007, 10:33:31 am »

And I don't like binary content in the source package hierarchy Wink. And this would be the only way to make it loadable the same way as if it is in a jar.
Add the media folder to the classpath?
Mathias
Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #6 on: 06. March 2007, 10:49:42 am »

Add the media folder to the classpath?

Hmm.. oh!... You're right Smiley

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic