nini9140 / jzebra

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

List All Printers: Exception in thread "Thread-12" java.util.regex.PatternSyntaxException: Illegal repetition near index 1 #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open sample.html
2. Click List All Printers (nothing happens)
3. Look at the Java Console

What version of the product are you using? On what operating system?
Latest version. Through Apache in Firefox on Windows 7

The "Print" button works OK. I have created a printer called "zebra" to test.

Full Java Console output:

03-Feb-2012 09:45:23 jzebra.LogIt log
INFO: jZebra 1.2.0
03-Feb-2012 09:45:23 jzebra.LogIt log
INFO: ===== JAVASCRIPT LISTENER THREAD STARTED =====
03-Feb-2012 09:45:23 jzebra.LogIt log
INFO: Current printer charset encoding: windows-1252
03-Feb-2012 09:45:23 jzebra.LogIt log
INFO: ===== SEARCHING FOR PRINTER =====
03-Feb-2012 09:45:23 jzebra.LogIt log
INFO: Found 7 attached printers.
03-Feb-2012 09:45:23 jzebra.LogIt log
INFO: Printer specified: zebra
03-Feb-2012 09:45:23 jzebra.LogIt log
INFO: Printer name match: zebra
03-Feb-2012 09:45:23 jzebra.LogIt log
INFO: Using best match: zebra
03-Feb-2012 09:45:34 jzebra.LogIt log
INFO: ===== SEARCHING FOR PRINTER =====
03-Feb-2012 09:45:34 jzebra.LogIt log
INFO: Found 7 attached printers.
03-Feb-2012 09:45:34 jzebra.LogIt log
INFO: Printer specified: {dummy printer name for listing}
03-Feb-2012 09:45:34 jzebra.LogIt log
INFO: ===== JAVASCRIPT LISTENER THREAD STOPPED =====
Exception in thread "Thread-12" java.util.regex.PatternSyntaxException: Illegal 
repetition near index 1
\b{dummy printer name for listing}\b
 ^
    at java.util.regex.Pattern.error(Unknown Source)
    at java.util.regex.Pattern.closure(Unknown Source)
    at java.util.regex.Pattern.sequence(Unknown Source)
    at java.util.regex.Pattern.expr(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at jzebra.PrintServiceMatcher.findPrinter(PrintServiceMatcher.java:60)
    at jzebra.PrintApplet.startJavaScriptListener(PrintApplet.java:155)
    at jzebra.PrintApplet.access$000(PrintApplet.java:33)
    at jzebra.PrintApplet$1.run(PrintApplet.java:81)
    at java.security.AccessController.doPrivileged(Native Method)
    at jzebra.PrintApplet.run(PrintApplet.java:76)
    at java.lang.Thread.run(Unknown Source)

I'm evaluating jZebra to see if it can be used in a web-based point of sale 
system.

Original issue reported on code.google.com by mar...@muphi.com on 3 Feb 2012 at 9:49

GoogleCodeExporter commented 9 years ago
Good find.  Take the brackets off and it should work. I'll fix this in next 
release. 

Original comment by tres.fin...@gmail.com on 3 Feb 2012 at 1:52

GoogleCodeExporter commented 9 years ago

Original comment by tres.fin...@gmail.com on 3 Feb 2012 at 1:53

GoogleCodeExporter commented 9 years ago
Thank you for the quick answer. This looks like a great product.

Original comment by mar...@muphi.com on 3 Feb 2012 at 1:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Applied fix to sample.html (put escape character in front of brackets)

applet.findPrinter("\\{dummy printer name for listing\\}");

Updated in version 1.2.1.  Download here:
http://code.google.com/p/jzebra/downloads/list?can=3

Original comment by tres.fin...@gmail.com on 7 Feb 2012 at 2:40