diff --git a/app/src/test/java/org/fdroid/fdroid/data/RepoProviderTest.java b/app/src/test/java/org/fdroid/fdroid/data/RepoProviderTest.java
index 40e68a1e4..a7b0b190d 100644
--- a/app/src/test/java/org/fdroid/fdroid/data/RepoProviderTest.java
+++ b/app/src/test/java/org/fdroid/fdroid/data/RepoProviderTest.java
@@ -38,6 +38,7 @@ import org.robolectric.annotation.Config;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
+import java.io.FileOutputStream;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
@@ -189,45 +190,50 @@ public class RepoProviderTest extends FDroidProviderTest {
7) pubkey
*/
String packageName = context.getPackageName();
- FileOutputStream outputStream = new FileOutputStream("/oem/etc/" + packageName + "/additional_repos.xml");
- outputStream.write(("
-
-
+ String filepath = "/oem/etc/" + packageName + "/additional_repos.xml";
+ try {
+ FileOutputStream outputStream = new FileOutputStream(filepath);
+ outputStream.write((""
+ + ""
+ + ""
+ +""
+ +"- oem0Name
"
+ +""
+ +"- https://www.oem0.com/yeah/repo
"
+ +""
+ +"- I'm the first oem repo.
"
+ +""
+ +"- 22
"
+ +""
+ +"- 1
"
+ +""
+ +"- ignore
"
+ +""
+ +"- fffff2313aaaaabcccc111
"
-
- - oem0Name
-
- - https://www.oem0.com/yeah/repo
-
- - I'm the first oem repo.
-
- - 22
-
- - 1
-
- - ignore
-
- - fffff2313aaaaabcccc111
-
-
- - oem1MyNameIs
-
- - https://www.mynameis.com/rapper/repo
-
- - Who is the first repo?
-
- - 22
-
- - 0
-
- - ignore
-
- - ddddddd2313aaaaabcccc111
-
-
- "
- ).getBytes());
- outputStream.close();
+ +""
+ +"- oem1MyNameIs
"
+ +""
+ +"- https://www.mynameis.com/rapper/repo
"
+ +""
+ +"- Who is the first repo?
"
+ +""
+ +"- 22
"
+ +""
+ +"- 0
"
+ +""
+ +"- ignore
"
+ +""
+ +"- ddddddd2313aaaaabcccc111
"
+ +""
+ +""
+ ).getBytes());
+ outputStream.close();
+ } catch (Exception e) {
+ Utils.debugLog("RepoProviderTest::canAddAdditionalRepos()", "failed creating/writing file " + filepath);
+ Utils.debugLog("RepoProviderTest::canAddAdditionalRepos()", e.getMessage());
+ return;
+ }
// Load the actual repos
List defaultRepos = DBHelper.loadDefaultRepos(context);