You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by le...@apache.org on 2012/03/18 18:23:14 UTC
svn commit: r1302172 - in /nutch/branches/nutchgora/src:
java/org/apache/nutch/plugin/ java/org/apache/nutch/protocol/
plugin/protocol-file/src/java/org/apache/nutch/protocol/file/
Author: lewismc
Date: Sun Mar 18 17:23:13 2012
New Revision: 1302172
URL: http://svn.apache.org/viewvc?rev=1302172&view=rev
Log:
rollback to -r1302136
Modified:
nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginDescriptor.java
nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginManifestParser.java
nutch/branches/nutchgora/src/java/org/apache/nutch/protocol/Content.java
nutch/branches/nutchgora/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.java
Modified: nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginDescriptor.java
URL: http://svn.apache.org/viewvc/nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginDescriptor.java?rev=1302172&r1=1302171&r2=1302172&view=diff
==============================================================================
--- nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginDescriptor.java (original)
+++ nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginDescriptor.java Sun Mar 18 17:23:13 2012
@@ -20,7 +20,6 @@ import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
@@ -215,16 +214,12 @@ public class PluginDescriptor {
/**
* Adds a exported library with a relative path to the plugin directory.
- * We wish to automatically escape characters that are illegal in URLs.
- * It is recommended that new code convert an abstract pathname into a URL
- * by first converting it into a URI, via the toURI method, and then
- * converting the URI into a URL via the URI.toURL method
*
* @param pLibPath
*/
public void addExportedLibRelative(String pLibPath)
throws MalformedURLException {
- URL url = new File(getPluginPath() + File.separator + pLibPath).toURI().toURL();
+ URL url = new File(getPluginPath() + File.separator + pLibPath).toURL();
fExportedLibs.add(url);
}
@@ -247,17 +242,13 @@ public class PluginDescriptor {
}
/**
- * Adds a exported library with a relative path to the plugin directory.
- * We wish to automatically escape characters that are illegal in URLs.
- * It is recommended that new code convert an abstract pathname into a URL
- * by first converting it into a URI, via the toURI method, and then
- * converting the URI into a URL via the URI.toURL method
+ * Adds a not exported library with a plugin directory relative path.
*
* @param pLibPath
*/
public void addNotExportedLibRelative(String pLibPath)
throws MalformedURLException {
- URL url = new File(getPluginPath() + File.separator + pLibPath).toURI().toURL();
+ URL url = new File(getPluginPath() + File.separator + pLibPath).toURL();
fNotExportedLibs.add(url);
}
@@ -288,7 +279,7 @@ public class PluginDescriptor {
try {
for (File file2 : file.listFiles()) {
if (file2.getAbsolutePath().endsWith("properties"))
- arrayList.add(file2.getParentFile().toURI().toURL());
+ arrayList.add(file2.getParentFile().toURL());
}
} catch (MalformedURLException e) {
LOG.debug(getPluginId() + " " + e.toString());
Modified: nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginManifestParser.java
URL: http://svn.apache.org/viewvc/nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginManifestParser.java?rev=1302172&r1=1302171&r2=1302172&view=diff
==============================================================================
--- nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginManifestParser.java (original)
+++ nutch/branches/nutchgora/src/java/org/apache/nutch/plugin/PluginManifestParser.java Sun Mar 18 17:23:13 2012
@@ -21,7 +21,6 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.URI;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
@@ -148,7 +147,7 @@ public class PluginManifestParser {
private PluginDescriptor parseManifestFile(String pManifestPath)
throws MalformedURLException, SAXException, IOException,
ParserConfigurationException {
- Document document = parseXML(new File(pManifestPath).toURI().toURL());
+ Document document = parseXML(new File(pManifestPath).toURL());
String pPath = new File(pManifestPath).getParent();
return parsePlugin(document, pPath);
}
Modified: nutch/branches/nutchgora/src/java/org/apache/nutch/protocol/Content.java
URL: http://svn.apache.org/viewvc/nutch/branches/nutchgora/src/java/org/apache/nutch/protocol/Content.java?rev=1302172&r1=1302171&r2=1302172&view=diff
==============================================================================
--- nutch/branches/nutchgora/src/java/org/apache/nutch/protocol/Content.java (original)
+++ nutch/branches/nutchgora/src/java/org/apache/nutch/protocol/Content.java Sun Mar 18 17:23:13 2012
@@ -32,6 +32,7 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.ArrayFile;
import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.UTF8;
import org.apache.hadoop.io.VersionMismatchException;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.util.GenericOptionsParser;
@@ -112,21 +113,21 @@ public final class Content implements Wr
switch (oldVersion) {
case 0:
case 1:
- url = Text.readString(in); // read url
- base = Text.readString(in); // read base
+ url = UTF8.readString(in); // read url
+ base = UTF8.readString(in); // read base
content = new byte[in.readInt()]; // read content
in.readFully(content);
- contentType = Text.readString(in); // read contentType
+ contentType = UTF8.readString(in); // read contentType
// reconstruct metadata
int keySize = in.readInt();
String key;
for (int i = 0; i < keySize; i++) {
- key = Text.readString(in);
+ key = UTF8.readString(in);
int valueSize = in.readInt();
for (int j = 0; j < valueSize; j++) {
- metadata.add(key, Text.readString(in));
+ metadata.add(key, UTF8.readString(in));
}
}
break;
Modified: nutch/branches/nutchgora/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.java
URL: http://svn.apache.org/viewvc/nutch/branches/nutchgora/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.java?rev=1302172&r1=1302171&r2=1302172&view=diff
==============================================================================
--- nutch/branches/nutchgora/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.java (original)
+++ nutch/branches/nutchgora/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.java Sun Mar 18 17:23:13 2012
@@ -21,7 +21,6 @@ package org.apache.nutch.protocol.file;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
-import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.nutch.metadata.Metadata;
@@ -144,7 +143,7 @@ public class FileResponse {
if (!f.equals(f.getCanonicalFile())) {
// set headers
//hdrs.put("Location", f.getCanonicalFile().toURI());
- headers.set(Response.LOCATION, f.getCanonicalFile().toURI().toURL().toString());
+ headers.set(Response.LOCATION, f.getCanonicalFile().toURL().toString());
this.code = 300; // http redirect
return;