Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346314 - Printer.checkNull destructively modifies the user's PrinterData
Summary: Printer.checkNull destructively modifies the user's PrinterData
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Carolyn MacLeod CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-18 14:13 EDT by Carolyn MacLeod CLA
Modified: 2019-11-14 02:19 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2011-05-18 14:13:08 EDT
In Printer.checkNull(data) the 2 lines:
		data.driver = defaultPrinter.driver;
		data.name = defaultPrinter.name;		
destructively modify the PrinterData that is passed in.
This should not happen.
The only way to avoid this is to have a copy/clone method in PrinterData, and keep a copy of the data that is passed in to the Printer constructor.
Comment 1 Carolyn MacLeod CLA 2011-05-18 14:30:08 EDT
See also bug 297957, which requests a public copy method.
(But not a "clone" method - see bug 4740).
See also bug 315932, for more background, and a case in StyledText that was failing because Printer does not keep a copy of the user's PrinterData.
All Printer/PrintDialog javadoc should be reviewed and fixed up if necessary, to explicitly state whether a copy of the PrinterData is used or not.
Comment 2 Lars Vogel CLA 2019-11-14 02:19:09 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.