Skip to content

Commit 8868791

Browse files
fixed 2 failing tests
1 parent 1259823 commit 8868791

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>io.frictionlessdata</groupId>
55
<artifactId>datapackage-java</artifactId>
6-
<version>0.1.7-SNAPSHOT</version>
6+
<version>0.1.9-SNAPSHOT</version>
77
<packaging>jar</packaging>
88
<issueManagement>
99
<url>https://github.com/frictionlessdata/datapackage-java/issues</url>
@@ -19,12 +19,12 @@
1919
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2020
<maven.compiler.source>1.8</maven.compiler.source>
2121
<maven.compiler.target>1.8</maven.compiler.target>
22-
<tableschema-java-version>0.1.5</tableschema-java-version>
22+
<tableschema-java-version>0.1.9</tableschema-java-version>
2323
<hamcrest.version>1.3</hamcrest.version>
24-
<junit.version>5.7.2</junit.version>
25-
<slf4j-simple.version>1.7.32</slf4j-simple.version>
24+
<junit.version>5.8.2</junit.version>
25+
<slf4j-simple.version>1.7.36</slf4j-simple.version>
2626
<apache-commons-collections.version>4.4</apache-commons-collections.version>
27-
<everit-json-schema.version>1.13.0</everit-json-schema.version>
27+
<everit-json-schema.version>1.14.1</everit-json-schema.version>
2828
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
2929
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
3030
<maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>

src/main/java/io/frictionlessdata/datapackage/Package.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.fasterxml.jackson.databind.node.ArrayNode;
99
import com.fasterxml.jackson.databind.node.ObjectNode;
1010
import io.frictionlessdata.datapackage.exceptions.DataPackageException;
11+
import io.frictionlessdata.datapackage.exceptions.DataPackageFileOrUrlNotFoundException;
1112
import io.frictionlessdata.datapackage.resource.AbstractDataResource;
1213
import io.frictionlessdata.datapackage.resource.AbstractReferencebasedResource;
1314
import io.frictionlessdata.datapackage.resource.Resource;
@@ -172,12 +173,16 @@ public Package(URL urlSource, boolean strict) throws Exception {
172173
* a local directory) or the ZIP file if it's a ZIP-based
173174
* package.
174175
* @param strict whether to use strict schema parsing
176+
* @throws DataPackageFileOrUrlNotFoundException if the path is invalid
175177
* @throws IOException thrown if I/O operations fail
176178
* @throws DataPackageException thrown if constructing the Descriptor fails
177179
*/
178180
public Package(Path descriptorFile, boolean strict) throws Exception {
179181
this.strictValidation = strict;
180182
JsonNode sourceJsonNode;
183+
if (!descriptorFile.toFile().exists()) {
184+
throw new DataPackageFileOrUrlNotFoundException("File " + descriptorFile + "does not exist");
185+
}
181186
if (isArchive(descriptorFile.toFile())) {
182187
isArchivePackage = true;
183188
basePath = descriptorFile;

src/test/java/io/frictionlessdata/datapackage/PackageTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ public void testReadFromZipFileWithInvalidDatapackageDescriptorAndStrictValidati
514514

515515
@Test
516516
public void testReadFromInvalidZipFilePath() throws Exception{
517-
exception.expect(IOException.class);
517+
exception.expect(DataPackageFileOrUrlNotFoundException.class);
518518
File invalidFile = new File ("/invalid/path/does/not/exist/datapackage.zip");
519519
Package p = new Package(invalidFile.toPath(), false);
520520
}

0 commit comments

Comments
 (0)