diff options
author | Olivier Lamy <olamy@apache.org> | 2013-12-10 02:03:04 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2013-12-10 02:03:04 +0000 |
commit | 128efac7075a15d17244953b5445326540b3744b (patch) | |
tree | 80a447bc8feb27b6fd610d5d6012cacc03d50821 | |
parent | c413114392e67debb4ba48681044581a9bba6bef (diff) | |
download | archiva-128efac7075a15d17244953b5445326540b3744b.tar.gz archiva-128efac7075a15d17244953b5445326540b3744b.zip |
prevent casting
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549740 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | archiva-cli/src/main/java/org/apache/archiva/cli/ArchivaCli.java | 15 |
1 files 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<String> ignoredContent = new ArrayList<String>(); 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>T lookup( Class<T> clazz ) throws PlexusSisuBridgeException { PlexusSisuBridge plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class ); @@ -232,8 +232,8 @@ public class ArchivaCli for ( Map.Entry<String, KnownRepositoryContentConsumer> 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(); |