Skip to content

Commit 8ea86ff

Browse files
committed
Merge pull request #29 from support-project/develop
スタイルチェック / FindBugs / PMD を mvn site で実行できるようにした
2 parents b6db029 + 2cc5f9f commit 8ea86ff

File tree

16 files changed

+472
-33
lines changed

16 files changed

+472
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.classpath
33
.project
44
.settings
5+
.checkstyle

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ language: java
22
jdk: oraclejdk8
33

44
install: mvn install -DskipTests=true
5-
script: mvn test
5+
script: mvn test site
66

config/stylecheck.xml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
3+
4+
<!--
5+
This configuration file was written by the eclipse-cs plugin configuration editor
6+
-->
7+
<!--
8+
Checkstyle-Configuration: SupportProject Check from Sun Checks (Eclipse)
9+
Description:
10+
Slightly modified version of Sun Checks that better matches the default code formatter setting of Eclipse.
11+
-->
12+
<module name="Checker">
13+
<property name="severity" value="warning"/>
14+
<module name="TreeWalker">
15+
<property name="tabWidth" value="4"/>
16+
<module name="JavadocMethod">
17+
<property name="allowMissingParamTags" value="true"/>
18+
<property name="allowMissingThrowsTags" value="true"/>
19+
<property name="allowMissingReturnTag" value="true"/>
20+
<property name="suppressLoadErrors" value="true"/>
21+
</module>
22+
<module name="JavadocType"/>
23+
<module name="JavadocVariable"/>
24+
<module name="JavadocStyle">
25+
<property name="severity" value="ignore"/>
26+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
27+
</module>
28+
<module name="ConstantName"/>
29+
<module name="LocalFinalVariableName"/>
30+
<module name="LocalVariableName"/>
31+
<module name="MemberName"/>
32+
<module name="MethodName"/>
33+
<module name="PackageName"/>
34+
<module name="ParameterName"/>
35+
<module name="StaticVariableName"/>
36+
<module name="TypeName"/>
37+
<module name="AvoidStarImport"/>
38+
<module name="IllegalImport"/>
39+
<module name="RedundantImport"/>
40+
<module name="UnusedImports"/>
41+
<module name="LineLength">
42+
<property name="max" value="150"/>
43+
</module>
44+
<module name="MethodLength"/>
45+
<module name="ParameterNumber"/>
46+
<module name="EmptyForIteratorPad"/>
47+
<module name="GenericWhitespace"/>
48+
<module name="MethodParamPad">
49+
<property name="severity" value="ignore"/>
50+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
51+
</module>
52+
<module name="NoWhitespaceAfter">
53+
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
54+
</module>
55+
<module name="NoWhitespaceBefore"/>
56+
<module name="ParenPad">
57+
<property name="tokens" value="ANNOTATION,ANNOTATION_FIELD_DEF,CTOR_DEF,CTOR_CALL,ENUM_CONSTANT_DEF,EXPR,LITERAL_CATCH,LITERAL_DO,LITERAL_FOR,LITERAL_IF,LITERAL_NEW,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_WHILE,METHOD_CALL,METHOD_DEF,RESOURCE_SPECIFICATION,SUPER_CTOR_CALL"/>
58+
</module>
59+
<module name="TypecastParenPad">
60+
<property name="severity" value="ignore"/>
61+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
62+
</module>
63+
<module name="WhitespaceAfter">
64+
<property name="tokens" value="COMMA,SEMI"/>
65+
</module>
66+
<module name="WhitespaceAround">
67+
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND"/>
68+
</module>
69+
<module name="ModifierOrder"/>
70+
<module name="RedundantModifier"/>
71+
<module name="AvoidNestedBlocks"/>
72+
<module name="EmptyBlock"/>
73+
<module name="LeftCurly"/>
74+
<module name="NeedBraces"/>
75+
<module name="RightCurly"/>
76+
<module name="AvoidInlineConditionals"/>
77+
<module name="EmptyStatement"/>
78+
<module name="EqualsHashCode"/>
79+
<module name="HiddenField">
80+
<property name="severity" value="ignore"/>
81+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
82+
</module>
83+
<module name="IllegalInstantiation"/>
84+
<module name="InnerAssignment"/>
85+
<module name="MagicNumber">
86+
<property name="severity" value="ignore"/>
87+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
88+
</module>
89+
<module name="MissingSwitchDefault"/>
90+
<module name="SimplifyBooleanExpression">
91+
<property name="severity" value="ignore"/>
92+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
93+
</module>
94+
<module name="SimplifyBooleanReturn">
95+
<property name="severity" value="ignore"/>
96+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
97+
</module>
98+
<module name="DesignForExtension">
99+
<property name="severity" value="ignore"/>
100+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
101+
</module>
102+
<module name="FinalClass">
103+
<property name="severity" value="ignore"/>
104+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
105+
</module>
106+
<module name="HideUtilityClassConstructor">
107+
<property name="severity" value="ignore"/>
108+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
109+
</module>
110+
<module name="InterfaceIsType"/>
111+
<module name="VisibilityModifier">
112+
<property name="severity" value="ignore"/>
113+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
114+
</module>
115+
<module name="ArrayTypeStyle"/>
116+
<module name="FinalParameters">
117+
<property name="severity" value="ignore"/>
118+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
119+
</module>
120+
<module name="TodoComment">
121+
<property name="severity" value="ignore"/>
122+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
123+
</module>
124+
<module name="UpperEll"/>
125+
<module name="OperatorWrap">
126+
<property name="tokens" value="BAND,BOR,BSR,BXOR,COLON,DIV,EQUAL,GE,GT,LAND,LE,LITERAL_INSTANCEOF,LOR,LT,MINUS,MOD,NOT_EQUAL,PLUS,SL,SR,STAR"/>
127+
</module>
128+
</module>
129+
<module name="JavadocPackage">
130+
<property name="severity" value="ignore"/>
131+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
132+
</module>
133+
<module name="NewlineAtEndOfFile">
134+
<property name="severity" value="ignore"/>
135+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
136+
</module>
137+
<module name="Translation"/>
138+
<module name="FileLength"/>
139+
<module name="FileTabCharacter">
140+
<property name="severity" value="ignore"/>
141+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
142+
</module>
143+
<module name="RegexpSingleline">
144+
<property name="severity" value="ignore"/>
145+
<property name="format" value="\s+$"/>
146+
<property name="message" value="Line has trailing spaces."/>
147+
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
148+
</module>
149+
</module>

