terrymanu commented on a change in pull request #1404:
URL:
https://github.com/apache/shardingsphere-elasticjob/pull/1404#discussion_r475658949
##########
File path:
elasticjob-infra/elasticjob-restful/src/main/java/org/apache/shardingsphere/elasticjob/restful/serializer/ResponseBodySerializerFactory.java
##########
@@ -84,7 +84,10 @@ public static ResponseBodySerializer
getResponseBodySerializer(final String cont
serializer = RESPONSE_BODY_SERIALIZERS.get(contentType);
}
}
- return serializer != MISSING_SERIALIZER ? serializer : null;
+ if (MISSING_SERIALIZER == serializer) {
+ throw new ResponseBodySerializerNotFoundException(contentType);
+ }
+ return serializer;
Review comment:
The result variable should named as `result`
##########
File path:
elasticjob-infra/elasticjob-restful/src/main/java/org/apache/shardingsphere/elasticjob/restful/deserializer/RequestBodyDeserializerFactory.java
##########
@@ -84,7 +84,10 @@ public static RequestBodyDeserializer
getRequestBodyDeserializer(final String co
deserializer = REQUEST_BODY_DESERIALIZERS.get(contentType);
}
}
- return deserializer != MISSING_DESERIALIZER ? deserializer : null;
+ if (MISSING_DESERIALIZER == deserializer) {
+ throw new RequestBodyDeserializerNotFoundException(contentType);
+ }
+ return deserializer;
Review comment:
The result variable should named as `result`
##########
File path:
elasticjob-infra/elasticjob-restful/src/main/java/org/apache/shardingsphere/elasticjob/restful/deserializer/RequestBodyDeserializerNotFoundException.java
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.restful.deserializer;
+
+import java.text.MessageFormat;
+
+/**
+ * {@link RequestBodyDeserializer} not found for specific MIME type.
+ */
+public class RequestBodyDeserializerNotFoundException extends RuntimeException
{
Review comment:
Please add final if class is not design for extension
----------------------------------------------------------------
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:
[email protected]