Skip to content

Commit

Permalink
Removed constraint that a basepath must be set for a package to conta…
Browse files Browse the repository at this point in the history
…in an image file. Version bump of Tableschema lib
  • Loading branch information
JohannesJander committed Jan 9, 2023
1 parent 9284448 commit d86ff87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.frictionlessdata</groupId>
<artifactId>datapackage-java</artifactId>
<version>0.6.5-SNAPSHOT</version>
<version>0.6.7-SNAPSHOT</version>
<packaging>jar</packaging>
<issueManagement>
<url>https://github.com/frictionlessdata/datapackage-java/issues</url>
Expand All @@ -22,7 +22,7 @@
<java.version>8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<tableschema-java-version>0.6.5</tableschema-java-version>
<tableschema-java-version>0.6.7</tableschema-java-version>
<hamcrest.version>1.3</hamcrest.version>
<junit.version>5.9.1</junit.version>
<slf4j-simple.version>2.0.5</slf4j-simple.version>
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/io/frictionlessdata/datapackage/Package.java
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,8 @@ public void write (File outputDir, boolean zipCompressed) throws Exception {
writeDescriptor(outFs, parentDirName);

if (null != imageData) {
if (null == getBasePath()) {
if (null != getBaseUrl()) {
throw new DataPackageException("Cannot add image data to a package read from an URL");
}
throw new DataPackageException("Invalid package, base path is null");
if (null != getBaseUrl()) {
throw new DataPackageException("Cannot add image data to a package read from an URL");
}
String fileName = (!StringUtils.isEmpty(this.image)) ? this.image : "image-file";
String sanitizedFileName = fileName.replaceAll("[\\s/\\\\]+", "_");
Expand All @@ -546,8 +543,10 @@ public void write (File outputDir, boolean zipCompressed) throws Exception {
}
}
}
// ZIP-FS needs close, but WindowsFileSystem unsurprisingly doesn't
// like to get closed...
/* ZIP-FS needs close, but WindowsFileSystem unsurprisingly doesn't
like to get closed...
The empty catch block is intentional.
*/
try {
outFs.close();
} catch (UnsupportedOperationException es) {};
Expand Down

0 comments on commit d86ff87

Please sign in to comment.