private void checkRestricted(String text) { Class[] context = getClassContext(); for ( int i = 2; i < context.length; i++ ) { ClassLoader loader = context[i].getClassLoader(); // Bungee / system can do everything if ( loader == ClassLoader.getSystemClassLoader() || loader == null ) { break; } AccessControlException ex = new AccessControlException( "Plugin violation: " + text ); if ( ENFORCE ) { throw ex; } StringWriter stack = new StringWriter(); ex.printStackTrace( new PrintWriter( stack ) ); if ( seen.add( stack.toString() ) ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, "Plugin performed restricted action, please inform them to use proper API methods: " + text, ex ); } break; } }
private static boolean isUsingQuartz() { try { return isMac && ((javaVersion>0 && javaVersion<1.4f) || (System.getProperty("apple.awt.graphics.UseQuartz")!=null && System.getProperty("apple.awt.graphics.UseQuartz").toString().equals("true"))); } catch(AccessControlException e) { e.printStackTrace(); return false; } }
/** * gets a new default Configuration * @return Configuration */ public static final Configuration getConfiguration() { try { String config = System.getProperty("jazzy.config"); // added by bd if (config != null && config.length() > 0) return getConfiguration(config); } catch (AccessControlException e) { e.printStackTrace(); } return getConfiguration(null); }
protected AbstractColorChooserPanel[] createDefaultChoosers() { String[] defaultChooserNames = (String[]) PaletteLookAndFeel.getInstance().get("ColorChooser.defaultChoosers"); ArrayList<AbstractColorChooserPanel> panels = new ArrayList<AbstractColorChooserPanel>(defaultChooserNames.length); for (int i=0; i < defaultChooserNames.length; i++) { try { panels.add((AbstractColorChooserPanel) Class.forName(defaultChooserNames[i]).newInstance()); } catch (AccessControlException e) { // suppress System.err.println("PaletteColorChooserUI warning: unable to instantiate "+defaultChooserNames[i]); e.printStackTrace(); } catch (Exception e) { // throw new InternalError("Unable to instantiate "+defaultChoosers[i]); // suppress System.err.println("PaletteColorChooserUI warning: unable to instantiate "+defaultChooserNames[i]); e.printStackTrace(); } catch (UnsupportedClassVersionError e) { // suppress System.err.println("PaletteColorChooserUI warning: unable to instantiate "+defaultChooserNames[i]); //e.printStackTrace(); } catch (Throwable t) { System.err.println("PaletteColorChooserUI warning: unable to instantiate "+defaultChooserNames[i]); } } //AbstractColorChooserPanel[] panels = new AbstractColorChooserPanel[defaultChoosers.length]; return (AbstractColorChooserPanel[]) panels.toArray(new AbstractColorChooserPanel[panels.size()]); }
private void createFrame(){ tabbedPane = new JTabbedPane(); this.setExtendedState(Frame.MAXIMIZED_BOTH); try { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } catch (java.security.AccessControlException e){ e.printStackTrace(); } final Container content = this.getContentPane(); JMenuBar menuBar = menuBuilder.createMenuBar(this); content.add(tabbedPane); this.setJMenuBar(menuBar); this.setMinimumSize(new Dimension(640, 480)); this.setVisible(true); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }