Re: Problem in loading a text file to java aglet application.
Ravikumar wrote:
..
I am writing a java aglet application
As I understand it, an aglet is an AGile appLET,
so the term 'aglet application' is wrong, it is
simply an 'Aglet'. Applets are quite distinct (in Java
terminology) from applications, and it is best not to
mix the terms. Applets normally operate within a
security sandbox that prevents operations such
as loading files off the local file system.
...
tablepanel.loadMibs("C:/Ravikumar/SoftWare/Aglets/Aglets2.0.2/public/
RFC1213-MIB");
And that is a file.
It loads RFC1213-MIB file from "C:/Ravikumar/SoftWare/Aglets/
Aglets2.0.2/public and parse the content. But while loading this file,
I have got the following exception
Exception : java.io.FileNotFoundException: Could not find the file :
C:/Ravikumar/SoftWare/Aglets/Aglets2.0.2/public/RFC1213-MIB
ERROR
How do you know it is an FNFE? The code below..
try{
tablepanel.loadMibs("C:/Ravikumar/SoftWare/Aglets/Aglets2.0.2/public/
RFC1213-MIB");
tablepanel.setTableOID("ifTable");
}catch(Exception e)
{
System.out.println("ERROR");
}
}
<http://snmp.adventnet.com/help/snmpapi/snmpv3/javadocs/com/adventnet/snmp/ui/SnmpTablePanel.html#loadMibs(java.lang.String
)>
..might throw FNFE, IOException, or a MibException.
It seems odd that list does not include any security
exceptions, which is what I would expect a sandboxed
applet to throw if it attempted file access.
So, is this code actually operating as an applet?
Is it working in a browser?
(It seems so to me, but tonight is the first time I
ever bothered checking the meaning of 'Aglet')
If so, you might look into passing the Applet as a param
to the constructor of the panel mentioned/linked above,
and the panel will attempt to fetch the resource via URL.
HTH
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200704/1