If we can't parse the port file, try again. Maybe we are catching it between create and write?

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4494 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-10-07 12:38:30 +00:00
parent 0e5d6056e4
commit 39dbfdec82

View File

@ -111,10 +111,10 @@ public class MainActivity extends Activity {
activity.runOnUiThread(() -> { activity.runOnUiThread(() -> {
web_view.loadUrl(base_url); web_view.loadUrl(base_url);
}); });
}
break; break;
} }
} }
}
if (!key.reset()) { if (!key.reset()) {
Log.w("tildefriends", "watcher is no longer valid"); Log.w("tildefriends", "watcher is no longer valid");
break; break;
@ -242,6 +242,8 @@ public class MainActivity extends Activity {
private int read_port(String path) { private int read_port(String path) {
try (BufferedReader reader = new BufferedReader(new FileReader(path))) { try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
return Integer.parseInt(reader.readLine()); return Integer.parseInt(reader.readLine());
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (java.io.FileNotFoundException e) { } catch (java.io.FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (java.io.IOException e) { } catch (java.io.IOException e) {