Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Nov 28, 2015
2 parents f1842e1 + a2468b7 commit 311cd72
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
8 changes: 7 additions & 1 deletion qulice-checkstyle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.8.1</version>
<version>6.12.1</version>
<exclusions>
<exclusion>
<groupId>org.abego.treelayout</groupId>
<artifactId>org.abego.treelayout.core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ public void validate(final Environment env) throws ValidationException {
return;
}
final Checker checker;
try {
checker = new Checker();
} catch (final CheckstyleException ex) {
throw new IllegalStateException("Failed to create checker", ex);
}
checker = new Checker();
checker.setClassLoader(env.classloader());
checker.setModuleClassLoader(
Thread.currentThread().getContextClassLoader()
Expand All @@ -89,7 +85,11 @@ public void validate(final Environment env) throws ValidationException {
}
final CheckstyleListener listener = new CheckstyleListener(env);
checker.addListener(listener);
checker.process(new LinkedList<File>(files));
try {
checker.process(new LinkedList<File>(files));
} catch (final CheckstyleException ex) {
throw new IllegalStateException("Failed to process files", ex);
}
checker.destroy();
final List<AuditEvent> events = listener.events();
if (!events.isEmpty()) {
Expand All @@ -116,10 +116,20 @@ public void validate(final Environment env) throws ValidationException {
* @see #validate()
*/
private Configuration configuration(final Environment env) {
final File cacheFile =
new File(env.tempdir(), "checkstyle/checkstyle.cache");
if (!cacheFile.getParentFile().mkdirs()) {
throw new IllegalStateException(
String.format(
"Unable to crate directories needed for %s",
cacheFile.getPath()
)
);
}
final Properties props = new Properties();
props.setProperty(
"cache.file",
new File(env.tempdir(), "checkstyle/checkstyle.cache").getPath()
cacheFile.getPath()
);
props.setProperty("header", this.header(env));
final InputSource src = new InputSource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
<property name="tokens" value="CTOR_DEF,METHOD_DEF,FOR_EACH_CLAUSE,LITERAL_CATCH"/>
</module>
<module name="Indentation"/>
<module name="CommentsIndentation"/>
<module name="TrailingComment"/>
<module name="OuterTypeFilename"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static final class Foo {
* Constructor.
* @param nam Name.
*/
public Foo(final String nam) {
Foo(final String nam) {
this.name = nam;
}

Expand Down

0 comments on commit 311cd72

Please sign in to comment.