sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-941: Sqoop2: Do not send sensitive values from server to client
Date Sat, 23 Mar 2013 15:04:12 GMT
Updated Branches:
  refs/heads/sqoop2 b94c22919 -> b49b71235


SQOOP-941: Sqoop2: Do not send sensitive values from server to client

(Abraham Elmahrek via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/b49b7123
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/b49b7123
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/b49b7123

Branch: refs/heads/sqoop2
Commit: b49b71235d655514eb581f21fc72e4ec0841d3d0
Parents: b94c229
Author: Jarek Jarcec Cecho <jarcec@cloudera.com>
Authored: Sat Mar 23 08:03:10 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@cloudera.com>
Committed: Sat Mar 23 08:03:10 2013 -0700

----------------------------------------------------------------------
 .../sqoop/client/request/ConnectionRequest.java    |    8 ++-
 .../apache/sqoop/client/request/JobRequest.java    |    8 ++-
 .../java/org/apache/sqoop/json/ConnectionBean.java |    6 +-
 .../java/org/apache/sqoop/json/ConnectorBean.java  |    6 +-
 .../java/org/apache/sqoop/json/FrameworkBean.java  |    6 +-
 .../main/java/org/apache/sqoop/json/JobBean.java   |    6 +-
 .../main/java/org/apache/sqoop/json/JsonBean.java  |    4 +-
 .../java/org/apache/sqoop/json/SubmissionBean.java |    2 +-
 .../java/org/apache/sqoop/json/ThrowableBean.java  |    4 +-
 .../java/org/apache/sqoop/json/ValidationBean.java |    2 +-
 .../java/org/apache/sqoop/json/VersionBean.java    |    2 +-
 .../apache/sqoop/json/util/FormSerialization.java  |   13 +++--
 .../org/apache/sqoop/json/TestConnectionBean.java  |   46 ++++++++++++++-
 .../org/apache/sqoop/json/TestConnectorBean.java   |    2 +-
 .../org/apache/sqoop/json/TestFrameworkBean.java   |    2 +-
 .../java/org/apache/sqoop/json/TestJobBean.java    |    2 +-
 .../org/apache/sqoop/json/TestSubmissionBean.java  |    2 +-
 .../org/apache/sqoop/json/TestThrowableBean.java   |    2 +-
 .../test/java/org/apache/sqoop/json/TestUtil.java  |    4 +-
 .../org/apache/sqoop/json/TestValidationBean.java  |    4 +-
 .../apache/sqoop/server/SqoopProtocolServlet.java  |    4 +-
 21 files changed, 96 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/client/src/main/java/org/apache/sqoop/client/request/ConnectionRequest.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/request/ConnectionRequest.java b/client/src/main/java/org/apache/sqoop/client/request/ConnectionRequest.java
index 57486b1..a69e009 100644
--- a/client/src/main/java/org/apache/sqoop/client/request/ConnectionRequest.java
+++ b/client/src/main/java/org/apache/sqoop/client/request/ConnectionRequest.java
@@ -49,7 +49,9 @@ public class ConnectionRequest extends Request {
   public ValidationBean create(String serverUrl, MConnection connection) {
 
     ConnectionBean connectionBean = new ConnectionBean(connection);
-    JSONObject connectionJson = connectionBean.extract();
+
+    // Extract all form inputs including sensitive inputs
+    JSONObject connectionJson = connectionBean.extract(false);
 
     String response = super.post(serverUrl + RESOURCE,
                                  connectionJson.toJSONString());
@@ -63,7 +65,9 @@ public class ConnectionRequest extends Request {
   public ValidationBean update(String serverUrl, MConnection connection) {
 
     ConnectionBean connectionBean = new ConnectionBean(connection);
-    JSONObject connectionJson = connectionBean.extract();
+
+    // Extract all form inputs including sensitive inputs
+    JSONObject connectionJson = connectionBean.extract(false);
 
     String response = super.put(serverUrl + RESOURCE
                                   + connection.getPersistenceId(),

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/client/src/main/java/org/apache/sqoop/client/request/JobRequest.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/sqoop/client/request/JobRequest.java b/client/src/main/java/org/apache/sqoop/client/request/JobRequest.java
index 499ebeb..55ba9db 100644
--- a/client/src/main/java/org/apache/sqoop/client/request/JobRequest.java
+++ b/client/src/main/java/org/apache/sqoop/client/request/JobRequest.java
@@ -49,7 +49,9 @@ public class JobRequest extends Request {
   public ValidationBean create(String serverUrl, MJob job) {
 
     JobBean jobBean = new JobBean(job);
-    JSONObject jobJson = jobBean.extract();
+
+    // Extract all form inputs including sensitive inputs
+    JSONObject jobJson = jobBean.extract(false);
 
     String response = super.post(serverUrl + RESOURCE,
       jobJson.toJSONString());
@@ -63,7 +65,9 @@ public class JobRequest extends Request {
   public ValidationBean update(String serverUrl, MJob job) {
 
     JobBean jobBean = new JobBean(job);
-    JSONObject jobJson = jobBean.extract();
+
+    // Extract all form inputs including sensitive inputs
+    JSONObject jobJson = jobBean.extract(false);
 
     String response = super.put(serverUrl + RESOURCE + job.getPersistenceId(),
                                 jobJson.toJSONString());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java b/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
index dbc0f93..b4e986a 100644
--- a/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ConnectionBean.java
@@ -96,7 +96,7 @@ public class ConnectionBean implements JsonBean {
 
   @Override
   @SuppressWarnings("unchecked")
-  public JSONObject extract() {
+  public JSONObject extract(boolean skipSensitive) {
     JSONArray array = new JSONArray();
 
     for(MConnection connection : connections) {
@@ -108,9 +108,9 @@ public class ConnectionBean implements JsonBean {
       object.put(UPDATED, connection.getLastUpdateDate().getTime());
       object.put(CONNECTOR_ID, connection.getConnectorId());
       object.put(CONNECTOR_PART,
-        extractForms(connection.getConnectorPart().getForms()));
+        extractForms(connection.getConnectorPart().getForms(), skipSensitive));
       object.put(FRAMEWORK_PART,
-        extractForms(connection.getFrameworkPart().getForms()));
+        extractForms(connection.getFrameworkPart().getForms(), skipSensitive));
 
       array.add(object);
     }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java b/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
index 601040d..cbe049a 100644
--- a/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ConnectorBean.java
@@ -62,7 +62,7 @@ public class ConnectorBean implements JsonBean {
 
   @SuppressWarnings("unchecked")
   @Override
-  public JSONObject extract() {
+  public JSONObject extract(boolean skipSensitive) {
 
     JSONArray array = new JSONArray();
 
@@ -73,11 +73,11 @@ public class ConnectorBean implements JsonBean {
       object.put(NAME, connector.getUniqueName());
       object.put(CLASS, connector.getClassName());
       object.put(VERSION, connector.getVersion());
-      object.put(CON_FORMS, extractForms(connector.getConnectionForms().getForms()));
+      object.put(CON_FORMS, extractForms(connector.getConnectionForms().getForms(), skipSensitive));
 
       JSONObject jobForms = new JSONObject();
       for (MJobForms job : connector.getAllJobsForms().values()) {
-        jobForms.put(job.getType().name(), extractForms(job.getForms()));
+        jobForms.put(job.getType().name(), extractForms(job.getForms(), skipSensitive));
       }
       object.put(JOB_FORMS, jobForms);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/FrameworkBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/FrameworkBean.java b/common/src/main/java/org/apache/sqoop/json/FrameworkBean.java
index 4e07b6c..ad4753b 100644
--- a/common/src/main/java/org/apache/sqoop/json/FrameworkBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/FrameworkBean.java
@@ -64,13 +64,13 @@ public class FrameworkBean implements JsonBean {
 
   @SuppressWarnings("unchecked")
   @Override
-  public JSONObject extract() {
+  public JSONObject extract(boolean skipSensitive) {
     JSONArray conForms =
-      extractForms(framework.getConnectionForms().getForms());
+      extractForms(framework.getConnectionForms().getForms(), skipSensitive);
     JSONObject jobForms = new JSONObject();
 
     for (MJobForms job : framework.getAllJobsForms().values()) {
-      jobForms.put(job.getType().name(), extractForms(job.getForms()));
+      jobForms.put(job.getType().name(), extractForms(job.getForms(), skipSensitive));
     }
 
     JSONObject result = new JSONObject();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/JobBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/JobBean.java b/common/src/main/java/org/apache/sqoop/json/JobBean.java
index a16c06e..a830646 100644
--- a/common/src/main/java/org/apache/sqoop/json/JobBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JobBean.java
@@ -98,7 +98,7 @@ public class JobBean implements JsonBean {
 
   @Override
   @SuppressWarnings("unchecked")
-  public JSONObject extract() {
+  public JSONObject extract(boolean skipSensitive) {
     JSONArray array = new JSONArray();
 
     for(MJob job : jobs) {
@@ -112,9 +112,9 @@ public class JobBean implements JsonBean {
       object.put(CONNECTION_ID, job.getConnectionId());
       object.put(CONNECTOR_ID, job.getConnectorId());
       object.put(CONNECTOR_PART,
-        extractForms(job.getConnectorPart().getForms()));
+        extractForms(job.getConnectorPart().getForms(), skipSensitive));
       object.put(FRAMEWORK_PART,
-        extractForms(job.getFrameworkPart().getForms()));
+        extractForms(job.getFrameworkPart().getForms(), skipSensitive));
 
       array.add(object);
     }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/JsonBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/JsonBean.java b/common/src/main/java/org/apache/sqoop/json/JsonBean.java
index 074a579..8189259 100644
--- a/common/src/main/java/org/apache/sqoop/json/JsonBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/JsonBean.java
@@ -21,14 +21,14 @@ import org.json.simple.JSONObject;
 
 public interface JsonBean {
 
-  JSONObject extract();
+  JSONObject extract(boolean skipSensitive);
 
   void restore(JSONObject jsonObject);
 
   public static final JsonBean EMPTY_BEAN = new JsonBean() {
 
     @Override
-    public JSONObject extract() {
+    public JSONObject extract(boolean skipSensitive) {
       return new JSONObject();
     }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java b/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
index 9d8011b..1ef72eb 100644
--- a/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
@@ -61,7 +61,7 @@ public class SubmissionBean implements JsonBean {
 
   @Override
   @SuppressWarnings("unchecked")
-  public JSONObject extract() {
+  public JSONObject extract(boolean skipSensitive) {
     JSONObject ret = new JSONObject();
 
     ret.put(JOB, submission.getJobId());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/ThrowableBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/ThrowableBean.java b/common/src/main/java/org/apache/sqoop/json/ThrowableBean.java
index 4bb0ffc..86b637a 100644
--- a/common/src/main/java/org/apache/sqoop/json/ThrowableBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ThrowableBean.java
@@ -54,7 +54,7 @@ public class ThrowableBean implements JsonBean {
 
   @Override
   @SuppressWarnings("unchecked")
-  public JSONObject extract() {
+  public JSONObject extract(boolean skipSensitive) {
     JSONObject result = new JSONObject();
 
     result.put(MESSAGE, throwable.getMessage());
@@ -77,7 +77,7 @@ public class ThrowableBean implements JsonBean {
     Throwable cause = throwable.getCause();
     if(cause != null) {
       ThrowableBean causeBean = new ThrowableBean(cause);
-      result.put(CAUSE, causeBean.extract());
+      result.put(CAUSE, causeBean.extract(skipSensitive));
     }
 
     return result;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/ValidationBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/ValidationBean.java b/common/src/main/java/org/apache/sqoop/json/ValidationBean.java
index 747a228..fd36825 100644
--- a/common/src/main/java/org/apache/sqoop/json/ValidationBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/ValidationBean.java
@@ -73,7 +73,7 @@ public class ValidationBean implements JsonBean {
   }
 
   @SuppressWarnings("unchecked")
-  public JSONObject extract() {
+  public JSONObject extract(boolean skipSensitive) {
     JSONObject object = new JSONObject();
 
     // Optionally transfer id

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/VersionBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/VersionBean.java b/common/src/main/java/org/apache/sqoop/json/VersionBean.java
index c37b2cc..029a776 100644
--- a/common/src/main/java/org/apache/sqoop/json/VersionBean.java
+++ b/common/src/main/java/org/apache/sqoop/json/VersionBean.java
@@ -54,7 +54,7 @@ public class VersionBean implements JsonBean {
 
   @SuppressWarnings("unchecked")
   @Override
-  public JSONObject extract() {
+  public JSONObject extract(boolean skipSensitive) {
     JSONObject result = new JSONObject();
     result.put(VERSION, version);
     result.put(REVISION, revision);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java b/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java
index 8b40a54..3f8f985 100644
--- a/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java
+++ b/common/src/main/java/org/apache/sqoop/json/util/FormSerialization.java
@@ -64,11 +64,11 @@ public final class FormSerialization {
    * @return JSON object with serialized form of the list.
    */
   @SuppressWarnings("unchecked")
-  public static JSONArray extractForms(List<MForm> mForms) {
+  public static JSONArray extractForms(List<MForm> mForms, boolean skipSensitive) {
     JSONArray forms = new JSONArray();
 
     for (MForm mForm : mForms) {
-      forms.add(extractForm(mForm));
+      forms.add(extractForm(mForm, skipSensitive));
     }
 
     return forms;
@@ -78,10 +78,11 @@ public final class FormSerialization {
    * Transform given form to JSON Object.
    *
    * @param mForm Given MForm instance
+   * @param skipSensitive conditionally add sensitive input values
    * @return Serialized JSON object.
    */
   @SuppressWarnings("unchecked")
-  public static JSONObject extractForm(MForm mForm) {
+  public static JSONObject extractForm(MForm mForm, boolean skipSensitive) {
     JSONObject form = new JSONObject();
     form.put(ID, mForm.getPersistenceId());
     form.put(FORM_NAME, mForm.getName());
@@ -91,7 +92,6 @@ public final class FormSerialization {
 
     for (MInput<?> mInput : mForm.getInputs()) {
       JSONObject input = new JSONObject();
-      mInputs.add(input);
       input.put(ID, mInput.getPersistenceId());
       input.put(FORM_INPUT_NAME, mInput.getName());
       input.put(FORM_INPUT_TYPE, mInput.getType().toString());
@@ -111,9 +111,12 @@ public final class FormSerialization {
       }
 
       // Serialize value if is there
-      if(!mInput.isEmpty()) {
+      // Skip if sensitive
+      if (!mInput.isEmpty() && !(skipSensitive && ((MStringInput)mInput).isMasked()))
{
         input.put(FORM_INPUT_VALUE, mInput.getUrlSafeValueString());
       }
+
+      mInputs.add(input);
     }
 
     return form;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java b/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
index 1322dd3..5553554 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestConnectionBean.java
@@ -20,6 +20,7 @@ package org.apache.sqoop.json;
 import org.apache.sqoop.model.MConnection;
 import org.apache.sqoop.model.MStringInput;
 import org.json.simple.JSONObject;
+import org.json.simple.JSONArray;
 import org.json.simple.JSONValue;
 import org.junit.Test;
 
@@ -49,7 +50,7 @@ public class TestConnectionBean {
 
     // Serialize it to JSON object
     ConnectionBean bean = new ConnectionBean(connection);
-    JSONObject json = bean.extract();
+    JSONObject json = bean.extract(false);
 
     // "Move" it across network in text form
     String string = json.toJSONString();
@@ -71,4 +72,47 @@ public class TestConnectionBean {
       .getForms().get(0).getInputs().get(0);
     assertEquals("Hi there!", targetInput.getValue());
   }
+
+  @Test
+  public void testSensitivityFilter() {
+    Date created = new Date();
+    Date updated = new Date();
+    MConnection connection = getConnection("ahoj");
+    connection.setName("Connection");
+    connection.setPersistenceId(666);
+    connection.setCreationDate(created);
+    connection.setLastUpdateDate(updated);
+
+    // Fill some data at the beginning
+    MStringInput input = (MStringInput) connection.getConnectorPart().getForms()
+      .get(0).getInputs().get(0);
+    input.setValue("Hi there!");
+
+    // Serialize it to JSON object
+    ConnectionBean bean = new ConnectionBean(connection);
+    JSONObject json = bean.extract(false);
+    JSONObject jsonFiltered = bean.extract(true);
+
+    // Sensitive values should exist
+    JSONArray all = (JSONArray)json.get("all");
+    JSONObject allItem = (JSONObject)all.get(0);
+    JSONArray connectors = (JSONArray)allItem.get("connector");
+    JSONObject connector = (JSONObject)connectors.get(0);
+    JSONArray inputs = (JSONArray)connector.get("inputs");
+    assertEquals(3, inputs.size());
+    // Inputs are ordered when creating connection
+    JSONObject password = (JSONObject)inputs.get(2);
+    assertTrue(password.containsKey("value"));
+
+    // Sensitive values should not exist
+    all = (JSONArray)jsonFiltered.get("all");
+    allItem = (JSONObject)all.get(0);
+    connectors = (JSONArray)allItem.get("connector");
+    connector = (JSONObject)connectors.get(0);
+    inputs = (JSONArray)connector.get("inputs");
+    assertEquals(3, inputs.size());
+    // Inputs are ordered when creating connection
+    password = (JSONObject)inputs.get(2);
+    assertFalse(password.containsKey("value"));
+  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java b/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
index 38cdb7e..e078474 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
@@ -55,7 +55,7 @@ public class TestConnectorBean {
 
     // Serialize it to JSON object
     ConnectorBean bean = new ConnectorBean(connectors, bundles);
-    JSONObject json = bean.extract();
+    JSONObject json = bean.extract(false);
 
     // "Move" it across network in text form
     String string = json.toJSONString();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/test/java/org/apache/sqoop/json/TestFrameworkBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestFrameworkBean.java b/common/src/test/java/org/apache/sqoop/json/TestFrameworkBean.java
index 5aa581b..5cc110a 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestFrameworkBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestFrameworkBean.java
@@ -44,7 +44,7 @@ public class TestFrameworkBean {
 
     // Serialize it to JSON object
     FrameworkBean bean = new FrameworkBean(framework, getResourceBundle());
-    JSONObject json = bean.extract();
+    JSONObject json = bean.extract(false);
 
     // "Move" it across network in text form
     String string = json.toJSONString();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
index 3ea30ce..6af1d8b 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
@@ -50,7 +50,7 @@ public class TestJobBean {
 
     // Serialize it to JSON object
     JobBean bean = new JobBean(job);
-    JSONObject json = bean.extract();
+    JSONObject json = bean.extract(false);
 
     // "Move" it across network in text form
     String string = json.toJSONString();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java b/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
index 7c77db6..6ee9aa1 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
@@ -158,7 +158,7 @@ public class TestSubmissionBean extends TestCase {
    */
   private MSubmission transfer(MSubmission submission) {
     SubmissionBean bean = new SubmissionBean(submission);
-    JSONObject json = bean.extract();
+    JSONObject json = bean.extract(false);
 
     String string = json.toString();
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/test/java/org/apache/sqoop/json/TestThrowableBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestThrowableBean.java b/common/src/test/java/org/apache/sqoop/json/TestThrowableBean.java
index 88267d1..0cf0651 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestThrowableBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestThrowableBean.java
@@ -31,7 +31,7 @@ public class TestThrowableBean extends TestCase {
 
     // Serialize it to JSON object
     ThrowableBean bean = new ThrowableBean(ex);
-    JSONObject json = bean.extract();
+    JSONObject json = bean.extract(false);
 
     // "Move" it across network in text form
     String string = json.toJSONString();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/test/java/org/apache/sqoop/json/TestUtil.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestUtil.java b/common/src/test/java/org/apache/sqoop/json/TestUtil.java
index 7dab5a4..b88d7a4 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestUtil.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestUtil.java
@@ -75,10 +75,12 @@ public class TestUtil {
 
     input = new MStringInput("username", false, (short) 10);
     input.setPersistenceId(2);
+    input.setValue("test");
     inputs.add(input);
 
-    input = new MStringInput("password", false, (short) 10);
+    input = new MStringInput("password", true, (short) 10);
     input.setPersistenceId(3);
+    input.setValue("test");
     inputs.add(input);
 
     form = new MForm("connection", inputs);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java b/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java
index ebcb749..95ea6e1 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestValidationBean.java
@@ -40,7 +40,7 @@ public class TestValidationBean {
       getValidation(Status.FINE),
       getValidation(Status.UNACCEPTABLE)
     );
-    JSONObject json = bean.extract();
+    JSONObject json = bean.extract(false);
 
     // "Move" it across network in text form
     String string = json.toJSONString();
@@ -78,7 +78,7 @@ public class TestValidationBean {
       getValidation(Status.FINE)
     );
     bean.setId((long) 10);
-    JSONObject json = bean.extract();
+    JSONObject json = bean.extract(false);
 
     // "Move" it across network in text form
     String string = json.toJSONString();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b49b7123/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java b/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
index dc0764e..896c605 100644
--- a/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
+++ b/server/src/main/java/org/apache/sqoop/server/SqoopProtocolServlet.java
@@ -108,7 +108,7 @@ public class SqoopProtocolServlet extends HttpServlet {
     response.setStatus(HttpServletResponse.SC_OK);
     setContentType(response);
     setHeaders(response, SqoopResponseCode.SQOOP_1000);
-    String responseString = bean.extract().toJSONString();
+    String responseString = bean.extract(true).toJSONString();
     response.getWriter().write(responseString);
     response.getWriter().flush();
   }
@@ -139,7 +139,7 @@ public class SqoopProtocolServlet extends HttpServlet {
       ThrowableBean throwableBean = new ThrowableBean(ex);
 
       response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-      response.getWriter().write(throwableBean.extract().toJSONString());
+      response.getWriter().write(throwableBean.extract(true).toJSONString());
     } else {
       response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
     }


Mime
View raw message