From 75718947275770e2a462647891d516f59c356a38 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Fri, 8 Nov 2013 19:02:04 +0000 Subject: [PATCH] git-svn-id: svn://imanolbarba.net/PAD@14 c2ee353e-ed0d-4329-bf56-03aec153487f --- readline/bin/pad/prac1/Console.class | Bin 3120 -> 0 bytes readline/bin/pad/prac1/EditableBufferedReader.class | Bin 4115 -> 0 bytes readline/src/pad/prac1/Console.java | 7 +++++-- readline/src/pad/prac1/EditableBufferedReader.java | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/readline/bin/pad/prac1/Console.class b/readline/bin/pad/prac1/Console.class index b2070fc..8af3d5d 100644 Binary files a/readline/bin/pad/prac1/Console.class and b/readline/bin/pad/prac1/Console.class differ diff --git a/readline/bin/pad/prac1/EditableBufferedReader.class b/readline/bin/pad/prac1/EditableBufferedReader.class index 04bc8ab..c6186cb 100644 Binary files a/readline/bin/pad/prac1/EditableBufferedReader.class and b/readline/bin/pad/prac1/EditableBufferedReader.class differ diff --git a/readline/src/pad/prac1/Console.java b/readline/src/pad/prac1/Console.java index 462ea52..1f5a848 100644 --- a/readline/src/pad/prac1/Console.java +++ b/readline/src/pad/prac1/Console.java @@ -27,6 +27,7 @@ public class Console implements Observer scanner.findWithinHorizon(pattern,0); numCols = Integer.parseInt(scanner.match().group(2)); numRows = Integer.parseInt(scanner.match().group(1)); + scanner.close(); } public Coordinate getCurrentPos() @@ -37,8 +38,10 @@ public class Console implements Observer Pattern pattern = Pattern.compile("(\\d+);(\\d+)"); Scanner scanner = new Scanner(System.in); scanner.findWithinHorizon(pattern,0); - return new Coordinate(Integer.parseInt(scanner.match().group(2)), - Integer.parseInt(scanner.match().group(1))); + int x = Integer.parseInt(scanner.match().group(2)); + int y = Integer.parseInt(scanner.match().group(1)); + scanner.close(); + return new Coordinate(x,y); } public void moveCursorTo(Coordinate xy) diff --git a/readline/src/pad/prac1/EditableBufferedReader.java b/readline/src/pad/prac1/EditableBufferedReader.java index 4bfb6e3..b0d2d99 100644 --- a/readline/src/pad/prac1/EditableBufferedReader.java +++ b/readline/src/pad/prac1/EditableBufferedReader.java @@ -108,6 +108,7 @@ public class EditableBufferedReader extends BufferedReader line.toggleMode(); break; } + scanner.close(); return; } else if(scanner.findWithinHorizon("O?", 0).length() > 0) @@ -124,8 +125,10 @@ public class EditableBufferedReader extends BufferedReader line.setCursorTo(line.length()+1); break; } + scanner.close(); return; } + scanner.close(); } else { @@ -147,6 +150,7 @@ public class EditableBufferedReader extends BufferedReader line.addChar((char)character); break; } + scanner.close(); return; } } -- libgit2 0.22.2