Menu

Only one chance to scan

Help
McAviti
2007-06-03
2013-04-15
  • McAviti

    McAviti - 2007-06-03

    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

     
    • Andi McLean

      Andi McLean - 2007-06-03

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.