pom.xml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>org.support-project</groupId>
55
<artifactId>web</artifactId>
66
<packaging>jar</packaging>
7-
<version>1.1.0</version>
7+
<version>1.2.0-SNAPSHOT</version>
88
<name>web</name>
99
<url>https://support-project.org/</url>
1010

@@ -16,7 +16,7 @@
1616
<dependency>
1717
<groupId>org.support-project</groupId>
1818
<artifactId>common</artifactId>
19-
<version>1.1.0</version>
19+
<version>1.2.0-SNAPSHOT</version>
2020
</dependency>
2121

2222
<dependency>
@@ -98,4 +98,54 @@
9898
</snapshotRepository>
9999
</distributionManagement>
100100

101+
<reporting>
102+
<plugins>
103+
<plugin>
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-project-info-reports-plugin</artifactId>
106+
<version>2.8.1</version>
107+
<configuration>
108+
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
109+
</configuration>
110+
</plugin>
111+
112+
<plugin>
113+
<groupId>org.codehaus.mojo</groupId>
114+
<artifactId>findbugs-maven-plugin</artifactId>
115+
<version>3.0.3</version>
116+
<configuration>
117+
<findbugsXmlOutput>true</findbugsXmlOutput>
118+
<xmlOutput>true</xmlOutput>
119+
</configuration>
120+
</plugin>
121+
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-pmd-plugin</artifactId>
125+
<version>3.5</version>
126+
</plugin>
127+
128+
<plugin>
129+
<groupId>org.apache.maven.plugins</groupId>
130+
<artifactId>maven-checkstyle-plugin</artifactId>
131+
<version>2.17</version>
132+
<reportSets>
133+
<reportSet>
134+
<reports>
135+
<report>checkstyle</report>
136+
</reports>
137+
</reportSet>
138+
</reportSets>
139+
<configuration>
140+
<configLocation>config/stylecheck.xml</configLocation>
141+
<encoding>UTF-8</encoding>
142+
<consoleOutput>true</consoleOutput>
143+
<failsOnError>true</failsOnError>
144+
<linkXRef>false</linkXRef>
145+
</configuration>
146+
</plugin>
147+
148+
</plugins>
149+
</reporting>
150+
101151
</project>

src/main/java/org/support/project/web/boundary/DownloadBoundary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void navigate() throws Exception {
7979
try {
8080
os.close();
8181
} catch (IOException e) {
82-
new SystemException(e);
82+
throw new SystemException(e);
8383
} finally {
8484
os = null;
8585
}

src/main/java/org/support/project/web/common/HttpUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public static <T> T parseRequest(HttpServletRequest req,
209209
}
210210
}
211211

212-
if (paramNames.contains(param.toString())) {
212+
if (param != null && paramNames.contains(param.toString())) {
213213
Class<?> type = PropertyUtil.getPropertyType(paramtypes, param.toString());
214214
// String[] values = req.getParameterValues(string);
215215
// if (values != null && values.length == 1) {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package org.support.project.web.config;
2+
3+
import org.support.project.di.Container;
4+
import org.support.project.di.DI;
5+
import org.support.project.di.Instance;
6+
7+
8+
@DI(instance=Instance.Singleton)
9+
public class AnalyticsConfig {
10+
11+
/** アナリティクス設定を保持するキー */
12+
public static final String KEY_ANALYTICS = "KEY_ANALYTICS";
13+
14+
public static AnalyticsConfig get() {
15+
return Container.getComp(AnalyticsConfig.class);
16+
}
17+
18+
private String analyticsScript = "";
19+
20+
/**
21+
* @return the analyticsScript
22+
*/
23+
public String getAnalyticsScript() {
24+
return analyticsScript;
25+
}
26+
27+
/**
28+
* @param analyticsScript the analyticsScript to set
29+
*/
30+
public void setAnalyticsScript(String analyticsScript) {
31+
this.analyticsScript = analyticsScript;
32+
}
33+
34+
35+
}

src/main/java/org/support/project/web/config/AppConfig.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public static AppConfig get() {
2222
private int uploadMaxMBSize;
2323
private boolean convTmpPath = false;
2424

25+
private String migratePackage;
26+
2527
/** HASH_ITERATIONS */
2628
private Integer hashIterations = DEFAULT_HASH_ITERATIONS;
2729
/** HASH_SIZE_BITS */
@@ -92,7 +94,7 @@ public String getWebRealPath() {
9294
/**
9395
* @param webRealPath the webRealPath to set
9496
*/
95-
public void setWebRealPath(String webRealPath) {
97+
public static void setWebRealPath(String webRealPath) {
9698
AppConfig.webRealPath = webRealPath;
9799
}
98100

@@ -109,5 +111,19 @@ public List<LabelValue> getLanguages() {
109111
public void setLanguages(List<LabelValue> languages) {
110112
this.languages = languages;
111113
}
114+
115+
/**
116+
* @return the migratePackage
117+
*/
118+
public String getMigratePackage() {
119+
return migratePackage;
120+
}
121+
122+
/**
123+
* @param migratePackage the migratePackage to set
124+
*/
125+
public void setMigratePackage(String migratePackage) {
126+
this.migratePackage = migratePackage;
127+
}
112128

113129
}

src/main/java/org/support/project/web/control/Control.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@
4444
import org.support.project.web.control.service.Get;
4545
import org.support.project.web.exception.InvalidParamException;
4646

47-
@DI(instance=Instance.Prototype)
47+
/**
48+
* Controlの基底クラス
49+
* @author Koda
50+
*/
51+
@DI(instance = Instance.Prototype)
4852
public abstract class Control {
4953
/** ログ */
5054
private static Log log = LogFactory.getLog(Control.class);
@@ -153,7 +157,7 @@ protected String getForwardDir() {
153157
String subPackageName = invokeTarget.getSubPackageName();
154158
if (StringUtils.isNotEmpty(subPackageName)) {
155159
if (subPackageName.indexOf("\\.") != -1) {
156-
String[] packages = subPackageName.split(".");
160+
String[] packages = StringUtils.split(subPackageName, ".");
157161
for (int i = packages.length -1; i <= 0; i--) {
158162
String string = packages[i];
159163
builder.append(string).append("/");

src/main/java/org/support/project/web/dao/GroupsDao.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ public List<GroupsEntity> selectOnKeyword(String keyword, LoginedUser loginedUse
8989
return executeQueryList(sql, GroupsEntity.class, keyword, limit, offset);
9090
} else {
9191
String sql = SQLManager.getInstance().getSql("/org/support/project/web/dao/sql/GroupsDao/GroupsDao_selectOnKeyword.sql");
92-
return executeQueryList(sql, GroupsEntity.class, keyword, loginedUser.getUserId(), limit, offset);
92+
int userId = -1;
93+
if (loginedUser != null) {
94+
userId = loginedUser.getUserId();
95+
}
96+
return executeQueryList(sql, GroupsEntity.class, keyword, userId, limit, offset);
9397
}
9498
}
9599

0 commit comments

Comments
 (0)