[jira] [Updated] (SENTRY-1572) SentryMain() shouldn't dynamically load tool class

2018-02-21 Thread JIRA

 [ 
https://issues.apache.org/jira/browse/SENTRY-1572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergio Peña updated SENTRY-1572:

   Resolution: Fixed
Fix Version/s: 2.1.0
   Status: Resolved  (was: Patch Available)

Thanks [~xyu2017] for your contribution. I committed to master.

> SentryMain() shouldn't dynamically load tool class
> --
>
> Key: SENTRY-1572
> URL: https://issues.apache.org/jira/browse/SENTRY-1572
> Project: Sentry
>  Issue Type: Improvement
>  Components: Sentry
>Reporter: Alexander Kolbasov
>Assignee: Xinran Tinney
>Priority: Major
>  Labels: bite-sized, newbie
> Fix For: 2.1.0
>
> Attachments: SENTRY-1572.001.patch, SENTRY-1572.002.patch, 
> SENTRY-1572.003.patch, SENTRY-1572.004.patch, SENTRY-1572.005.patch
>
>
> TheSentryMain class currently works by mapping the command name to a Java 
> class that is then dynamically loaded:
> {code}
> String commandName = commandLine.getOptionValue(COMMAND);
> String commandClazz = COMMANDS.get(commandName);
> Object command;
> try {
>   command = Class.forName(commandClazz.trim()).newInstance();
> } catch (Exception e) {
>   String msg = "Could not create instance of " + commandClazz + " for 
> command " + commandName;
>   throw new IllegalStateException(msg, e);
> }
> if (!(command instanceof Command)) {
>   String msg = "Command " + command.getClass().getName() + " is not an 
> instance of "
>   + Command.class.getName();
>   throw new IllegalStateException(msg);
> }
> ((Command)command).run(commandLine.getArgs());
>   }
> {code}
> This ia too complicated and causes subtle problems at runtime. Instead it 
> should just create a new instance of appropriate class and call it directly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (SENTRY-1572) SentryMain() shouldn't dynamically load tool class

2018-01-12 Thread Xinran Tinney (JIRA)

 [ 
https://issues.apache.org/jira/browse/SENTRY-1572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xinran Tinney updated SENTRY-1572:
--
Attachment: SENTRY-1572.005.patch

> SentryMain() shouldn't dynamically load tool class
> --
>
> Key: SENTRY-1572
> URL: https://issues.apache.org/jira/browse/SENTRY-1572
> Project: Sentry
>  Issue Type: Improvement
>  Components: Sentry
>Reporter: Alexander Kolbasov
>Assignee: Xinran Tinney
>  Labels: bite-sized, newbie
> Attachments: SENTRY-1572.001.patch, SENTRY-1572.002.patch, 
> SENTRY-1572.003.patch, SENTRY-1572.004.patch, SENTRY-1572.005.patch
>
>
> TheSentryMain class currently works by mapping the command name to a Java 
> class that is then dynamically loaded:
> {code}
> String commandName = commandLine.getOptionValue(COMMAND);
> String commandClazz = COMMANDS.get(commandName);
> Object command;
> try {
>   command = Class.forName(commandClazz.trim()).newInstance();
> } catch (Exception e) {
>   String msg = "Could not create instance of " + commandClazz + " for 
> command " + commandName;
>   throw new IllegalStateException(msg, e);
> }
> if (!(command instanceof Command)) {
>   String msg = "Command " + command.getClass().getName() + " is not an 
> instance of "
>   + Command.class.getName();
>   throw new IllegalStateException(msg);
> }
> ((Command)command).run(commandLine.getArgs());
>   }
> {code}
> This ia too complicated and causes subtle problems at runtime. Instead it 
> should just create a new instance of appropriate class and call it directly.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (SENTRY-1572) SentryMain() shouldn't dynamically load tool class

