[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] [9] RFR JDK-6218397:Printing to file does not throw a PrinterException if the f
From:       Jayathirth D V <jayathirth.d.v () oracle ! com>
Date:       2016-06-30 10:16:28
Message-ID: 16e22c79-d151-4522-9b2c-502ed6b7c268 () default
[Download RAW message or body]

Hi Prasanta,

  

Changes are fine.

  

Thanks,

Jay

  

From: Prasanta Sadhukhan 
Sent: Thursday, June 30, 2016 3:19 PM
To: Jayathirth D V; Philip Race
Cc: 2d-dev@openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] [9] RFR JDK-6218397:Printing to file does not throw a \
PrinterException if the file cannot be created

  

Hi Jay,

Yes, we can do that.
Updated webrev:
http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.05/

Regards
Prasanta

On 6/30/2016 3:09 PM, Jayathirth D V wrote:

Hi Prasanta,

  

I think we can use same abortDoc() functionality in "endDoc() -> \
mPSStream.checkError()" case as it is used in startDoc().

In abortDoc() we are closing mPSStream and deleting the spoolfile. Otherwise it will \
be a redundant code.

  

Like :

if (mPSStream.checkError()) {

                               abortDoc();

throw new PrinterException("Error while writing to file");

}

  

Thanks,

Jay

From: Prasanta Sadhukhan 
Sent: Thursday, June 30, 2016 10:35 AM
To: Philip Race; Jayathirth D V
Cc: HYPERLINK "mailto:2d-dev@openjdk.java.net"2d-dev@openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] [9] RFR JDK-6218397:Printing to file does not throw a \
PrinterException if the file cannot be created

  

Thanks Phil.
@Jay, can you please review this updated webrev \
http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.04/  that takes care of this \
syntactic changes?

Regards
Prasanta

On 6/29/2016 11:01 PM, Philip Race wrote:

 if (f.exists()) f.delete();
should use { ... } for the body - 2 cases of this one in each
of the modified files.
  
Other than that OK. I don't need to see an updated webrev
so long as you make those syntactic changes.
  
  
-phil



On 6/23/16, 3:40 AM, Prasanta Sadhukhan wrote: 

Hi Phil, All,

Based on the offline discussion, I added the case when disk gets filled while writing \
to the file.  Since PrintStream does not throw IOException, I added check for \
checkError() to do the corresponding error handling. I added it after flush() as that \
is where the stream will be written to the file. HYPERLINK \
"http://cr.openjdk.java.net/%7Epsadhukhan/6218397/webrev.03/"http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.03/


Regards
Prasanta

On 6/20/2016 12:01 PM, prasanta sadhukhan wrote:

Hi Phil,All,

Added file delete in another case where we throw PrinterException.
HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/6218397/webrev.02/"http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.02/


Regards
Prasanta

On 6/16/2016 1:40 PM, prasanta sadhukhan wrote:

Modified webrev to close output stream.

HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/6218397/webrev.01/"http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.01/


Regards
Prasanta

On 6/15/2016 9:52 PM, Philip Race wrote:

If this is executed on Windows (shared Postscript stream printer could do this)
then since the output stream is still open I expect the delete will fail.
Attempt to close the open stream first (in a try .. catch I suppose).

-phil.

On 6/15/16, 3:25 AM, prasanta sadhukhan wrote: 

Hi All,

Bug: https://bugs.openjdk.java.net/browse/JDK-6218397

The issue was if the linux disk is full and we are trying to "print to file" then \
PrinterException is not thrown and a 0 byte file is created.

Although I am not able to reproduce this behaviour, because when I make my disk full \
and try to run "java", I get

Java HotSpot(TM) Server VM warning: Insufficient space for shared memory file:
     13783
Try using the -Djava.io.tmpdir= option to select an alternate temp location.

but on investigating this, I see that we are calling f.createNewFile() in \
RasterPrinterJob#validateDestination() which creates a new, empty file

but if there is any exception in PSPrinterJob#startDoc this file is not deleted. 

Modified the code to make sure if there is any exception, delete the file.

HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/6218397/webrev.00/"http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.00/


Regards
Prasanta

  

  

  

  

  

  


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;
	color:black;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;
	color:black;}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";
	color:black;}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:Consolas;
	color:black;}
