-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cups printer getPrinterState() returns 'null' #52
Comments
I have created a pull request - #53 |
I m seeing same behaviour. it will be nice if the next release included this fix. |
Even after your fix @rajibdk , getPrinterState still returns null. what you fixed is the method getState(). |
it sounds to me like there may be a printer state value that cups4j does not know about (yet) - and therefor the state parser returns null. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using 0.7.8 release along with CUPS v2.2.1. However when I try to get the state of a printer I get 'null' value. I have investigated and found that in class 'PrinterStateEnum' you've compared incoming state value (string, eg 'idle') with toString of enum getValue. If you see your enum declaration the values are in integer, however the incoming state value is string - something like 'idle' or so. Hence we get a 'null' assigned to printer state as if condition fails. For example see below code, so instead of using getValue, getStateName should solve this issue.
for (PrinterStateEnum printerState : PrinterStateEnum.values()) {
System.out.println(printerState.getValue().toString());
}
output: 3 4 5
for (PrinterStateEnum printerState : PrinterStateEnum.values()) {
System.out.println(printerState.getStateName().toString());
}
output: idle printing stopped
The text was updated successfully, but these errors were encountered: