提交 e6674c94 authored 作者: Thomas Mueller's avatar Thomas Mueller

Split long lines.

上级 277312ed
...@@ -348,7 +348,11 @@ public class TestFileLockSerialized extends TestBase { ...@@ -348,7 +348,11 @@ public class TestFileLockSerialized extends TestBase {
ResultSet rs = c.createStatement().executeQuery("select id, id2 from test"); ResultSet rs = c.createStatement().executeQuery("select id, id2 from test");
while (rs.next()) { while (rs.next()) {
if (rs.getInt(1) != rs.getInt(2)) { if (rs.getInt(1) != rs.getInt(2)) {
throw new Exception(Thread.currentThread().getId() + " nextInt: " + nextInt [0] + " rs.getInt(1): " + rs.getInt(1) + " rs.getInt(2): " + rs.getInt(2)); throw new Exception(
Thread.currentThread().getId() +
" nextInt: " + nextInt [0] +
" rs.getInt(1): " + rs.getInt(1) +
" rs.getInt(2): " + rs.getInt(2));
} }
} }
nextInt[0]++; nextInt[0]++;
...@@ -532,7 +536,10 @@ public class TestFileLockSerialized extends TestBase { ...@@ -532,7 +536,10 @@ public class TestFileLockSerialized extends TestBase {
deleteDb("fileLockSerialized"); deleteDb("fileLockSerialized");
int cacheSizeKb = withCache ? 5000 : 0; int cacheSizeKb = withCache ? 5000 : 0;
final String url = "jdbc:h2:" + getBaseDir() + "/fileLockSerialized;FILE_LOCK=SERIALIZED;OPEN_NEW=TRUE;CACHE_SIZE=" + cacheSizeKb; final String url = "jdbc:h2:" + getBaseDir() + "/fileLockSerialized" +
";FILE_LOCK=SERIALIZED" +
";OPEN_NEW=TRUE" +
";CACHE_SIZE=" + cacheSizeKb;
final boolean[] importFinished = { false }; final boolean[] importFinished = { false };
final Task importUpdate = new Task() { final Task importUpdate = new Task() {
public void call() throws Exception { public void call() throws Exception {
......
...@@ -116,7 +116,9 @@ public class TestRecovery extends TestBase { ...@@ -116,7 +116,9 @@ public class TestRecovery extends TestBase {
} }
f.close(); f.close();
Recover.main("-dir", getBaseDir(), "-db", "recovery"); Recover.main("-dir", getBaseDir(), "-db", "recovery");
String script = IOUtils.readStringAndClose(new InputStreamReader(IOUtils.openFileInputStream(getBaseDir() + "/recovery.h2.sql")), -1); String script = IOUtils.readStringAndClose(
new InputStreamReader(
IOUtils.openFileInputStream(getBaseDir() + "/recovery.h2.sql")), -1);
assertContains(script, "checksum mismatch"); assertContains(script, "checksum mismatch");
assertContains(script, "dump:"); assertContains(script, "dump:");
assertContains(script, "Hello World2"); assertContains(script, "Hello World2");
......
...@@ -66,13 +66,20 @@ public class TestSecurity extends TestBase { ...@@ -66,13 +66,20 @@ public class TestSecurity extends TestBase {
getHashString( getHashString(
new byte[] { (byte) 0xe3, (byte) 0xd7, 0x25, 0x70, (byte) 0xdc, (byte) 0xdd, 0x78, 0x7c, (byte) 0xe3, new byte[] { (byte) 0xe3, (byte) 0xd7, 0x25, 0x70, (byte) 0xdc, (byte) 0xdd, 0x78, 0x7c, (byte) 0xe3,
(byte) 0x88, 0x7a, (byte) 0xb2, (byte) 0xcd, 0x68, 0x46, 0x52 })); (byte) 0x88, 0x7a, (byte) 0xb2, (byte) 0xcd, 0x68, 0x46, 0x52 }));
checkSHA256("", "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"); checkSHA256("",
checkSHA256("a", "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB"); "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855");
checkSHA256("abc", "BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD"); checkSHA256("a",
checkSHA256("message digest", "F7846F55CF23E14EEBEAB5B4E1550CAD5B509E3348FBC4EFA3A1413D393CB650"); "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB");
checkSHA256("abcdefghijklmnopqrstuvwxyz", "71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73"); checkSHA256("abc",
checkSHA256("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1"); "BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD");
checkSHA256("12345678901234567890123456789012345678901234567890123456789012345678901234567890", "F371BC4A311F2B009EEF952DD83CA80E2B60026C8E935592D0F9C308453C813E"); checkSHA256("message digest",
"F7846F55CF23E14EEBEAB5B4E1550CAD5B509E3348FBC4EFA3A1413D393CB650");
checkSHA256("abcdefghijklmnopqrstuvwxyz",
"71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73");
checkSHA256("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
"248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1");
checkSHA256("12345678901234567890123456789012345678901234567890123456789012345678901234567890",
"F371BC4A311F2B009EEF952DD83CA80E2B60026C8E935592D0F9C308453C813E");
StringBuilder buff = new StringBuilder(1000000); StringBuilder buff = new StringBuilder(1000000);
buff.append('a'); buff.append('a');
checkSHA256(buff.toString(), "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB"); checkSHA256(buff.toString(), "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB");
...@@ -116,7 +123,8 @@ public class TestSecurity extends TestBase { ...@@ -116,7 +123,8 @@ public class TestSecurity extends TestBase {
assertEquals("3f5b8cc9ea855a0afa7347d23e8d664e", r); assertEquals("3f5b8cc9ea855a0afa7347d23e8d664e", r);
// test vector from // test vector from
// http://www.inconteam.com/index.php?option=com_content&view=article&id=55:aes-test-vectors&catid=41:encryption&Itemid=60#aes-ecb-128 // http://www.inconteam.com/index.php?option=com_content&view=article&
// id=55:aes-test-vectors&catid=41:encryption&Itemid=60#aes-ecb-128
test.setKey(StringUtils.convertHexToBytes("2b7e151628aed2a6abf7158809cf4f3c")); test.setKey(StringUtils.convertHexToBytes("2b7e151628aed2a6abf7158809cf4f3c"));
data = StringUtils.convertHexToBytes("6bc1bee22e409f96e93d7e117393172a"); data = StringUtils.convertHexToBytes("6bc1bee22e409f96e93d7e117393172a");
test.encrypt(data, 0, data.length); test.encrypt(data, 0, data.length);
......
...@@ -525,7 +525,9 @@ public class TestTools extends TestBase { ...@@ -525,7 +525,9 @@ public class TestTools extends TestBase {
prep.executeUpdate(); prep.executeUpdate();
conn.close(); conn.close();
ConvertTraceFile.main("-traceFile", getBaseDir() + "/toolsConvertTraceFile.trace.db", "-javaClass", getBaseDir() + "/Test", "-script", getBaseDir() + "/test.sql"); ConvertTraceFile.main("-traceFile", getBaseDir() + "/toolsConvertTraceFile.trace.db",
"-javaClass", getBaseDir() + "/Test",
"-script", getBaseDir() + "/test.sql");
FileSystem fs = FileSystem.getInstance(getBaseDir()); FileSystem fs = FileSystem.getInstance(getBaseDir());
fs.delete(getBaseDir() + "/Test.java"); fs.delete(getBaseDir() + "/Test.java");
......
...@@ -72,7 +72,10 @@ public class TestValueMemory extends TestBase implements DataHandler { ...@@ -72,7 +72,10 @@ public class TestValueMemory extends TestBase implements DataHandler {
testCompare(); testCompare();
for (int i = 0; i < Value.TYPE_COUNT; i++) { for (int i = 0; i < Value.TYPE_COUNT; i++) {
Value v = create(i); Value v = create(i);
String s = "type: " + v.getType() + " calculated: " + v.getMemory() + " real: " + MemoryFootprint.getObjectSize(v) + " " + v.getClass().getName() + ": " + v.toString(); String s = "type: " + v.getType() +
" calculated: " + v.getMemory() +
" real: " + MemoryFootprint.getObjectSize(v) + " " +
v.getClass().getName() + ": " + v.toString();
trace(s); trace(s);
} }
for (int i = 0; i < Value.TYPE_COUNT; i++) { for (int i = 0; i < Value.TYPE_COUNT; i++) {
...@@ -112,11 +115,15 @@ public class TestValueMemory extends TestBase implements DataHandler { ...@@ -112,11 +115,15 @@ public class TestValueMemory extends TestBase implements DataHandler {
System.gc(); System.gc();
long used = Utils.getMemoryUsed() - first; long used = Utils.getMemoryUsed() - first;
memory /= 1024; memory /= 1024;
if (config.traceTest) { if (config.traceTest || used > memory * 3) {
trace("Type: " + type + " Used memory: " + used + " calculated: " + memory + " length: " + array.length + " size: " + size); String msg = "Type: " + type + " Used memory: " + used +
} " calculated: " + memory + " length: " + array.length + " size: " + size;
if (used > memory * 3) { if (config.traceTest) {
fail("Type: " + type + " Used memory: " + used + " calculated: " + memory + " length: " + array.length + " size: " + size); trace(msg);
}
if (used > memory * 3) {
fail(msg);
}
} }
} }
private Value create(int type) throws SQLException { private Value create(int type) throws SQLException {
......
...@@ -60,7 +60,8 @@ public class OutputCatcher { ...@@ -60,7 +60,8 @@ public class OutputCatcher {
File file = new File(fileName); File file = new File(fileName);
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
PrintWriter writer = new PrintWriter(new FileOutputStream(file)); PrintWriter writer = new PrintWriter(new FileOutputStream(file));
writer.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"); writer.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 " +
"Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
writer.write("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n"); writer.write("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n");
writer.write("<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>\n"); writer.write("<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>\n");
writer.print(title); writer.print(title);
......
...@@ -320,7 +320,8 @@ public class H2Database { ...@@ -320,7 +320,8 @@ public class H2Database {
* @param conflictAlgorithm what conflict resolution to use * @param conflictAlgorithm what conflict resolution to use
* @return TODO * @return TODO
*/ */
public long insertWithOnConflict(String table, String nullColumnHack, ContentValues initialValues, int conflictAlgorithm) { public long insertWithOnConflict(String table, String nullColumnHack,
ContentValues initialValues, int conflictAlgorithm) {
return 0; return 0;
} }
......
...@@ -745,7 +745,8 @@ public class BuildBase { ...@@ -745,7 +745,8 @@ public class BuildBase {
println("Zip " + destFile + " (" + kb + " KB)"); println("Zip " + destFile + " (" + kb + " KB)");
} }
private static long zipOrJar(String destFile, FileList files, String basePath, boolean storeOnly, boolean sortBySuffix, boolean jar) { private static long zipOrJar(String destFile, FileList files,
String basePath, boolean storeOnly, boolean sortBySuffix, boolean jar) {
if (sortBySuffix) { if (sortBySuffix) {
// for better compressibility, sort by suffix, then name // for better compressibility, sort by suffix, then name
Collections.sort(files, new Comparator<File>() { Collections.sort(files, new Comparator<File>() {
......
...@@ -18,6 +18,7 @@ import java.io.RandomAccessFile; ...@@ -18,6 +18,7 @@ import java.io.RandomAccessFile;
public class CheckJavadoc { public class CheckJavadoc {
private static final int MAX_COMMENT_LINE_SIZE = 80; private static final int MAX_COMMENT_LINE_SIZE = 80;
private static final int MAX_SOURCE_LINE_SIZE = 120;
private int errorCount; private int errorCount;
/** /**
...@@ -114,6 +115,9 @@ public class CheckJavadoc { ...@@ -114,6 +115,9 @@ public class CheckJavadoc {
System.out.println("Long line: " + file.getAbsolutePath() System.out.println("Long line: " + file.getAbsolutePath()
+ " (" + file.getName() + ":" + lineNumber + ")"); + " (" + file.getName() + ":" + lineNumber + ")");
errorCount++; errorCount++;
} else if (!inComment && line.length() > MAX_SOURCE_LINE_SIZE) {
System.out.println("Long line: " + file.getAbsolutePath()
+ " (" + file.getName() + ":" + lineNumber + ")");
} }
lineNumber++; lineNumber++;
pos = next + 1; pos = next + 1;
......
...@@ -34,7 +34,9 @@ public class CheckTextFiles { ...@@ -34,7 +34,9 @@ public class CheckTextFiles {
private int spacesPerTab = 4; private int spacesPerTab = 4;
private boolean autoFix = true; private boolean autoFix = true;
private boolean useCRLF; private boolean useCRLF;
private String[] suffixIgnoreLicense = { "bat", "nsi", "txt", "properties", "xml", "java.sql.Driver", "task", "sh", "prefs" }; private String[] suffixIgnoreLicense = {
"bat", "nsi", "txt", "properties", "xml",
"java.sql.Driver", "task", "sh", "prefs" };
private boolean hasError; private boolean hasError;
/** /**
......
...@@ -27,7 +27,10 @@ public class WebSite { ...@@ -27,7 +27,10 @@ public class WebSite {
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>";
private static final String TRANSLATE_START = "<!-- translate"; private static final String TRANSLATE_START = "<!-- translate";
private static final String TRANSLATE_END = "translate -->"; private static final String TRANSLATE_END = "translate -->";
......
...@@ -139,7 +139,8 @@ public class Doclet { ...@@ -139,7 +139,8 @@ public class Doclet {
hasMethods = true; hasMethods = true;
} }
String type = getTypeName(method.isStatic(), false, getReturnType(method)); String type = getTypeName(method.isStatic(), false, getReturnType(method));
writer.println("<tr id=\"__"+id+"\" onclick=\"return on("+ id +")\"><td class=\"return\">" + type + "</td><td class=\"method\">"); writer.println("<tr id=\"__"+id+"\" onclick=\"return on("+ id +")\">");
writer.println("<td class=\"return\">" + type + "</td><td class=\"method\">");
Parameter[] params = method.parameters(); Parameter[] params = method.parameters();
StringBuilder buff = new StringBuilder(); StringBuilder buff = new StringBuilder();
StringBuilder buffSignature = new StringBuilder(name); StringBuilder buffSignature = new StringBuilder(name);
...@@ -311,7 +312,8 @@ public class Doclet { ...@@ -311,7 +312,8 @@ public class Doclet {
if (hasComment && !method.commentText().startsWith("[")) { if (hasComment && !method.commentText().startsWith("[")) {
// [Not supported] and such are not problematic // [Not supported] and such are not problematic
addError("Undocumented parameter(s) (" + addError("Undocumented parameter(s) (" +
clazz.name() + ".java:" + method.position().line() + ") " + name + " documented: " + paramTags.length + " params: "+ params.length); clazz.name() + ".java:" + method.position().line() + ") " +
name + " documented: " + paramTags.length + " params: "+ params.length);
} }
} }
for (int j = 0; j < paramTags.length; j++) { for (int j = 0; j < paramTags.length; j++) {
...@@ -420,9 +422,14 @@ public class Doclet { ...@@ -420,9 +422,14 @@ public class Doclet {
boolean setterOrGetter = name.startsWith("set") && method.parameters().length == 1; boolean setterOrGetter = name.startsWith("set") && method.parameters().length == 1;
setterOrGetter |= name.startsWith("get") && method.parameters().length == 0; setterOrGetter |= name.startsWith("get") && method.parameters().length == 0;
Type returnType = getReturnType(method); Type returnType = getReturnType(method);
setterOrGetter |= name.startsWith("is") && method.parameters().length == 0 && returnType != null && returnType.toString().equals("boolean"); setterOrGetter |= name.startsWith("is") &&
method.parameters().length == 0 &&
returnType != null &&
returnType.toString().equals("boolean");
if (!setterOrGetter) { if (!setterOrGetter) {
addError("Undocumented method " + " (" + clazz.name() + ".java:" + method.position().line() +") " + clazz + "." + name + " " + raw); addError("Undocumented method " +
" (" + clazz.name() + ".java:" + method.position().line() +") " +
clazz + "." + name + " " + raw);
return true; return true;
} }
} }
......
...@@ -46,7 +46,9 @@ public class SecureKeyStoreBuilder { ...@@ -46,7 +46,9 @@ public class SecureKeyStoreBuilder {
printKeystore(store, password); printKeystore(store, password);
} }
private static void printKeystore(KeyStore store, String password) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException, CertificateEncodingException { private static void printKeystore(KeyStore store, String password)
throws KeyStoreException, NoSuchAlgorithmException,
UnrecoverableKeyException, CertificateEncodingException {
System.out.println("KeyStore store = KeyStore.getInstance(\""+store.getType()+"\");"); System.out.println("KeyStore store = KeyStore.getInstance(\""+store.getType()+"\");");
System.out.println("store.load(null, password.toCharArray());"); System.out.println("store.load(null, password.toCharArray());");
//System.out.println("keystore provider="+store.getProvider().getName()); //System.out.println("keystore provider="+store.getProvider().getName());
......
...@@ -86,7 +86,9 @@ public class FileViewer extends Tool { ...@@ -86,7 +86,9 @@ public class FileViewer extends Tool {
} }
} }
private static void process(String fileName, String find, boolean head, boolean tail, long start, int lines, boolean quiet) throws IOException { private static void process(String fileName, String find,
boolean head, boolean tail, long start, int lines,
boolean quiet) throws IOException {
RandomAccessFile file = new RandomAccessFile(fileName, "r"); RandomAccessFile file = new RandomAccessFile(fileName, "r");
long length = file.length(); long length = file.length();
if (head) { if (head) {
......
...@@ -1367,7 +1367,9 @@ public class ClassReader { ...@@ -1367,7 +1367,9 @@ public class ClassReader {
int field = constantPool[fieldRef].intValue(); int field = constantPool[fieldRef].intValue();
int classIndex = field >>> 16; int classIndex = field >>> 16;
int nameAndType = constantPool[field & 0xffff].intValue(); int nameAndType = constantPool[field & 0xffff].intValue();
String className = constantPool[constantPool[classIndex].intValue()] + "." + constantPool[nameAndType >>> 16] + " " + constantPool[nameAndType & 0xffff]; String className = constantPool[constantPool[classIndex].intValue()] + "." +
constantPool[nameAndType >>> 16] + " " +
constantPool[nameAndType & 0xffff];
return className; return className;
} }
...@@ -1375,7 +1377,9 @@ public class ClassReader { ...@@ -1375,7 +1377,9 @@ public class ClassReader {
int method = constantPool[methodRef].intValue(); int method = constantPool[methodRef].intValue();
int classIndex = method >>> 16; int classIndex = method >>> 16;
int nameAndType = constantPool[method & 0xffff].intValue(); int nameAndType = constantPool[method & 0xffff].intValue();
String className = constantPool[constantPool[classIndex].intValue()] + "." + constantPool[nameAndType >>> 16] + " " + constantPool[nameAndType & 0xffff]; String className = constantPool[constantPool[classIndex].intValue()] + "." +
constantPool[nameAndType >>> 16] + " " +
constantPool[nameAndType & 0xffff];
return className; return className;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论