Author: saces
Date: 2009-04-18 17:54:37 +0000 (Sat, 18 Apr 2009)
New Revision: 27000

Modified:
   trunk/plugins/KeyExplorer/KeyExplorer.java
Log:
remove unused code
rename action download -> splitdownload, now it is 
http://127.0.0.1:8888/plugins/plugins.KeyExplorer.KeyExplorer/?action=splitdownload&key=...@...

Modified: trunk/plugins/KeyExplorer/KeyExplorer.java
===================================================================
--- trunk/plugins/KeyExplorer/KeyExplorer.java  2009-04-18 17:15:11 UTC (rev 
26999)
+++ trunk/plugins/KeyExplorer/KeyExplorer.java  2009-04-18 17:54:37 UTC (rev 
27000)
@@ -104,7 +104,7 @@
                        hexWidth = 32;
                }
                
-               if ("download".equals(action)) {
+               if ("splitdownload".equals(action)) {
                        byte[] data = doDownload(errors, uri);
                        if (errors.size()==0) {
                                throw new DownloadPluginHTTPException(data, 
"plugindownload", DefaultMIMETypes.DEFAULT_MIME_TYPE);
@@ -261,7 +261,7 @@
                        FreenetURI furi = sanitizeURI(errors, key);
                        GetResult getresult = simpleGet(m_pr, furi);
                        if (getresult.isMetaData()) {
-                               return 
unrollMetadata(Metadata.construct(getresult.getData()));
+                               return unrollMetadata(errors, 
Metadata.construct(getresult.getData()));
                        } else {
                                return 
BucketTools.toByteArray(getresult.getData());
                        }
@@ -287,8 +287,12 @@
                return null;
        }
 
-       private byte[] unrollMetadata(Metadata md) throws 
MalformedURLException, IOException, LowLevelGetException, FetchException, 
MetadataParseException, KeyListenerConstructionException {
+       private byte[] unrollMetadata(List<String> errors, Metadata md) throws 
MalformedURLException, IOException, LowLevelGetException, FetchException, 
MetadataParseException, KeyListenerConstructionException {
                
+               if (!md.isSplitfile()) {
+                       errors.add("Unsupported Metadata: Not a Splitfile");
+                       return null;
+               }
                byte[] result = null;
                result = BucketTools.toByteArray(splitGet(md).asBucket());
                return result;
@@ -850,31 +854,6 @@
                return "0.4α " + Version.svnRevision;
        }
 
-       // unroll until it hit a ARCHIVE_MANIFEST, return this
-       private Metadata archiveManifestGet(FreenetURI uri) throws 
MetadataParseException, LowLevelGetException, IOException {
-               GetResult res = simpleGet(m_pr, uri);
-               if (!res.isMetaData()) {
-                       throw new MetadataParseException("Uri did not point to 
metadata " + uri);
-               }
-               Metadata md = Metadata.construct(res.getData());
-               if (md.isArchiveManifest())
-                       return md;
-               return archiveManifestGet(md);
-       }
-
-       private Metadata archiveManifestGet(Metadata md) throws 
MetadataParseException, LowLevelGetException, IOException {
-               // GetResult res = simpleGet(uri);
-               // if (!res.isMetaData()) {
-               // throw new MetadataParseException("Uri did not point to 
metadata " +
-               // uri);
-               // }
-               // Metadata md = Metadata.construct(res.getData());
-               // if (md.isArchiveManifest())
-               // return md;
-               // return archiveManifestGet(md);
-               return md;
-       }
-
        public static Metadata simpleManifestGet(PluginRespirator pr, 
FreenetURI uri) throws MetadataParseException, LowLevelGetException, 
IOException {
                GetResult res = simpleGet(pr, uri);
                if (!res.isMetaData()) {

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to