OPENJPA-2410: Merge checkstyle changes from trunk.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.0.x@1511055 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard G. Curtis 2013-08-06 18:05:25 +00:00
parent ae15030654
commit 08479060d4
24 changed files with 95 additions and 16 deletions

View File

@ -40,6 +40,7 @@
<properties>
<openjpa.Log>DefaultLevel=WARN</openjpa.Log>
<checkstyle.config.location>${project.basedir}/../openjpa-project/checkstyle.xml</checkstyle.config.location>
<checkstyle.suppressions.location>${project.basedir}/../openjpa-project/suppressions.xml</checkstyle.suppressions.location>
</properties>
<dependencies>

View File

@ -181,7 +181,9 @@ public class ClassTableJDBCSeq
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.out.println(_loc.get("clstable-seq-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**
@ -233,7 +235,9 @@ public class ClassTableJDBCSeq
try {
long cur = seq.getSequence(mapping, conn);
if (ACTION_GET.equals(action))
// START - ALLOW PRINT STATEMENTS
System.out.println(mapping + ": " + cur);
// STOP - ALLOW PRINT STATEMENTS
else {
long set;
if (args.length > 1)
@ -248,7 +252,9 @@ public class ClassTableJDBCSeq
conn);
set = stat.seq;
}
// START - ALLOW PRINT STATEMENTS
System.err.println(mapping + ": " + set);
// STOP - ALLOW PRINT STATEMENTS
}
} catch (NumberFormatException nfe) {
return false;

View File

@ -406,7 +406,9 @@ public class NativeJDBCSeq
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.out.println(_loc.get("native-seq-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**
@ -441,7 +443,9 @@ public class NativeJDBCSeq
Connection conn = conf.getDataSource2(null).getConnection();
try {
long cur = seq.getSequence(conn);
// START - ALLOW PRINT STATEMENTS
System.out.println(cur);
// STOP - ALLOW PRINT STATEMENTS
} finally {
try { conn.close(); } catch (SQLException se) {}
}

View File

@ -722,7 +722,9 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable {
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.out.println(_loc.get("seq-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**
@ -759,7 +761,9 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable {
try {
long cur = seq.getSequence(null, conn);
if (ACTION_GET.equals(action))
// START - ALLOW PRINT STATEMENTS
System.out.println(cur);
// STOP - ALLOW PRINT STATEMENTS
else {
long set;
if (args.length > 0)
@ -774,7 +778,9 @@ public class TableJDBCSeq extends AbstractJDBCSeq implements Configurable {
conn);
set = stat.seq;
}
// START - ALLOW PRINT STATEMENTS
System.err.println(set);
// STOP - ALLOW PRINT STATEMENTS
}
}
catch (NumberFormatException nfe) {

View File

@ -133,7 +133,9 @@ public class ValueTableJDBCSeq
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.out.println(_loc.get("clstable-seq-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**
@ -173,7 +175,9 @@ public class ValueTableJDBCSeq
try {
long cur = seq.getSequence(null, conn);
if (ACTION_GET.equals(action))
// START - ALLOW PRINT STATEMENTS
System.out.println(seq.getPrimaryKeyValue() + ": " + cur);
// STOP - ALLOW PRINT STATEMENTS
else {
long set;
if (args.length > 1)
@ -188,7 +192,9 @@ public class ValueTableJDBCSeq
conn);
set = stat.seq;
}
// START - ALLOW PRINT STATEMENTS
System.err.println(seq.getPrimaryKeyValue() + ": " + set);
// STOP - ALLOW PRINT STATEMENTS
}
}
catch (NumberFormatException nfe) {

View File

@ -935,7 +935,9 @@ public class MappingTool
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.err.println(_loc.get("tool-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**

View File

@ -1833,7 +1833,9 @@ public class ReverseMappingTool
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.out.println(_loc.get("revtool-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**

View File

@ -1361,7 +1361,9 @@ public class SchemaTool {
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.out.println(_loc.get("tool-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**

View File

@ -471,7 +471,9 @@ public class TableSchemaFactory
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.out.println(_loc.get("sch-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**

View File

@ -102,8 +102,10 @@ public class MetaDataCacheMaintenance {
}
private static int usage() {
// START - ALLOW PRINT STATEMENTS
System.err.println("Usage: java MetaDataCacheMaintenance " +
"[-scanDevPath t|f] [-<openjpa.PropertyName> value] store | dump");
// STOP - ALLOW PRINT STATEMENTS
return -1;
}

View File

@ -98,7 +98,9 @@ public class OpenJPAVersion {
}
public static void main(String [] args) {
// START - ALLOW PRINT STATEMENTS
System.out.println(new OpenJPAVersion().toString());
// STOP - ALLOW PRINT STATEMENTS
}
public String toString() {

View File

@ -1298,7 +1298,9 @@ public class ApplicationIdTool {
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.err.println(_loc.get("appid-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**

View File

@ -301,8 +301,10 @@ public class ManagedClassSubclasser {
dir.mkdirs();
dir = Files.getPackageFile(dir, bc.getPackageName(), true);
File f = new File(dir, bc.getClassName() + ".class");
// START - ALLOW PRINT STATEMENTS
System.err.println("Writing to " + f);
bc.write(f);
// STOP - ALLOW PRINT STATEMENTS
}
}

View File

@ -4621,7 +4621,9 @@ public class PCEnhancer {
Options opts = new Options();
args = opts.setFromCmdLine(args);
if (!run(args, opts))
// START - ALLOW PRINT STATEMENTS
System.err.println(_loc.get("enhance-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**

View File

@ -264,7 +264,9 @@ public class MetaDataTool
}
});
if (!ret)
// START - ALLOW PRINT STATEMENTS
System.err.println(_loc.get("tool-usage"));
// STOP - ALLOW PRINT STATEMENTS
}
/**

View File

@ -1663,8 +1663,10 @@ public class ProxyManagerImpl
});
}
// START - ALLOW PRINT STATEMENTS
System.out.println(bc.getName());
bc.write(new File(dir, bc.getClassName() + ".class"));
// STOP - ALLOW PRINT STATEMENTS
}
}
}

View File

@ -91,14 +91,18 @@ public class ProductDerivations {
}
// if some derivations weren't instantiable, warn
// START - ALLOW PRINT STATEMENTS
if (errors)
System.err.println(_loc.get("bad-product-derivations",
ProductDerivations.class.getName()));
// STOP - ALLOW PRINT STATEMENTS
for (int i = 0; i < _derivationErrors.length; i++) {
if (_derivationErrors[i] == null)
continue;
// START - ALLOW PRINT STATEMENTS
System.err.println(_derivationNames[i] + ":" +
_derivationErrors[i]);
// STOP - ALLOW PRINT STATEMENTS
break;
}
@ -477,7 +481,9 @@ public class ProductDerivations {
* Prints product derivation information.
*/
public static void main(String[] args) {
// START - ALLOW PRINT STATEMENTS
System.err.println(derivationErrorsToString());
// STOP - ALLOW PRINT STATEMENTS
}
/**

View File

@ -365,7 +365,6 @@ public class IdentifierUtilImpl implements IdentifierUtil, Configurable {
*/
public boolean isReservedWord(IdentifierRule rule, String name) {
if (rule == null) {
System.out.println("NAmingConfig: " + _config.getClass().getName());
throw new IllegalArgumentException("Naming rule is null!");
}
if (rule.getReservedWords() == null) {

View File

@ -266,7 +266,9 @@ public class SQLFormatter {
public static void main(String [] args) {
SQLFormatter formatter = new SQLFormatter();
for (int i = 0; i < args.length; i++) {
// START - ALLOW PRINT STATEMENTS
System.out.println(formatter.prettyPrint(args[i]));
// STOP - ALLOW PRINT STATEMENTS
}
}
}

View File

@ -258,6 +258,8 @@ public class JavaVersions {
}
public static void main(String[] args) {
// START - ALLOW PRINT STATEMENTS
System.out.println("Java version is: " + VERSION);
// STOP - ALLOW PRINT STATEMENTS
}
}

View File

@ -648,7 +648,9 @@ public class PersistenceProductDerivation
*/
private static void log(String msg) {
// at this point logging isn't configured yet
// START - ALLOW PRINT STATEMENTS
System.err.println(msg);
// STOP - ALLOW PRINT STATEMENTS
}
private void addPuNameCollision(String puName, String file1, String file2){

View File

@ -21,17 +21,27 @@
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!-- This is a temporary file.
As we get closer to enforcing the OpenJPA style to be like the
default Sun Microsystems Definition default file, then
we can remove this file and remove the reference from the
pom.xml -->
<!-- This is a temporary file. As we get closer to enforcing the OpenJPA
style to be like the default Sun Microsystems Definition default file, then
we can remove this file and remove the reference from the pom.xml -->
<module name="Checker">
<module name="NewlineAtEndOfFile"/>
<module name="TreeWalker">
<module name="LineLength">
<property name="max" value="120"/>
</module>
</module>
<module name="NewlineAtEndOfFile" />
<module name="TreeWalker">
<module name="FileContentsHolder" />
<module name="LineLength">
<property name="max" value="120" />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="System\.(out|err)\.print(ln)?\(" />
<property name="ignoreComments" value="true" />
</module>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="// START - ALLOW PRINT STATEMENTS" />
<property name="onCommentFormat" value="// STOP - ALLOW PRINT STATEMENTS" />
</module>
<!-- File location is specified in root pom.xml via ${checkstyle.suppressions.location} -->
<module name="SuppressionFilter"/>
</module>

View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress checks="RegexpSinglelineJava" files=".*openjpa-examples\\.*java" />
<suppress checks="RegexpSinglelineJava" files="Test.*java" />
<suppress checks="RegexpSinglelineJava" files=".*src\\test.*java" />
<suppress checks="RegexpSinglelineJava" files=".*src.test.*java" />
<suppress checks="RegexpSinglelineJava" files="Main.java" />
</suppressions>

View File

@ -46,7 +46,8 @@
<openjpa.version>${project.version}</openjpa.version>
<openjpa.Log>DefaultLevel=INFO</openjpa.Log>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<checkstyle.config.location>${project.basedir}/../openjpa-project/checkstyle.xml</checkstyle.config.location>
<checkstyle.config.location>${project.basedir}${file.separator}..${file.separator}openjpa-project${file.separator}checkstyle.xml</checkstyle.config.location>
<checkstyle.suppressions.location>${project.basedir}/../openjpa-project/suppressions.xml</checkstyle.suppressions.location>
<site.deploy.url>scp://people.apache.org/home/${user.name}/public_html/openjpa/${project.version}/staging-site</site.deploy.url>
<!-- the test settings can be overridden my specific profiles -->
<test.jvm.maxpermsize>512m</test.jvm.maxpermsize>
@ -766,12 +767,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.2</version>
<version>2.4</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-velocity</artifactId>
<version>1.1.3</version>
<version>1.1.5</version>
</dependency>
</dependencies>
</plugin>
@ -896,7 +897,6 @@
<goal>checkstyle</goal>
</goals>
<configuration>
<configLocation>${checkstyle.config.location}</configLocation>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
<includeTestSourceDirectory>true</includeTestSourceDirectory>