Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod2001-09-10 19:42:40 +0000
committerCarolyn MacLeod2001-09-10 19:42:40 +0000
commitac05b6199f666ed9c624db0b5527d6efde6a5a2f (patch)
tree0d9d96ae45bdc4cbf2512c7c5bec66d3be70c163
parent7387a87791e42194bbd1d0c59aa0e24483dae3b9 (diff)
downloadeclipse.platform.swt-ac05b6199f666ed9c624db0b5527d6efde6a5a2f.tar.gz
eclipse.platform.swt-ac05b6199f666ed9c624db0b5527d6efde6a5a2f.tar.xz
eclipse.platform.swt-ac05b6199f666ed9c624db0b5527d6efde6a5a2f.zip
Do not walkback if there are no printers
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java14
1 files changed, 3 insertions, 11 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java
index a59c5d6b84..33267dc032 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java
@@ -64,16 +64,12 @@ public final class Printer extends Device {
* Returns an array of <code>PrinterData</code> objects
* representing all available printers.
*
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
* @return the list of available printers
*/
public static PrinterData[] getPrinterList() {
byte[] buf = new byte[1024];
int n = OS.GetProfileString(profile, null, new byte[] {0}, buf, buf.length);
- if (n == 0) SWT.error(SWT.ERROR_UNSPECIFIED);
+ if (n == 0) return new PrinterData[0];
byte[][] deviceNames = new byte[5][];
int nameCount = 0;
int index = 0;
@@ -112,17 +108,13 @@ public static PrinterData[] getPrinterList() {
* Returns a <code>PrinterData</code> object representing
* the default printer.
*
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_UNSPECIFIED - if there are no valid printers
- * </ul>
- *
- * @return the default printer
+ * @return the default printer or null if there is no default printer
*/
static PrinterData getDefaultPrinterData() {
byte [] deviceName = null;
byte[] buf = new byte[1024];
int n = OS.GetProfileString(appName, keyName, new byte[] {0}, buf, buf.length);
- if (n == 0) SWT.error(SWT.ERROR_UNSPECIFIED);
+ if (n == 0) return null;
int commaIndex = 0;
while(buf[commaIndex] != ',' && commaIndex < buf.length) commaIndex++;
if (commaIndex < buf.length) {

Back to the top