[Tinyos-beta-commits] CVS: tinyos-1.x/beta/TOSComm/packet SerialByteSource.java, 1.1, 1.2

Cory Sharp cssharp at users.sourceforge.net
Thu Feb 17 10:55:14 PST 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/TOSComm/packet
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27396

Modified Files:
	SerialByteSource.java 
Log Message:
Add finalize to help make serial ports more robust.

Index: SerialByteSource.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/TOSComm/packet/SerialByteSource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SerialByteSource.java	22 Dec 2004 01:31:48 -0000	1.1
--- SerialByteSource.java	17 Feb 2005 18:55:11 -0000	1.2
***************
*** 61,64 ****
--- 61,65 ----
              serialPort = new TOSSerial(portName);
            }
+ /*
            else
            {
***************
*** 76,82 ****
              serialPort = new JavaxCommSerialPort(sp);
            }
  	}
  	catch (Exception e) {
! 	    throw new IOException("Port " + portName + " busy");
  	}
  
--- 77,84 ----
              serialPort = new JavaxCommSerialPort(sp);
            }
+ */
  	}
  	catch (Exception e) {
! 	    throw new IOException("Could not open " + portName + ": " + e.getMessage());
  	}
  
***************
*** 93,97 ****
  	catch (Exception e) {
  	    serialPort.close();
! 	    throw new IOException("Couldn't configure " + portName);
  	}
  
--- 95,99 ----
  	catch (Exception e) {
  	    serialPort.close();
! 	    throw new IOException("Could not configure " + portName + ": " + e.getMessage() );
  	}
  
***************
*** 161,163 ****
--- 163,170 ----
      }
  
+     protected void finalize() {
+       System.out.println("SerialByteSource finalize");
+       serialPort.close();
+     }
+ 
  }



More information about the Tinyos-beta-commits mailing list