changeset 1936:d79482fa202f

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 15 May 2025 16:23:14 -0600
parents 12957bc6fa07
children d44659709959
files src/luan/modules/IoLuan.java src/luan/modules/swing/Option_pane.luan
diffstat 2 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
diff -r 12957bc6fa07 -r d79482fa202f src/luan/modules/IoLuan.java
--- a/src/luan/modules/IoLuan.java	Sat May 03 12:17:35 2025 -0600
+++ b/src/luan/modules/IoLuan.java	Thu May 15 16:23:14 2025 -0600
@@ -243,9 +243,9 @@
 	};
 
 	public static abstract class LuanIO extends LuanIn {
-		abstract OutputStream outputStream() throws IOException;
+		abstract OutputStream outputStream() throws IOException, LuanException;
 
-		private Writer writer() throws IOException {
+		private Writer writer() throws IOException, LuanException {
 			OutputStream out = outputStream();
 			return charset==null ? new OutputStreamWriter(out) : new OutputStreamWriter(out,charset);
 		}
@@ -280,11 +280,11 @@
 			throw new LuanException( "bad argument #1 to 'write' (string or binary or Io.uri expected)" );
 		}
 
-		public LuanWriter text_writer() throws IOException {
+		public LuanWriter text_writer() throws IOException, LuanException {
 			return luanWriter(new BufferedWriter(writer()));
 		}
 
-		public OutputStream binary_writer() throws IOException {
+		public OutputStream binary_writer() throws IOException, LuanException {
 			return new BufferedOutputStream(outputStream());
 		}
 
@@ -406,8 +406,12 @@
 			return new FileInputStream(file);
 		}
 
-		@Override OutputStream outputStream() throws IOException {
-			return new FileOutputStream(file);
+		@Override OutputStream outputStream() throws LuanException {
+			try {
+				return new FileOutputStream(file);
+			} catch(FileNotFoundException e) {
+				throw new LuanException(e.getMessage(),e);
+			}
 		}
 
 		@Override public String to_string() {
diff -r 12957bc6fa07 -r d79482fa202f src/luan/modules/swing/Option_pane.luan
--- a/src/luan/modules/swing/Option_pane.luan	Sat May 03 12:17:35 2025 -0600
+++ b/src/luan/modules/swing/Option_pane.luan	Thu May 15 16:23:14 2025 -0600
@@ -6,11 +6,13 @@
 local Option_pane = {}
 
 function Option_pane.show_message_dialog(frame,message)
-	JOptionPane.showMessageDialog( frame.java, message, "", JOptionPane.PLAIN_MESSAGE )
+	local jframe = frame and frame.java
+	JOptionPane.showMessageDialog( jframe, message, "", JOptionPane.PLAIN_MESSAGE )
 end
 
 function Option_pane.show_input_dialog(frame,message,value)
-	return JOptionPane.showInputDialog( frame.java, message, "", JOptionPane.PLAIN_MESSAGE, nil, nil, value )
+	local jframe = frame and frame.java
+	return JOptionPane.showInputDialog( jframe, message, "", JOptionPane.PLAIN_MESSAGE, nil, nil, value )
 end
 
 return Option_pane