提交 713b55c8 authored 作者: Thomas Mueller's avatar Thomas Mueller

stricter checkstyle settings

上级 612d32f0
...@@ -17,8 +17,8 @@ import java.io.RandomAccessFile; ...@@ -17,8 +17,8 @@ import java.io.RandomAccessFile;
*/ */
public class CheckJavadoc { public class CheckJavadoc {
private int errorCount;
private static final int MAX_COMMENT_LINE_SIZE = 80; private static final int MAX_COMMENT_LINE_SIZE = 80;
private int errorCount;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
new CheckJavadoc().run(); new CheckJavadoc().run();
......
...@@ -18,25 +18,28 @@ import org.h2.util.ByteUtils; ...@@ -18,25 +18,28 @@ import org.h2.util.ByteUtils;
* removes trailing spaces. * removes trailing spaces.
*/ */
public class CheckTextFiles { public class CheckTextFiles {
public static void main(String[] args) throws Exception {
new CheckTextFiles().run();
}
String[] suffixCheck = new String[] { "html", "jsp", "js", "css", "bat", "nsi", // must contain "+" otherwise this here counts as well
private static final String COPYRIGHT = "Copyright 2004-2008 " + "H2 Group.";
private static final String LICENSE = "Multiple-Licensed " + "under the H2 License";
private static final String[] SUFFIX_CHECK = new String[] { "html", "jsp", "js", "css", "bat", "nsi",
"java", "txt", "properties", "sql", "xml", "csv", "Driver" }; "java", "txt", "properties", "sql", "xml", "csv", "Driver" };
String[] suffixIgnore = new String[] { "gif", "png", "odg", "ico", "sxd", private static final String[] SUFFIX_IGNORE = new String[] { "gif", "png", "odg", "ico", "sxd",
"layout", "res", "win", "jar", "task", "svg", "MF", "sh" }; "layout", "res", "win", "jar", "task", "svg", "MF", "sh" };
boolean failOnError; boolean failOnError;
boolean allowTab, allowCR = true, allowTrailingSpaces = true; boolean allowTab, allowCR = true, allowTrailingSpaces = true;
int spacesPerTab = 4; int spacesPerTab = 4;
boolean autoFix = true; boolean autoFix = true;
boolean useCRLF = true; boolean useCRLF = true;
// must contain "+" otherwise this here counts as well
static final String COPYRIGHT = "Copyright 2004-2008 " + "H2 Group.";
static final String LICENSE = "Multiple-Licensed " + "under the H2 License";
String[] suffixIgnoreLicense = new String[] { "bat", "nsi", "txt", "properties", "xml", "java.sql.Driver", "task", "sh" }; String[] suffixIgnoreLicense = new String[] { "bat", "nsi", "txt", "properties", "xml", "java.sql.Driver", "task", "sh" };
boolean hasError; boolean hasError;
public static void main(String[] args) throws Exception {
new CheckTextFiles().run();
}
void run() throws Exception { void run() throws Exception {
String baseDir = "src"; String baseDir = "src";
check(new File(baseDir)); check(new File(baseDir));
...@@ -62,8 +65,8 @@ public class CheckTextFiles { ...@@ -62,8 +65,8 @@ public class CheckTextFiles {
suffix = name.substring(lastDot + 1); suffix = name.substring(lastDot + 1);
} }
boolean check = false, ignore = false; boolean check = false, ignore = false;
for (int i = 0; i < suffixCheck.length; i++) { for (int i = 0; i < SUFFIX_CHECK.length; i++) {
if (suffix.equals(suffixCheck[i])) { if (suffix.equals(SUFFIX_CHECK[i])) {
check = true; check = true;
} }
} }
...@@ -77,8 +80,8 @@ public class CheckTextFiles { ...@@ -77,8 +80,8 @@ public class CheckTextFiles {
check = false; check = false;
ignore = true; ignore = true;
} }
for (int i = 0; i < suffixIgnore.length; i++) { for (int i = 0; i < SUFFIX_IGNORE.length; i++) {
if (suffix.equals(suffixIgnore[i])) { if (suffix.equals(SUFFIX_IGNORE[i])) {
ignore = true; ignore = true;
} }
} }
......
...@@ -30,16 +30,16 @@ import org.h2.util.StringUtils; ...@@ -30,16 +30,16 @@ import org.h2.util.StringUtils;
*/ */
public class GenerateDoc { public class GenerateDoc {
public static void main(String[] args) throws Exception {
new GenerateDoc().run(args);
}
String inDir = "src/docsrc/html"; String inDir = "src/docsrc/html";
String outDir = "docs/html"; String outDir = "docs/html";
Connection conn; Connection conn;
HashMap session = new HashMap(); HashMap session = new HashMap();
Bnf bnf; Bnf bnf;
public static void main(String[] args) throws Exception {
new GenerateDoc().run(args);
}
void run(String[] args) throws Exception { void run(String[] args) throws Exception {
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
if (args[i].equals("-in")) { if (args[i].equals("-in")) {
......
...@@ -28,13 +28,13 @@ public class LinkChecker { ...@@ -28,13 +28,13 @@ public class LinkChecker {
"SysProperties", "ErrorCode" "SysProperties", "ErrorCode"
}; };
private HashMap targets = new HashMap();
private HashMap links = new HashMap();
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
new LinkChecker().run(args); new LinkChecker().run(args);
} }
private HashMap targets = new HashMap();
private HashMap links = new HashMap();
private void run(String[] args) throws Exception { private void run(String[] args) throws Exception {
String dir = "docs"; String dir = "docs";
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
......
...@@ -24,19 +24,21 @@ import org.h2.build.BuildBase; ...@@ -24,19 +24,21 @@ import org.h2.build.BuildBase;
*/ */
public class SpellChecker { public class SpellChecker {
private HashSet dictionary = new HashSet();
private HashSet used = new HashSet();
private HashMap unknown = new HashMap();
private boolean debug;
private boolean printDictionary = false;
private boolean addToDictionary;
private static final String[] SUFFIX = new String[] { "html", "java", "sql", "txt", "xml", "jsp", "css", "bat", private static final String[] SUFFIX = new String[] { "html", "java", "sql", "txt", "xml", "jsp", "css", "bat",
"csv", "xml", "js", "Driver", "properties", "task", "MF", "sh", "" }; "csv", "xml", "js", "Driver", "properties", "task", "MF", "sh", "" };
private static final String[] IGNORE = new String[] { "dev", "nsi", "gif", "png", "odg", "ico", "sxd", "zip", private static final String[] IGNORE = new String[] { "dev", "nsi", "gif", "png", "odg", "ico", "sxd", "zip",
"bz2", "rc", "layout", "res", "dll", "jar", "svg" }; "bz2", "rc", "layout", "res", "dll", "jar", "svg" };
private static final String PREFIX_IGNORE = "abc"; private static final String PREFIX_IGNORE = "abc";
private static final String IGNORE_FILE = "mainWeb.html"; private static final String IGNORE_FILE = "mainWeb.html";
private HashSet dictionary = new HashSet();
private HashSet used = new HashSet();
private HashMap unknown = new HashMap();
private boolean debug;
private boolean printDictionary;
private boolean addToDictionary;
private int errorCount; private int errorCount;
private int contextCount;
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String dir = "src"; String dir = "src";
...@@ -220,6 +222,10 @@ public class SpellChecker { ...@@ -220,6 +222,10 @@ public class SpellChecker {
if (token.length() < 3) { if (token.length() < 3) {
return; return;
} }
if (contextCount > 0) {
// System.out.println(token);
contextCount--;
}
while (true) { while (true) {
char last = token.charAt(token.length() - 1); char last = token.charAt(token.length() - 1);
if (!Character.isDigit(last)) { if (!Character.isDigit(last)) {
...@@ -258,6 +264,7 @@ public class SpellChecker { ...@@ -258,6 +264,7 @@ public class SpellChecker {
Integer value = (Integer) map.get(key); Integer value = (Integer) map.get(key);
value = new Integer(value == null ? 0 : value.intValue() + 1); value = new Integer(value == null ? 0 : value.intValue() + 1);
map.put(key, value); map.put(key, value);
contextCount = 10;
} }
} }
...@@ -23,14 +23,14 @@ import org.h2.util.StringUtils; ...@@ -23,14 +23,14 @@ import org.h2.util.StringUtils;
*/ */
public class WebSite { public class WebSite {
String sourceDir = "docs";
String targetDir = "dataWeb";
private static final String ANALYTICS_TAG = "<!-- analytics -->"; private static final String ANALYTICS_TAG = "<!-- analytics -->";
private static final String ANALYTICS_SCRIPT = private static final String ANALYTICS_SCRIPT =
"<script src=\"http://www.google-analytics.com/ga.js\" type=\"text/javascript\"></script>\n" + "<script src=\"http://www.google-analytics.com/ga.js\" type=\"text/javascript\"></script>\n" +
"<script type=\"text/javascript\">var pageTracker=_gat._getTracker(\"UA-2351060-1\");pageTracker._initData();pageTracker._trackPageview();</script>"; "<script type=\"text/javascript\">var pageTracker=_gat._getTracker(\"UA-2351060-1\");pageTracker._initData();pageTracker._trackPageview();</script>";
String sourceDir = "docs";
String targetDir = "dataWeb";
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
new WebSite().run(); new WebSite().run();
} }
......
...@@ -512,5 +512,7 @@ intentional knowing jcl plug facade deployment logback confusion visited ...@@ -512,5 +512,7 @@ intentional knowing jcl plug facade deployment logback confusion visited
pickle associate subtraction negation multiplication visitors sharp connector pickle associate subtraction negation multiplication visitors sharp connector
derbynet ado happy derbyclient unspecified federated sysadmin lengths doing derbynet ado happy derbyclient unspecified federated sysadmin lengths doing
gives clunky cooperative paged conflicts ontology freely regards standards gives clunky cooperative paged conflicts ontology freely regards standards
placing refer informational unlocks placing refer informational unlocks memo unlimited unmounted keeping hints
hides heterogeneous construction rutema prepending rowscn overrides jconsole
mbean explicit directs leaves printing holds covariant redirector
...@@ -35,6 +35,10 @@ import org.h2.util.StringUtils; ...@@ -35,6 +35,10 @@ import org.h2.util.StringUtils;
*/ */
public class PropertiesToUTF8 { public class PropertiesToUTF8 {
private PropertiesToUTF8() {
// utility class
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
convert("bin/org/h2/res"); convert("bin/org/h2/res");
convert("bin/org/h2/server/web/res"); convert("bin/org/h2/server/web/res");
......
...@@ -13,6 +13,7 @@ import java.util.HashMap; ...@@ -13,6 +13,7 @@ import java.util.HashMap;
* character and vice versa. * character and vice versa.
*/ */
public class HtmlConverter { public class HtmlConverter {
private static HashMap charMap = new HashMap(); private static HashMap charMap = new HashMap();
private static HashMap codeMap = new HashMap(); private static HashMap codeMap = new HashMap();
...@@ -49,6 +50,10 @@ public class HtmlConverter { ...@@ -49,6 +50,10 @@ public class HtmlConverter {
"rdquo:8221", "bdquo:8222", "dagger:8224", "Dagger:8225", "hellip:8230", "permil:8240", "lsaquo:8249", "rdquo:8221", "bdquo:8222", "dagger:8224", "Dagger:8225", "hellip:8230", "permil:8240", "lsaquo:8249",
"rsaquo:8250" }; "rsaquo:8250" };
private HtmlConverter() {
// utility class
}
static { static {
for (int i = 0; i < CHARS.length; i++) { for (int i = 0; i < CHARS.length; i++) {
String token = CHARS[i]; String token = CHARS[i];
......
...@@ -26,6 +26,9 @@ import org.h2.util.StringUtils; ...@@ -26,6 +26,9 @@ import org.h2.util.StringUtils;
*/ */
public class Indexer { public class Indexer {
private static final int MIN_WORD_SIZE = 3;
private static final int MAX_RELATIONS = 20;
ArrayList pages = new ArrayList(); ArrayList pages = new ArrayList();
HashMap words = new HashMap(); HashMap words = new HashMap();
HashSet noIndex = new HashSet(); HashSet noIndex = new HashSet();
...@@ -37,9 +40,6 @@ public class Indexer { ...@@ -37,9 +40,6 @@ public class Indexer {
boolean title; boolean title;
boolean heading; boolean heading;
private static final int MIN_WORD_SIZE = 3;
private static final int MAX_RELATIONS = 20;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
new Indexer().run(args); new Indexer().run(args);
} }
......
...@@ -33,8 +33,10 @@ public class PgTcpRedirect { ...@@ -33,8 +33,10 @@ public class PgTcpRedirect {
// http://developer.postgresql.org/pgdocs/postgres/protocol.html // http://developer.postgresql.org/pgdocs/postgres/protocol.html
// int portServer = 9083, portClient = 9084; // int portServer = 9083, portClient = 9084;
// int portServer = 3306, portClient = 3307; // int portServer = 3306, portClient = 3307;
// int portServer = 5435, portClient = 5433; // H2 PgServer // H2 PgServer
int portServer = 5432, portClient = 5433; // PostgreSQL // int portServer = 5435, portClient = 5433;
// PostgreSQL
int portServer = 5432, portClient = 5433;
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
if ("-client".equals(args[i])) { if ("-client".equals(args[i])) {
...@@ -54,14 +56,16 @@ public class PgTcpRedirect { ...@@ -54,14 +56,16 @@ public class PgTcpRedirect {
} }
} }
/**
* This is the working thread of the TCP redirector.
*/
private class TcpRedirectThread implements Runnable { private class TcpRedirectThread implements Runnable {
private static final int STATE_INIT_CLIENT = 0, STATE_REGULAR = 1;
private Socket read, write; private Socket read, write;
private int state; private int state;
private boolean client; private boolean client;
private static final int STATE_INIT_CLIENT = 0, STATE_REGULAR = 1;
TcpRedirectThread(Socket read, Socket write, boolean client) { TcpRedirectThread(Socket read, Socket write, boolean client) {
this.read = read; this.read = read;
this.write = write; this.write = write;
......
...@@ -30,6 +30,10 @@ import org.h2.util.ByteUtils; ...@@ -30,6 +30,10 @@ import org.h2.util.ByteUtils;
*/ */
public class SecureKeyStoreBuilder { public class SecureKeyStoreBuilder {
private SecureKeyStoreBuilder() {
// utility class
}
public static void main(String[] a) throws Exception { public static void main(String[] a) throws Exception {
String password = SecureSocketFactory.KEYSTORE_PASSWORD; String password = SecureSocketFactory.KEYSTORE_PASSWORD;
KeyStore store = SecureSocketFactory.getKeyStore(password); KeyStore store = SecureSocketFactory.getKeyStore(password);
......
...@@ -16,6 +16,10 @@ public class Base64 { ...@@ -16,6 +16,10 @@ public class Base64 {
private static final byte[] CODE = new byte[64]; private static final byte[] CODE = new byte[64];
private static final byte[] REV = new byte[256]; private static final byte[] REV = new byte[256];
private Base64() {
// utility class
}
static { static {
for (int i = 'A'; i <= 'Z'; i++) { for (int i = 'A'; i <= 'Z'; i++) {
CODE[i - 'A'] = (byte) i; CODE[i - 'A'] = (byte) i;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论