From 128efac7075a15d17244953b5445326540b3744b Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 10 Dec 2013 02:03:04 +0000 Subject: prevent casting git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549740 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/archiva/cli/ArchivaCli.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java index ebb9111fd..f7147575b 100644 --- a/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java +++ b/archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java @@ -161,8 +161,8 @@ public class ArchivaCli { // hack around poorly configurable project builder by pointing all repositories back at this location to be self // contained - PlexusSisuBridge plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class ); - WagonManager wagonManager = plexusSisuBridge.lookup( WagonManager.class ); + + WagonManager wagonManager = lookup( WagonManager.class ); wagonManager.addMirror( "internal", "*", new File( path ).toURL().toExternalForm() ); ManagedRepository repo = new ManagedRepository(); @@ -179,7 +179,7 @@ public class ArchivaCli List ignoredContent = new ArrayList(); ignoredContent.addAll( Arrays.asList( RepositoryScanner.IGNORABLE_CONTENT ) ); - RepositoryScanner scanner = (RepositoryScanner) lookup( RepositoryScanner.class ); + RepositoryScanner scanner = lookup( RepositoryScanner.class ); try { @@ -194,7 +194,7 @@ public class ArchivaCli } } - private Object lookup( Class clazz ) + private T lookup( Class clazz ) throws PlexusSisuBridgeException { PlexusSisuBridge plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class ); @@ -232,8 +232,8 @@ public class ArchivaCli for ( Map.Entry entry : availableConsumers.entrySet() ) { - String consumerHint = (String) entry.getKey(); - RepositoryContentConsumer consumer = (RepositoryContentConsumer) entry.getValue(); + String consumerHint = entry.getKey(); + RepositoryContentConsumer consumer = entry.getValue(); System.out.println( " " + consumerHint + ": " + consumer.getDescription() + " (" + consumer.getClass().getName() + ")" ); } @@ -262,8 +262,7 @@ public class ArchivaCli private void doConversion( String properties ) throws FileNotFoundException, IOException, RepositoryConversionException, PlexusSisuBridgeException { - LegacyRepositoryConverter legacyRepositoryConverter = - (LegacyRepositoryConverter) lookup( LegacyRepositoryConverter.class ); + LegacyRepositoryConverter legacyRepositoryConverter = lookup( LegacyRepositoryConverter.class ); Properties p = new Properties(); -- cgit v1.2.3