Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

better error handling

  • Loading branch information...
commit 3088f903774a653a38d709226c6e4a875cb061e0 1 parent e575bbc
@commonsguy authored
View
2  Files/ReadWrite/project.properties
@@ -1,2 +1,2 @@
-android.library.reference.1=../../external/ActionBarSherlock
target=android-15
+android.library.reference.1=../../external/ActionBarSherlock
View
27 Files/ReadWrite/src/com/commonsware/android/frw/EditorFragment.java
@@ -86,7 +86,7 @@ else if (item.getItemId() == R.id.saveBackground) {
private File getTarget() {
File root=null;
- if (external!=null && external.isChecked()) {
+ if (external != null && external.isChecked()) {
root=getActivity().getExternalFilesDir(null);
}
else {
@@ -119,17 +119,22 @@ private String load(File target) throws IOException {
InputStream in=new FileInputStream(target);
if (in != null) {
- InputStreamReader tmp=new InputStreamReader(in);
- BufferedReader reader=new BufferedReader(tmp);
- String str;
- StringBuilder buf=new StringBuilder();
-
- while ((str=reader.readLine()) != null) {
- buf.append(str + "\n");
+ try {
+ InputStreamReader tmp=new InputStreamReader(in);
+ BufferedReader reader=new BufferedReader(tmp);
+ String str;
+ StringBuilder buf=new StringBuilder();
+
+ while ((str=reader.readLine()) != null) {
+ buf.append(str);
+ buf.append("\n");
+ }
+
+ result=buf.toString();
+ }
+ finally {
+ in.close();
}
-
- in.close();
- result=buf.toString();
}
}
catch (java.io.FileNotFoundException e) {
Please sign in to comment.
Something went wrong with that request. Please try again.