Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » java.io.tmpdir points to an unexsiting folder
java.io.tmpdir points to an unexsiting folder [message #1692523] Thu, 16 April 2015 10:47 Go to next message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 72
Registered: July 2009
Member
Hello,

I had a runtime error in a third-party library because Virgo sets the variable java.io.tmpdir to a subfolder named tmp within its working directory, but such folder is not created.

In other words, user code that assumes that the java.io.tmpdir folder exists may fail. Of course this is not a big issue, one can always write a line of code like the following:

  new File(System.getProperty("java.io.tmpdir")).mkdirs();


but it's not clear to me what is the correct behaviour: I checked the javadoc for the File class but it's not mentioning whether the user code should (or should not) assume that the temporary folder exists. However, common experience is that in Java SE applications and in other application servers that folder always exists.

As such I would suggest to have Virgo automatically create the folder upon startup, especially since it's Virgo that sets the variable in dmk.sh

GianMaria.





Developing for Virgo using PDE: http://bit.ly/1w0tTit
Global JNDI in Virgo: http://bit.ly/1to42mn
Hyperic to monitor Virgo: http://bit.ly/W1Fst9
Profile Virgo with JProfiler http://bit.ly/1FBLGCw
Re: java.io.tmpdir points to an unexsiting folder [message #1692528 is a reply to message #1692523] Thu, 16 April 2015 11:03 Go to previous messageGo to next message
Florian Waibel is currently offline Florian WaibelFriend
Messages: 166
Registered: June 2010
Senior Member
I like your suggestion. Would you mind creating a bugzilla item?
Re: java.io.tmpdir points to an unexsiting folder [message #1692531 is a reply to message #1692528] Thu, 16 April 2015 11:20 Go to previous messageGo to next message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 72
Registered: July 2009
Member
I double checked the shell scripts, and I now believe that this is probably an issue in the Virgo Tools rather than Virgo.

A deeper look at dmk.sh reveals that at some point the start scripts try to create the folder:

	# If we get here we have the correct Java version.
	
	if [ -z "$NO_START_FLAG" ]
	then
		TMP_DIR=$KERNEL_HOME/work/tmp
		# Ensure that the tmp directory exists
		mkdir -p $TMP_DIR


At this point I think I should open the bugzilla entry against the Virgo Tools, right?

GianMaria.


Developing for Virgo using PDE: http://bit.ly/1w0tTit
Global JNDI in Virgo: http://bit.ly/1to42mn
Hyperic to monitor Virgo: http://bit.ly/W1Fst9
Profile Virgo with JProfiler http://bit.ly/1FBLGCw

[Updated on: Thu, 16 April 2015 13:06]

Report message to a moderator

Re: java.io.tmpdir points to an unexsiting folder [message #1692535 is a reply to message #1692531] Thu, 16 April 2015 11:26 Go to previous messageGo to next message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 72
Registered: July 2009
Member
And at first sight this may be the right place to apply the fix in the Virgo tools:

https://github.com/eclipse/virgo.ide/blob/82e3dd95c387b170a38ec978c477cfe26a14b32b/org.eclipse.virgo.ide.runtime.core/src/org/eclipse/virgo/ide/runtime/internal/core/ServerLaunchConfigurationDelegate.java#L79

unless you prefer to move the initialization logic from the shell script into the server Java code.

GianMaria.


Developing for Virgo using PDE: http://bit.ly/1w0tTit
Global JNDI in Virgo: http://bit.ly/1to42mn
Hyperic to monitor Virgo: http://bit.ly/W1Fst9
Profile Virgo with JProfiler http://bit.ly/1FBLGCw
Re: java.io.tmpdir points to an unexsiting folder [message #1692561 is a reply to message #1692535] Thu, 16 April 2015 13:35 Go to previous messageGo to next message
Florian Waibel is currently offline Florian WaibelFriend
Messages: 166
Registered: June 2010
Senior Member
Thanks for looking deeper into this. Any chance you can spare some more minutes and create a pull request?
Re: java.io.tmpdir points to an unexsiting folder [message #1692565 is a reply to message #1692561] Thu, 16 April 2015 14:11 Go to previous messageGo to next message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 72
Registered: July 2009
Member

I'll try to have a look at it in the next days. Meanwhile I'll open the bugzilla entry against the Virgo IDE project.

GianMaria.


Developing for Virgo using PDE: http://bit.ly/1w0tTit
Global JNDI in Virgo: http://bit.ly/1to42mn
Hyperic to monitor Virgo: http://bit.ly/W1Fst9
Profile Virgo with JProfiler http://bit.ly/1FBLGCw
Re: java.io.tmpdir points to an unexsiting folder [message #1692597 is a reply to message #1692565] Thu, 16 April 2015 16:54 Go to previous message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 72
Registered: July 2009
Member
I created the bugzilla entry https://bugs.eclipse.org/bugs/show_bug.cgi?id=464814



Developing for Virgo using PDE: http://bit.ly/1w0tTit
Global JNDI in Virgo: http://bit.ly/1to42mn
Hyperic to monitor Virgo: http://bit.ly/W1Fst9
Profile Virgo with JProfiler http://bit.ly/1FBLGCw
Previous Topic:Virgo 3.6.2 library load error (folder is expected as jar archive)
Next Topic:Requesting to be started bundle list to virgo
Goto Forum:
  


Current Time: Fri Apr 19 05:41:32 GMT 2024

Powered by FUDForum. Page generated in 0.01854 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top