Author: ron.sigal(a)jboss.com
Date: 2008-05-08 04:47:11 -0400 (Thu, 08 May 2008)
New Revision: 4144
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java
Log:
JBREM-978: Makes some file oriented calls through SecurityUtility.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java 2008-05-08
08:35:59 UTC (rev 4143)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java 2008-05-08
08:47:11 UTC (rev 4144)
@@ -26,8 +26,8 @@
import org.jboss.remoting.util.SecurityUtility;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
@@ -208,13 +208,12 @@
File file = null;
try
{
- file = File.createTempFile("cbc", ".class");
- file.deleteOnExit();
+ file = SecurityUtility.createTempFile("cbc", ".class",
true);
if(log.isTraceEnabled())
{
log.trace("adding resource at: " + name + " to file: " +
file);
}
- out = new FileOutputStream(file);
+ out = SecurityUtility.getFileOutputStream(file);
out.write(buf);
out.flush();
}
@@ -254,15 +253,16 @@
{
log.trace("getResourceAsStream =>" + denormalized + " = "
+ file);
}
- if(file != null && file.exists())
+ if(file != null && SecurityUtility.fileExists(file))
{
try
{
- return new java.io.BufferedInputStream(new java.io.FileInputStream(file));
+ InputStream is = SecurityUtility.getFileInputStream(file);
+ return new java.io.BufferedInputStream(is);
}
catch(Exception ex)
{
-
+ log.debug("file doesn't exist", ex);
}
}
return super.getResourceAsStream(name);
Show replies by date