2017-12-11 Thread Xinran Tinney (JIRA)

 [ 
https://issues.apache.org/jira/browse/SENTRY-1572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xinran Tinney updated SENTRY-1572:
--
Attachment: SENTRY-1572.002.patch

> SentryMain() shouldn't dynamically load tool class
> --
>
> Key: SENTRY-1572
> URL: https://issues.apache.org/jira/browse/SENTRY-1572
> Project: Sentry
>  Issue Type: Improvement
>  Components: Sentry
>Reporter: Alexander Kolbasov
>Assignee: Xinran Tinney
>  Labels: bite-sized, newbie
> Attachments: SENTRY-1572.001.patch, SENTRY-1572.002.patch
>
>
> TheSentryMain class currently works by mapping the command name to a Java 
> class that is then dynamically loaded:
> {code}
> String commandName = commandLine.getOptionValue(COMMAND);
> String commandClazz = COMMANDS.get(commandName);
> Object command;
> try {
>   command = Class.forName(commandClazz.trim()).newInstance();
> } catch (Exception e) {
>   String msg = "Could not create instance of " + commandClazz + " for 
> command " + commandName;
>   throw new IllegalStateException(msg, e);
> }
> if (!(command instanceof Command)) {
>   String msg = "Command " + command.getClass().getName() + " is not an 
> instance of "
>   + Command.class.getName();
>   throw new IllegalStateException(msg);
> }
> ((Command)command).run(commandLine.getArgs());
>   }
> {code}
> This ia too complicated and causes subtle problems at runtime. Instead it 
> should just create a new instance of appropriate class and call it directly.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (SENTRY-1572) SentryMain() shouldn't dynamically load tool class

2017-12-01 Thread Xinran Tinney (JIRA)

 [ 
https://issues.apache.org/jira/browse/SENTRY-1572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xinran Tinney updated SENTRY-1572:
--
Attachment: SENTRY-1572.001.patch

> SentryMain() shouldn't dynamically load tool class
> --
>
> Key: SENTRY-1572
> URL: https://issues.apache.org/jira/browse/SENTRY-1572
> Project: Sentry
>  Issue Type: Improvement
>  Components: Sentry
>Reporter: Alexander Kolbasov
>Assignee: Xinran Tinney
>  Labels: bite-sized, newbie
> Attachments: SENTRY-1572.001.patch
>
>
> TheSentryMain class currently works by mapping the command name to a Java 
> class that is then dynamically loaded:
> {code}
> String commandName = commandLine.getOptionValue(COMMAND);
> String commandClazz = COMMANDS.get(commandName);
> Object command;
> try {
>   command = Class.forName(commandClazz.trim()).newInstance();
> } catch (Exception e) {
>   String msg = "Could not create instance of " + commandClazz + " for 
> command " + commandName;
>   throw new IllegalStateException(msg, e);
> }
> if (!(command instanceof Command)) {
>   String msg = "Command " + command.getClass().getName() + " is not an 
> instance of "
>   + Command.class.getName();
>   throw new IllegalStateException(msg);
> }
> ((Command)command).run(commandLine.getArgs());
>   }
> {code}
> This ia too complicated and causes subtle problems at runtime. Instead it 
> should just create a new instance of appropriate class and call it directly.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (SENTRY-1572) SentryMain() shouldn't dynamically load tool class

2017-12-01 Thread Xinran Tinney (JIRA)

 [ 
https://issues.apache.org/jira/browse/SENTRY-1572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xinran Tinney updated SENTRY-1572:
--
Status: Patch Available  (was: In Progress)

> SentryMain() shouldn't dynamically load tool class
> --
>
> Key: SENTRY-1572
> URL: https://issues.apache.org/jira/browse/SENTRY-1572
> Project: Sentry
>  Issue Type: Improvement
>  Components: Sentry
>Reporter: Alexander Kolbasov
>Assignee: Xinran Tinney
>  Labels: bite-sized, newbie
> Attachments: SENTRY-1572.001.patch
>
>
> TheSentryMain class currently works by mapping the command name to a Java 
> class that is then dynamically loaded:
> {code}
> String commandName = commandLine.getOptionValue(COMMAND);
> String commandClazz = COMMANDS.get(commandName);
> Object command;
> try {
>   command = Class.forName(commandClazz.trim()).newInstance();
> } catch (Exception e) {
>   String msg = "Could not create instance of " + commandClazz + " for 
> command " + commandName;
>   throw new IllegalStateException(msg, e);
> }
> if (!(command instanceof Command)) {
>   String msg = "Command " + command.getClass().getName() + " is not an 
> instance of "
>   + Command.class.getName();
>   throw new IllegalStateException(msg);
> }
> ((Command)command).run(commandLine.getArgs());
>   }
> {code}
> This ia too complicated and causes subtle problems at runtime. Instead it 
> should just create a new instance of appropriate class and call it directly.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)