Update to upstream version 1.71

- Add patch for issue https://github.com/cbeust/jcommander/issues/367
- Upload new sources
This commit is contained in:
Roman Vais 2017-06-13 14:23:12 +02:00
parent d72337e7a6
commit a4506bb8fe
4 changed files with 71 additions and 2 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@
/1.62.tar.gz
/1.65.tar.gz
/1.66.tar.gz
/1.71.tar.gz

View File

@ -0,0 +1,61 @@
From 2b813829d02b89206493520eb86075a43b145db9 Mon Sep 17 00:00:00 2001
From: Roman Vais <rvais@redhat.com>
Date: Tue, 13 Jun 2017 13:24:24 +0200
Subject: [PATCH] ParseValues-NullPointerException-patch
---
.../java/com/beust/jcommander/Parameterized.java | 27 ++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/beust/jcommander/Parameterized.java b/src/main/java/com/beust/jcommander/Parameterized.java
index 3264008..e937a66 100644
--- a/src/main/java/com/beust/jcommander/Parameterized.java
+++ b/src/main/java/com/beust/jcommander/Parameterized.java
@@ -13,6 +13,8 @@ import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* Encapsulate a field or a method annotated with @Parameter or @DynamicParameter
@@ -180,12 +182,33 @@ public class Parameterized {
String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4);
Object result = null;
try {
- Field field = method.getDeclaringClass().getDeclaredField(fieldName);
+ Field field = object.getClass().getDeclaredField(fieldName);
if (field != null) {
setFieldAccessible(field);
result = field.get(object);
}
- } catch(NoSuchFieldException | IllegalAccessException ex) {
+ } catch(NoSuchFieldException ex) {
+ Class<?> clazz = object.getClass();
+ Field found = null;
+ while (clazz != null && method.getDeclaringClass().isAssignableFrom(clazz)) {
+ try {
+ found = clazz.getDeclaredField(fieldName);
+ } catch (NoSuchFieldException nfex) {
+ // ignore
+ }
+ if (found != null) break;
+ clazz = clazz.getSuperclass();
+ }
+ if (found != null) {
+ setFieldAccessible(found);
+ try {
+ result = found.get(object);
+ } catch (IllegalAccessException iex) {
+ // ignore
+ }
+ }
+
+ } catch(IllegalAccessException ex) {
// ignore
}
return result;
--
2.7.4

View File

@ -1,5 +1,5 @@
Name: beust-jcommander
Version: 1.66
Version: 1.71
Release: 1%{?dist}
Summary: Java framework for parsing command line parameters
License: ASL 2.0
@ -10,6 +10,8 @@ Source0: https://github.com/cbeust/jcommander/archive/%{version}.tar.gz
# Adapted from earlier version that still shipped poms. It uses kobalt for building now
Source1: %{name}.pom
Patch0: 0001-ParseValues-NullPointerException-patch.patch
BuildRequires: maven-local
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
@ -27,6 +29,7 @@ This package contains the %{summary}.
%prep
%setup -q -n jcommander-%{version}
%patch0 -p1
chmod -x license.txt
cp -p %SOURCE1 pom.xml
@ -46,6 +49,10 @@ sed -i 's/@VERSION@/%{version}/g' pom.xml
%doc license.txt notice.md
%changelog
* Tue Jun 13 2017 Roman Vais <rvais@redhat.com> - 1.71-1
- Update to upstream version 1.71
- Add patch for issue https://github.com/cbeust/jcommander/issues/367
* Fri Mar 10 2017 Roman Vais <rvais@redhat.com> - 1.66-1
- Update to upstream version 1.66

View File

@ -1 +1 @@
SHA512 (1.66.tar.gz) = f98f3008c0a2612c4863bb901d7106b41dae74ff20c2d9b2bb40ccc5effeb30aadeb161844dd64f82492aad95b0d6613c2d00174ae6a32a472a125aeaef1e55f
SHA512 (1.71.tar.gz) = 50424b00ee8f53870108eae8a117c92d1ae35bfd0aaba64bdcc0ae015029f81ff8bad448a4ebbd095bee32b0cab9162748a7d3ff39fce21925b5eb431e7811d0