Mercurial > 510Connectbot
diff src/ch/ethz/ssh2/compression/CompressionFactory.java @ 308:42b15aaa7ac7 ganymed
merge
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 30 Jul 2014 14:21:50 -0700 |
parents | 071eccdff8ea |
children | 97da8c5fb40a |
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/compression/CompressionFactory.java Wed Jul 30 13:38:04 2014 -0700 +++ b/src/ch/ethz/ssh2/compression/CompressionFactory.java Wed Jul 30 14:21:50 2014 -0700 @@ -19,7 +19,7 @@ } private static final List<CompressorEntry> compressors - = new ArrayList<CompressorEntry>(); + = new ArrayList<CompressorEntry>(); static { // Higher priority first @@ -28,15 +28,17 @@ public static String[] getDefaultCompressorList() { String list[] = new String[compressors.size()]; - for(int i = 0; i < compressors.size(); i++) { + + for (int i = 0; i < compressors.size(); i++) { CompressorEntry ce = compressors.get(i); list[i] = ce.type; } + return list; } public static void checkCompressorList(String[] list) { - for(final String candidate : list) { + for (final String candidate : list) { getEntry(candidate); } } @@ -44,23 +46,26 @@ public static Compressor createCompressor(String type) { try { CompressorEntry ce = getEntry(type); - if(null == ce.compressorClass) { + + if (null == ce.compressorClass) { return null; } + Class<?> cc = Class.forName(ce.compressorClass); return (Compressor) cc.newInstance(); } - catch(Exception e) { + catch (Exception e) { throw new IllegalArgumentException("Cannot instantiate " + type); } } private static CompressorEntry getEntry(String type) { - for(CompressorEntry ce : compressors) { - if(ce.type.equals(type)) { + for (CompressorEntry ce : compressors) { + if (ce.type.equals(type)) { return ce; } } + throw new IllegalArgumentException("Unknown algorithm " + type); } } \ No newline at end of file