Hello Markus, Hello Uwe,

Agens wrote:
> 
> Hi all
> 
> I'm developing an application, where a card reader should be
> accessable per remote methode invocation.
> After a set of transctions of a client, I have to shut down the Smart
> Card. At the next transaction, I have to start the whole procedure
> again.
> 
> if I try to to this again (the next client makes an transaction some
> time later), I get an error msg:
> 
> opencard.core.terminal.CardTerminalException:
> opencard.opt.terminal.protocol.T1I
> OException: GemplusBlockProtocol.internalTransmit: write error
> 
> What's the mistake. I must make something wrong at closing or
> shutdown.
> 

I had no problem doing several start+shutdown, but I haven't
tried with a communication with the card.. so there might be
a bug somewhere leading to what you have described.

In any case, and I do not know if this is related, Franck Ohayon,
from Gemplus R&D, has discovered what it seems to be a bug in the
"shutdown" _when you have multiple CardTerminals_ (I do not know if
this is your case, so it might not be related).

The problem he discovered comes from the fact that (in SmartCard.java)
"terminals" contains an enumeration of the different CardTerminals
and during the while loop:

    ______
   | while (terminals.hasMoreElements () ) {
   |     CardTerminal terminal=(CardTerminal)terminals.nextElement ();
   |     registry.remove(terminal);
   | }
   |______

some CardTerminals are removed while at the same time the
enumeration is modified (the GC being removing objects).
He is suggesting a patch where a clone of the enumeration
is used for the while loop. Below is the corresponding context
diff:

*** SmartCard.java~     Thu Oct 22 15:30:08 1998
--- SmartCard.java      Tue May 25 17:11:10 1999
***************
*** 170,175 ****
--- 170,182 ----
      if (refCount_ == 0) {
        CardTerminalRegistry registry = CardTerminalRegistry.getRegistry
();
        Enumeration terminals = registry. getCardTerminals ();
+ 
+       Vector terminals_Vector_Copy=new Vector();
+       while (terminals.hasMoreElements () ) {
+         terminals_Vector_Copy.addElement(terminals.nextElement());
+       }
+       terminals=terminals_Vector_Copy.elements();
+ 
        while (terminals.hasMoreElements () ) {
          CardTerminal terminal = (CardTerminal) terminals.nextElement
();
          registry.remove(terminal);

Uwe, could you see with the current maintener if this correction
is valid and if it can be incorporated in the next release ?

Cheers,
Christophe.

 = Foster's Query: If the polls are so accurate, why are there      =
 =                 so many polling companies?                       =
Visit the OpenCard Framework's WWW site at http://www.opencard.org/ for
access to documentation, code, presentations, and OCF announcements.
-----------------------------------------------------------------------------
To unsubscribe from the OCF Mailing list, send a mail to
"[EMAIL PROTECTED]" with the word "unsubscribe" in the BODY of the
message.

Reply via email to