Use InterruptedException, IOException instead of just Exception (#9063)

* use InterruptedException, IOException instead of just Exception

* undo changes to the license
This commit is contained in:
William Cheng 2021-03-25 13:30:30 +08:00 committed by GitHub
parent 7813398e7e
commit fea1377603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 49 additions and 24 deletions

View File

@ -32,6 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
@ -1262,7 +1263,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -40,6 +40,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -330,7 +331,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
@ -709,7 +710,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
} else { } else {
LOGGER.info("Successfully executed: {}", command); LOGGER.info("Successfully executed: {}", command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
import java.lang.Exception; import java.lang.Exception;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
@ -1124,7 +1125,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -27,6 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
@ -830,7 +831,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -42,6 +42,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.*; import java.util.*;
@ -1839,7 +1840,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -33,6 +33,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -891,7 +892,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -27,6 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
@ -748,7 +749,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -29,6 +29,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -276,7 +278,7 @@ abstract public class AbstractPythonCodegen extends DefaultCodegen implements Co
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
@ -250,7 +251,7 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
} else { } else {
LOGGER.info("Successfully executed: `{}`", command); LOGGER.info("Successfully executed: `{}`", command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -29,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY; import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY;
@ -532,7 +533,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -34,6 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -855,7 +856,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -28,6 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
@ -890,7 +891,7 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDate; import java.time.LocalDate;
@ -883,7 +884,7 @@ public class CrystalClientCodegen extends DefaultCodegen {
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -33,6 +33,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -1456,7 +1457,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -694,7 +695,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -32,6 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.OnceLogger.once; import static org.openapitools.codegen.utils.OnceLogger.once;

View File

@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.OnceLogger.once; import static org.openapitools.codegen.utils.OnceLogger.once;
@ -1220,7 +1221,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
} }
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -36,6 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -445,7 +446,7 @@ public class NodeJSExpressServerCodegen extends DefaultCodegen implements Codege
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
} }
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -817,7 +818,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -28,6 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -621,7 +622,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import static java.util.UUID.randomUUID; import static java.util.UUID.randomUUID;
@ -1311,7 +1312,7 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -39,6 +39,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;

View File

@ -32,6 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -974,7 +975,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }

View File

@ -31,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -41,7 +42,6 @@ import java.util.concurrent.TimeUnit;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig { public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig {
private final Logger LOGGER = LoggerFactory.getLogger(Swift5ClientCodegen.class); private final Logger LOGGER = LoggerFactory.getLogger(Swift5ClientCodegen.class);
@ -979,7 +979,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: " + command);
} }
} catch (Exception e) { } catch (InterruptedException | IOException e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
} }
} }