| 1 |
<!-- can not use doctype --> |
| 2 |
<!-- |
| 3 |
Copyright 2004-2019 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 4 |
and the EPL 1.0 (http://h2database.com/html/license.html). |
| 5 |
Initial Developer: H2 Group |
| 6 |
--> |
| 7 |
<html><head> |
| 8 |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
| 9 |
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 10 |
<title>Error Analyzer</title> |
| 11 |
<link rel="stylesheet" type="text/css" href="stylesheet.css" /> |
| 12 |
<style type="text/css"> |
| 13 |
body { |
| 14 |
max-width: none; |
| 15 |
width: inherit; |
| 16 |
} |
| 17 |
a { |
| 18 |
text-decoration: underline; |
| 19 |
font-weight: normal; |
| 20 |
color: #0000ff; |
| 21 |
} |
| 22 |
a.selected { |
| 23 |
text-decoration: none; |
| 24 |
font-weight: bold; |
| 25 |
color: #000000; |
| 26 |
} |
| 27 |
a.disabled { |
| 28 |
text-decoration: none; |
| 29 |
font-weight: normal; |
| 30 |
color: lightGray; |
| 31 |
} |
| 32 |
input { |
| 33 |
vertical-align: middle; |
| 34 |
} |
| 35 |
</style> |
| 36 |
|
| 37 |
<script type="text/javascript"> |
| 38 |
//<!-- |
| 39 |
|
| 40 |
function getVersion(build) { |
| 41 |
if (build == 64) { |
| 42 |
return '1.0/version-1.0.' + build; |
| 43 |
} else if (build >= 177) { |
| 44 |
return '1.4.' + build; |
| 45 |
} else if (build >= 146 && build != 147) { |
| 46 |
return '1.3/version-1.3.' + build; |
| 47 |
} else if (build >= 120) { |
| 48 |
return '1.2/version-1.2.' + build; |
| 49 |
} else if (build >= 100) { |
| 50 |
return '1.1/version-1.1.' + build; |
| 51 |
} |
| 52 |
return '1.0.' + build; |
| 53 |
} |
| 54 |
|
| 55 |
function get(id) { |
| 56 |
return document.getElementById(id); |
| 57 |
} |
| 58 |
|
| 59 |
var lastError = ''; |
| 60 |
var hasData = false; |
| 61 |
var errorCode = '0'; |
| 62 |
var build = 100; |
| 63 |
|
| 64 |
function goDetails(code) { |
| 65 |
code = code.replace('21S', '210'); |
| 66 |
code = code.replace('42S', '421'); |
| 67 |
code = code.replace('HY', '50'); |
| 68 |
code = code.replace('C', '1'); |
| 69 |
code = code.replace('T', '2'); |
| 70 |
get('more').src = 'http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c' + code; |
| 71 |
} |
| 72 |
|
| 73 |
function go(file, line) { |
| 74 |
var url; |
| 75 |
if (get('rawSource').checked == true) { |
| 76 |
url = "source.html?file="; |
| 77 |
url += file; |
| 78 |
url += "&line="; |
| 79 |
url += line; |
| 80 |
url += "&build="; |
| 81 |
url += build; |
| 82 |
get('file').innerHTML = file; |
| 83 |
get('code').src = url; |
| 84 |
} else { |
| 85 |
url = 'https://github.com/h2database/h2database/tree/' |
| 86 |
if (build && build > 0) { |
| 87 |
url += 'version-' + getVersion(build) + '/h2'; |
| 88 |
} else { |
| 89 |
var tag = 'master/h2'; |
| 90 |
} |
| 91 |
url += '/src/main/'; |
| 92 |
url += file; |
| 93 |
url += '#'; |
| 94 |
url += line; |
| 95 |
// X-Frame-Options is now 'SAMEORIGIN' |
| 96 |
window.open(url); |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
function convert() { |
| 101 |
try { |
| 102 |
var s = get('error').value; |
| 103 |
if(lastError == s) { |
| 104 |
return; |
| 105 |
} |
| 106 |
lastError = s; |
| 107 |
var result = ''; |
| 108 |
hasData = false; |
| 109 |
var idx = s.lastIndexOf("["); |
| 110 |
if (idx >= 0) { |
| 111 |
get('message').innerHTML = s.substring(0, idx); |
| 112 |
var end = s.indexOf("]", idx); |
| 113 |
errorCode = s.substring(idx + 1, end); |
| 114 |
hasData = true; |
| 115 |
idx = errorCode.indexOf("-"); |
| 116 |
build = parseInt(errorCode.substring(idx + 1)); |
| 117 |
get('version').innerHTML = getVersion(build); |
| 118 |
errorCode = errorCode.substring(0, idx); |
| 119 |
while (errorCode.length > 1 && errorCode.charAt(0) == '0') { |
| 120 |
errorCode = errorCode.substring(1); |
| 121 |
} |
| 122 |
get('errorCode').innerHTML = errorCode; |
| 123 |
goDetails(errorCode); |
| 124 |
} |
| 125 |
idx = 0; |
| 126 |
s = s.replace(/\t/g, " "); |
| 127 |
s = s.replace(/ +/g, " "); |
| 128 |
while (true) { |
| 129 |
var start = s.indexOf("at org.h2.", idx); |
| 130 |
if (start < 0) { |
| 131 |
result += s.substring(idx); |
| 132 |
break; |
| 133 |
} |
| 134 |
start += 3; // skip 'at ' |
| 135 |
if (idx > 0) { |
| 136 |
result += s.substring(idx, start); |
| 137 |
} |
| 138 |
var end = s.indexOf(')', start); |
| 139 |
if (end < 0) { |
| 140 |
result += s.substring(idx); |
| 141 |
break; |
| 142 |
} |
| 143 |
var element = s.substring(start, end + 1); |
| 144 |
var open = element.lastIndexOf('('); |
| 145 |
var dotMethod = element.lastIndexOf('.', open - 1); |
| 146 |
var dotClass = element.lastIndexOf('.', dotMethod - 1); |
| 147 |
var packageName = element.substring(0, dotClass); |
| 148 |
var colon = element.lastIndexOf(':'); |
| 149 |
var file = element.substring(open + 1, colon); |
| 150 |
var lineNumber = element.substring(colon + 1, element.length - 1); |
| 151 |
var fullFileName = packageName.replace(/\./g, '/') + "/" + file; |
| 152 |
result += "<a href='javascript:go(\""; |
| 153 |
result += fullFileName; |
| 154 |
result += "\","; |
| 155 |
result += lineNumber; |
| 156 |
result += ")'>"; |
| 157 |
result += element; |
| 158 |
result += "<" + "/a>"; |
| 159 |
hasData = true; |
| 160 |
idx = end + 1; |
| 161 |
} |
| 162 |
result = result.replace(/[\n\r]+/g, "<br/>"); |
| 163 |
result = result.replace(/ at /g, ""); |
| 164 |
get('links').innerHTML = result; |
| 165 |
select('input'); |
| 166 |
} catch(e) { |
| 167 |
hasData = false; |
| 168 |
alert('Can not parse the stack trace: ' + e); |
| 169 |
} |
| 170 |
|
| 171 |
} |
| 172 |
|
| 173 |
function select(id) { |
| 174 |
get('input').style.display = 'none'; |
| 175 |
get('details').style.display = 'none'; |
| 176 |
get('source').style.display = 'none'; |
| 177 |
get('inputTab').className = ''; |
| 178 |
get('detailsTab').className = hasData ? '' : 'disabled'; |
| 179 |
get('sourceTab').className = hasData ? '' : 'disabled'; |
| 180 |
get(id + 'Tab').className = 'selected'; |
| 181 |
get(id).style.display = ''; |
| 182 |
if(id=='details') { |
| 183 |
goDetails(errorCode); |
| 184 |
} |
| 185 |
sizeTextArea(); |
| 186 |
} |
| 187 |
|
| 188 |
function sizeTextArea() { |
| 189 |
var height=document.body.clientHeight; |
| 190 |
var error = get('error'); |
| 191 |
error.style.height = (height - error.offsetTop - 25) + 'px'; |
| 192 |
var more = get('more'); |
| 193 |
more.style.height = (height - more.offsetTop - 25) + 'px'; |
| 194 |
var code = get('code'); |
| 195 |
code.style.height = (height - get('sourceTable').offsetTop - code.offsetTop - 30) + 'px'; |
| 196 |
} |
| 197 |
|
| 198 |
//--> |
| 199 |
</script> |
| 200 |
|
| 201 |
</head> |
| 202 |
<body style="margin:20px" onresize="sizeTextArea();" onload="sizeTextArea();" > |
| 203 |
|
| 204 |
<h1>Error Analyzer</h1> |
| 205 |
<b><a href="../html/main.html">Home</a></b><br /> |
| 206 |
<h2> |
| 207 |
<a href="javascript:select('input')" id = "inputTab">Input</a> |
| 208 |
<a href="javascript:select('details')" id = "detailsTab">Details</a> |
| 209 |
<a href="javascript:select('source')" id = "sourceTab">Source Code</a> |
| 210 |
</h2> |
| 211 |
<hr/> |
| 212 |
<div id = "input"> |
| 213 |
<p>Paste the error message and stack trace below and click on 'Details' or 'Source Code': </p> |
| 214 |
<textarea id = "error" cols="100" style="width: 100%; overflow: auto;" rows="20" |
| 215 |
onChange="convert()" |
| 216 |
onSelect="convert()" |
| 217 |
onKeyUp="convert()" |
| 218 |
onKeyPress="convert()" |
| 219 |
onFocus="convert()" |
| 220 |
onBlur="convert()" |
| 221 |
> |
| 222 |
</textarea> |
| 223 |
</div> |
| 224 |
<div id = "details"> |
| 225 |
<p><b>Error Code: </b><span id = "errorCode"></span></p> |
| 226 |
<p><b>Product Version: </b><span id = "version"></span></p> |
| 227 |
<p><b>Message: </b></p> |
| 228 |
<p id = "message"></p> |
| 229 |
<p><b>More Information:</b></p> |
| 230 |
<iframe id = "more" frameborder="0" marginwidth="0" marginheight="0" width="100%" height="100px" src=""> |
| 231 |
</iframe> |
| 232 |
</div> |
| 233 |
<div id = "source"> |
| 234 |
<table id = "sourceTable" style="border:0px" width="100%"><tr> |
| 235 |
<td style="border:0px" width="30px"> |
| 236 |
<p><b>Stack Trace: </b></p> |
| 237 |
<p id = "links"></p> |
| 238 |
</td><td style="border:0px" width="90%"> |
| 239 |
<p><b>Source File: </b><span id = "file"></span><br /> |
| 240 |
Inline <input type="checkbox" id = "rawSource" checked="checked" /></p> |
| 241 |
<iframe id = "code" frameborder="0" marginwidth="0" marginheight="0" width="4000px" height="100px" src=""> |
| 242 |
</iframe> |
| 243 |
</td> |
| 244 |
</tr></table> |
| 245 |
</div> |
| 246 |
<script type="text/javascript"> |
| 247 |
//<!-- |
| 248 |
select('input'); |
| 249 |
//--> |
| 250 |
</script> |
| 251 |
<!-- analytics --> |
| 252 |
</body></html> |