InputStream не работает на некоторых устройствах
Столкнулся с проблемой. Строка 'InputStream is = url.openConnection().getInputStream();' на некоторых устройствах возвращает исключение, вроде как нет соединения. Хотя в другой активности e-mail отправляется без проблем. Недуг проявляется только на 2ух устройствах из 7ми. В эмуляторе тоже все работает хорошо. Кусок кода:
'''
protected Void doInBackground() {
int i = 0;
int j = 0;
try {
URL url = new URL("ссылка_на_файл");
InputStream is = url.openConnection().getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
Workbook wb = WorkbookFactory.create(bis);
Sheet sheet = wb.getSheetAt(0);
Iterator<Row> rows = sheet.iterator();
while (rows.hasNext()) {
Row row = rows.next();
Iterator<Cell> cells = row.iterator();
while (cells.hasNext()) {
Cell cell = cells.next();
switch (cell.getCellType()) {
case STRING:
str = cell.getStringCellValue();
price[i][j] = str;
str = "";
break;
case BLANK:
break;
default:
str = "" + cell.getNumericCellValue();
price[i][j] = str;
str = "";
break;
}
j++;
}
j = 0;
i++;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
Log.i("LOG", "Нет файла");
} catch (MalformedURLException e) {
e.printStackTrace();
Log.i("LOG", "Error");
} catch (IOException e) {
e.printStackTrace();
Log.i("LOG", "Нет соединения");
}
return null;
}
'''