You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ga...@apache.org on 2008/01/29 00:51:15 UTC
svn commit: r616108 - in /incubator/pig/trunk: CHANGES.txt
src/org/apache/pig/impl/PigContext.java
Author: gates
Date: Mon Jan 28 15:51:08 2008
New Revision: 616108
URL: http://svn.apache.org/viewvc?rev=616108&view=rev
Log:
PIG-57: Fixed NPE in PigContext.fixUpDomain
Modified:
incubator/pig/trunk/CHANGES.txt
incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java
Modified: incubator/pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=616108&r1=616107&r2=616108&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Mon Jan 28 15:51:08 2008
@@ -70,3 +70,5 @@
PIG-63: Fix for non-ascii UTF-8 data (breed@ and olgan@)
PIG-77: Added eclipse specific files to svn:ignore
+
+ PIG-57: Fixed NPE in PigContext.fixUpDomain (francisoud via gates)
Modified: incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java?rev=616108&r1=616107&r2=616108&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/PigContext.java Mon Jan 28 15:51:08 2008
@@ -351,9 +351,23 @@
}
throw new RuntimeException("Could not scrape needed information.");
}
+
+ /**
+ * Transform from "hostname:port" to "ip:port".
+ * @param hostPort "hostname:port"
+ * @throws IllegalArgumentException if hostPort doesn't match pattern 'host:port'
+ * @return "ip:port"
+ */
private String fixUpDomain(String hostPort) throws UnknownHostException {
+ if (hostPort == null) {
+ return null;
+ }
String parts[] = hostPort.split(":");
+ if (parts.length < 2) {
+ throw new IllegalArgumentException("Invalid 'host:port' parameter was: " + hostPort);
+ }
if (parts[0].indexOf('.') == -1) {
+ // FIXME don't hardcode "inktomisearch" strings
parts[0] = parts[0] + ".inktomisearch.com";
}
InetAddress.getByName(parts[0]);