I've got the library principal to work, anyway with my code i can only scan once, when i open the device in a subsequent try i receive the following exception:
--
Device = Brother MFC-5840CN
uk.org.jsane.JSane_Exceptions.JSane_Exception_Invalid: Invalid operation
at uk.org.jsane.JSane_Exceptions.JSane_Exception.getException(JSane_Exception.java:53)
at uk.org.jsane.JSane_Net.JSane_Net_Device._open(JSane_Net_Device.java:235)
at uk.org.jsane.JSane_Net.JSane_Net_Device.open(JSane_Net_Device.java:88)
--
I can get it to work only with a reboot.
I tried to close the devices whenever i have opened them in a finally block:
--
} finally {
try {
if (device != null) device.close();
if (connection != null) connection.exit();
} catch (JSane_Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
--
Any guess what's wrong with my code?
thanx,
~klemens
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I've got the library principal to work, anyway with my code i can only scan once, when i open the device in a subsequent try i receive the following exception:
--
Device = Brother MFC-5840CN
uk.org.jsane.JSane_Exceptions.JSane_Exception_Invalid: Invalid operation
at uk.org.jsane.JSane_Exceptions.JSane_Exception.getException(JSane_Exception.java:53)
at uk.org.jsane.JSane_Net.JSane_Net_Device._open(JSane_Net_Device.java:235)
at uk.org.jsane.JSane_Net.JSane_Net_Device.open(JSane_Net_Device.java:88)
--
I can get it to work only with a reboot.
I tried to close the devices whenever i have opened them in a finally block:
--
} finally {
try {
if (device != null) device.close();
if (connection != null) connection.exit();
} catch (JSane_Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
--
Any guess what's wrong with my code?
thanx,
~klemens
The code looks fine, though usually you wouldn't keep opening and closing devices.
You would :-
Open
{
Perform scans / set options etc
} repeat as many times as necessary
close.
It's just that opening and closing the device can take a lot of time.
Have you tried from the command line?
Both via the network interface, and using it directly.
If the same thing happens then the problem is with the backend and you may need to ask the backend developer for help.