Reduce complexity in indentation/HandlerFactory class by grouping catch blocks
Pull #833
This commit is contained in:
parent
9d3d08837a
commit
91d979ef8e
2
pom.xml
2
pom.xml
|
|
@ -593,7 +593,7 @@
|
|||
<regex><pattern>.*.api.AbstractViolationReporter</pattern><branchRate>100</branchRate><lineRate>90</lineRate></regex>
|
||||
<regex><pattern>.*.api.AnnotationUtility</pattern><branchRate>60</branchRate><lineRate>60</lineRate></regex>
|
||||
<regex><pattern>.*.api.AuditEvent</pattern><branchRate>100</branchRate><lineRate>93</lineRate></regex>
|
||||
<regex><pattern>.*.api.AutomaticBean</pattern><branchRate>90</branchRate><lineRate>74</lineRate></regex>
|
||||
<regex><pattern>.*.api.AutomaticBean</pattern><branchRate>90</branchRate><lineRate>82</lineRate></regex>
|
||||
<regex><pattern>.*.api.AutomaticBean\$.*</pattern><branchRate>75</branchRate><lineRate>90</lineRate></regex>
|
||||
<regex><pattern>.*.api.Check</pattern><branchRate>100</branchRate><lineRate>86</lineRate></regex>
|
||||
<regex><pattern>.*.api.Comment</pattern><branchRate>100</branchRate><lineRate>95</lineRate></regex>
|
||||
|
|
|
|||
|
|
@ -155,27 +155,16 @@ public class AutomaticBean
|
|||
+ configuration.getName() + " to '" + value
|
||||
+ "': " + e.getTargetException().getMessage(), e);
|
||||
}
|
||||
catch (final IllegalAccessException e) {
|
||||
catch (final IllegalAccessException | NoSuchMethodException e) {
|
||||
throw new CheckstyleException(
|
||||
"cannot access " + key + " in "
|
||||
+ this.getClass().getName(), e);
|
||||
}
|
||||
catch (final NoSuchMethodException e) {
|
||||
throw new CheckstyleException(
|
||||
"cannot access " + key + " in "
|
||||
+ this.getClass().getName(), e);
|
||||
}
|
||||
catch (final IllegalArgumentException e) {
|
||||
catch (final IllegalArgumentException | ConversionException e) {
|
||||
throw new CheckstyleException(
|
||||
"illegal value '" + value + "' for property '" + key
|
||||
+ "' of module " + configuration.getName(), e);
|
||||
}
|
||||
catch (final ConversionException e) {
|
||||
throw new CheckstyleException(
|
||||
"illegal value '" + value + "' for property '" + key
|
||||
+ "' of module " + configuration.getName(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
finishLocalSetup();
|
||||
|
|
@ -219,12 +208,7 @@ public class AutomaticBean
|
|||
"cannot access " + key + " in "
|
||||
+ this.getClass().getName(), e);
|
||||
}
|
||||
catch (final IllegalArgumentException e) {
|
||||
throw new CheckstyleException(
|
||||
"illegal value '" + value + "' for property '" + key
|
||||
+ "' of bean " + this.getClass().getName(), e);
|
||||
}
|
||||
catch (final ConversionException e) {
|
||||
catch (final IllegalArgumentException | ConversionException e) {
|
||||
throw new CheckstyleException(
|
||||
"illegal value '" + value + "' for property '" + key
|
||||
+ "' of bean " + this.getClass().getName(), e);
|
||||
|
|
|
|||
|
|
@ -35,9 +35,8 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
public class HandlerFactory
|
||||
{
|
||||
/** Logger for indentation check */
|
||||
private static final Log LOG =
|
||||
LogFactory.getLog("com.puppycrawl.tools.checkstyle.checks.indentation");
|
||||
/** Logger for indentation check. */
|
||||
private static final Log LOG = LogFactory.getLog(HandlerFactory.class);
|
||||
|
||||
/**
|
||||
* Registered handlers.
|
||||
|
|
|
|||
Loading…
Reference in New Issue