#23 Permission denied @ RFO.unCompress

open
nobody
5
2011-01-18
2011-01-18
Anonymous
No

When trying to load a (handcrafted) RFO file into the reprap host software version "rerap-mendel-20100806" on Windows Vista with Java 1.6.0_14 i get a FileNotFoundException (whichs stacktrace will just be swallowed) caused by "permission denied".

The log:
ERROR: RFO.unCompress(): java.io.FileNotFoundException: [UserTempFolder]\rfo[uuid/timestamp]\rfo (Zugriff verweigert) [0,000s/-1295357699198ms] ERROR: XMLIn() 2: java.io.FileNotFoundException: AppData\Local\Temp\rfo[uuid/timestamp]\rfo\legend.xml (Das System kann die angegebene Datei nicht finden) [0,057s/57ms]

Quickfix:
The denied 'file' is a directory. So skipping it in RFO.unCompress() by inserting the following check directly after line 692 worked for me:

if (ze.isDirectory()) {
continue;
}

I don't know if this introduces problems on other platforms though.

Change in context (lines 682-706/709 of RFO.java)

private void unCompress()
{
try
{
byte[] buffer = new byte[4096];
int bytesIn;
ZipFile rfoFile = new ZipFile(path + fileName);
Enumeration<? extends ZipEntry> allFiles = rfoFile.entries();
while(allFiles.hasMoreElements())
{
ZipEntry ze = allFiles.nextElement();
if (ze.isDirectory()) {
continue;
}
InputStream is = rfoFile.getInputStream(ze);
String fName = processSeparators(ze.getName());
File element = new File(tempDir + fName);
org.reprap.Main.ftd.add(element);
FileOutputStream os = new FileOutputStream(element);
while((bytesIn = is.read(buffer)) != -1)
os.write(buffer, 0, bytesIn);
os.close();
}
} catch (Exception e)
{
e.printStackTrace();
Debug.e("RFO.unCompress(): " + e);
}
}

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks