Skip to main content

Is OCAP.javaio.tmpdir set for each application or is it a system property

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
4 replies [Last post]
ldragan
Offline
Joined: 2009-12-22
Points: 0

The comment for this property is:

# The name of the sub-directory (from the app's home dir) that will
# serve as the value for the java.io.tmpdir property. We use '[' in the
# directory name because it is supported natively but not in OCAP.
OCAP.javaio.tmpdir=[javaiotmpdir]

The property is used in the following pice of code:

// Set the java.io.tmpdir property
String tmpDir = MPEEnv.getEnv("OCAP.javaio.tmpdir", "[javaiotmpdir]");
System.setProperty("java.io.tmpdir", tmpDir);

This means that the OCAP property is used to override Java's tmpdir which is a system property, but the comment indicated that the path is relative to app's home dir. java.io.tmpdir is an absolute path used by File.createTempFile().

Can you please clarify the intended use for this property?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
greg80303
Offline
Joined: 2008-07-03
Points: 0
greg80303
Offline
Joined: 2008-07-03
Points: 0

The problem in OCAP is that multiple applications using the same location for their tmpdir would create a potential security violation (an app could read temp files created by another app). I think the correct way to solve this is to have the JVM retrieve an application-specific value of this Java system property. We already do this for "user.dir" and "ocap.j.location" (see $OCAPROOT/jvm/phoneME/mpe_jvm/src/mpe/classes/org/cablelabs/impl/appctx/AppContextManager.java). In order to avoid the security hole, we'll need to place the directory in a location where the application will have write-access.

With that in mind, I think the value "OCAP.java.io.tmpdir" in base.properties will indicate a subdirectory of <dvb.persistent.root>/<orgID>/<appID>. Upon application launch, the implementation will delete any old tmpdir for that app from a previous run -- this will maintain the true nature of the files in that directory as "temporary". The directory will be automatically created when the application first requests the java.io.tmpdir Java system property. SecurityExceptions will be thrown if the application does not have access to persistent storage granted in its PRF.

I will create a bug to track this work.

G

howardteece
Offline
Joined: 2010-06-17
Points: 0

More importantly,

Why isn't java.io.tmpdir set in the Windows Platform? Here's a dump of the values:

</p>
<p>20110726 18:23:48.982 INFO     RI.Stack.StdOut- Key: java.library.builtin.net Value: yes</p>
<p>20110726 18:23:48.982 INFO     RI.Stack.StdOut- Key: sun.boot.library.path Value: ./cvm/bin</p>
<p>20110726 18:23:48.982 INFO     RI.Stack.StdOut- Key: java.vm.version Value: phoneme_advanced_mr2-b137</p>
<p>20110726 18:23:48.998 INFO     RI.Stack.StdOut- Key: java.vm.vendor Value: Sun Microsystems Inc.</p>
<p>20110726 18:23:48.998 INFO     RI.Stack.StdOut- Key: java.vendor.url Value: <a href="http://java.sun.com/" title="http://java.sun.com/">http://java.sun.com/</a></p>
<p>20110726 18:23:48.998 INFO     RI.Stack.StdOut- Key: path.separator Value: ;</p>
<p>20110726 18:23:48.998 INFO     RI.Stack.StdOut- Key: java.vm.name Value: CVM</p>
<p>20110726 18:23:48.998 INFO     RI.Stack.StdOut- Key: file.encoding.pkg Value: org.cablelabs.ocap.charset</p>
<p>20110726 18:23:48.998 INFO     RI.Stack.StdOut- Key: java.vm.specification.name Value: Java Virtual Machine Specification</p>
<p>20110726 18:23:48.998 INFO     RI.Stack.StdOut- Key: user.dir Value: /C/Workdrives/Comcast/RI_114_Branch/ri/RI_Stack/bin/CableLabs/simulator/Win32/debug/env</p>
<p>20110726 18:23:48.998 INFO     RI.Stack.StdOut- Key: microedition.encoding Value: ISO-8859-1</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: java.library.builtin.awtjpeg Value: true</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: line.separator Value:</p>
</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: java.vm.specification.vendor Value: Sun Microsystems Inc.</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: microedition.profiles Value:</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: java.library.builtin.zip Value: yes</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: java.library.path Value: /syscwd/../bin</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: microedition.platform Value: j2me</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: java.specification.name Value: Personal Basis Profile Specification</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: java.class.version Value: 47.0</p>
<p>20110726 18:23:49.013 INFO     RI.Stack.StdOut- Key: sun.misc.product Value: phoneME Advanced</p>
<p>20110726 18:23:49.029 INFO     RI.Stack.StdOut- Key: user.home Value: /C/Workdrives/Comcast/RI_114_Branch/ri/RI_Stack/bin/CableLabs/simulator/Win32/debug/env</p>
<p>20110726 18:23:49.029 INFO     RI.Stack.StdOut- Key: user.timezone Value:</p>
<p>20110726 18:23:49.029 INFO     RI.Stack.StdOut- Key: file.encoding Value: ISO8859_1</p>
<p>20110726 18:23:49.029 INFO     RI.Stack.StdOut- Key: java.specification.version Value: 1.1</p>
<p>20110726 18:23:49.029 INFO     RI.Stack.StdOut- Key: java.class.path Value: /syscwd/sys/ocap-classes.jar;/syscwd/sys/ocap-rez.jar;/syscwd/sys/support.jar;/syscwd/qa/ocap-test.jar;/syscwd/qa/support-test.jar;/syscwd;/syscwd/usr;/syscwd/apps/eas</p>
<p>20110726 18:23:49.029 INFO     RI.Stack.StdOut- Key: microedition.locale Value: en-US</p>
<p>20110726 18:23:49.029 INFO     RI.Stack.StdOut- Key: java.vm.specification.version Value: 1.0</p>
<p>20110726 18:23:49.029 INFO     RI.Stack.StdOut- Key: java.home Value: /syscwd/cvm</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: user.language Value: eng</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: java.specification.vendor Value: Sun Microsystems Inc.</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: awt.toolkit Value: java.awt.MPEToolkit</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: java.vm.info Value: interpreter loop</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: java.version Value: phoneme_advanced_mr2-b137</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: java.library.builtin.mpeawt Value: true</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: java.ext.dirs Value: /syscwd/cvm/lib/ext</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: sun.boot.class.path Value: ./cvm/lib/basis.jar</p>
<p>20110726 18:23:49.044 INFO     RI.Stack.StdOut- Key: java.library.builtin.math Value: yes</p>
<p>20110726 18:23:49.060 INFO     RI.Stack.StdOut- Key: java.vendor Value: Sun Microsystems Inc.</p>
<p>20110726 18:23:49.060 INFO     RI.Stack.StdOut- Key: file.separator Value: /</p>
<p>20110726 18:23:49.060 INFO     RI.Stack.StdOut- Key: microedition.configuration Value: CLDC-1.1</p>
<p>20110726 18:23:49.060 INFO     RI.Stack.StdOut- Key: sun.io.unicode.encoding Value: UnicodeLittle</p>
<p>20110726 18:23:49.060 INFO     RI.Stack.StdOut- Key: sun.cpu.endian Value: little</p>
<p>20110726 18:23:49.060 INFO     RI.Stack.StdOut- Key: sun.cpu.isalist Value:</p>
<p>

howardteece
Offline
Joined: 2010-06-17
Points: 0

Is this the worst Forum engine or what?
Here's that quote without [hopefully] the HTML
Well, that failed. But I think you get the picture.
[/hopefully]