提交 2f8b42f4 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 373a5600
......@@ -2,8 +2,9 @@
Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html><script>
<!--
<html>
<script type="text/javascript">
// <!--
var line = 0, file = '';
var params = location.search.substring(1).split('&');
var build = 'trunk';
......@@ -14,28 +15,28 @@ Initial Developer: H2 Group
line = value;
} else if (key == 'file') {
file = value;
} else if (key == 'build') {
} else if (key == 'build' && value >= 63) {
build = 'tags/version-1.0.' + value;
}
}
-->
// -->
</script>
<pre>
<table width="100%">
<tr>
<td style="width: 50px">
<script>
<!--
<script type="text/javascript">
// <!--
for(var i = 1; i <= 5000; i++) {
if (line == i) {
document.write('<b>' + i + ' ></b><br />');
document.write('<b>' + i + '></b><br />');
} else if (line <= 4 || i + 4 == line) {
document.write(i + '<a name="here"></a><br />');
} else {
document.write(i + '<br />');
}
}
-->
// -->
</script>
</td>
<td width="92%" style="vertical-align: top;">
......@@ -45,11 +46,11 @@ Initial Developer: H2 Group
</tr>
</table>
<a href="#here"></a>
<script>
<!--
<script type="text/javascript">
// <!--
var source = document.getElementById('source');
source.src = 'http://h2database.googlecode.com/svn/' + build + '/h2/src/main/' + file;
document.location = '#here';
-->
// -->
</script>
</pre></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
Error Analytics
</title><link rel="stylesheet" type="text/css" href="stylesheet.css" />
<style type="text/css">
a {
text-decoration: underline;
font-weight: normal;
color: #0000ff;
}
a.selected {
text-decoration: none;
font-weight: bold;
color: #000000;
}
a.disabled {
text-decoration: none;
font-weight: normal;
color: lightGray;
}
</style>
</head><body style="margin:20px">
<script type="text/javascript">
//<!--
function $(id) {
return document.getElementById(id);
}
function goDetails(code) {
code = code.replace('21S', '210');
code = code.replace('42S', '421');
code = code.replace('HY', '50');
code = code.replace('C', '1');
code = code.replace('T', '2');
$('more').src = 'http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c' + code;
}
function go(url, file) {
$('file').innerHTML = file;
$('code').src = url;
}
var lastError = '';
var hasData = false;
var errorCode = '0';
function convert() {
try {
var s = $('error').value;
if(lastError == s) {
return;
}
lastError = s;
var result = '';
hasData = false;
var idx = s.lastIndexOf("[");
if (idx >= 0) {
$('message').innerHTML = s.substring(0, idx);
var end = s.indexOf("]", idx);
errorCode = s.substring(idx + 1, end);
hasData = true;
idx = errorCode.indexOf("-");
build = errorCode.substring(idx + 1);
$('version').innerHTML = '1.0.' + build;
errorCode = errorCode.substring(0, idx);
while (errorCode.length > 1 && errorCode.charAt(0) == '0') {
errorCode = errorCode.substring(1);
}
$('errorCode').innerHTML = errorCode;
goDetails(errorCode);
s = s.substring(end + 1);
}
idx = 0;
while (true) {
var start = s.indexOf("org.h2.", idx);
if (start < 0) {
result += s.substring(idx);
break;
}
if (idx > 0) {
result += s.substring(idx, start);
}
var end = s.indexOf(')', start);
if (end < 0) {
result += s.substring(idx);
break;
}
var element = s.substring(start, end + 1);
var open = element.lastIndexOf('(');
var dotMethod = element.lastIndexOf('.', open - 1);
var dotClass = element.lastIndexOf('.', dotMethod - 1);
var packageName = element.substring(0, dotClass);
var colon = element.lastIndexOf(':');
var file = element.substring(open + 1, colon);
var lineNumber = element.substring(colon + 1, element.length - 1);
var fullFileName = packageName.replace(/\./g, '/') + "/" + file;
var url = "http://h2database.com/html/source.html?file=";
url += fullFileName;
url += "&line=";
url += lineNumber;
url += "&build=";
url += build;
result += "<a href='javascript:go(\"";
result += url;
result += "\",\"";
result += fullFileName;
result += "\")'>";
result += element;
result += "</a>";
hasData = true;
idx = end + 1;
}
result = result.replace(/[\n\r]+/g, "<br/>");
result = result.replace(/ at /g, "");
$('links').innerHTML = result;
select('input');
} catch(e) {
hasData = false;
alert('Can not parse the stack trace: ' + e);
}
}
function select(id) {
$('input').style.display = 'none';
$('details').style.display = 'none';
$('source').style.display = 'none';
$('inputTab').className = '';
$('detailsTab').className = hasData ? '' : 'disabled';
$('sourceTab').className = hasData ? '' : 'disabled';
$(id + 'Tab').className = 'selected';
$(id).style.display = '';
if(id=='details') {
goDetails(errorCode);
}
}
//-->
</script>
<h1>Error Analytics</h1>
<h2>
<a href="javascript:select('input')" id="inputTab">Input</a>&nbsp;
<a href="javascript:select('details')" id="detailsTab">Details</a>&nbsp;
<a href="javascript:select('source')" id="sourceTab">Source Code</a>
</h2>
<hr/>
<div id="input">
<p>Fill in the error message and stack trace and click on 'Details' or 'Source Code': </p>
<textarea id="error" cols="100" style="width: 100%; overflow: auto;" rows="20"
onChange="convert()"
onSelect="convert()"
onKeyUp="convert()"
onKeyPress="convert()"
onFocus="convert()"
onBlur="convert()"
>
</textarea>
</div>
<div id="details">
<p><b>Error Code: </b><span id="errorCode"></span></p>
<p><b>Product Version: </b><span id="version"></span></p>
<p><b>Message: </b></p>
<p id="message"></p>
<p><b>More Information:</b></p>
<iframe id="more" frameborder="0" marginwidth="0" marginheight="0" width="100%" height="300px" src="">
</iframe>
</div>
<div id="source">
<table style="border:0px" width="100%"><tr><td style="border:0px" width="30px">
<p><b>Stack Trace: </b></p>
<p id="links"></p>
</td><td style="border:0px" width="90%">
<p><b>Source File: </b><span id="file"></span></p>
<iframe id="code" frameborder="0" marginwidth="0" marginheight="0" width="100%" height="300px" src="">
</iframe>
</td></tr></table>
</div>
<script type="text/javascript">
//<!--
select('input');
//-->
</script>
</body></html>
\ No newline at end of file
......@@ -675,6 +675,9 @@ public class ErrorCode {
* INTERNAL
*/
public static String getState(int errorCode) {
// To convert SQLState to error code, replace
// 21S: 210, 42S: 421, HY: 50, C: 1, T: 2
switch (errorCode) {
// 02: no data
case NO_DATA_AVAILABLE: return "02000";
......
......@@ -70,7 +70,7 @@ public class Engine {
if (user == null) {
try {
database.checkFilePasswordHash(cipher, ci.getFilePasswordHash());
//create the exception here so it is not possible from the stack trace
// create the exception here so it is not possible from the stack trace
// to see if the user name was wrong or the password
SQLException wrongUserOrPassword = Message.getSQLException(ErrorCode.WRONG_USER_OR_PASSWORD);
user = database.getUser(ci.getUserName(), wrongUserOrPassword);
......
......@@ -155,7 +155,7 @@ public class JdbcSQLException extends SQLException {
buff.append(sql);
}
buff.append(" [");
buff.append(getSQLState());
buff.append(getErrorCode());
buff.append('-');
buff.append(Constants.BUILD_ID);
buff.append(']');
......
......@@ -151,6 +151,16 @@ java org.h2.test.TestAll timer
/*
add sourceError as an official link
corruption should be it's own error code(s)
Online Error Analyzer
add a 'kill process while altering tables' test case
1.5 tool: closeSilently(s1, s2,...)
implement max_query_time and use it for TestCrashAPI
document IKVM
......@@ -175,11 +185,6 @@ Roadmap:
Move Maven 2 repository from hsql.sf.net to h2database.sf.net
History:
Primary keys are now considered constraints and can have a constraint name.
H2 Console: stack traces are now links to the source code in the source repository (H2 database only).
CHAR data type equals comparison was case insensitive instead of case sensitive.
The exception 'Value too long for column' now includes the data.
The table name was missing in the documentation of CREATE INDEX.
Test Recovery with MAX_LOG_FILE_SIZE=1; test with various log file sizes
......
......@@ -78,6 +78,7 @@ public class Doclet {
writer.println("<h1>" + className + "</h1>");
writer.println(formatText(clazz.commentText()) + "<br /><br />");
// method overview
MethodDoc[] methods = clazz.methods();
Arrays.sort(methods, new Comparator() {
public int compare(Object a, Object b) {
......@@ -122,6 +123,8 @@ public class Doclet {
if (hasMethods) {
writer.println("</table>");
}
// field overview
FieldDoc[] fields = clazz.fields();
if (clazz.interfaces().length > 0) {
fields = clazz.interfaces()[0].fields();
......@@ -150,27 +153,12 @@ public class Doclet {
String constant = field.constantValueExpression();
// add a link (a name) if there is a <code> tag
int linkStart = text.indexOf("<code>");
if (linkStart >= 0) {
int linkEnd = text.indexOf("</code>", linkStart);
String link = text.substring(linkStart + "<code>".length(), linkEnd);
if (constant != null && !constant.equals(link)) {
throw new Error("wrong code tag? " + clazz.name() + "." + name +
" code: " + link + " constant: " + constant);
}
if (Character.isDigit(link.charAt(0))) {
link = "c" + link;
}
writer.println("<a name=\"" + link + "\"></a>");
}
String link = getFieldLink(text, constant, clazz, name);
writer.print("<a href=\"#" + link + "\">" + name + "</a>");
if (constant == null) {
writer.println(name);
writer.println();
} else {
writer.println(name + " = " + constant);
}
if (text != null) {
writer.println("<div class=\"fieldText\">" + formatText(text) + "</div>");
writer.println(" = " + constant);
}
writer.println("</td></tr>");
fieldId++;
......@@ -179,6 +167,7 @@ public class Doclet {
writer.println("</table>");
}
// message details
for (int i = 0; i < methods.length; i++) {
MethodDoc method = methods[i];
String name = method.name();
......@@ -255,11 +244,68 @@ public class Doclet {
}
writer.println("<hr />");
}
// field details
Arrays.sort(fields, new Comparator() {
public int compare(Object a, Object b) {
FieldDoc fa = (FieldDoc) a;
FieldDoc fb = (FieldDoc) b;
String ca = fa.constantValueExpression();
String cb = fb.constantValueExpression();
if (ca != null && cb != null) {
return ca.compareTo(cb);
}
return fa.name().compareTo(fb.name());
}
});
for (int i = 0; i < fields.length; i++) {
FieldDoc field = fields[i];
if (!field.isFinal() || !field.isStatic() || !field.isPublic()) {
continue;
}
String text = field.commentText();
if (text.startsWith("INTERNAL")) {
continue;
}
String name = field.name();
String constant = field.constantValueExpression();
String link = getFieldLink(text, constant, clazz, name);
writer.println("<a name=\"" + link + "\"></a>");
writer.println("<h4><span class=\"methodName\">" + name);
if (constant == null) {
writer.println();
} else {
writer.println(" = " + constant);
}
writer.println("</span></h4>");
if (text != null) {
writer.println("<div class=\"item\">" + formatText(text) + "</div>");
}
writer.println("<hr />");
}
writer.println("</div></td></tr></table></body></html>");
writer.close();
out.close();
}
private static String getFieldLink(String text, String constant, ClassDoc clazz, String name) {
String link = constant != null ? constant : name.toLowerCase();
int linkStart = text.indexOf("<code>");
if (linkStart >= 0) {
int linkEnd = text.indexOf("</code>", linkStart);
link = text.substring(linkStart + "<code>".length(), linkEnd);
if (constant != null && !constant.equals(link)) {
throw new Error("wrong code tag? " + clazz.name() + "." + name +
" code: " + link + " constant: " + constant);
}
}
if (Character.isDigit(link.charAt(0))) {
link = "c" + link;
}
return link;
}
private static String formatText(String text) {
if (text == null) {
return text;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论