TeslaCN commented on a change in pull request #1462: URL: https://github.com/apache/shardingsphere-elasticjob/pull/1462#discussion_r489449180
########## File path: elasticjob-error-handler/elasticjob-error-handler-dingtalk/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/impl/DingtalkJobErrorHandler.java ########## @@ -0,0 +1,144 @@ +/* + * 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.error.handler.impl; + +import com.google.common.base.Strings; +import com.google.common.collect.Maps; +import com.google.gson.JsonObject; +import lombok.extern.slf4j.Slf4j; +import org.apache.shardingsphere.elasticjob.error.handler.config.DingtalkConfiguration; +import org.apache.shardingsphere.elasticjob.error.handler.env.DingtalkEnvironment; +import org.apache.shardingsphere.elasticjob.infra.exception.JobExecutionException; +import org.apache.shardingsphere.elasticjob.infra.handler.error.JobErrorHandler; +import org.apache.shardingsphere.elasticjob.infra.json.GsonFactory; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Base64; +import java.util.Collections; +import java.util.Map; + +/** + * Job error handler for dingtalk error message. + */ +@Slf4j +public final class DingtalkJobErrorHandler implements JobErrorHandler { + + private DingtalkConfiguration dingtalkConfiguration; + + @Override + public void handleException(final String jobName, final Throwable cause) { + if (dingtalkConfiguration == null) { Review comment: Constants on the left. ---------------------------------------------------------------- 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]
