ramonlopes / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 0 forks source link

Printer name mixup when one printer name is a subset of another #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  Map two printers on your machine where one is a subset of the other, like 
"Eltron LP2348" and "Desk10 Eltron LP2348"
2.  Try to choose the smaller printer name, "Eltron LP2348" in the example above
3.  Try sending a command or file to the printer

What is the expected output? What do you see instead?
I expect to be able to choose the exact printer I selected, but the other 
printer is assigned to the applet and gets the file in it's print queue.

What version of the product are you using? On what operating system?
version 1.1.7 on windows 7.

Please provide any additional information below.

I see some unused flags in the printServiceMatcher.java file that appear to 
control this behavior, is there a way to access them from Javascript so I can 
specify exact printer name matches only?

Original issue reported on code.google.com by good2beh...@gmail.com on 9 Sep 2011 at 4:10

GoogleCodeExporter commented 8 years ago
I think the problem lies in printServiceMatcher.java
u can edit line :
60: Pattern p1 = Pattern.compile("^" + printerName + "$", 
Pattern.CASE_INSENSITIVE);
61: Pattern p2 = Pattern.compile("^" + printerName, Pattern.CASE_INSENSITIVE);

76: partial = ps;

96: return partial;

-------------------------

I haven't try this code yet, bet imho this is where the problem lies.
because with \b you will get only word boundaries, which will have no big 
difference for p1 and p2. we might as weel just used p3 for this purpose.

Original comment by erik.luk...@gmail.com on 12 Sep 2011 at 7:26

GoogleCodeExporter commented 8 years ago
Could not reproduce this bug.  Case sensitivity matters and will make the 
non-exact rank higher.  Perhaps this should be changed?

Here's my log file:

INFO: ===== SEARCHING FOR PRINTER =====
Sep 19, 2011 3:55:01 PM jzebra.LogIt log
INFO: Found 9 attached printers.
Sep 19, 2011 3:55:01 PM jzebra.LogIt log
INFO: Printer specified: Eltron LP2348
Sep 19, 2011 3:55:01 PM jzebra.LogIt log
INFO: Printer name match: Desk10 Eltron LP2348
Sep 19, 2011 3:55:01 PM jzebra.LogIt log
INFO: Printer name match: Eltron LP2348
Sep 19, 2011 3:55:01 PM jzebra.LogIt log
INFO: Using best match: Eltron LP2348

Original comment by tres.fin...@gmail.com on 19 Sep 2011 at 7:57

GoogleCodeExporter commented 8 years ago
Closing as invalid due to inactivity and inability to reproduce.

Original comment by tres.fin...@gmail.com on 16 Mar 2012 at 1:48