SHA256
1
0
forked from pool/apache-ivy

Accepting request 964692 from Java:packages

Fix build with jdk17

OBS-URL: https://build.opensuse.org/request/show/964692
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/apache-ivy?expand=0&rev=20
This commit is contained in:
Dominique Leuenberger 2022-03-28 14:59:42 +00:00 committed by Git OBS Bridge
commit 63f5e24dc0
8 changed files with 160 additions and 227 deletions

View File

@ -1,22 +0,0 @@
--- apache-ivy-2.3.0/build.properties 2012-04-02 23:11:30.000000000 +0200
+++ apache-ivy-2.3.0/build.properties 2017-09-07 14:13:28.647597540 +0200
@@ -42,7 +42,7 @@
checkstyle.src.dir=${basedir}/src/etc/checkstyle
rat.report.dir=${reports.dir}/rat
-ivy.minimum.javaversion=1.5
+ivy.minimum.javaversion=1.8
debug.mode=on
ivy.install.version=1.4.1
--- apache-ivy-2.3.0/build.xml 2012-04-09 08:58:36.000000000 +0200
+++ apache-ivy-2.3.0/build.xml 2017-09-07 14:46:13.128164218 +0200
@@ -517,7 +517,7 @@
</target>
<target name="javadoc" unless="skip.javadoc">
- <javadoc destdir="${javadoc.build.dir}" useexternalfile="true">
+ <javadoc destdir="${javadoc.build.dir}" useexternalfile="false" source="${ivy.minimum.javaversion}">
<fileset dir="${src.dir}" includes="**/*.java" />
</javadoc>
</target>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:202f08ca41f4bdf1c081aa8b2e531565be6c73e9e5e0d68137f454f14eb16ef6
size 3616939

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:109583a8d10b5d9a71c57c539719ca3648ebb8ca4af867976128e7fa657312b7
size 2719181

View File

