You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@twill.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/03/25 01:22:52 UTC
[jira] [Commented] (TWILL-125) BundledJarRunner doesn't work for
classes with no zero-args constructor
[ https://issues.apache.org/jira/browse/TWILL-125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14378998#comment-14378998 ]
ASF GitHub Bot commented on TWILL-125:
--------------------------------------
GitHub user rob-morgan opened a pull request:
https://github.com/apache/incubator-twill/pull/28
(TWILL-125) Eliminate mainObject instance in BundedJarRunner
Instantiating the object containing the main method in order to invoke
the main method is unnecessary since main is always static. There is
also a potential problem with calling newInstance() on the main object's
class; it will throw an exception if the main object does not have
a 0-args constructor.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/rob-morgan/incubator-twill master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-twill/pull/28.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 #28
----
commit ca5877995e92da081c16e3f273f3e22e346e3c38
Author: Rob Morgan <rm...@tracelink.com>
Date: 2015-03-23T16:08:57Z
(TWILL-125) Eliminate mainObject instance in BundedJarRunner
Instantiating the object containing the main method in order to invoke
the main method is unnecessary since main is always static. There is
also a potential problem with calling newInstance() on the main object's
class; it will throw an exception if the main object does not have
a 0-args constructor.
----
> BundledJarRunner doesn't work for classes with no zero-args constructor
> -----------------------------------------------------------------------
>
> Key: TWILL-125
> URL: https://issues.apache.org/jira/browse/TWILL-125
> Project: Apache Twill
> Issue Type: Bug
> Components: ext
> Affects Versions: 0.5.0-incubating
> Reporter: Rob Morgan
>
> BundledJarRunner attempts to load the main class using Class#newInstance. The call to newInstance will then attempt to find and invoke the class's zero-args constructor. This will throw an InstantiationException if there is no zero-args constructor to be found.
> Loading the main class is unnecessary. Since main is always static it can be invoked with a null target object.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)