From 2c1e729ef7b7f81b4a727781ebed0fd416ba72cb Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Wed, 11 Dec 2013 09:37:01 +0100 Subject: [PATCH] Workaround for NPE in setting NamingPolicy Signed-off-by: Michael Simacek --- mockito.spec | 9 ++++++++- setting-naming-policy.patch | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 setting-naming-policy.patch diff --git a/mockito.spec b/mockito.spec index 5586832..d651a87 100644 --- a/mockito.spec +++ b/mockito.spec @@ -1,6 +1,6 @@ Name: mockito Version: 1.9.0 -Release: 13%{?dist} +Release: 14%{?dist} Summary: A Java mocking framework License: MIT @@ -12,6 +12,8 @@ Patch1: fix-cglib-refs.patch Patch2: maven-cglib-dependency.patch Patch3: fix-bnd-config.patch Patch4: %{name}-matcher.patch +# Workaround for NPE in setting NamingPolicy in cglib +Patch5: setting-naming-policy.patch BuildArch: noarch BuildRequires: jpackage-utils @@ -53,8 +55,10 @@ This package contains the API documentation for %{name}. sed -i 's/Bundle-Version= ${version}/Bundle-Version= %{version}/' conf/mockito-core.bnd %patch3 %patch4 -p1 +%patch5 -p1 %build +build-jar-repository lib/compile objenesis ant jar javadoc # Convert to OSGi bundle pushd target @@ -88,6 +92,9 @@ cp -rp target/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name} %doc NOTICE %changelog +* Wed Dec 11 2013 Michael Simacek - 1.9.0-14 +- Workaround for NPE in setting NamingPolicy + * Sat Aug 03 2013 Fedora Release Engineering - 1.9.0-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild diff --git a/setting-naming-policy.patch b/setting-naming-policy.patch new file mode 100644 index 0000000..d4f30b1 --- /dev/null +++ b/setting-naming-policy.patch @@ -0,0 +1,34 @@ +From 04e36a01e93c3b79caa9f7e9e8573fe2a0d65d1a Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Thu, 5 Dec 2013 16:53:36 +0100 +Subject: [PATCH] Setting naming policy + +Signed-off-by: Michael Simacek +--- + src/org/mockito/internal/creation/cglib/CGLIBHacker.java | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/org/mockito/internal/creation/cglib/CGLIBHacker.java b/src/org/mockito/internal/creation/cglib/CGLIBHacker.java +index 172f744..de53ab1 100644 +--- a/src/org/mockito/internal/creation/cglib/CGLIBHacker.java ++++ b/src/org/mockito/internal/creation/cglib/CGLIBHacker.java +@@ -20,6 +20,9 @@ public class CGLIBHacker implements Serializable { + Field createInfoField = reflectOnCreateInfo(methodProxy); + createInfoField.setAccessible(true); + Object createInfo = createInfoField.get(methodProxy); ++ if (createInfo == null) { ++ return; ++ } + Field namingPolicyField = createInfo.getClass().getDeclaredField("namingPolicy"); + namingPolicyField.setAccessible(true); + if (namingPolicyField.get(createInfo) == null) { +@@ -43,4 +46,4 @@ public class CGLIBHacker implements Serializable { + } + return cglibMethodProxyClass.getDeclaredField("createInfo"); + } +-} +\ No newline at end of file ++} +-- +1.8.3.1 +