[Git][java-team/libsejda-io-java][upstream] New upstream version 1.1.4
Markus Koschany
gitlab at salsa.debian.org
Sat Dec 22 11:19:50 GMT 2018
Markus Koschany pushed to branch upstream at Debian Java Maintainers / libsejda-io-java
Commits:
98ad5ea9 by Markus Koschany at 2018-12-22T10:37:23Z
New upstream version 1.1.4
- - - - -
5 changed files:
- .travis.yml
- pom.xml
- src/main/java/org/sejda/io/MemoryMappedSeekableSource.java
- src/main/java/org/sejda/io/SeekableSource.java
- src/main/java/org/sejda/util/IOUtils.java
Changes:
=====================================
.travis.yml
=====================================
@@ -2,3 +2,6 @@ language: java
sudo: false
jdk:
- oraclejdk8
+notifications:
+ email:
+ - info at sejda.org
=====================================
pom.xml
=====================================
@@ -5,7 +5,7 @@
<artifactId>sejda-io</artifactId>
<packaging>jar</packaging>
<name>sejda-io</name>
- <version>1.1.3.RELEASE</version>
+ <version>1.1.4</version>
<description>An Input/Output layer built on top of Java standard io and nio packages</description>
<url>http://www.sejda.org</url>
@@ -37,7 +37,7 @@
<connection>scm:git:git at github.com:torakiki/sejda-io.git</connection>
<developerConnection>scm:git:git at github.com:torakiki/sejda-io.git</developerConnection>
<url>scm:git:git at github.com:torakiki/sejda-io.git</url>
- <tag>v1.1.3.RELEASE</tag>
+ <tag>v1.1.4</tag>
</scm>
<developers>
@@ -85,7 +85,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
- <version>2.5.2</version>
+ <version>2.5.3</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<preparationGoals>clean install</preparationGoals>
@@ -115,7 +115,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.3</version>
+ <version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@@ -126,12 +126,19 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.6</version>
+ <version>3.1.0</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Automatic-Module-Name>org.sejda.io</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
- <version>2.4</version>
+ <version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
@@ -147,17 +154,17 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.21</version>
+ <version>1.7.25</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.5</version>
+ <version>2.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.1.7</version>
+ <version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
=====================================
src/main/java/org/sejda/io/MemoryMappedSeekableSource.java
=====================================
@@ -27,6 +27,8 @@ import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
+import java.util.function.Consumer;
import org.sejda.util.IOUtils;
import org.slf4j.Logger;
@@ -49,6 +51,7 @@ public class MemoryMappedSeekableSource extends BaseSeekableSource {
private long size;
private ThreadBoundCopiesSupplier<MemoryMappedSeekableSource> localCopiesSupplier = new ThreadBoundCopiesSupplier<>(
() -> new MemoryMappedSeekableSource(this));
+ private Consumer<? super ByteBuffer> unmapper = IOUtils::unmap;
public MemoryMappedSeekableSource(File file) throws IOException {
super(ofNullable(file).map(File::getAbsolutePath).orElseThrow(() -> {
@@ -74,6 +77,8 @@ public class MemoryMappedSeekableSource extends BaseSeekableSource {
for (ByteBuffer page : parent.pages) {
this.pages.add(page.duplicate());
}
+ // unmap doesn't work on duplicate, see Unsafe#invokeCleaner
+ this.unmapper = null;
}
@Override
@@ -146,7 +151,7 @@ public class MemoryMappedSeekableSource extends BaseSeekableSource {
public void close() throws IOException {
super.close();
IOUtils.close(localCopiesSupplier);
- pages.stream().forEach(IOUtils::unmap);
+ Optional.ofNullable(unmapper).ifPresent(m -> pages.stream().forEach(m));
pages.clear();
}
=====================================
src/main/java/org/sejda/io/SeekableSource.java
=====================================
@@ -39,7 +39,7 @@ public interface SeekableSource extends ReadableByteChannel {
/**
* Sets the source position. Setting the position to a value that is greater than the source's size is legal but does not change the size of the source. A later attempt to read
- * bytes at such a position will immediately
+ * bytes at such a position will immediately return an end-of-file indication.
*
* @param position
* a non-negative long for the new position
=====================================
src/main/java/org/sejda/util/IOUtils.java
=====================================
@@ -54,8 +54,8 @@ public final class IOUtils {
private static final Optional<Consumer<ByteBuffer>> UNMAPPER;
static {
- UNMAPPER = Optional
- .ofNullable(AccessController.doPrivileged((PrivilegedAction<Consumer<ByteBuffer>>) IOUtils::unmapper));
+ UNMAPPER = Optional.ofNullable(
+ AccessController.doPrivileged((PrivilegedAction<Consumer<ByteBuffer>>) IOUtils::unmapper));
}
private IOUtils() {
@@ -110,13 +110,11 @@ public final class IOUtils {
* @param buf
*/
public static void unmap(ByteBuffer buf) {
- UNMAPPER.ifPresent(u -> {
- try {
- u.accept(buf);
- } catch (Exception e) {
- LOG.error("Unable to unmap ByteBuffer.", e);
- }
- });
+ try {
+ UNMAPPER.ifPresent(u -> u.accept(buf));
+ } catch (Exception e) {
+ LOG.error("Unable to unmap ByteBuffer.", e);
+ }
}
/**
@@ -157,9 +155,8 @@ public final class IOUtils {
* needs ELSE } }
*/
final MethodHandle cleanMethod = lookup.findVirtual(cleanerClass, "clean", methodType(void.class));
- final MethodHandle nonNullTest = lookup
- .findStatic(Objects.class, "nonNull", methodType(boolean.class, Object.class))
- .asType(methodType(boolean.class, cleanerClass));
+ final MethodHandle nonNullTest = lookup.findStatic(Objects.class, "nonNull",
+ methodType(boolean.class, Object.class)).asType(methodType(boolean.class, cleanerClass));
final MethodHandle noop = dropArguments(constant(Void.class, null).asType(methodType(void.class)), 0,
cleanerClass);
final MethodHandle unmapper = filterReturnValue(directBufferCleanerMethod,
View it on GitLab: https://salsa.debian.org/java-team/libsejda-io-java/commit/98ad5ea91a367f68bce1e0ddd9823d23b9587836
--
View it on GitLab: https://salsa.debian.org/java-team/libsejda-io-java/commit/98ad5ea91a367f68bce1e0ddd9823d23b9587836
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20181222/9587bce5/attachment.html>
More information about the pkg-java-commits
mailing list