Skip to content

Commit d4983fa

Browse files
ddamkeddamke
authored andcommitted
add JavaDoc and Exception error message
1 parent c24337b commit d4983fa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/de/doubleslash/keeptime/common/SvgNodeProvider.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,31 @@
1313
import java.io.IOException;
1414
import java.io.InputStream;
1515

16+
/**
17+
* class loads SvgPath from a SvgFile because Java can not load the original svg file as it is. <p>
18+
* To load the svg the class extracts the path as string and creates a new SvgPath and returns it.
19+
*/
20+
1621
public class SvgNodeProvider {
1722

1823
private static String getSvgPathWithXMl(Resources.RESOURCE resource) {
1924
String svgPath;
2025
Document document;
2126
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
22-
DocumentBuilder db = null;
23-
27+
DocumentBuilder db;
2428

2529
try {
2630
db = dbf.newDocumentBuilder();
2731
} catch (ParserConfigurationException e) {
28-
throw new RuntimeException(e);
32+
throw new RuntimeException(e + "Tried to build new document");
2933
}
3034

3135
try (InputStream inputStream = Resources.getResource(resource).openStream()) {
3236
document = db.parse(inputStream);
3337
NodeList nodeList = document.getElementsByTagName("path");
3438
svgPath = nodeList.item(0).getAttributes().getNamedItem("d").getNodeValue();
3539
} catch (IOException | SAXException e) {
36-
throw new RuntimeException(e);
40+
throw new RuntimeException(e + " ");
3741
}
3842
return svgPath;
3943
}

0 commit comments

Comments
 (0)