summaryrefslogtreecommitdiff
path: root/comms/rxtx/files/patch-src-gnu-io-CommPort.java
blob: 933de8d9233b2135955f72c8c8557d5df37c3134 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- src/gnu/io/CommPort.java.orig	2007-04-26 05:26:05 UTC
+++ src/gnu/io/CommPort.java
@@ -73,7 +73,7 @@ import java.io.IOException;
   */
 public abstract class CommPort extends Object {
 	protected String name;
-	private final static boolean debug = false;
+	private final static boolean debug = "true".equals( System.getProperty( "gnu.io.rxtx.DEBUG" ) );
 
 	public abstract void enableReceiveFraming( int f ) 
 		throws UnsupportedCommOperationException;
@@ -94,6 +94,7 @@ public abstract class CommPort extends O
 	public abstract int getInputBufferSize();
 	public abstract void setOutputBufferSize( int size );
 	public abstract int getOutputBufferSize();
+	
 	public void close() 
 	{
 		if (debug) System.out.println("CommPort:close()");
@@ -102,12 +103,23 @@ public abstract class CommPort extends O
 		{
 			CommPortIdentifier cp = 
 				CommPortIdentifier.getPortIdentifier(this);
-			if ( cp != null )
+				
+			if (cp != null)
+			{
+				
+				if (debug) System.out.println(" Not Null");
+				
 				cp.getPortIdentifier(this).internalClosePort();
+				
+			}
 		}
 		catch (NoSuchPortException e)
 		{
+			if (debug) System.out.println("CommPort:close(): No Such Port");
 		}
+		
+		if (debug) System.out.println("CommPort:close:Exit");
+		
 	};
 
 	public abstract InputStream getInputStream() throws IOException;