You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ja...@apache.org on 2016/08/28 19:28:34 UTC
oozie git commit: OOZIE-1173 Refactor: use ParamChecker
inXOozieClient (abhishekbafna via jaydeepvishwakarma)
Repository: oozie
Updated Branches:
refs/heads/master 4c88e29ec -> 86c5ebb58
OOZIE-1173 Refactor: use ParamChecker inXOozieClient (abhishekbafna via jaydeepvishwakarma)
Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/86c5ebb5
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/86c5ebb5
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/86c5ebb5
Branch: refs/heads/master
Commit: 86c5ebb58c950524c515b83c4793d3e6341e44d2
Parents: 4c88e29
Author: jvishwakarma <jv...@walmartlabs.com>
Authored: Mon Aug 29 00:58:04 2016 +0530
Committer: jvishwakarma <jv...@walmartlabs.com>
Committed: Mon Aug 29 00:58:04 2016 +0530
----------------------------------------------------------------------
.../org/apache/oozie/client/OozieClient.java | 8 ++---
.../org/apache/oozie/client/XOozieClient.java | 31 +++++---------------
.../java/org/apache/oozie/util/JobUtils.java | 4 +--
.../apache/oozie/util/PriorityDelayQueue.java | 7 +----
.../oozie/client/TestWorkflowXClient.java | 4 +--
release-log.txt | 1 +
6 files changed, 14 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oozie/blob/86c5ebb5/client/src/main/java/org/apache/oozie/client/OozieClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/oozie/client/OozieClient.java b/client/src/main/java/org/apache/oozie/client/OozieClient.java
index eee2d63..a882cab 100644
--- a/client/src/main/java/org/apache/oozie/client/OozieClient.java
+++ b/client/src/main/java/org/apache/oozie/client/OozieClient.java
@@ -1252,9 +1252,7 @@ public class OozieClient {
* @throws IOException
*/
private void sendToOutputStream(Reader reader, int maxLen) throws IOException {
- if (reader == null) {
- throw new IllegalArgumentException("reader cannot be null");
- }
+ notNull(reader, "reader");
StringBuilder sb = new StringBuilder();
char[] buffer = new char[2048];
int read;
@@ -1284,9 +1282,7 @@ public class OozieClient {
* @throws IOException thrown if the resource could not be read.
*/
private String getReaderAsString(Reader reader, int maxLen) throws IOException {
- if (reader == null) {
- throw new IllegalArgumentException("reader cannot be null");
- }
+ notNull(reader, "reader");
StringBuffer sb = new StringBuffer();
char[] buffer = new char[2048];
int read;
http://git-wip-us.apache.org/repos/asf/oozie/blob/86c5ebb5/client/src/main/java/org/apache/oozie/client/XOozieClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/oozie/client/XOozieClient.java b/client/src/main/java/org/apache/oozie/client/XOozieClient.java
index 8ee9c57..8538ec7 100644
--- a/client/src/main/java/org/apache/oozie/client/XOozieClient.java
+++ b/client/src/main/java/org/apache/oozie/client/XOozieClient.java
@@ -202,13 +202,8 @@ public class XOozieClient extends OozieClient {
*/
public String submitScriptLanguage(Properties conf, String scriptFile, String[] args, String[] params, String jobType)
throws IOException, OozieClientException {
- if (conf == null) {
- throw new IllegalArgumentException("conf cannot be null");
- }
- if (scriptFile == null) {
- throw new IllegalArgumentException("scriptFile cannot be null");
- }
-
+ OozieClient.notNull(conf, "conf");
+ OozieClient.notNull(scriptFile, "scriptFile");
validateHttpSubmitConf(conf);
String script = "";
@@ -247,13 +242,8 @@ public class XOozieClient extends OozieClient {
*/
public String submitSqoop(Properties conf, String[] command, String[] args)
throws OozieClientException {
- if (conf == null) {
- throw new IllegalArgumentException("conf cannot be null");
- }
- if (command == null) {
- throw new IllegalArgumentException("command cannot be null");
- }
-
+ OozieClient.notNull(conf, "conf");
+ OozieClient.notNull(command, "command");
validateHttpSubmitConf(conf);
conf.setProperty(XOozieClient.SQOOP_COMMAND, serializeSqoopCommand(command));
@@ -270,10 +260,7 @@ public class XOozieClient extends OozieClient {
* @throws OozieClientException thrown if the job could not be submitted.
*/
public String submitMapReduce(Properties conf) throws OozieClientException {
- if (conf == null) {
- throw new IllegalArgumentException("conf cannot be null");
- }
-
+ OozieClient.notNull(conf, "conf");
validateHttpSubmitConf(conf);
return (new HttpJobSubmit(conf, "mapreduce")).call();
@@ -321,9 +308,7 @@ public class XOozieClient extends OozieClient {
* symbolic link name.
*/
public void addFile(Properties conf, String file) {
- if (file == null || file.length() == 0) {
- throw new IllegalArgumentException("file cannot be null or empty");
- }
+ OozieClient.notEmpty(file, "file");
String files = conf.getProperty(FILES);
conf.setProperty(FILES, files == null ? file : files + "," + file);
}
@@ -337,9 +322,7 @@ public class XOozieClient extends OozieClient {
* symbolic link name.
*/
public void addArchive(Properties conf, String file) {
- if (file == null || file.length() == 0) {
- throw new IllegalArgumentException("file cannot be null or empty");
- }
+ OozieClient.notEmpty(file, "file");
String files = conf.getProperty(ARCHIVES);
conf.setProperty(ARCHIVES, files == null ? file : files + "," + file);
}
http://git-wip-us.apache.org/repos/asf/oozie/blob/86c5ebb5/core/src/main/java/org/apache/oozie/util/JobUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/JobUtils.java b/core/src/main/java/org/apache/oozie/util/JobUtils.java
index a3a5fc0..a4d7272 100644
--- a/core/src/main/java/org/apache/oozie/util/JobUtils.java
+++ b/core/src/main/java/org/apache/oozie/util/JobUtils.java
@@ -51,9 +51,7 @@ public class JobUtils {
* @throws IOException thrown if normalization can not be done properly.
*/
public static void normalizeAppPath(String user, String group, Configuration conf) throws IOException {
- if (user == null) {
- throw new IllegalArgumentException("user cannot be null");
- }
+ ParamChecker.notNull(user, "user");
if (conf.get(XOozieClient.IS_PROXY_SUBMISSION) != null) { // do nothing for proxy submission job;
return;
http://git-wip-us.apache.org/repos/asf/oozie/blob/86c5ebb5/core/src/main/java/org/apache/oozie/util/PriorityDelayQueue.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/util/PriorityDelayQueue.java b/core/src/main/java/org/apache/oozie/util/PriorityDelayQueue.java
index 1ce6fae..75c2069 100644
--- a/core/src/main/java/org/apache/oozie/util/PriorityDelayQueue.java
+++ b/core/src/main/java/org/apache/oozie/util/PriorityDelayQueue.java
@@ -79,9 +79,6 @@ public class PriorityDelayQueue<E> extends AbstractQueue<PriorityDelayQueue.Queu
*/
public QueueElement(XCallable<E> element, int priority, long delay, TimeUnit unit) {
super(element);
- if (element == null) {
- throw new IllegalArgumentException("element cannot be null");
- }
if (priority < 0) {
throw new IllegalArgumentException("priority cannot be negative, [" + element + "]");
}
@@ -331,9 +328,7 @@ public class PriorityDelayQueue<E> extends AbstractQueue<PriorityDelayQueue.Queu
* @throws NullPointerException if the specified element is null
*/
boolean offer(QueueElement<E> queueElement, boolean ignoreSize) {
- if (queueElement == null) {
- throw new NullPointerException("queueElement is NULL");
- }
+ ParamChecker.notNull(queueElement, "queueElement");
if (queueElement.getPriority() < 0 || queueElement.getPriority() >= priorities) {
throw new IllegalArgumentException("priority out of range: " + queueElement);
}
http://git-wip-us.apache.org/repos/asf/oozie/blob/86c5ebb5/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java b/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java
index b06f81d..51ae9e8 100644
--- a/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java
+++ b/core/src/test/java/org/apache/oozie/client/TestWorkflowXClient.java
@@ -218,7 +218,7 @@ public class TestWorkflowXClient extends DagServletTestCase {
wc.addFile(configuration, null);
}
catch (IllegalArgumentException e) {
- assertEquals("file cannot be null or empty", e.getMessage());
+ assertEquals("file cannot be null", e.getMessage());
}
wc.addFile(configuration, "file1");
wc.addFile(configuration, "file2");
@@ -228,7 +228,7 @@ public class TestWorkflowXClient extends DagServletTestCase {
wc.addArchive(configuration, null);
}
catch (IllegalArgumentException e) {
- assertEquals("file cannot be null or empty", e.getMessage());
+ assertEquals("file cannot be null", e.getMessage());
}
wc.addArchive(configuration, "archive1");
wc.addArchive(configuration, "archive2");
http://git-wip-us.apache.org/repos/asf/oozie/blob/86c5ebb5/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 500eaea..12ec7fe 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
-- Oozie 4.3.0 release (trunk - unreleased)
+OOZIE-1173 Refactor: use ParamChecker inXOozieClient (abhishekbafna via jaydeepvishwakarma)
OOZIE-2657 Clean up redundant access modifiers from oozie interfaces (abhishekbafna via jaydeepvishwakarma)
OOZIE-2517 Add support for startCreatedTime and endCreatedTime filters for coord and bundles (abhishekbafna via jaydeepvishwakarma)
OOZIE-2589 CompletedActionXCommand is hardcoded to wrong priority (tm_linfly via rkanter)