@ -1,27 +1,11 @@
From 27cf17a1eea310b8d75efc7fc9d4d733fffcbdc1 Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Fri, 19 Oct 2018 15:25:30 +0200
Subject: [PATCH] Change global settings
---
src/java/org/apache/ivy/ant/IvyAntSettings.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/java/org/apache/ivy/ant/IvyAntSettings.java b/src/java/org/apache/ivy/ant/IvyAntSettings.java
index 660ebbe..85cf97f 100644
--- a/src/java/org/apache/ivy/ant/IvyAntSettings.java --- a/src/java/org/apache/ivy/ant/IvyAntSettings.java
+++ b/src/java/org/apache/ivy/ant/IvyAntSettings.java +++ b/src/java/org/apache/ivy/ant/IvyAntSettings.java
@@ -354,6 +354,10 @@ public class IvyAntSettings extends DataType { @@ -345,7 +345,7 @@ public class IvyAntSettings extends DataType {
break; File[] settingsLocations = new File[] {
} new File(getProject().getBaseDir(), settingsFileName),
} new File(getProject().getBaseDir(), "ivyconf.xml"), new File(settingsFileName),
+ if (!file.exists() && task.getProject().getProperty("ivy.mode") != null) { - new File("ivyconf.xml")};
+ file = new File("/etc/ivy/ivysettings.xml"); + new File("ivyconf.xml"), new File("/etc/ivy/ivysettings.xml")};
+ task.log("searching settings file: trying " + file, Project.MSG_VERBOSE); for (File settingsFile : settingsLocations) {
+ } task.log("searching settings file: trying " + settingsFile, Project.MSG_VERBOSE);
if (!file.exists()) { if (settingsFile.exists()) {
file = null;
if (Boolean.valueOf(getProject().getProperty("ivy.14.compatible")).booleanValue()) {
--
2.17.2

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Sat Mar 19 13:22:59 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Upgrade to upstream version 2.5.0
- Force building with JDK < 14, since it imports statically a class
removed in JDK14
- Change dependencies for the httpclient to httpcomponents-client
instead of apache-commons-httpclient
- Modified patch:
* apache-ivy-global-settings.patch
+ implement the same functionality with a bit of less code
- Removed patches:
* apache-ivy-2.4.0-jdk9.patch
* port-to-bc-1.52.patch
+ not needed with this version
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Dec 10 22:39:53 UTC 2019 - Fridrich Strba <fstrba@suse.com> Tue Dec 10 22:39:53 UTC 2019 - Fridrich Strba <fstrba@suse.com>

View File

@ -1,7 +1,7 @@
# #
# spec file for package apache-ivy # spec file for package apache-ivy
# #
# Copyright (c) 2019 SUSE LLC # Copyright (c) 2022 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,40 +16,46 @@
# #
%bcond_without ssh %bcond_without httpclient
%bcond_without oro
%bcond_without sftp
%bcond_without vfs %bcond_without vfs
Name: apache-ivy Name: apache-ivy
Version: 2.4.0 Version: 2.5.0
Release: 0 Release: 0
Summary: Java-based dependency manager Summary: Java-based dependency manager
License: Apache-2.0 License: Apache-2.0
Group: Development/Tools/Building Group: Development/Tools/Building
URL: http://ant.apache.org/ivy/ URL: https://ant.apache.org/ivy/
Source0: %{name}-%{version}-src.tar.gz Source0: https://archive.apache.org/dist/ant/ivy/%{version}/%{name}-%{version}-src.tar.gz
Source1: ivy.1 Source1: ivy.1
Source2: http://repo1.maven.org/maven2/org/apache/ivy/ivy/%{version}/ivy-%{version}.pom Source2: https://repo1.maven.org/maven2/org/apache/ivy/ivy/%{version}/ivy-%{version}.pom
Patch0: apache-ivy-2.4.0-jdk9.patch Patch0: apache-ivy-global-settings.patch
Patch1: apache-ivy-global-settings.patch
Patch2: port-to-bc-1.52.patch
BuildRequires: ant BuildRequires: ant
BuildRequires: bouncycastle-pg BuildRequires: bouncycastle-pg
BuildRequires: commons-httpclient
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: java-devel >= 1.8 BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local BuildRequires: javapackages-local
BuildRequires: jsch BuildRequires: jsch
BuildRequires: oro BuildRequires: oro
BuildConflicts: java-devel >= 14
Provides: ivy = %{version}-%{release} Provides: ivy = %{version}-%{release}
Obsoletes: ivy < %{version}-%{release} Obsoletes: ivy < %{version}-%{release}
BuildArch: noarch BuildArch: noarch
%if %{with vfs} %if %{with vfs}
BuildRequires: apache-commons-vfs2 BuildRequires: apache-commons-vfs2
%endif %endif
%if %{with ssh} %if %{with sftp}
BuildRequires: jsch-agent-proxy-connector-factory BuildRequires: jsch-agent-proxy-connector-factory
BuildRequires: jsch-agent-proxy-core BuildRequires: jsch-agent-proxy-core
BuildRequires: jsch-agent-proxy-jsch BuildRequires: jsch-agent-proxy-jsch
%endif %endif
%if %{with httpclient}
BuildRequires: httpcomponents-client
%endif
%if %{with oro}
BuildRequires: oro
%endif
%description %description
Apache Ivy is a tool for managing (recording, tracking, resolving and Apache Ivy is a tool for managing (recording, tracking, resolving and
@ -69,50 +75,74 @@ JavaDoc documentation for %{name}
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
%patch2 -p1
cp %{SOURCE2} pom.xml cp %{SOURCE2} pom.xml
%pom_remove_parent . %pom_remove_parent .
# Remove prebuilt documentation %pom_remove_dep :jsch.agentproxy
rm -rf doc build/doc
# Port from commons-vfs 1.x to 2.x %if %{without httpclient}
%if %{with vfs} %pom_remove_dep :httpclient
sed -i "s/commons.vfs/&2/" {src,test}/java/org/apache/ivy/plugins/repository/vfs/* rm src/java/org/apache/ivy/util/url/HttpClientHandler.java
%else
sed -i /commons-vfs/d ivy.xml
sed '/vfs.*=.*org.apache.ivy.plugins.resolver.VfsResolver/d' -i \
src/java/org/apache/ivy/core/settings/typedef.properties
rm -rf src/java/org/apache/ivy/plugins/repository/vfs
rm -rf src/java/org/apache/ivy/plugins/resolver/VfsResolver.java
%endif %endif
%if %{without ssh} %if %{without oro}
rm -r src/java/org/apache/ivy/plugins/repository/{ssh,sftp} %pom_remove_dep :oro
rm src/java/org/apache/ivy/plugins/resolver/*{Ssh,SFTP}*.java rm src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
%endif
%if %{without vfs}
%pom_remove_dep :commons-vfs2
rm src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java
rm src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
rm src/java/org/apache/ivy/plugins/repository/vfs/ivy_vfs.xml
rm src/java/org/apache/ivy/plugins/resolver/VfsResolver.java
%endif
%if %{without sftp}
%pom_remove_dep :jsch
%pom_remove_dep :jsch.agentproxy.connector-factory
%pom_remove_dep :jsch.agentproxy.jsch
rm src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
rm src/java/org/apache/ivy/plugins/repository/sftp/SFTPResource.java
rm src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
rm src/java/org/apache/ivy/plugins/repository/ssh/RemoteScpException.java
rm src/java/org/apache/ivy/plugins/repository/ssh/Scp.java
rm src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
rm src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
rm src/java/org/apache/ivy/plugins/repository/ssh/SshResource.java
rm src/java/org/apache/ivy/plugins/resolver/AbstractSshBasedResolver.java
rm src/java/org/apache/ivy/plugins/resolver/SFTPResolver.java
rm src/java/org/apache/ivy/plugins/resolver/SshResolver.java
%endif %endif
%build %build
# Craft class path # Craft class path
mkdir -p lib mkdir -p lib
build-jar-repository lib ant ant/ant-nodeps oro jsch commons-httpclient bcprov bcpg build-jar-repository -s lib ant ant/ant-nodeps jsch bcprov bcpg
export CLASSPATH=$(build-classpath ant ant/ant-nodeps oro jsch commons-httpclient bcprov bcpg) export CLASSPATH=$(build-classpath ant ant/ant-nodeps jsch httpcomponents bcprov bcpg)
%if %{with httpclient}
build-jar-repository lib httpcomponents
export CLASSPATH=${CLASSPATH}:$(build-classpath httpcomponents)
%endif
%if %{with oro}
build-jar-repository lib oro
export CLASSPATH=${CLASSPATH}:$(build-classpath oro)
%endif
%if %{with vfs} %if %{with vfs}
build-jar-repository lib commons-vfs2 build-jar-repository lib commons-vfs2
export CLASSPATH=${CLASSPATH}:$(build-classpath commons-vfs2) export CLASSPATH=${CLASSPATH}:$(build-classpath commons-vfs2)
%endif %endif
%if %{with ssh} %if %{with sftp}
build-jar-repository lib jsch.agentproxy.core \ build-jar-repository -s lib jsch.agentproxy.core \
jsch.agentproxy.connector-factory \ jsch.agentproxy.connector-factory \
jsch.agentproxy.jsch jsch.agentproxy.jsch
export CLASSPATH=${CLASSPATH}:$(build-classpath jsch.agentproxy.core jsch.agentproxy.connector-factory jsch.agentproxy.jsch) export CLASSPATH=${CLASSPATH}:$(build-classpath jsch.agentproxy.core jsch.agentproxy.connector-factory jsch.agentproxy.jsch)
%endif %endif
# Build # Build
ant -Dtarget.ivy.version=%{version} -Dbundle.version=%{version} /localivy /offline jar javadoc %{ant} -v -Dtarget.ivy.version=%{version} -Dbundle.version=%{version} /localivy /offline jar javadoc
%install %install
# Code # Code
@ -127,7 +157,7 @@ install -m 0644 pom.xml %{buildroot}/%{_mavenpomdir}/JPP-ivy.pom
# API Documentation # API Documentation
install -d %{buildroot}%{_javadocdir}/%{name} install -d %{buildroot}%{_javadocdir}/%{name}
cp -rp build/doc/reports/api/. %{buildroot}%{_javadocdir}/%{name} cp -rp build/reports/api/. %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}/%{name} %fdupes -s %{buildroot}%{_javadocdir}/%{name}
# Command line script # Command line script
@ -143,7 +173,7 @@ install %{SOURCE1} %{buildroot}%{_mandir}/man1/ivy.1
%files -f .mfiles %files -f .mfiles
%license LICENSE NOTICE %license LICENSE NOTICE
%doc README %doc README.adoc
%config %{_sysconfdir}/ant.d/%{name} %config %{_sysconfdir}/ant.d/%{name}
%{_javadir}/%{name} %{_javadir}/%{name}
%attr(755,root,root) %{_bindir}/* %attr(755,root,root) %{_bindir}/*

View File

@ -8,7 +8,7 @@
"License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an software distributed under the License is distributed on an
@ -28,13 +28,13 @@
</parent> </parent>
<groupId>org.apache.ivy</groupId> <groupId>org.apache.ivy</groupId>
<artifactId>ivy</artifactId> <artifactId>ivy</artifactId>
<version>2.4.0</version> <version>2.5.0</version>
<name>Apache Ivy</name> <name>Apache Ivy</name>
<url>http://ant.apache.org/ivy/</url> <url>http://ant.apache.org/ivy/</url>
<scm> <scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/ant/ivy/core/trunk/</connection> <connection>scm:svn:https://svn.apache.org/repos/asf/ant/ivy/core/trunk/</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/ant/ivy/core/trunk</developerConnection> <developerConnection>scm:svn:https://svn.apache.org/repos/asf/ant/ivy/core/trunk</developerConnection>
<url>http://svn.apache.org/repos/asf/ant/ivy/core/trunk</url> <url>https://svn.apache.org/repos/asf/ant/ivy/core/trunk</url>
</scm> </scm>
<mailingLists> <mailingLists>
<mailingList> <mailingList>
@ -42,43 +42,31 @@
<subscribe>dev-subscribe@ant.apache.org</subscribe> <subscribe>dev-subscribe@ant.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@ant.apache.org</unsubscribe> <unsubscribe>dev-unsubscribe@ant.apache.org</unsubscribe>
<post>dev@ant.apache.org</post> <post>dev@ant.apache.org</post>
<archive>http://mail-archives.apache.org/mod_mbox/ant-dev</archive> <archive>https://mail-archives.apache.org/mod_mbox/ant-dev</archive>
</mailingList> </mailingList>
<mailingList> <mailingList>
<name>Ivy Users List</name> <name>Ivy Users List</name>
<subscribe>ivy-user-subscribe@ant.apache.org</subscribe> <subscribe>ivy-user-subscribe@ant.apache.org</subscribe>
<unsubscribe>ivy-user-unsubscribe@ant.apache.org</unsubscribe> <unsubscribe>ivy-user-unsubscribe@ant.apache.org</unsubscribe>
<post>ivy-user@ant.apache.org</post> <post>ivy-user@ant.apache.org</post>
<archive>http://mail-archives.apache.org/mod_mbox/ant-ivy-user</archive> <archive>https://mail-archives.apache.org/mod_mbox/ant-ivy-user</archive>
</mailingList> </mailingList>
</mailingLists> </mailingLists>
<issueManagement> <issueManagement>
<system>jira</system> <system>jira</system>
<url>http://issues.apache.org/jira/browse/IVY</url> <url>https://issues.apache.org/jira/browse/IVY</url>
</issueManagement> </issueManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.ant</groupId> <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId> <artifactId>ant</artifactId>
<version>1.7.1</version> <version>1.9.14</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.ant</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>ant-nodeps</artifactId> <artifactId>httpclient</artifactId>
<version>1.7.1</version> <version>4.5.9</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.7.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
@ -88,63 +76,69 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-vfs</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-vfs</artifactId> <artifactId>commons-vfs2</artifactId>
<version>1.0</version> <version>2.2</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jcraft</groupId> <groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId> <artifactId>jsch</artifactId>
<version>0.1.50</version> <version>0.1.55</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jcraft</groupId> <groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId> <artifactId>jsch.agentproxy</artifactId>
<version>0.0.6</version> <version>0.0.9</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jcraft</groupId> <groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.connector-factory</artifactId> <artifactId>jsch.agentproxy.connector-factory</artifactId>
<version>0.0.6</version> <version>0.0.9</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jcraft</groupId> <groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.jsch</artifactId> <artifactId>jsch.agentproxy.jsch</artifactId>
<version>0.0.6</version> <version>0.0.9</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk14</artifactId> <artifactId>bcpg-jdk15on</artifactId>
<version>1.45</version> <version>1.62</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId> <artifactId>bcprov-jdk15on</artifactId>
<version>1.45</version> <version>1.62</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>3.8.2</version> <version>4.12</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>org.hamcrest</groupId>
<artifactId>commons-lang</artifactId> <artifactId>hamcrest-core</artifactId>
<version>2.6</version> <version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.ant</groupId> <groupId>org.apache.ant</groupId>
<artifactId>ant-testutil</artifactId> <artifactId>ant-testutil</artifactId>
<version>1.7.0</version> <version>1.9.14</version>
<scope>test</scope> <scope>test</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@ -154,9 +148,33 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ant</groupId> <groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId> <artifactId>ant-launcher</artifactId>
<version>1.6.2</version> <version>1.9.14</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.9.14</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit4</artifactId>
<version>1.9.14</version>
<scope>test</scope> <scope>test</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@ -178,16 +196,16 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>xerces</groupId> <groupId>xmlunit</groupId>
<artifactId>xercesImpl</artifactId> <artifactId>xmlunit</artifactId>
<version>2.6.2</version> <version>1.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.6.2</version>
<scope>test</scope> <scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,93 +0,0 @@
diff --git a/ivy.xml b/ivy.xml
index d448897..7d8896a 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -50,8 +50,8 @@
<dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.6" conf="default,sftp->default"/>
<dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.6" conf="default,sftp->default"/>
<dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.6" conf="default,sftp->default"/>
- <dependency org="org.bouncycastle" name="bcpg-jdk14" rev="1.45" conf="default"/>
- <dependency org="org.bouncycastle" name="bcprov-jdk14" rev="1.45" conf="default"/>
+ <dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.52" conf="default"/>
+ <dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.52" conf="default"/>
<!-- Test dependencies -->
<dependency org="junit" name="junit" rev="3.8.2" conf="test->default"/>
diff --git a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
index af7beae..bec8ae4 100644
--- a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
+++ b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
@@ -23,16 +23,18 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
import java.security.Security;
-import java.security.SignatureException;
import java.util.Iterator;
import org.apache.ivy.plugins.signer.SignatureGenerator;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.bcpg.BCPGOutputStream;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
+import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator;
+import org.bouncycastle.openpgp.operator.bc.BcPBESecretKeyDecryptorBuilder;
+import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder;
+import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPrivateKey;
import org.bouncycastle.openpgp.PGPSecretKey;
@@ -101,11 +103,13 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator {
pgpSec = readSecretKey(keyIn);
}
- PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(),
- BouncyCastleProvider.PROVIDER_NAME);
- PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey()
- .getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME);
- sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
+ PBESecretKeyDecryptor decryptor = new BcPBESecretKeyDecryptorBuilder(
+ new BcPGPDigestCalculatorProvider()).build(password.toCharArray());
+ PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(decryptor);
+ PGPSignatureGenerator sGen = new PGPSignatureGenerator(
+ new BcPGPContentSignerBuilder(pgpSec.getPublicKey()
+ .getAlgorithm(), PGPUtil.SHA1));
+ sGen.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
in = new FileInputStream(src);
out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest)));
@@ -116,22 +120,10 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator {
}
sGen.generate().encode(out);
- } catch (SignatureException e) {
- IOException ioexc = new IOException();
- ioexc.initCause(e);
- throw ioexc;
} catch (PGPException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
- } catch (NoSuchAlgorithmException e) {
- IOException ioexc = new IOException();
- ioexc.initCause(e);
- throw ioexc;
- } catch (NoSuchProviderException e) {
- IOException ioexc = new IOException();
- ioexc.initCause(e);
- throw ioexc;
} finally {
if (out != null) {
try {
@@ -156,7 +148,8 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator {
private PGPSecretKey readSecretKey(InputStream in) throws IOException, PGPException {
in = PGPUtil.getDecoderStream(in);
- PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in);
+ PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in,
+ new BcKeyFingerprintCalculator());
PGPSecretKey key = null;
for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext();) {