use of org.apache.jena.shared.NotFoundException in project jena by apache.
the class TestFileManager method testFileManagerClone.
@Test
public void testFileManagerClone() {
FileManager fileManager1 = new FileManager();
FileManager fileManager2 = fileManager1.clone();
// Should not affect fileManager2
fileManager1.addLocatorFile();
{
InputStream in = fileManager1.open(testingDir + "/" + filename);
assertNotNull(in);
closeInputStream(in);
}
// Should not work.
try {
InputStream in = fileManager2.open(testingDir + "/" + filename);
closeInputStream(in);
assertNull("Found file via wrong FileManager", in);
} catch (NotFoundException ex) {
}
}
use of org.apache.jena.shared.NotFoundException in project jena by apache.
the class ModResultsIn method getResultSet.
public ResultSet getResultSet() {
if (resultSet != null)
return resultSet;
if (resultsFilename == null) {
System.err.println("No result file name");
throw new TerminationException(1);
}
try {
if (resultsFilename.equals("-"))
return ResultSetFactory.load(System.in, inputFormat);
ResultSet rs = ResultSetFactory.load(resultsFilename, inputFormat);
if (rs == null) {
System.err.println("Failed to read the result set");
throw new TerminationException(9);
}
resultSet = rs;
return resultSet;
} catch (NotFoundException ex) {
System.err.println("File not found: " + resultsFilename);
throw new TerminationException(9);
} catch (ARQInternalErrorException intEx) {
System.err.println(intEx.getMessage());
if (intEx.getCause() != null) {
System.err.println("Cause:");
intEx.getCause().printStackTrace(System.err);
System.err.println();
}
intEx.printStackTrace(System.err);
throw new TerminationException(99);
}
}
use of org.apache.jena.shared.NotFoundException in project jena by apache.
the class TestFileManager method testLocationMappingURLtoFileOpenNotFound.
public void testLocationMappingURLtoFileOpenNotFound() {
LocationMapper locMap = new LocationMapper(TestLocationMapper.mapping);
FileManager fileManager = new FileManager(locMap);
fileManager.addLocatorClassLoader(fileManager.getClass().getClassLoader());
try {
InputStream in = fileManager.open("http://example.org/file");
closeInputStream(in);
assertNull("Found nont-existant URL", null);
} catch (NotFoundException ex) {
}
}
use of org.apache.jena.shared.NotFoundException in project jena by apache.
the class TestFileManager method testFileManagerClone.
public void testFileManagerClone() {
FileManager fileManager1 = new FileManager();
FileManager fileManager2 = fileManager1.clone();
// Should not affect fileManager2
fileManager1.addLocatorFile();
{
InputStream in = fileManager1.open(testingDir + "/" + filename);
assertNotNull(in);
closeInputStream(in);
}
// Should not work.
try {
InputStream in = fileManager2.open(testingDir + "/" + filename);
closeInputStream(in);
assertNull("Found file via wrong FileManager", in);
} catch (NotFoundException ex) {
}
}
use of org.apache.jena.shared.NotFoundException in project jena by apache.
the class TestFileManager method testFileManagerLocatorZipNonFound.
public void testFileManagerLocatorZipNonFound() {
FileManager fileManager = new FileManager();
try {
fileManager.addLocatorZip(zipname);
} catch (Exception ex) {
fail("Failed to create a filemanager and add a zip locator");
}
try {
InputStream in = fileManager.open(filenameNonExistent);
closeInputStream(in);
assertNull("Found non-existant zip file member", in);
} catch (NotFoundException ex) {
}
}
Aggregations