Repository: provectus/kafka-ui
Issue: Null Pointer Exception after saving changes during edit settings of the Topic
Labels: scope/frontend

**Pre-conditions:** 
Kafka has a Topic

**Steps:** 
1. Navigate to the Topic 
2. Click “Edit settings”
3. Click “Submit”

**Expected:** 
Successfully saving of the setting changes 

**Actual:** 
The app is freezing. Null point exception in the console. 

```
java.lang.NullPointerException: null
   at org.apache.commons.pool2.impl.GenericKeyedObjectPool.returnObject(GenericKeyedObjectPool.java:470) ~[commons-pool2-2.2.jar!/:2.2]
   at com.provectus.kafka.ui.util.JmxClusterUtil.getJmxMetrics(JmxClusterUtil.java:47) ~[classes!/:?]
   at com.provectus.kafka.ui.service.KafkaService.lambda$getJmxMetric$53(KafkaService.java:413) ~[classes!/:?]
   at java.util.Optional.map(Optional.java:258) ~[?:?]
   at com.provectus.kafka.ui.service.KafkaService.getJmxMetric(KafkaService.java:413) ~[classes!/:?]
   at com.provectus.kafka.ui.service.KafkaService.lambda$fillBrokerMetrics$55(KafkaService.java:424) ~[classes!/:?]
   ...
ERROR com.provectus.kafka.ui.util.JmxClusterUtil - Cannot invalidate object in pool, service:jmx:rmi:///jndi/rmi://kafka1:9998/jmxrmi
```

Issue comments:
@antipova0803, thank you for creating issue. We'll try to  find a root cause and fix it soon. Look's like we are triyng to connect jmx port after topic settings update without success. 
Issue is not connected with Null Pointer Exception on BE. There is not request to BE after Submit button click (you can see it if you open UI console).
@workshur can you please check what is going on UI ? 

Pull request review comments:

Patch that resolved the issue:
diff --git a/kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx b/kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx
index b52735e9588..5daf7c408ba 100644
--- a/kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx
+++ b/kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx
@@ -21,7 +21,11 @@ interface Props {
   isFetched: boolean;
   isTopicUpdated: boolean;
   fetchTopicConfig: (clusterName: ClusterName, topicName: TopicName) => void;
-  updateTopic: (clusterName: ClusterName, form: TopicFormDataRaw) => void;
+  updateTopic: (
+    clusterName: ClusterName,
+    topicName: TopicName,
+    form: TopicFormDataRaw
+  ) => void;
 }
 
 const DEFAULTS = {
@@ -104,7 +108,7 @@ const Edit: React.FC<Props> = ({
   });
 
   const onSubmit = async (data: TopicFormDataRaw) => {
-    updateTopic(clusterName, data);
+    updateTopic(clusterName, topicName, data);
     setIsSubmitting(true); // Keep this action after updateTopic to prevent redirect before update.
   };
 
diff --git a/kafka-ui-react-app/src/redux/actions/thunks/topics.ts b/kafka-ui-react-app/src/redux/actions/thunks/topics.ts
index 50942d410dd..6565aa23c78 100644
--- a/kafka-ui-react-app/src/redux/actions/thunks/topics.ts
+++ b/kafka-ui-react-app/src/redux/actions/thunks/topics.ts
@@ -234,13 +234,14 @@ export const createTopic = (
 
 export const updateTopic = (
   clusterName: ClusterName,
+  topicName: TopicName,
   form: TopicFormDataRaw
 ): PromiseThunkResult => async (dispatch, getState) => {
   dispatch(actions.updateTopicAction.request());
   try {
     const topic: Topic = await topicsApiClient.updateTopic({
       clusterName,
-      topicName: form.name,
+      topicName,
       topicUpdate: formatTopicUpdate(form),
     });
 


Test patch: