< prev index next >

src/java.desktop/share/classes/java/awt/Taskbar.java

Print this page

        

*** 188,197 **** --- 188,205 ---- sm.checkPermission(new AWTPermission( "showWindowWithoutWarningBanner")); } } + private static void checkEventsProcessingPermission() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new RuntimePermission( + "canProcessApplicationEvents")); + } + } + private Taskbar() { Toolkit defaultToolkit = Toolkit.getDefaultToolkit(); if (defaultToolkit instanceof SunToolkit) { peer = ((SunToolkit) defaultToolkit).createTaskbarPeer(this); }
*** 203,219 **** --- 211,231 ---- * supported; use the {@link #isTaskbarSupported} method to * determine if the current taskbar is supported. * @return the Taskbar instance * @throws HeadlessException if {@link * GraphicsEnvironment#isHeadless()} returns {@code true} + * @throws SecurityException if a security manager exists and it + * denies the {@code RuntimePermission("canProcessApplicationEvents")} + * permission * @throws UnsupportedOperationException if this class is not * supported on the current platform * @see #isTaskbarSupported() * @see java.awt.GraphicsEnvironment#isHeadless */ public static synchronized Taskbar getTaskbar(){ if (GraphicsEnvironment.isHeadless()) throw new HeadlessException(); + checkEventsProcessingPermission(); if (!Taskbar.isTaskbarSupported()) { throw new UnsupportedOperationException("Taskbar API is not " + "supported on the current platform"); }
< prev index next >