You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/04/29 08:45:30 UTC

[GitHub] [kafka] showuon opened a new pull request #10610: MINOR: replace deprecated Class.newInstance() to new one

showuon opened a new pull request #10610:
URL: https://github.com/apache/kafka/pull/10610


   replace deprecated `Clazz.newInstance()` to `clazz.getDeclaredConstructor().newInstance()` as described in official java doc [here](https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#newInstance--):
   
   > The call
    clazz.newInstance()
   can be replaced by
    clazz.getDeclaredConstructor().newInstance()
    
   
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] tombentley commented on a change in pull request #10610: MINOR: replace deprecated Class.newInstance() to new one

Posted by GitBox <gi...@apache.org>.
tombentley commented on a change in pull request #10610:
URL: https://github.com/apache/kafka/pull/10610#discussion_r627177896



##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java
##########
@@ -236,13 +237,13 @@ private void initPluginLoader(String path) {
             log.error("Invalid path in plugin path: {}. Ignoring.", path, e);
         } catch (IOException e) {
             log.error("Could not get listing for plugin path: {}. Ignoring.", path, e);
-        } catch (InstantiationException | IllegalAccessException e) {
+        } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {

Review comment:
       Probably simpler to just catch `ReflectiveOperationException`

##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/DelegatingClassLoader.java
##########
@@ -236,13 +237,13 @@ private void initPluginLoader(String path) {
             log.error("Invalid path in plugin path: {}. Ignoring.", path, e);
         } catch (IOException e) {
             log.error("Could not get listing for plugin path: {}. Ignoring.", path, e);
-        } catch (InstantiationException | IllegalAccessException e) {
+        } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
             log.error("Could not instantiate plugins in: {}. Ignoring: {}", path, e);
         }
     }
 
     private void registerPlugin(Path pluginLocation)
-            throws InstantiationException, IllegalAccessException, IOException {
+        throws InstantiationException, IllegalAccessException, IOException, NoSuchMethodException, InvocationTargetException {

Review comment:
       Similarly, better to declare `throws IOException, ReflectiveOperationException`. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] showuon commented on pull request #10610: MINOR: replace deprecated Class.newInstance() to new one

Posted by GitBox <gi...@apache.org>.
showuon commented on pull request #10610:
URL: https://github.com/apache/kafka/pull/10610#issuecomment-833206456


   @rhauch , could you help review this simple PR? Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] tombentley merged pull request #10610: MINOR: replace deprecated Class.newInstance() to new one

Posted by GitBox <gi...@apache.org>.
tombentley merged pull request #10610:
URL: https://github.com/apache/kafka/pull/10610


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] showuon commented on pull request #10610: MINOR: replace deprecated Class.newInstance() to new one

Posted by GitBox <gi...@apache.org>.
showuon commented on pull request #10610:
URL: https://github.com/apache/kafka/pull/10610#issuecomment-833353747


   @tombentley , thanks for the comments. Make sense! I've updated. Thanks. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] tombentley commented on pull request #10610: MINOR: replace deprecated Class.newInstance() to new one

Posted by GitBox <gi...@apache.org>.
tombentley commented on pull request #10610:
URL: https://github.com/apache/kafka/pull/10610#issuecomment-834374769


   The CI failures appear to be unrelated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org