Skip to content
Snippets Groups Projects
Commit 5100b21c authored by srosse's avatar srosse
Browse files

OO-1190: better error handling

parent e906b28e
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ import java.io.StringReader; ...@@ -30,6 +30,7 @@ import java.io.StringReader;
import java.nio.file.FileSystems; import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult; import java.nio.file.FileVisitResult;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor; import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.BasicFileAttributes;
...@@ -544,14 +545,19 @@ class QTIImportProcessor { ...@@ -544,14 +545,19 @@ class QTIImportProcessor {
private boolean processSidecarMetadata(QuestionItemImpl item, DocInfos docInfos) { private boolean processSidecarMetadata(QuestionItemImpl item, DocInfos docInfos) {
try { try {
Path path = docInfos.root; Path path = docInfos.root;
Path metadata = path.resolve(path.getFileName().toString() + "_metadata.xml"); if(path != null) {
InputStream metadataIn = Files.newInputStream(metadata); Path metadata = path.resolve(path.getFileName().toString() + "_metadata.xml");
SAXReader reader = new SAXReader(); InputStream metadataIn = Files.newInputStream(metadata);
Document document = reader.read(metadataIn); SAXReader reader = new SAXReader();
Element rootElement = document.getRootElement(); Document document = reader.read(metadataIn);
QTIMetadata enricher = new QTIMetadata(rootElement, qItemTypeDao, taxonomyLevelDao, qEduContextDao); Element rootElement = document.getRootElement();
enricher.toQuestion(item); QTIMetadata enricher = new QTIMetadata(rootElement, qItemTypeDao, taxonomyLevelDao, qEduContextDao);
enricher.toQuestion(item);
}
return true; return true;
} catch(NoSuchFileException e) {
//nothing to do
return true;
} catch (Exception e) { } catch (Exception e) {
log.error("", e); log.error("", e);
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment