GitHub user hsaputra opened a pull request:

    https://github.com/apache/incubator-twill/pull/43

    (TWILL-136) Override equals and hashCode for JvmOptions.DebugOptions to 
test equality

    The current code for JvmOptions.DebugOptions does not have equals and 
hashCode overriden for equality test.
    
    This would cause fail comparison for DebugOptions.NO_DEBUG when being used 
in YarnTwillPreparer:
    
    ```
    final class YarnTwillPreparer implements TwillPreparer {
    
    ...
    
      @Override
      public TwillPreparer enableDebugging(boolean doSuspend, String... 
runnables) {
        this.debugOptions = new JvmOptions.DebugOptions(true, doSuspend, 
ImmutableSet.copyOf(runnables));
        return this;
      }
    
    ....
      private void saveJvmOptions(Map<String, LocalFile> localFiles) throws 
IOException {
        if ((extraOptions == null || extraOptions.isEmpty()) &&
          JvmOptions.DebugOptions.NO_DEBUG.equals(this.debugOptions)) {
          // If no vm options, no need to localize the file.
          return;
        }
        ...
      }
    ...
    }
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/hsaputra/incubator-twill 
TWILL-136_override_equals_debugoptions

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-twill/pull/43.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #43
    
----
commit 4846bff74bc3f836e6cea37f1a9e8e8298ebdd96
Author: hsaputra <[email protected]>
Date:   2015-06-17T22:08:41Z

    TWILL-136 Override equals and hashCode for JvmOptions.DebugOptions to test 
equality
    
    The current code for JvmOptions.DebugOptions does not have equals and 
hashCode overriden for equality test.
    
    This would cause fail comparison for DebugOptions.NO_DEBUG when being used 
in YarnTwillPreparer:
    
    final class YarnTwillPreparer implements TwillPreparer {
    
    ...
    
      @Override
      public TwillPreparer enableDebugging(boolean doSuspend, String... 
runnables) {
        this.debugOptions = new JvmOptions.DebugOptions(true, doSuspend, 
ImmutableSet.copyOf(runnables));
        return this;
      }
    
    ....
      private void saveJvmOptions(Map<String, LocalFile> localFiles) throws 
IOException {
        if ((extraOptions == null || extraOptions.isEmpty()) &&
          JvmOptions.DebugOptions.NO_DEBUG.equals(this.debugOptions)) {
          // If no vm options, no need to localize the file.
          return;
        }
        ...
      }
    
    ...
    }

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to