diff src/luan/LuanState.java @ 1222:cb422386f6b5

logging
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 25 Mar 2018 17:35:30 -0600
parents d3a3ca116e42
children d41997776788
line wrap: on
line diff
--- a/src/luan/LuanState.java	Sun Mar 25 17:13:11 2018 -0600
+++ b/src/luan/LuanState.java	Sun Mar 25 17:35:30 2018 -0600
@@ -8,12 +8,16 @@
 import java.util.ArrayList;
 import java.util.Map;
 import java.util.HashMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import luan.impl.LuanCompiler;
 import luan.modules.BasicLuan;
 import luan.modules.JavaLuan;
 
 
 public final class LuanState implements LuanCloneable {
+	private static final Logger logger = LoggerFactory.getLogger(LuanState.class);
+
 	public LuanJavaOk javaOk;
 	private Map registry;
 	private final List<Reference<Closeable>> onClose = new ArrayList<Reference<Closeable>>();
@@ -46,11 +50,16 @@
 		onClose.add(new WeakReference<Closeable>(c));
 	}
 
-	public void close() throws IOException {
+	public void close() {
 		for( Reference<Closeable> ref : onClose ) {
 			Closeable c = ref.get();
-			if( c != null )
-				c.close();
+			if( c != null ) {
+				try {
+					c.close();
+				} catch(IOException e) {
+					logger.error(c.toString(),e);
+				}
+			}
 		}
 		onClose.clear();
 	}