[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-2d-dev
Subject: Re: [OpenJDK 2D-Dev] [9] RFR JDK-8025439: [TEST BUG] [macosx] PrintServiceLookup.lookupPrintServices
From: Philip Race <philip.race () oracle ! com>
Date: 2016-11-30 16:46:00
Message-ID: 583F0248.9010505 () oracle ! com
[Download RAW message or body]
+1
-phil.
On 11/30/16, 2:19 AM, Prasanta Sadhukhan wrote:
> Please find the modifed the webrev as per review comments
> http://cr.openjdk.java.net/~psadhukhan/8025439/webrev.02/
>
> Regards
> Prasanta
> On 11/30/2016 1:04 AM, Phil Race wrote:
> > Leaving aside platform printer naming conventions and the like, it
> > seems that
> > PrintService.getName() returns "Rich Aficio" but then when
> > the test does new PrinterName("Rich Aficio") and try to locate a printer
> > with that name it says "no such printer" ?
> >
> > Yes, that is possible since PrinterName is allowed to be different
> > than PrintService.getName() :-
> > https://docs.oracle.com/javase/8/docs/api/javax/print/PrintService.html#getName--
> > so this strictly a test bug.
> >
> > So it seems to me that what the test should be doing is
> > querying the PrinterName attribute on the service and then
> > using the string obtained from there to initialise the PrinterName
> > used in the lookup.
> >
> > -phil.
> >
> >
> > On 11/16/2016 12:53 AM, Ajit Ghaisas wrote:
> > >
> > > The test should not worry about linux/solaris future change. If
> > > there is any change, we will get to know with test failure.
> > >
> > > Change is OK.
> > >
> > > Please update the year in banner & add this bug id in jtreg @bug tag
> > > before pushing.
> > >
> > > Regards,
> > >
> > > Ajit
> > >
> > > *From:*Prasanta Sadhukhan
> > > *Sent:* Wednesday, November 16, 2016 11:55 AM
> > > *To:* Ajit Ghaisas; Philip Race; 2d-dev
> > > *Subject:* Re: [OpenJDK 2D-Dev] [9] RFR JDK-8025439: [TEST BUG]
> > > [macosx] PrintServiceLookup.lookupPrintServices doesn't work
> > > properly since jdk8b105
> > >
> > > It can be done that way and it will solve this specific problem but
> > > I did !Windows because even though linux/solaris GUI does not
> > > support spaces as of now, GUI is easy to change and can accomodate
> > > spaces in near future
> > > but CUPS library will not accomodate the spaces so it might fail in
> > > linux/solaris then.
> > > Anyways, I am ok with making this mac specific
> > > http://cr.openjdk.java.net/~psadhukhan/8025439/webrev.01/
> > > <http://cr.openjdk.java.net/%7Epsadhukhan/8025439/webrev.01/>
> > >
> > > Regards
> > > Prasanta
> > >
> > > On 11/15/2016 4:11 PM, Ajit Ghaisas wrote:
> > >
> > > If we know that exceptional behavior (service name containing
> > > spaces) is only limited to Mac, then the check in test should be
> > > only Mac specific and not (!windows).
> > >
> > > Regards,
> > >
> > > Ajit
> > >
> > > *From:*Prasanta Sadhukhan
> > > *Sent:* Tuesday, November 15, 2016 12:32 PM
> > > *To:* Phil Race; 2d-dev
> > > *Subject:* Re: [OpenJDK 2D-Dev] [9] RFR JDK-8025439: [TEST BUG]
> > > [macosx] PrintServiceLookup.lookupPrintServices doesn't work
> > > properly since jdk8b105
> > >
> > > On 11/15/2016 4:39 AM, Phil Race wrote:
> > >
> > > This evaluation needs to go in the bug report, not (just) here.
> > >
> > > mac. shows spaces in the name in its GUI but "_" in the
> > > names reported by lpstat
> > > so it may be that the replacement is right but I'd still
> > > like to dig a bit here.
> > > Can you point to the code that does the " "->"_"
> > > replacement. I can't see it
> > > in CUPSPrinter.getAllPrinters().
> > >
> > > As per
> > > http://hg.openjdk.java.net/jdk9/client/jdk/file/449518f6a468/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java#l425
> > > it gets the response from CUPS server and the printer names
> > > obtained from server is stored in jdk. In my case, even though I
> > > specified "Ricoh Aficio..." in GUI
> > > the "nameStr" obtained from CUPS responseMap is "Ricoh_Aficio..."
> > >
> > >
> > > And you saying that
> > >
> > > PrintServiceLookup.lookupPrintServices(null, null)
> > >
> > > will return an array with a "null" element ?
> > >
> > > No, sorry to "eat-up words". What I meant to say,
> > > lookupPrintServices(null, attributes) returns array with 0
> > > elements as checkPrinterName() return false [as user is asking
> > > to find "Ricoh Aficio" and not "Ricoh_Aficio"]
> > > resulting in getServiceByName() returning null
> > > which in turn causes lookByName() in the testcase to return null
> > >
> > > Regards
> > >
> > > Prasanta
> > >
> > > That would be a bug.
> > >
> > > -phil.
> > >
> > > On 11/14/2016 02:18 AM, Prasanta Sadhukhan wrote:
> > >
> > > Hi All,
> > >
> > > Please review a small bugfix whereby it is seen that if
> > > we specify printer with space in its name, then
> > > javax/print/PrintServiceLookup/GetPrintServices.java
> > > fails citing NPE.
> > >
> > > Bug: https://bugs.openjdk.java.net/browse/JDK-8025439
> > > webrev:
> > > http://cr.openjdk.java.net/~psadhukhan/8025439/webrev.00/ \
> > > <http://cr.openjdk.java.net/%7Epsadhukhan/8025439/webrev.00/>
> > > The NPE happens because
> > > http://hg.openjdk.java.net/jdk9/client/jdk/file/b1543c5eb8af/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java#l460
> > > calls checkPrinterName() which checks it name contains
> > > letter or digit
> > > http://hg.openjdk.java.net/jdk9/client/jdk/file/b1543c5eb8af/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java#l433
> > > and returns null if has spaces
> > > so lookupPrintServices() gets null
> > >
> > > Now, if we remove this <space> check then also, it will
> > > not work as
> > > In system running with CUPS, refreshServices calls
> > > CUPSPrinter#getAllPrinters() which returns a set of
> > > printers. It seems it replaces " " with "_" when
> > > populating the list
> > > for e.g Ricoh Aficio MP 5002 printer name is sent as
> > > Ricoh_Aficio_MP_5002 and stored in the list so we cannot
> > > have <space> in printer name.
> > >
> > > In Mac, it takes <sp> in printer name when we add
> > > printers but in linux, solaris it does not allow spaces
> > > in printer name during addition
> > > so in the proposed fix, a check for <sp> is added to
> > > make it automatic pass for non-windows (CUPS) system.
> > >
> > > Regards
> > > Prasanta
> > >
> > >
> > >
> >
>
[Attachment #3 (text/html)]
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
+1<br>
<br>
-phil.<br>
<br>
On 11/30/16, 2:19 AM, Prasanta Sadhukhan wrote:
<blockquote
cite="mid:99fc40a8-b364-f070-0894-d7ff06ed27ad@oracle.com"
type="cite">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
Please find the modifed the webrev as per review comments<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://cr.openjdk.java.net/%7Epsadhukhan/8025439/webrev.02/">http://cr.openjdk.java.net/~psadhukhan/8025439/webrev.02/</a><br>
<br>
Regards<br>
Prasanta<br>
<div class="moz-cite-prefix">On 11/30/2016 1:04 AM, Phil Race
wrote:<br>
</div>
<blockquote
cite="mid:7dd58912-2798-e1ea-e2a9-2d5d22199356@oracle.com"
type="cite">
<meta content="text/html; charset=UTF-8"
http-equiv="Content-Type">
Leaving aside platform printer naming conventions and the like,
it seems that<br>
PrintService.getName() returns "Rich Aficio" but then when<br>
the test does new PrinterName("Rich Aficio") and try to locate a
printer<br>
with that name it says "no such printer" ?<br>
<br>
Yes, that is possible since PrinterName is allowed to be
different than PrintService.getName() :-<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://docs.oracle.com/javase/8/docs/api/javax/print/PrintService.html#getName" \
>https://docs.oracle.com/javase/8/docs/api/javax/print/PrintService.html#getName</a>--<br>
>
so this strictly a test bug.<br>
<br>
So it seems to me that what the test should be doing is<br>
querying the PrinterName attribute on the service and then<br>
using the string obtained from there to initialise the
PrinterName<br>
used in the lookup.<br>
<br>
-phil.<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/16/2016 12:53 AM, Ajit
Ghaisas wrote:<br>
</div>
<blockquote
cite="mid:e259c815-4c4b-4fca-865e-a96f40f5ed30@default"
type="cite">
<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.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle21
{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]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The
test should not worry about linux/solaris future change.
If there is any change, we will get to know with test
failure.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> \
</o:p></span></p> <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Change
is OK.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Please
update the year in banner & add this bug id in jtreg
@bug tag before pushing.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> \
</o:p></span></p> <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Ajit<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> \
</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> Wednesday, November 16, 2016 11:55 AM<br>
<b>To:</b> Ajit Ghaisas; Philip Race; 2d-dev<br>
<b>Subject:</b> Re: [OpenJDK 2D-Dev] [9] RFR
JDK-8025439: [TEST BUG] [macosx]
PrintServiceLookup.lookupPrintServices doesn't work
properly since jdk8b105<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It can be done that way and it will
solve this specific problem but I did !Windows because
even though linux/solaris GUI does not support spaces as
of now, GUI is easy to change and can accomodate spaces in
near future<br>
but CUPS library will not accomodate the spaces so it
might fail in linux/solaris then.<br>
Anyways, I am ok with making this mac specific<br>
<a moz-do-not-send="true"
href="http://cr.openjdk.java.net/%7Epsadhukhan/8025439/webrev.01/">http://cr.openjdk.java.net/~psadhukhan/8025439/webrev.01/</a><br>
<br>
Regards<br>
Prasanta<o:p></o:p></p>
<div>
<p class="MsoNormal">On 11/15/2016 4:11 PM, Ajit Ghaisas
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">If
we know that exceptional behavior (service name
containing spaces) is only limited to Mac, then the
check in test should be only Mac specific and not
(!windows).</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">Regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Ajit</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> <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> Tuesday, November 15, 2016 12:32 PM<br>
<b>To:</b> Phil Race; 2d-dev<br>
<b>Subject:</b> Re: [OpenJDK 2D-Dev] [9] RFR
JDK-8025439: [TEST BUG] [macosx]
PrintServiceLookup.lookupPrintServices doesn't
work properly since jdk8b105</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p> <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal">On 11/15/2016 4:39 AM, Phil Race
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt">This
evaluation needs to go in the bug report, not (just)
here.<br>
<br>
mac. shows spaces in the name in its GUI but "_" in
the names reported by lpstat<br>
so it may be that the replacement is right but I'd
still like to dig a bit here.<br>
Can you point to the code that does the " "->"_"
replacement. I can't see it<br>
in CUPSPrinter.getAllPrinters().<o:p></o:p></p>
</blockquote>
<p class="MsoNormal">As per <a moz-do-not-send="true"
href="http://hg.openjdk.java.net/jdk9/client/jdk/file/449518f6a468/src/java.desktop/un \
ix/classes/sun/print/CUPSPrinter.java#l425">http://hg.openjdk.java.net/jdk9/client/jdk \
/file/449518f6a468/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java#l425</a><br>
it gets the response from CUPS server and the printer
names obtained from server is stored in jdk. In my case,
even though I specified "Ricoh Aficio..." in GUI<br>
the "nameStr" obtained from CUPS responseMap is
"Ricoh_Aficio..."<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">And you saying that <o:p></o:p></p>
<pre>PrintServiceLookup.lookupPrintServices(null, \
null)<o:p></o:p></pre> <p class="MsoNormal" style="margin-bottom:12.0pt">will
return an array with a "null" element ?<o:p></o:p></p>
</blockquote>
<p class="MsoNormal">No, sorry to "eat-up words". What I
meant to say, lookupPrintServices(null, attributes)
returns array with 0 elements as checkPrinterName()
return false [as user is asking to find "Ricoh Aficio"
and not "Ricoh_Aficio"]<br>
resulting in getServiceByName() returning null<br>
which in turn causes lookByName() in the testcase to
return null<o:p></o:p></p>
<pre>Regards<o:p></o:p></pre>
<pre>Prasanta<o:p></o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt">That
would be a bug.<br>
<br>
-phil.<o:p></o:p></p>
<div>
<p class="MsoNormal">On 11/14/2016 02:18 AM, Prasanta
Sadhukhan wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>Hi All,<o:p></o:p></p>
<p class="MsoNormal">Please review a small bugfix
whereby it is seen that if we specify printer with
space in its name, then <br>
javax/print/PrintServiceLookup/GetPrintServices.java
fails citing NPE.<br>
<br>
Bug: <a moz-do-not-send="true"
\
href="https://bugs.openjdk.java.net/browse/JDK-8025439">https://bugs.openjdk.java.net/browse/JDK-8025439</a><br>
webrev: <a moz-do-not-send="true"
\
href="http://cr.openjdk.java.net/%7Epsadhukhan/8025439/webrev.00/">http://cr.openjdk.java.net/~psadhukhan/8025439/webrev.00/</a><br>
<br>
The NPE happens because<br>
<a moz-do-not-send="true"
href="http://hg.openjdk.java.net/jdk9/client/jdk/file/b1543c5eb8af/src/java.desktop/un \
ix/classes/sun/print/PrintServiceLookupProvider.java#l460">http://hg.openjdk.java.net/ \
jdk9/client/jdk/file/b1543c5eb8af/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java#l460</a><br>
calls checkPrinterName() which checks it name
contains letter or digit<br>
<a moz-do-not-send="true"
href="http://hg.openjdk.java.net/jdk9/client/jdk/file/b1543c5eb8af/src/java.desktop/un \
ix/classes/sun/print/PrintServiceLookupProvider.java#l433">http://hg.openjdk.java.net/ \
jdk9/client/jdk/file/b1543c5eb8af/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java#l433</a><br>
and returns null if has spaces<br>
so lookupPrintServices() gets null<br>
<br>
Now, if we remove this <space> check then
also, it will not work as<br>
In system running with CUPS, refreshServices calls
CUPSPrinter#getAllPrinters() which returns a set of
printers. It seems it replaces " " with "_" when
populating the list<br>
for e.g Ricoh Aficio MP 5002 printer name is sent as
Ricoh_Aficio_MP_5002 and stored in the list so we
cannot have <space> in printer name.<br>
<br>
In Mac, it takes <sp> in printer name when we
add printers but in linux, solaris it does not allow
spaces in printer name during addition<br>
so in the proposed fix, a check for <sp> is
added to make it automatic pass for non-windows
(CUPS) system.<br>
<br>
Regards<br>
Prasanta<br>
<br>
<br>
<br>
<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic