Removed error checking within XML readers and ensured XML readers fail. Did this so an XML reader is not made with an invalid file. #story[782]
This commit is contained in:
@@ -30,7 +30,7 @@ public class BoatXMLReader extends XMLReader {
|
||||
* @throws ParserConfigurationException error
|
||||
*/
|
||||
public BoatXMLReader(String filePath) throws IOException, SAXException, ParserConfigurationException, ParseException {
|
||||
this(filePath, false);
|
||||
this(filePath, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,19 +89,14 @@ public class BoatXMLReader extends XMLReader {
|
||||
|
||||
/**
|
||||
* Reads the information about one boat
|
||||
* Ignored values: ShapeID, StoweName, HullNum, Skipper
|
||||
* Ignored values: ShapeID, StoweName, HullNum, Skipper, Type
|
||||
*/
|
||||
private void readSingleBoat(Node boat) {
|
||||
StreamedBoat streamedBoat;
|
||||
String type = "None";
|
||||
int sourceID = -1;
|
||||
String boatName = null;
|
||||
String shortName = null;
|
||||
String country = null;
|
||||
if (exists(boat, "Type")) type = boat.getAttributes().getNamedItem("Type").getTextContent();
|
||||
if (exists(boat, "SourceID")) sourceID = Integer.parseInt(boat.getAttributes().getNamedItem("SourceID").getTextContent());
|
||||
if (exists(boat, "BoatName")) boatName = boat.getAttributes().getNamedItem("BoatName").getTextContent();
|
||||
if (exists(boat, "ShortName")) shortName = boat.getAttributes().getNamedItem("ShortName").getTextContent();
|
||||
int sourceID = Integer.parseInt(boat.getAttributes().getNamedItem("SourceID").getTextContent());
|
||||
String boatName = boat.getAttributes().getNamedItem("BoatName").getTextContent();
|
||||
String shortName = boat.getAttributes().getNamedItem("ShortName").getTextContent();
|
||||
if (exists(boat, "Country")) country = boat.getAttributes().getNamedItem("Country").getTextContent();
|
||||
|
||||
// Ignore all non participating boats
|
||||
@@ -137,10 +132,6 @@ public class BoatXMLReader extends XMLReader {
|
||||
this.participants = participants;
|
||||
}
|
||||
|
||||
public Map<Integer, StreamedBoat> getStreamedBoatMap() {
|
||||
return streamedBoatMap;
|
||||
}
|
||||
|
||||
public List<Boat> getBoats() {
|
||||
return new ArrayList<>(streamedBoatMap.values());
|
||||
}
|
||||
|
||||
@@ -45,4 +45,8 @@ public class StreamedBoat extends Boat {
|
||||
}
|
||||
return azimuth;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user