Skip to content
Commits on Source (8)
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>${env.OSSRH_USER}</username>
<password>${env.OSSRH_PWD}</password>
</server>
</servers>
</settings>
\ No newline at end of file
......@@ -15,10 +15,13 @@ addons:
apt:
packages:
- oracle-java8-installer
#GPG_PASSPHRASE
env:
global:
secure: YqXA0mY5JW3EwtKQjWLMD7Q4dpHVoIpfgYjG2D1D2X67KfekN6h5NaQWCQsPV0AJvznbF/bWoNjUGscncukA2MW/Fz1kXmnnuFmsFQNQAYBCilO5L8/MPWd0UFmHNJQYq5NGw9ajduB46E8K3URMPzseZsZo6IPalJ9i1VKF/Cg=
#GPG_PASSPHRASE
- secure: "YqXA0mY5JW3EwtKQjWLMD7Q4dpHVoIpfgYjG2D1D2X67KfekN6h5NaQWCQsPV0AJvznbF/bWoNjUGscncukA2MW/Fz1kXmnnuFmsFQNQAYBCilO5L8/MPWd0UFmHNJQYq5NGw9ajduB46E8K3URMPzseZsZo6IPalJ9i1VKF/Cg="
#OSSRH credentials
- secure: "OQKwWq4cDk7jaVHAnjv9TC1ZuJ40k2q4rpN+do5zdu4506hvWZbv42J7adJlHQifAfGuu4dRnj7tZrG98RZLU4PZSA9hOdJOmzT4BE/8zJCYU06RAgOgry+KpR6TE+2cl+6h+MQslwBEylWaGj7GbrKGQWiBjfNZsPdhATZboNM="
- secure: "Jh3PnqzzGjfboV8W++lYcp2zAyI7EhH+9nli/eLcKoS1whqcs6pdHAIkEwNpWQj3oAWLapFuL7/dR/dtlzXjggF9myVhl6io5W8+JDezGlow95QojIqlcQ8R0dmcN27wX8VSUtUuQlScHRBFvvNyxmp7pk1Q9fRykZWm2ui9ygo="
deploy:
- provider: releases
skip_cleanup: true
......@@ -31,11 +34,9 @@ deploy:
- sejda-console/target/*.deb
- sejda-console/target/*.zip
- sejda-distribution/target/*.zip
- provider: bintray
file: "target/bintray/bintray-deploy.json"
user: "sejdapdf"
key:
secure: dLhy8d+Dra+0tVMnm/JPkhQvvIYBq/6EMS3E8TNHmkoYJmF5bUvWJZdopLn7E+HEG9n4KGaELA37NHdJsxkYMQIV0A5kF0MvrMVKf9ls9MKNT4lNDtub+FP3GxCRdZJvJBPnX9ND1y1dcXj7/c+3BadXTT2r2yZeulERD+uMiGg=
- provider: script
script: "mvn deploy --settings .travis.settings.xml"
skip_cleanup: true
on:
tags: true
notifications:
......
{
"package":
{
"name": "sejda",
"repo": "maven",
"subject": "sejdapdf",
"desc": "An extendible and configurable PDF manipulation layer library. A ready to use java library to perform PDF documents manipulation without having to deal with the low level API. Sejda offers many \"ready to go\" manipulations implemented using the SAMBox but it can be extended to use other implementations.",
"website_url": "www.sejda.org",
"issue_tracker_url": "https://github.com/torakiki/sejda/issues",
"vcs_url": "hhttps://github.com/torakiki/sejda",
"licenses":
["AGPL-V3"],
"public_download_numbers": false,
"public_stats": false
},
"version":
{
"name": "${project.version}",
"desc": "Sejda version ${project.version}",
"released": "${timestamp}",
"vcs_tag": "${project.version}",
"gpgSign": false
},
"files":
[
{
"includePattern": "sejda-console/target/(.*)\\.(jar|asc|md5|pom)",
"excludePattern": "sejda-console/target/assembled/.*",
"uploadPattern": "org/sejda/sejda-console/${project.version}/$1.$2"
},
{
"includePattern": "sejda-conversion/target/(.*)\\.(jar|asc|md5|pom)",
"uploadPattern": "org/sejda/sejda-conversion/${project.version}/$1.$2"
},
{
"includePattern": "sejda-core/target/(.*)\\.(jar|asc|md5|pom)",
"uploadPattern": "org/sejda/sejda-core/${project.version}/$1.$2"
},
{
"includePattern": "sejda-fonts/target/(.*)\\.(jar|asc|md5|pom)",
"uploadPattern": "org/sejda/sejda-fonts/${project.version}/$1.$2"
},
{
"includePattern": "sejda-image-writers/target/(.*)\\.(jar|asc|md5|pom)",
"uploadPattern": "org/sejda/sejda-image-writers/${project.version}/$1.$2"
},
{
"includePattern": "sejda-model/target/(.*)\\.(jar|asc|md5|pom)",
"uploadPattern": "org/sejda/sejda-model/${project.version}/$1.$2"
},
{
"includePattern": "sejda-optional-fonts/target/(.*)\\.(jar|asc|md5|pom)",
"uploadPattern": "org/sejda/sejda-optional-fonts/${project.version}/$1.$2"
},
{
"includePattern": "sejda-sambox/target/(.*)\\.(jar|asc|md5|pom)",
"uploadPattern": "org/sejda/sejda-sambox/${project.version}/$1.$2"
},
{
"includePattern": "target/(.*)\\.(asc|md5|pom)",
"uploadPattern": "org/sejda/sejda-parent/${project.version}/$1.$2"
}
],
"publish": true
}
\ No newline at end of file
libsejda-java (3.2.56-1) unstable; urgency=medium
* New upstream version 3.2.56.
* Build-depend on libcommons-csv-java.
* Declare compliance with Debian Policy 4.2.1.
* Switch to compat level 11.
-- Markus Koschany <apo@debian.org> Fri, 12 Oct 2018 13:11:13 +0200
libsejda-java (3.2.38-1) unstable; urgency=medium
* New upstream version 3.2.38.
......
......@@ -5,26 +5,27 @@ Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.or
Uploaders:
Markus Koschany <apo@debian.org>
Build-Depends:
debhelper (>= 10),
debhelper (>= 11),
default-jdk,
default-jdk-doc,
junit4,
libapache-poi-java,
libbcmail-java,
libbcprov-java,
libcommons-csv-java,
libcommons-io-java,
libcommons-lang3-java,
libgeronimo-validation-1.0-spec-java,
libimgscalr-java,
libmaven-javadoc-plugin-java,
libmetadata-extractor-java (>= 2.10.1),
libsambox-java (>= 1.1.16),
libsambox-java (>= 1.1.41),
libsejda-java,
libslf4j-java,
libtwelvemonkeys-java,
libxmlgraphics-commons-java,
maven-debian-helper (>= 2.1)
Standards-Version: 4.1.1
Standards-Version: 4.2.1
Vcs-Git: https://anonscm.debian.org/git/pkg-java/libsejda-java.git
Vcs-Browser: https://anonscm.debian.org/git/pkg-java/libsejda-java.git
Homepage: http://sejda.org/
......
......@@ -3,7 +3,7 @@ Upstream-Name: Sejda
Source: https://github.com/torakiki/sejda
Files: *
Copyright: 2010-2016, Andrea Vacondio (andrea.vacondio@gmail.com)
Copyright: 2010-2018, Andrea Vacondio (andrea.vacondio@gmail.com)
2010-2016, Eduard Weissmann (edi.weissmann@gmail.com)
License: AGPL-3+
......@@ -28,7 +28,7 @@ Copyright: Google, Inc.
License: OFL-1.1
Files: debian/*
Copyright: 2017, Markus Koschany <apo@debian.org>
Copyright: 2017-2018, Markus Koschany <apo@debian.org>
License: AGPL-3+
License: LGPL-2.1+
......
......@@ -6,7 +6,7 @@
<artifactId>sejda-parent</artifactId>
<packaging>pom</packaging>
<name>sejda</name>
<version>3.2.38</version>
<version>3.2.56</version>
<description>An extendible and configurable PDF manipulation layer library. A ready to use java library to perform PDF documents manipulation without having to deal with the low level API. Sejda offers many "ready to go" manipulations implemented using the SAMBox but it can be extended to use other implementations.</description>
<organization>
......@@ -32,7 +32,7 @@
<connection>scm:git:git@github.com:torakiki/sejda.git</connection>
<developerConnection>scm:git:git@github.com:torakiki/sejda.git</developerConnection>
<url>scm:git:git@github.com:torakiki/sejda.git</url>
<tag>v3.2.38</tag>
<tag>v3.2.56</tag>
</scm>
<developers>
......@@ -94,7 +94,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
......@@ -108,7 +107,6 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
......@@ -121,80 +119,87 @@
</profile>
<profile>
<id>travis</id>
<activation>
<property>
<name>env.TRAVIS</name>
<value>true</value>
</property>
</activation>
<id>private-release</id>
<distributionManagement>
<snapshotRepository>
<id>sejda-pro-snapshot</id>
<url>http://mvn.sejda.com/artifactory/libs-snapshot</url>
</snapshotRepository>
<repository>
<id>sejda-pro</id>
<url>http://mvn.sejda.com/artifactory/libs-release</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<preparationGoals>clean install</preparationGoals>
<autoVersionSubmodules>true</autoVersionSubmodules>
<localCheckout>true</localCheckout>
</configuration>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
<goal>perform</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/target/bintray</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>bintray-deploy.json</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<dryRun>true</dryRun>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
<quiet>true</quiet>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>travis</id>
<activation>
<property>
<name>env.TRAVIS</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>net.ju-n.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.3</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
<quiet>true</quiet>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<id>attach-javadocs</id>
<goals>
<goal>artifacts</goal>
<goal>jar</goal>
</goals>
<configuration>
<algorithms>
<algorithm>MD5</algorithm>
</algorithms>
<failOnError>false</failOnError>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<configuration>
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
</configuration>
......@@ -208,7 +213,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
......@@ -227,6 +241,11 @@
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
......@@ -312,18 +331,19 @@
<junit.version>4.12</junit.version>
<slf4j.version>1.7.25</slf4j.version>
<commons.lang.version>3.5</commons.lang.version>
<commons.io.version>2.5</commons.io.version>
<commons.io.version>2.6</commons.io.version>
<validation.api.version>1.0.0.GA</validation.api.version>
<mockito.version>1.10.19</mockito.version>
<logback.version>1.2.2</logback.version>
<jdepend.version>2.9.1</jdepend.version>
<hibernate-validator.version>4.2.0.Final</hibernate-validator.version>
<hamcrest.version>1.3</hamcrest.version>
<sambox.version>1.1.19</sambox.version>
<sambox.version>1.1.41</sambox.version>
<bouncycastle.version>1.56</bouncycastle.version>
<twelvemonkeys.version>3.3.1</twelvemonkeys.version>
<apache.poi.version>3.15</apache.poi.version>
<tess4j.version>3.2.1</tess4j.version>
<apache.commons.csv.version>1.5</apache.commons.csv.version>
<!-- so that build is not platform dependent via encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<timestamp>${maven.build.timestamp}</timestamp>
......@@ -377,6 +397,11 @@
<artifactId>poi-ooxml</artifactId>
<version>${apache.poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>${apache.commons.csv.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
......
......@@ -10,7 +10,7 @@
<parent>
<groupId>org.sejda</groupId>
<artifactId>sejda-parent</artifactId>
<version>3.2.38</version>
<version>3.2.56</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -46,7 +46,7 @@ public final class Main {
SLF4JBridgeHandler.install();
Map<CustomizableProps, String> customs = new HashMap<>();
customs.put(CustomizableProps.APP_NAME, "Sejda Console");
customs.put(CustomizableProps.LICENSE_PATH, "/LICENSE.txt");
customs.put(CustomizableProps.LICENSE_PATH, "/SEJDA_LICENSE.txt");
new SejdaConsole(args, getTaskExecutionAdapter(), customs).execute();
}
......
......@@ -22,7 +22,6 @@ package org.sejda.cli;
import static java.util.Optional.ofNullable;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
......@@ -150,7 +149,7 @@ public class SejdaConsole {
info.append(l);
info.append(System.lineSeparator());
});
} catch (IOException e) {
} catch (Exception e) {
LOG.error("An error occurred while reading license information, please refer to http://www.sejda.org", e);
}
LOG.info(info.toString());
......
......@@ -33,6 +33,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.mockito.ArgumentCaptor;
import org.sejda.cli.util.OnceWithMessage;
......@@ -210,7 +211,7 @@ class CommandLineExecuteTestHelper {
CommandLineExecuteTestHelper(boolean useMockTaskExecutionService) {
this(useMockTaskExecutionService, new HashMap<>());
customs.put(CustomizableProps.APP_NAME, "Sejda Console");
customs.put(CustomizableProps.LICENSE_PATH, "/sejda-console/LICENSE.txt");
customs.put(CustomizableProps.LICENSE_PATH, "/sejda-console/SEJDA_LICENSE.txt");
}
CommandLineExecuteTestHelper(boolean useMockTaskExecutionService, Map<CustomizableProps, String> customs) {
......@@ -286,12 +287,13 @@ class CommandLineExecuteTestHelper {
} catch (SejdaRuntimeException e) {
// no-op
} catch (Exception e) {
throw new SejdaRuntimeException("An unexpected exception occured while executing the console", e);
throw new SejdaRuntimeException("An unexpected exception occurred while executing the console", e);
}
}
private void prepareSystemOutCapture() {
newSystemOut = new SystemOutRecordingStream(System.out);
//newSystemOut = new SystemOutRecordingStream(System.out);
newSystemOut = new SystemOutRecordingStream(new NullOutputStream());
System.setOut(new PrintStream(newSystemOut));
}
......
......@@ -78,7 +78,7 @@ public class GeneralConsoleOptionsTest extends AbstractTestSuite {
public void testExecuteVersion() {
Map<CustomizableProps, String> customs = new HashMap<>();
customs.put(CustomizableProps.APP_NAME, "Sejda Console");
customs.put(CustomizableProps.LICENSE_PATH, "/LICENSE.txt");
customs.put(CustomizableProps.LICENSE_PATH, "/SEJDA_LICENSE.txt");
new CommandLineExecuteTestHelper(false, customs).assertConsoleOutputContains("--version",
"Sejda Console (Version " + Sejda.VERSION + ")");
}
......@@ -87,8 +87,8 @@ public class GeneralConsoleOptionsTest extends AbstractTestSuite {
public void testExecuteLicense() throws IOException {
Map<CustomizableProps, String> customs = new HashMap<>();
customs.put(CustomizableProps.APP_NAME, "Sejda Console");
customs.put(CustomizableProps.LICENSE_PATH, "/LICENSE.txt");
try (InputStream resource = getClass().getResourceAsStream("/LICENSE.txt")) {
customs.put(CustomizableProps.LICENSE_PATH, "/SEJDA_LICENSE.txt");
try (InputStream resource = getClass().getResourceAsStream("/SEJDA_LICENSE.txt")) {
new CommandLineExecuteTestHelper(false, customs).assertConsoleOutputContains("--license",
new BufferedReader(new InputStreamReader(resource, StandardCharsets.UTF_8)).lines()
.map(StringUtils::trim).toArray(String[]::new));
......
......@@ -91,6 +91,7 @@ target/assembled/bin/sejda-console setmetadata -f /tmp/sejda-smoketest/meta.pdf
target/assembled/bin/sejda-console setmetadata -f /tmp/sejda-smoketest/meta.pdf -o /tmp/sejda-smoketest/meta2.pdf -a "Torakiki" -t "Test the title" -s "What a subject" -k "" --overwrite -v 1.5
target/assembled/bin/sejda-console setviewerpreferences -h
target/assembled/bin/sejda-console setviewerpreferences -f ../sejda-core/src/test/resources/pdf/large_test.pdf -o /tmp/sejda-smoketest/ -p view_ --hideMenu --hideToolbar --displayDocTitle
target/assembled/bin/sejda-console setviewerpreferences -f ../sejda-core/src/test/resources/pdf/short-test-file.pdf -o /tmp/sejda-smoketest/ -m outlines
target/assembled/bin/sejda-console setviewerpreferences -f ../sejda-core/src/test/resources/pdf/large_test.pdf -o /tmp/sejda-smoketest/ -p view_ --hideMenu --hideToolbar --displayDocTitle -v 1.6 -j overwrite
target/assembled/bin/sejda-console setviewerpreferences -f ../sejda-core/src/test/resources/pdf/large_test.pdf -o /tmp/sejda-smoketest/ -p view_ --hideMenu --hideToolbar --displayDocTitle -v 1.7 -j overwrite
target/assembled/bin/sejda-console setheaderfooter -h
......
......@@ -28,7 +28,7 @@ function run_tests {
while read cmd; do
# echo "RUNNING: $cmd"
if eval "$cmd"; then
# echo "PASSED: $cmd"
echo "PASSED: $cmd"
else
echo "FAILED: $cmd"
return 1
......
......@@ -10,7 +10,7 @@
<parent>
<groupId>org.sejda</groupId>
<artifactId>sejda-parent</artifactId>
<version>3.2.38</version>
<version>3.2.56</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.sejda</groupId>
<artifactId>sejda-parent</artifactId>
<version>3.2.38</version>
<version>3.2.56</version>
<relativePath>../pom.xml</relativePath>
</parent>
......@@ -77,6 +77,11 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
......
......@@ -29,6 +29,9 @@ import org.apache.commons.lang3.StringUtils;
import org.sejda.core.support.prefix.model.NameGenerationRequest;
import org.sejda.core.support.prefix.processor.PrefixTypesChain;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
/**
* Component used to generate the output name for a manipulation given the input prefix (if any);
*
......@@ -63,15 +66,50 @@ public final class NameGenerator {
}
String result = toSafeFilename(prefixTypesChain.process(prefix, preProcessRequest(request)));
if (result.length() > 255) {
String baseName = getBaseName(result);
String ext = getExtension(result);
return baseName.substring(0, 254 - ext.length()) + "." + ext;
String osName = System.getProperty("os.name").toLowerCase();
if(osName.contains("win") || osName.contains("mac")) {
// char based max length
result = shortenFilenameCharLength(result, 255);
} else {
// bytes based max length
result = shortenFilenameBytesLength(result, 255, StandardCharsets.UTF_8);
}
return result;
}
static String shortenFilenameCharLength(String input, int maxCharLength) {
if (input.length() > 255) {
String baseName = getBaseName(input);
String ext = getExtension(input);
baseName = baseName.substring(0, 254 - ext.length());
return String.format("%s.%s", baseName, ext);
} else {
return input;
}
}
static String shortenFilenameBytesLength(String input, int maxBytesLength, Charset charset) {
if(input.getBytes(charset).length > maxBytesLength) {
String baseName = getBaseName(input);
String ext = getExtension(input);
// drop last char from basename, try again
baseName = baseName.substring(0, baseName.length() - 1);
String shorterFilename = String.format("%s.%s", baseName, ext);
while(shorterFilename.getBytes(charset).length > maxBytesLength) {
baseName = baseName.substring(0, baseName.length() - 1);
shorterFilename = String.format("%s.%s", baseName, ext);
}
return shorterFilename;
} else {
return input;
}
}
/**
* pre process the request ensuring a not null request is returned
*
......