Update upstream patch for bug 429369
This commit is contained in:
parent
ae05a4f50b
commit
b805ee9f0d
|
@ -0,0 +1,51 @@
|
|||
From 210d3f409d57f83a644b69000ae8399d5c0dc07b Mon Sep 17 00:00:00 2001
|
||||
From: Stuart McCulloch <mcculls@gmail.com>
|
||||
Date: Wed, 16 Apr 2014 02:18:15 +0100
|
||||
Subject: [PATCH] Bug 429369: fallback to relaxed (unchecked values) Map
|
||||
conversion with warning
|
||||
|
||||
---
|
||||
.../converters/composite/MapConverter.java | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/composite/MapConverter.java b/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/composite/MapConverter.java
|
||||
index 277f267..c343004 100644
|
||||
--- a/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/composite/MapConverter.java
|
||||
+++ b/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/composite/MapConverter.java
|
||||
@@ -26,6 +26,7 @@ import org.codehaus.plexus.component.configurator.converters.ParameterizedConfig
|
||||
import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup;
|
||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||
+import org.eclipse.sisu.inject.Logs;
|
||||
|
||||
public class MapConverter
|
||||
extends AbstractConfigurationConverter
|
||||
@@ -72,9 +73,23 @@ public class MapConverter
|
||||
final ConfigurationConverter converter = lookup.lookupConverterForType( elementType );
|
||||
for ( int i = 0, size = configuration.getChildCount(); i < size; i++ )
|
||||
{
|
||||
+ Object elementValue;
|
||||
final PlexusConfiguration element = configuration.getChild( i );
|
||||
- map.put( element.getName(), converter.fromConfiguration( lookup, element, elementType, enclosingType,
|
||||
- loader, evaluator, listener ) );
|
||||
+ try
|
||||
+ {
|
||||
+ elementValue = converter.fromConfiguration( lookup, element, elementType, enclosingType, //
|
||||
+ loader, evaluator, listener );
|
||||
+ }
|
||||
+ // TEMP: remove when http://jira.codehaus.org/browse/MSHADE-168 is fixed
|
||||
+ catch ( final ComponentConfigurationException e )
|
||||
+ {
|
||||
+ elementValue = fromExpression( element, evaluator );
|
||||
+
|
||||
+ Logs.warn( "Map in " + enclosingType + " declares value type as: {} but saw: {} at runtime",
|
||||
+ elementType, null != elementValue ? elementValue.getClass() : null );
|
||||
+ }
|
||||
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+ map.put( element.getName(), elementValue );
|
||||
}
|
||||
return map;
|
||||
}
|
||||
--
|
||||
1.9.0
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
From fdbcb51eea40131ed221ecd07e6f33926d14e387 Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Mon, 3 Mar 2014 05:48:15 +0100
|
||||
Subject: [PATCH] Revert "Bug 406688: allow maps of string to complex types in
|
||||
mojo configuration"
|
||||
|
||||
This reverts commit 5b469c87c134ca9e78883981f138a8972ac31bdc.
|
||||
---
|
||||
.../converters/composite/MapConverter.java | 37 +---------------------
|
||||
1 file changed, 1 insertion(+), 36 deletions(-)
|
||||
|
||||
diff --git a/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/composite/MapConverter.java b/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/composite/MapConverter.java
|
||||
index 277f267..790b6c2 100644
|
||||
--- a/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/composite/MapConverter.java
|
||||
+++ b/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/composite/MapConverter.java
|
||||
@@ -13,7 +13,6 @@
|
||||
package org.codehaus.plexus.component.configurator.converters.composite;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
-import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeMap;
|
||||
@@ -21,15 +20,12 @@ import java.util.TreeMap;
|
||||
import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
|
||||
import org.codehaus.plexus.component.configurator.ConfigurationListener;
|
||||
import org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter;
|
||||
-import org.codehaus.plexus.component.configurator.converters.ConfigurationConverter;
|
||||
-import org.codehaus.plexus.component.configurator.converters.ParameterizedConfigurationConverter;
|
||||
import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup;
|
||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||
|
||||
public class MapConverter
|
||||
extends AbstractConfigurationConverter
|
||||
- implements ParameterizedConfigurationConverter
|
||||
{
|
||||
public boolean canConvert( final Class<?> type )
|
||||
{
|
||||
@@ -41,15 +37,6 @@ public class MapConverter
|
||||
final ExpressionEvaluator evaluator, final ConfigurationListener listener )
|
||||
throws ComponentConfigurationException
|
||||
{
|
||||
- return fromConfiguration( lookup, configuration, type, null, enclosingType, loader, evaluator, listener );
|
||||
- }
|
||||
-
|
||||
- public Object fromConfiguration( final ConverterLookup lookup, final PlexusConfiguration configuration,
|
||||
- final Class<?> type, final Type[] typeArguments, final Class<?> enclosingType,
|
||||
- final ClassLoader loader, final ExpressionEvaluator evaluator,
|
||||
- final ConfigurationListener listener )
|
||||
- throws ComponentConfigurationException
|
||||
- {
|
||||
final Object value = fromExpression( configuration, evaluator, type );
|
||||
if ( null != value )
|
||||
{
|
||||
@@ -58,23 +45,10 @@ public class MapConverter
|
||||
try
|
||||
{
|
||||
final Map<Object, Object> map = instantiateMap( configuration, type, loader );
|
||||
- final Class<?> elementType = findElementType( typeArguments );
|
||||
- if ( Object.class == elementType || String.class == elementType )
|
||||
- {
|
||||
- for ( int i = 0, size = configuration.getChildCount(); i < size; i++ )
|
||||
- {
|
||||
- final PlexusConfiguration element = configuration.getChild( i );
|
||||
- map.put( element.getName(), fromExpression( element, evaluator ) );
|
||||
- }
|
||||
- return map;
|
||||
- }
|
||||
- // handle maps with complex element types...
|
||||
- final ConfigurationConverter converter = lookup.lookupConverterForType( elementType );
|
||||
for ( int i = 0, size = configuration.getChildCount(); i < size; i++ )
|
||||
{
|
||||
final PlexusConfiguration element = configuration.getChild( i );
|
||||
- map.put( element.getName(), converter.fromConfiguration( lookup, element, elementType, enclosingType,
|
||||
- loader, evaluator, listener ) );
|
||||
+ map.put( element.getName(), fromExpression( element, evaluator ) );
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -103,13 +77,4 @@ public class MapConverter
|
||||
failIfNotTypeCompatible( impl, type, configuration );
|
||||
return (Map<Object, Object>) impl;
|
||||
}
|
||||
-
|
||||
- private static Class<?> findElementType( final Type[] typeArguments )
|
||||
- {
|
||||
- if ( null != typeArguments && typeArguments.length > 1 && typeArguments[1] instanceof Class<?> )
|
||||
- {
|
||||
- return (Class<?>) typeArguments[1];
|
||||
- }
|
||||
- return Object.class;
|
||||
- }
|
||||
}
|
||||
--
|
||||
1.8.4.2
|
||||
|
10
sisu.spec
10
sisu.spec
|
@ -1,7 +1,7 @@
|
|||
Name: sisu
|
||||
Epoch: 1
|
||||
Version: 0.2.0
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: Eclipse dependency injection framework
|
||||
# bundled asm is under BSD
|
||||
# See also: https://fedorahosted.org/fpc/ticket/346
|
||||
|
@ -13,8 +13,9 @@ URL: http://eclipse.org/sisu
|
|||
Source0: http://git.eclipse.org/c/%{name}/org.eclipse.%{name}.inject.git/snapshot/releases/%{version}.tar.bz2#/org.eclipse.%{name}.inject-%{version}.tar.bz2
|
||||
Source1: http://git.eclipse.org/c/%{name}/org.eclipse.%{name}.plexus.git/snapshot/releases/%{version}.tar.bz2#/org.eclipse.%{name}.plexus-%{version}.tar.bz2
|
||||
|
||||
# Revert new feature which introduced a regressionm
|
||||
Patch0: 0001-Revert-Bug-406688-allow-maps-of-string-to-complex-ty.patch
|
||||
# Upstream patch to fix a regression
|
||||
# See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=429369
|
||||
Patch0: 0001-Bug-429369-fallback-to-relaxed-unchecked-values-Map-.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
|
@ -200,6 +201,9 @@ done
|
|||
|
||||
|
||||
%changelog
|
||||
* Wed Apr 16 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 1:0.2.0-5
|
||||
- Update upstream patch for bug 429369
|
||||
|
||||
* Mon Mar 3 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 1:0.2.0-4
|
||||
- Revert upstream feature which introduced a regression
|
||||
- Resolves: rhbz#1070915
|
||||
|
|
Loading…
Reference in New Issue