Stupi / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

SecurityException when running FS in an applet #136

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
(moved from https://github.com/flyingsaucerproject/flyingsaucer/issues#issue/5, 
reported by https://github.com/jheid)

Hi. 

Please modifiy 

private void updateSystemSelection() {
        if (this.dotInfo != this.markInfo && panel != null) {
            Clipboard clip = panel.getToolkit().getSystemSelection();
            if (clip != null) {
                String selectedText = lastHighlightedString;
                try {
                    clip.setContents(new StringSelection(selectedText), null);
                } catch (IllegalStateException ise) {
                    // clipboard was unavailable
                    // no need to provide error feedback to user since updating
                    // the system selection is not a user invoked action
                }
            }
        }
    }

in org.xhtmlrenderer.swing.SelectionHighlighter to

private void updateSystemSelection() {
        if (this.dotInfo != this.markInfo && panel != null) 
           try {
            Clipboard clip = panel.getToolkit().getSystemSelection();
            if (clip != null) {
                String selectedText = lastHighlightedString;
                try {
                    clip.setContents(new StringSelection(selectedText), null);

                } catch (IllegalStateException ise) {
                    // clipboard was unavailable
                    // no need to provide error feedback to user since updating
                    // the system selection is not a user invoked action
                }
            }
        } catch (AccessControlException t) { }
    }

so you won't get a SecurityException when running XHTMLRenderer in an unsigned 
applet.

Cheers,
Jörn

Original issue reported on code.google.com by pdoubl...@gmail.com on 26 Mar 2011 at 9:25