Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I accidentaly the whole applet

Name: GlacialEntropy 2009-07-13 2:23


public String readFile(File aFile) {
           
            StringBuilder contents = new StringBuilder();
           
            try {
             
              BufferedReader input =  new BufferedReader(new FileReader(aFile));
              try {
                String line = null;
               
                while (( line = input.readLine()) != null){
                  contents.append(line);
                  contents.append(System.getProperty("line.separator"));
                }
              }
              finally {
                input.close();
              }
            }
            catch (Exception ex){
              ex.printStackTrace();
            }
            System.out.println(contents.toString());
            return contents.toString();
          }

This compiles and runs properly in any IDE, but it throws security exceptions when I put it into an html file with this code:

<applet code =
"uniSim.class" width = 800 height =
600></applet>

Is this bad?

Name: FrozenVoid 2009-07-13 6:11

1.Check security permissions. Is it signed?
2.Try Class.getResourceAsStream
3.remove printStackTrace() and try again.


___________________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
The genius of culture is to create an ontological system so compelling that what is inside and outside of a person are viewed as of a piece, no seams and patches noticeable.

Name: Anonymous 2009-07-13 6:23

Whether it is ``bad'' depends on what you need to do. Writing files (any non-temp file I believe) requires the applet to be trusted. If you intend for it to be run as an applet, and for some reason need to write files on random users' hard drives- it's an indicator of a fundamentally flawed design.

Name: Anonymous 2009-07-13 11:06

>>3
indicator of a fundamentally flawed design
That would be using Java.

Name: Anonymous 2009-07-13 12:52

>>3
No, my applet reads files not writes them. It inputs data from a file if the user so needs it. Im about to attempt FVs suggestion.

Name: GlacialEntropy 2009-07-13 13:05

>>5
Oops, forgot my name!

Name: Anonymous 2009-07-14 0:30

>>5
.. It's the same fucking thing; an untrusted applet can't go waltzing round anybodies file system taking whatever it likes. Did you even think about it for more than twenty seconds? Read from your SAM file? Sure. How about include/databaseinfo.inc.php? No problem. documents/bank-statement.docx? Go for it.

Name: Anonymous 2009-07-14 1:34

>>7
Ok dude, this program needs to be a Java applet because my professor says so. I'd love to do it another way, but I cant.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List