From ca81ab5ebc10722171ac861aa460bfaf520f3c7d Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 26 Nov 2024 07:03:15 +0000 Subject: [PATCH] 8344994: Remove most uses of RuntimePermission checks in java.desktop Reviewed-by: azvegint --- .../classes/com/apple/eawt/Application.java | 10 ----- .../classes/com/apple/eio/FileManager.java | 17 -------- .../classes/sun/lwawt/macosx/CPrinterJob.java | 6 +-- .../sun/lwawt/macosx/CPrinterJobDialog.java | 4 +- .../share/classes/java/awt/Font.java | 8 ---- .../share/classes/java/awt/Taskbar.java | 24 ----------- .../classes/java/awt/color/ICC_Profile.java | 1 - .../accessibility/AccessibilityProvider.java | 31 -------------- .../share/classes/javax/imageio/ImageIO.java | 40 +------------------ .../share/classes/sun/print/PrintJob2D.java | 15 ------- .../classes/sun/print/RasterPrinterJob.java | 38 ------------------ .../classes/sun/print/ServiceDialog.java | 36 ++--------------- .../classes/sun/awt/windows/WPrinterJob.java | 18 --------- .../libawt/windows/awt_PrintControl.cpp | 11 ----- .../native/libawt/windows/awt_PrintControl.h | 1 - 15 files changed, 8 insertions(+), 252 deletions(-) diff --git a/src/java.desktop/macosx/classes/com/apple/eawt/Application.java b/src/java.desktop/macosx/classes/com/apple/eawt/Application.java index 6ed4a7c1daf19..d9f01f75dd986 100644 --- a/src/java.desktop/macosx/classes/com/apple/eawt/Application.java +++ b/src/java.desktop/macosx/classes/com/apple/eawt/Application.java @@ -79,7 +79,6 @@ public class Application { static Application sApplication = null; static { - checkSecurity(); Toolkit.getDefaultToolkit(); // Start AppKit if (!Beans.isDesignTime()) { nativeInitializeApplicationDelegate(); @@ -88,20 +87,12 @@ public class Application { sApplication = new Application(); } - private static void checkSecurity() { - @SuppressWarnings("removal") - final SecurityManager security = System.getSecurityManager(); - if (security == null) return; - security.checkPermission(new RuntimePermission("canProcessApplicationEvents")); - } - /** * @return the singleton representing this Mac OS X Application * * @since 1.4 */ public static Application getApplication() { - checkSecurity(); return sApplication; } @@ -118,7 +109,6 @@ public static Application getApplication() { */ @Deprecated public Application() { - checkSecurity(); } /** diff --git a/src/java.desktop/macosx/classes/com/apple/eio/FileManager.java b/src/java.desktop/macosx/classes/com/apple/eio/FileManager.java index 5449e3ff9e2e2..2f847416d216b 100644 --- a/src/java.desktop/macosx/classes/com/apple/eio/FileManager.java +++ b/src/java.desktop/macosx/classes/com/apple/eio/FileManager.java @@ -254,11 +254,6 @@ public static String findFolder(short domain, int folderType) throws FileNotFoun * @since 1.4 */ public static String findFolder(short domain, int folderType, boolean createIfNeeded) throws FileNotFoundException { - @SuppressWarnings("removal") - final SecurityManager security = System.getSecurityManager(); - if (security != null) { - security.checkPermission(new RuntimePermission("canExamineFileSystem")); - } final String foundFolder = _findFolder(domain, folderType, createIfNeeded); if (foundFolder == null) throw new FileNotFoundException("Can't find folder: " + Integer.toHexString(folderType)); @@ -282,11 +277,6 @@ public static String findFolder(short domain, int folderType, boolean createIfNe */ @Deprecated public static void openURL(String url) throws IOException { - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - if (security != null) { - security.checkPermission(new RuntimePermission("canOpenURLs")); - } _openURL(url); } private static native void _openURL(String url) throws IOException; @@ -334,10 +324,6 @@ public static String getResource(String resourceName, String subDirName, String private static native String getNativeResourceFromBundle(String resourceName, String subDirName, String type) throws FileNotFoundException; private static String getResourceFromBundle(String resourceName, String subDirName, String type) throws FileNotFoundException { - @SuppressWarnings("removal") - final SecurityManager security = System.getSecurityManager(); - if (security != null) security.checkPermission(new RuntimePermission("canReadBundle")); - final String resourceFromBundle = getNativeResourceFromBundle(resourceName, subDirName, type); if (resourceFromBundle == null) throw new FileNotFoundException(resourceName); return resourceFromBundle; @@ -353,9 +339,6 @@ private static String getResourceFromBundle(String resourceName, String subDirNa * @since Java for Mac OS X 10.5 Update 2 - 1.5 */ public static String getPathToApplicationBundle() { - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - if (security != null) security.checkPermission(new RuntimePermission("canReadBundle")); return getNativePathToApplicationBundle(); } diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java index 95cca2d3ea8be..a336f4278128d 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java @@ -123,7 +123,7 @@ public boolean printDialog() throws HeadlessException { return super.printDialog(attributes); } - return jobSetup(getPageable(), checkAllowedToPrintToFile()); + return jobSetup(getPageable()); } /** @@ -580,8 +580,8 @@ public boolean pageSetup(PageFormat page, Printable painter) { * dialog. * If the dialog is to use a set of attributes, useAttributes is true. */ - private boolean jobSetup(Pageable doc, boolean allowPrintToFile) { - CPrinterDialog printerDialog = new CPrinterJobDialog(null, this, doc, allowPrintToFile); + private boolean jobSetup(Pageable doc) { + CPrinterDialog printerDialog = new CPrinterJobDialog(null, this, doc); printerDialog.setVisible(true); boolean result = printerDialog.getRetVal(); printerDialog.dispose(); diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java index 562f0524f917b..129cc17b5154f 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java @@ -32,12 +32,10 @@ @SuppressWarnings("serial") // JDK implementation class final class CPrinterJobDialog extends CPrinterDialog { private Pageable fPageable; - private boolean fAllowPrintToFile; - CPrinterJobDialog(Frame parent, CPrinterJob printerJob, Pageable doc, boolean allowPrintToFile) { + CPrinterJobDialog(Frame parent, CPrinterJob printerJob, Pageable doc) { super(parent, printerJob); fPageable = doc; - fAllowPrintToFile = allowPrintToFile; } @Override diff --git a/src/java.desktop/share/classes/java/awt/Font.java b/src/java.desktop/share/classes/java/awt/Font.java index 3df4632f9d3b4..4de614737077e 100644 --- a/src/java.desktop/share/classes/java/awt/Font.java +++ b/src/java.desktop/share/classes/java/awt/Font.java @@ -36,7 +36,6 @@ import java.awt.peer.FontPeer; import java.io.File; import java.io.FileOutputStream; -import java.io.FilePermission; import java.io.IOException; import java.io.InputStream; import java.io.ObjectOutputStream; @@ -1231,13 +1230,6 @@ private static File checkFontFile(int fontFormat, File fontFile) fontFormat != Font.TYPE1_FONT) { throw new IllegalArgumentException ("font format not recognized"); } - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - FilePermission filePermission = - new FilePermission(fontFile.getPath(), "read"); - sm.checkPermission(filePermission); - } if (!fontFile.canRead()) { throw new IOException("Can't read " + fontFile); } diff --git a/src/java.desktop/share/classes/java/awt/Taskbar.java b/src/java.desktop/share/classes/java/awt/Taskbar.java index 8922c7380b0b7..2a46aca711653 100644 --- a/src/java.desktop/share/classes/java/awt/Taskbar.java +++ b/src/java.desktop/share/classes/java/awt/Taskbar.java @@ -177,19 +177,6 @@ private void checkFeatureSupport(Feature featureType){ } } - /** - * Calls to the security manager's {@code checkPermission} method with - * an {@code RuntimePermission("canProcessApplicationEvents")} permissions. - */ - private void checkEventsProcessingPermission(){ - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new RuntimePermission( - "canProcessApplicationEvents")); - } - } - private Taskbar() { Toolkit defaultToolkit = Toolkit.getDefaultToolkit(); if (defaultToolkit instanceof SunToolkit) { @@ -265,7 +252,6 @@ public static boolean isTaskbarSupported(){ * does not support the {@link Taskbar.Feature#USER_ATTENTION} feature */ public void requestUserAttention(final boolean enabled, final boolean critical) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.USER_ATTENTION); peer.requestUserAttention(enabled, critical); } @@ -282,7 +268,6 @@ public void requestUserAttention(final boolean enabled, final boolean critical) * does not support the {@link Taskbar.Feature#USER_ATTENTION_WINDOW} feature */ public void requestWindowUserAttention(Window w) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.USER_ATTENTION_WINDOW); peer.requestWindowUserAttention(w); } @@ -296,7 +281,6 @@ public void requestWindowUserAttention(Window w) { * does not support the {@link Taskbar.Feature#MENU} feature */ public void setMenu(final PopupMenu menu) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.MENU); peer.setMenu(menu); } @@ -309,7 +293,6 @@ public void setMenu(final PopupMenu menu) { * does not support the {@link Taskbar.Feature#MENU} feature */ public PopupMenu getMenu() { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.MENU); return peer.getMenu(); } @@ -322,7 +305,6 @@ public PopupMenu getMenu() { * does not support the {@link Taskbar.Feature#ICON_IMAGE} feature */ public void setIconImage(final Image image) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.ICON_IMAGE); peer.setIconImage(image); } @@ -339,7 +321,6 @@ public void setIconImage(final Image image) { * does not support the {@link Taskbar.Feature#ICON_IMAGE} feature */ public Image getIconImage() { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.ICON_IMAGE); return peer.getIconImage(); } @@ -360,7 +341,6 @@ public Image getIconImage() { * or {@link Taskbar.Feature#ICON_BADGE_TEXT} feature */ public void setIconBadge(final String badge) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.ICON_BADGE_NUMBER); peer.setIconBadge(badge); } @@ -380,7 +360,6 @@ public void setIconBadge(final String badge) { * does not support the {@link Taskbar.Feature#ICON_BADGE_IMAGE_WINDOW} feature */ public void setWindowIconBadge(Window w, final Image badge) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.ICON_BADGE_IMAGE_WINDOW); if (w != null) { peer.setWindowIconBadge(w, badge); @@ -396,7 +375,6 @@ public void setWindowIconBadge(Window w, final Image badge) { * does not support the {@link Taskbar.Feature#PROGRESS_VALUE} feature */ public void setProgressValue(int value) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.PROGRESS_VALUE); peer.setProgressValue(value); } @@ -426,7 +404,6 @@ public void setProgressValue(int value) { * does not support the {@link Taskbar.Feature#PROGRESS_VALUE_WINDOW} feature */ public void setWindowProgressValue(Window w, int value) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.PROGRESS_VALUE_WINDOW); if (w != null) { peer.setWindowProgressValue(w, value); @@ -458,7 +435,6 @@ public void setWindowProgressValue(Window w, int value) { * does not support the {@link Taskbar.Feature#PROGRESS_STATE_WINDOW} feature */ public void setWindowProgressState(Window w, State state) { - checkEventsProcessingPermission(); checkFeatureSupport(Feature.PROGRESS_STATE_WINDOW); if (w != null) { peer.setWindowProgressState(w, state); diff --git a/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java b/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java index 729d8123a2492..d4bae0d08ce18 100644 --- a/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java +++ b/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java @@ -39,7 +39,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.FilePermission; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; diff --git a/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java b/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java index abf6f471916e8..8ca6f8332f639 100644 --- a/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java +++ b/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java @@ -52,37 +52,6 @@ public abstract class AccessibilityProvider { * Initializes a new accessibility provider. */ protected AccessibilityProvider() { - // Use a permission check when calling a private constructor to check - // that the proper security permission has been granted before the - // {@code Object} superclass is called. If an exception is thrown before - // the {@code Object} superclass is constructed a finalizer in a - // subclass of this class will not be run. This protects against a - // finalizer vulnerability. - this(checkPermission()); - } - - /** - * Allows to check a permission before the {@code Object} is called. - * - * @param ignore unused stub to call a {@link #checkPermission()}} - */ - private AccessibilityProvider(Void ignore) { } - - /** - * If this code is running with a security manager and if the permission - * {@code "accessibilityProvider"} has not been granted - * {@code SecurityException} will be thrown. - * - * @return {@code null} if {@code SecurityException} was not thrown - * @throws SecurityException If a security manager has been installed and it - * denies {@link RuntimePermission} {@code "accessibilityProvider"} - */ - private static Void checkPermission() { - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkPermission(new RuntimePermission("accessibilityProvider")); - return null; } /** diff --git a/src/java.desktop/share/classes/javax/imageio/ImageIO.java b/src/java.desktop/share/classes/javax/imageio/ImageIO.java index f085383284ea9..8180145a8eae5 100644 --- a/src/java.desktop/share/classes/javax/imageio/ImageIO.java +++ b/src/java.desktop/share/classes/javax/imageio/ImageIO.java @@ -28,7 +28,6 @@ import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.File; -import java.io.FilePermission; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; @@ -170,50 +169,13 @@ private static String getTempDir() { /** * Determines whether the caller has write access to the cache * directory, stores the result in the {@code CacheInfo} object, - * and returns the decision. This method helps to prevent mysterious - * SecurityExceptions to be thrown when this convenience class is used - * in an applet, for example. + * and returns the decision. */ private static boolean hasCachePermission() { Boolean hasPermission = getCacheInfo().getHasPermission(); - if (hasPermission != null) { return hasPermission.booleanValue(); } else { - try { - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - if (security != null) { - File cachedir = getCacheDirectory(); - String cachepath; - - if (cachedir != null) { - cachepath = cachedir.getPath(); - } else { - cachepath = getTempDir(); - - if (cachepath == null || cachepath.isEmpty()) { - getCacheInfo().setHasPermission(Boolean.FALSE); - return false; - } - } - - // we have to check whether we can read, write, - // and delete cache files. - // So, compose cache file path and check it. - String filepath = cachepath; - if (!filepath.endsWith(File.separator)) { - filepath += File.separator; - } - filepath += "*"; - - security.checkPermission(new FilePermission(filepath, "read, write, delete")); - } - } catch (SecurityException e) { - getCacheInfo().setHasPermission(Boolean.FALSE); - return false; - } - getCacheInfo().setHasPermission(Boolean.TRUE); return true; } diff --git a/src/java.desktop/share/classes/sun/print/PrintJob2D.java b/src/java.desktop/share/classes/sun/print/PrintJob2D.java index 975c9c47d54ce..fbec484435f82 100644 --- a/src/java.desktop/share/classes/sun/print/PrintJob2D.java +++ b/src/java.desktop/share/classes/sun/print/PrintJob2D.java @@ -42,7 +42,6 @@ import java.awt.print.PrinterJob; import java.io.File; -import java.io.FilePermission; import java.io.IOException; import java.net.URI; @@ -351,7 +350,6 @@ private void initPrintJob2D(Frame frame, String doctitle, // Verify that the app has access to the file system DestinationType dest= this.jobAttributes.getDestination(); if (dest == DestinationType.FILE) { - throwPrintToFile(); // check if given filename is valid String destStr = jobAttributes.getFileName(); @@ -1264,17 +1262,4 @@ private void translateOutputProps() { props.setProperty(PAPERSIZE_PROP, str); } - private void throwPrintToFile() { - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - FilePermission printToFilePermission = null; - if (security != null) { - if (printToFilePermission == null) { - printToFilePermission = - new FilePermission("<>", "read,write"); - } - security.checkPermission(printToFilePermission); - } - } - } diff --git a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java index bf380873d2be5..4e096f506e5b9 100644 --- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java +++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java @@ -25,8 +25,6 @@ package sun.print; -import java.io.FilePermission; - import java.awt.Color; import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; @@ -256,11 +254,6 @@ public abstract class RasterPrinterJob extends PrinterJob { // MacOSX - made protected so subclasses can reference it. protected boolean userCancelled = false; - /** - * Print to file permission variables. - */ - private FilePermission printToFilePermission; - /** * List of areas & the graphics state for redrawing */ @@ -2501,37 +2494,6 @@ protected void initPrinterGraphics(Graphics2D g, Rectangle2D clip) { g.setPaint(Color.black); } - - /** - * User dialogs should disable "File" buttons if this returns false. - * - */ - public boolean checkAllowedToPrintToFile() { - try { - throwPrintToFile(); - return true; - } catch (SecurityException e) { - return false; - } - } - - /** - * Break this out as it may be useful when we allow API to - * specify printing to a file. In that case its probably right - * to throw a SecurityException if the permission is not granted - */ - private void throwPrintToFile() { - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - if (security != null) { - if (printToFilePermission == null) { - printToFilePermission = - new FilePermission("<>", "read,write"); - } - security.checkPermission(printToFilePermission); - } - } - /* On-screen drawString renders most control chars as the missing glyph * and have the non-zero advance of that glyph. * Exceptions are \t, \n and \r which are considered zero-width. diff --git a/src/java.desktop/share/classes/sun/print/ServiceDialog.java b/src/java.desktop/share/classes/sun/print/ServiceDialog.java index ae2c787ce3606..ba530bbf58fb8 100644 --- a/src/java.desktop/share/classes/sun/print/ServiceDialog.java +++ b/src/java.desktop/share/classes/sun/print/ServiceDialog.java @@ -46,7 +46,6 @@ import java.awt.event.WindowAdapter; import java.awt.print.PrinterJob; import java.io.File; -import java.io.FilePermission; import java.io.IOException; import java.net.URI; import java.net.URL; @@ -680,14 +679,12 @@ private class PrintServicePanel extends JPanel implements ActionListener, ItemListener, PopupMenuListener { private final String strTitle = getMsg("border.printservice"); - private FilePermission printToFilePermission; private JButton btnProperties; private JCheckBox cbPrintToFile; private JComboBox cbName; private JLabel lblType, lblStatus, lblInfo; private ServiceUIFactory uiFactory; private boolean changedService = false; - private boolean filePermission; public PrintServicePanel() { super(); @@ -744,8 +741,6 @@ public PrintServicePanel() { c.gridwidth = GridBagConstraints.REMAINDER; cbPrintToFile = createCheckBox("checkbox.printtofile", this); addToGB(cbPrintToFile, this, gridbag, c); - - filePermission = allowedToPrintToFile(); } public boolean isPrintToFileSelected() { @@ -873,37 +868,13 @@ public void popupMenuCanceled(PopupMenuEvent e) { * We disable the "Print To File" checkbox if this returns false */ private boolean allowedToPrintToFile() { - try { - throwPrintToFile(); - return true; - } catch (SecurityException e) { - return false; - } - } - - /** - * Break this out as it may be useful when we allow API to - * specify printing to a file. In that case its probably right - * to throw a SecurityException if the permission is not granted. - */ - private void throwPrintToFile() { - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - if (security != null) { - if (printToFilePermission == null) { - printToFilePermission = - new FilePermission("<>", "read,write"); - } - security.checkPermission(printToFilePermission); - } + return true; } public void updateInfo() { Class dstCategory = Destination.class; boolean dstSupported = false; boolean dstSelected = false; - boolean dstAllowed = filePermission ? - allowedToPrintToFile() : false; // setup Destination (print-to-file) widgets Destination dst = (Destination)asCurrent.get(dstCategory); @@ -923,9 +894,8 @@ public void updateInfo() { dstSupported = true; } } - cbPrintToFile.setEnabled(dstSupported && dstAllowed); - cbPrintToFile.setSelected(dstSelected && dstAllowed - && dstSupported); + cbPrintToFile.setEnabled(dstSupported); + cbPrintToFile.setSelected(dstSelected && dstSupported); // setup PrintService information widgets Attribute type = psCurrent.getAttribute(PrinterMakeAndModel.class); diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java index 85b4866e2323a..0d41aacde2f8a 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java @@ -98,7 +98,6 @@ import sun.print.ServiceDialog; import java.awt.Frame; -import java.io.FilePermission; import sun.java2d.Disposer; import sun.java2d.DisposerRecord; @@ -1906,23 +1905,6 @@ private int getMediaTrayAttrib() { return mAttMediaTray; } - - - private boolean getPrintToFileEnabled() { - @SuppressWarnings("removal") - SecurityManager security = System.getSecurityManager(); - if (security != null) { - FilePermission printToFilePermission = - new FilePermission("<>", "read,write"); - try { - security.checkPermission(printToFilePermission); - } catch (SecurityException e) { - return false; - } - } - return true; - } - private void setNativeAttributes(int flags, int fields, int values) { if (attributes == null) { return; diff --git a/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp b/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp index 8f2dcf21caa39..a8a20789eec4a 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp @@ -72,7 +72,6 @@ jmethodID AwtPrintControl::getMinPageID; jmethodID AwtPrintControl::getCollateID; jmethodID AwtPrintControl::getOrientID; jmethodID AwtPrintControl::getQualityID; -jmethodID AwtPrintControl::getPrintToFileEnabledID; jmethodID AwtPrintControl::getPrinterID; jmethodID AwtPrintControl::setPrinterID; jmethodID AwtPrintControl::getResID; @@ -369,11 +368,6 @@ void AwtPrintControl::initIDs(JNIEnv *env, jclass cls) DASSERT(AwtPrintControl::getSelectID != NULL); CHECK_NULL(AwtPrintControl::getSelectID); - AwtPrintControl::getPrintToFileEnabledID = - env->GetMethodID(cls, "getPrintToFileEnabled", "()Z"); - DASSERT(AwtPrintControl::getPrintToFileEnabledID != NULL); - CHECK_NULL(AwtPrintControl::getPrintToFileEnabledID); - AwtPrintControl::setNativeAttID = env->GetMethodID(cls, "setNativeAttributes", "(III)V"); DASSERT(AwtPrintControl::setNativeAttID != NULL); @@ -809,11 +803,6 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env, pd.Flags |= selectType; } - if (!env->CallBooleanMethod(printCtrl, - AwtPrintControl::getPrintToFileEnabledID)) { - pd.Flags |= PD_DISABLEPRINTTOFILE; - } - if (pd.hDevMode != NULL) { DEVMODE *devmode = (DEVMODE *)::GlobalLock(pd.hDevMode); DASSERT(!IsBadWritePtr(devmode, sizeof(DEVMODE))); diff --git a/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h b/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h index bc782c41469ff..d3a77babb2ef6 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h +++ b/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h @@ -63,7 +63,6 @@ class AwtPrintControl { static jmethodID getCollateID; static jmethodID getOrientID; static jmethodID getQualityID; - static jmethodID getPrintToFileEnabledID; static jmethodID getPrinterID; static jmethodID setPrinterID; static jmethodID getResID;