span.new
	{mso-style-name:new;}
span.EmailStyle21
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:#1F497D;}
span.EmailStyle22
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue \
vlink=purple><div class=WordSection1><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Hi \
Prasanta,<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Changes are \
fine.<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Thanks,<o:p></o:p></span></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Jay<o:p></o:p></span></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div \
style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p \
class=MsoNormal><b><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'>From:</span></b><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'> Prasanta \
Sadhukhan <br><b>Sent:</b> Thursday, June 30, 2016 3:19 PM<br><b>To:</b> Jayathirth D \
V; Philip Race<br><b>Cc:</b> 2d-dev@openjdk.java.net<br><b>Subject:</b> Re: [OpenJDK \
2D-Dev] [9] RFR JDK-6218397:Printing to file does not throw a PrinterException if the \
file cannot be created<o:p></o:p></span></p></div></div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Hi Jay,<br><br>Yes, we can do \
that.<br>Updated webrev:<br><a \
href="http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.05/">http://cr.openjdk.jav \
a.net/~psadhukhan/6218397/webrev.05/</a><br><br>Regards<br>Prasanta<o:p></o:p></p><div><p \
class=MsoNormal>On 6/30/2016 3:09 PM, Jayathirth D V \
wrote:<o:p></o:p></p></div><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Hi \
Prasanta,</span><o:p></o:p></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>&nbsp;</span><o:p></o:p></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>I think we \
can use same abortDoc() functionality in "endDoc() -&gt; mPSStream.checkError()" case \
as it is used in startDoc().</span><o:p></o:p></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>In abortDoc() \
we are closing mPSStream and deleting the spoolfile. Otherwise it will be a redundant \
code.</span><o:p></o:p></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>&nbsp;</span><o:p></o:p></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Like \
:</span><o:p></o:p></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>if \
(mPSStream.checkError()) {</span><o:p></o:p></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
abortDoc();</span><o:p></o:p></p><p class=MsoNormal style='text-indent:.5in'><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>throw new \
PrinterException(&quot;Error while writing to file&quot;);</span><o:p></o:p></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>}</span><o:p></o:p></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>&nbsp;</span><o:p></o:p></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Thanks,</span><o:p></o:p></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Jay</span><o:p></o:p></p><div><div \
style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p \
class=MsoNormal><b><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'>From:</span></b><span \
style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'> Prasanta \
Sadhukhan <br><b>Sent:</b> Thursday, June 30, 2016 10:35 AM<br><b>To:</b> Philip \
Race; Jayathirth D V<br><b>Cc:</b> <a \
href="mailto:2d-dev@openjdk.java.net">2d-dev@openjdk.java.net</a><br><b>Subject:</b> \
Re: [OpenJDK 2D-Dev] [9] RFR JDK-6218397:Printing to file does not throw a \
PrinterException if the file cannot be created</span><o:p></o:p></p></div></div><p \
class=MsoNormal>&nbsp;<o:p></o:p></p><p class=MsoNormal>Thanks Phil.<br>@Jay, can you \
please review this updated webrev <a \
href="http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.04/">http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.04/</a> \
<br>that takes care of this syntactic \
changes?<br><br>Regards<br>Prasanta<o:p></o:p></p><div><p class=MsoNormal>On \
6/29/2016 11:01 PM, Philip Race wrote:<o:p></o:p></p></div><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span class=new> if (f.exists()) \
f.delete();</span><o:p></o:p></pre><pre><span class=new>should use { ... } for the \
body - 2 cases of this one in each</span><o:p></o:p></pre><pre><span class=new>of the \
modified files.</span><o:p></o:p></pre><pre><span \
class=new>&nbsp;</span><o:p></o:p></pre><pre><span class=new>Other than that OK. I \
don't need to see an updated webrev</span><o:p></o:p></pre><pre><span class=new>so \
long as you make those syntactic changes.</span><o:p></o:p></pre><pre><span \
class=new>&nbsp;</span><o:p></o:p></pre><pre><span \
class=new>&nbsp;</span><o:p></o:p></pre><pre><span \
class=new>-phil</span><o:p></o:p></pre><p class=MsoNormal><br><br>On 6/23/16, 3:40 \
AM, Prasanta Sadhukhan wrote: <o:p></o:p></p><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal>Hi Phil, \
All,<br><br>Based on the offline discussion, I added the case when disk gets filled \
while writing to the file. <br>Since PrintStream does not throw IOException, I added \
check for checkError() to do the corresponding error handling. I added it after \
flush() as that is where the stream will be written to the file.<br><a \
href="http://cr.openjdk.java.net/%7Epsadhukhan/6218397/webrev.03/">http://cr.openjdk.j \
ava.net/~psadhukhan/6218397/webrev.03/</a><br><br>Regards<br>Prasanta<o:p></o:p></p><div><p \
class=MsoNormal>On 6/20/2016 12:01 PM, prasanta sadhukhan \
wrote:<o:p></o:p></p></div><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><p>Hi Phil,All,<o:p></o:p></p><p \
class=MsoNormal>Added file delete in another case where we throw \
PrinterException.<br><a \
href="http://cr.openjdk.java.net/%7Epsadhukhan/6218397/webrev.02/">http://cr.openjdk.j \
ava.net/~psadhukhan/6218397/webrev.02/</a><br><br>Regards<br>Prasanta<o:p></o:p></p><div><p \
class=MsoNormal>On 6/16/2016 1:40 PM, prasanta sadhukhan \
wrote:<o:p></o:p></p></div><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><p>Modified webrev to close output \
stream.<o:p></o:p></p><p class=MsoNormal><a \
href="http://cr.openjdk.java.net/%7Epsadhukhan/6218397/webrev.01/">http://cr.openjdk.j \
ava.net/~psadhukhan/6218397/webrev.01/</a><br><br>Regards<br>Prasanta<o:p></o:p></p><div><p \
class=MsoNormal>On 6/15/2016 9:52 PM, Philip Race \
wrote:<o:p></o:p></p></div><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal>If this is executed \
on Windows (shared Postscript stream printer could do this)<br>then since the output \
stream is still open I expect the delete will fail.<br>Attempt to close the open \
stream first (in a try .. catch I suppose).<br><br>-phil.<br><br>On 6/15/16, 3:25 AM, \
prasanta sadhukhan wrote: <o:p></o:p></p><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><p>Hi All,<o:p></o:p></p><p>Bug: <a \
href="https://bugs.openjdk.java.net/browse/JDK-6218397">https://bugs.openjdk.java.net/browse/JDK-6218397</a><o:p></o:p></p><p>The \
issue was if the linux disk is full and we are trying to &quot;print to file&quot; \
then PrinterException is not thrown and a 0 byte file is \
created.<o:p></o:p></p><p>Although I am not able to reproduce this behaviour, because \
when I make my disk full and try to run &quot;java&quot;, I \
get<o:p></o:p></p><p><i>Java HotSpot(TM) Server VM warning: Insufficient space for \
shared memory file:<br>&nbsp;&nbsp; 13783<br>Try using the -Djava.io.tmpdir= option \
to select an alternate temp location.</i><o:p></o:p></p><p>but on investigating this, \
I see that we are calling f.createNewFile() in RasterPrinterJob#validateDestination() \
which creates a new, empty file<o:p></o:p></p><p>but if there is any exception in \
PSPrinterJob#startDoc this file is not deleted. <o:p></o:p></p><p>Modified the code \
to make sure if there is any exception, delete the file.<o:p></o:p></p><p><a \
href="http://cr.openjdk.java.net/%7Epsadhukhan/6218397/webrev.00/">http://cr.openjdk.java.net/~psadhukhan/6218397/webrev.00/</a><o:p></o:p></p><p \
class=MsoNormal>Regards<br>Prasanta<o:p></o:p></p><p>&nbsp;<o:p></o:p></p></blockquote></blockquote><p \
class=MsoNormal>&nbsp;<o:p></o:p></p></blockquote><p \
class=MsoNormal>&nbsp;<o:p></o:p></p></blockquote><p \
class=MsoNormal>&nbsp;<o:p></o:p></p></blockquote></blockquote><p \
class=MsoNormal>&nbsp;<o:p></o:p></p></blockquote><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic