Commit 5cc8bccf2f6d680c1cb24af580e7d4261fea3e6f

Authored by Imanol-Mikel Barba Sabariego
1 parent ef227bf5

--no commit message

src/com/upc/pbe/upcnews/Parser.java
@@ -3,6 +3,8 @@ package com.upc.pbe.upcnews; @@ -3,6 +3,8 @@ package com.upc.pbe.upcnews;
3 import java.net.MalformedURLException; 3 import java.net.MalformedURLException;
4 import java.util.ArrayList; 4 import java.util.ArrayList;
5 5
  6 +import android.widget.Toast;
  7 +
6 public class Parser 8 public class Parser
7 { 9 {
8 private static final String STARTWORD = "#EXTM3U"; 10 private static final String STARTWORD = "#EXTM3U";
@@ -13,7 +15,6 @@ public class Parser @@ -13,7 +15,6 @@ public class Parser
13 private boolean expectSegment = false; 15 private boolean expectSegment = false;
14 private boolean expectList = false; 16 private boolean expectList = false;
15 private Descarrega download; 17 private Descarrega download;
16 - Parser p = new Parser();  
17 18
18 public Parser() 19 public Parser()
19 { 20 {
@@ -37,8 +38,18 @@ public class Parser @@ -37,8 +38,18 @@ public class Parser
37 String[] lines = file.split("\n"); 38 String[] lines = file.split("\n");
38 for(int i = 0; i < lines.length; i++) 39 for(int i = 0; i < lines.length; i++)
39 { 40 {
40 -  
41 - parseLine(lines[i],lists); 41 + try
  42 + {
  43 + parseLine(lines[i],lists);
  44 + }
  45 + catch(InfoException iE)
  46 + {
  47 + //Toast.makeText(this, iE.getMessage(), Toast.LENGTH_SHORT).show();
  48 + }
  49 + catch(WarningException wE)
  50 + {
  51 +
  52 + }
42 } 53 }
43 /* 54 /*
44 * Esto contiene una lista de RECURSOS, 55 * Esto contiene una lista de RECURSOS,
@@ -297,6 +308,7 @@ public class Parser @@ -297,6 +308,7 @@ public class Parser
297 pl.setDefault(Default); 308 pl.setDefault(Default);
298 pl.setName(Name); 309 pl.setName(Name);
299 pl.setType(Type); 310 pl.setType(Type);
  311 + Parser p = new Parser();
300 p.parseFile(download.doInBackground(URI)); 312 p.parseFile(download.doInBackground(URI));
301 /* 313 /*
302 * Procesar URI y descargar listas recursivamente y añadir a la lista actual. 314 * Procesar URI y descargar listas recursivamente y añadir a la lista actual.
@@ -375,6 +387,7 @@ public class Parser @@ -375,6 +387,7 @@ public class Parser
375 else if(expectList) 387 else if(expectList)
376 { 388 {
377 expectList = false; 389 expectList = false;
  390 + Parser p = new Parser();
378 p.parseFile(download.doInBackground(line)); 391 p.parseFile(download.doInBackground(line));
379 } 392 }
380 else 393 else