Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
71603295
提交
71603295
authored
7月 15, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use a RuntimeException for UnsupportedEncoding
上级
152e4944
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
17 行增加
和
38 行删除
+17
-38
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+1
-1
WebServlet.java
h2/src/main/org/h2/server/web/WebServlet.java
+2
-13
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+2
-8
IOUtils.java
h2/src/main/org/h2/util/IOUtils.java
+7
-8
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+3
-4
ReaderInputStream.java
h2/src/tools/org/h2/dev/util/ReaderInputStream.java
+2
-4
没有找到文件。
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
71603295
...
@@ -507,7 +507,7 @@ public class ScriptCommand extends ScriptBase {
...
@@ -507,7 +507,7 @@ public class ScriptCommand extends ScriptBase {
return
prep
.
executeQuery
();
return
prep
.
executeQuery
();
}
}
private
void
reset
()
throws
SQLException
{
private
void
reset
()
{
result
=
null
;
result
=
null
;
buffer
=
null
;
buffer
=
null
;
lineSeparator
=
StringUtils
.
utf8Encode
(
SysProperties
.
LINE_SEPARATOR
);
lineSeparator
=
StringUtils
.
utf8Encode
(
SysProperties
.
LINE_SEPARATOR
);
...
...
h2/src/main/org/h2/server/web/WebServlet.java
浏览文件 @
71603295
...
@@ -9,17 +9,14 @@ package org.h2.server.web;
...
@@ -9,17 +9,14 @@ package org.h2.server.web;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.Properties
;
import
java.util.Properties
;
import
javax.servlet.ServletConfig
;
import
javax.servlet.ServletConfig
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServlet
;
import
javax.servlet.http.HttpServlet
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
...
@@ -127,20 +124,12 @@ public class WebServlet extends HttpServlet {
...
@@ -127,20 +124,12 @@ public class WebServlet extends HttpServlet {
bytes
=
server
.
getFile
(
file
);
bytes
=
server
.
getFile
(
file
);
if
(
bytes
==
null
)
{
if
(
bytes
==
null
)
{
resp
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
resp
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
try
{
bytes
=
StringUtils
.
utf8Encode
(
"File not found: "
+
file
);
bytes
=
StringUtils
.
utf8Encode
(
"File not found: "
+
file
);
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
}
}
else
{
}
else
{
if
(
session
!=
null
&&
file
.
endsWith
(
".jsp"
))
{
if
(
session
!=
null
&&
file
.
endsWith
(
".jsp"
))
{
String
page
=
StringUtils
.
utf8Decode
(
bytes
);
String
page
=
StringUtils
.
utf8Decode
(
bytes
);
page
=
PageParser
.
parse
(
page
,
session
.
map
);
page
=
PageParser
.
parse
(
page
,
session
.
map
);
try
{
bytes
=
StringUtils
.
utf8Encode
(
page
);
bytes
=
StringUtils
.
utf8Encode
(
page
);
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
}
}
}
resp
.
setContentType
(
mimeType
);
resp
.
setContentType
(
mimeType
);
if
(!
cache
)
{
if
(!
cache
)
{
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
71603295
...
@@ -196,8 +196,6 @@ class WebThread extends Thread implements DatabaseEventListener {
...
@@ -196,8 +196,6 @@ class WebThread extends Thread implements DatabaseEventListener {
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
TraceSystem
.
traceThrowable
(
e
);
TraceSystem
.
traceThrowable
(
e
);
}
catch
(
SQLException
e
)
{
TraceSystem
.
traceThrowable
(
e
);
}
}
IOUtils
.
closeSilently
(
output
);
IOUtils
.
closeSilently
(
output
);
IOUtils
.
closeSilently
(
input
);
IOUtils
.
closeSilently
(
input
);
...
@@ -210,7 +208,7 @@ class WebThread extends Thread implements DatabaseEventListener {
...
@@ -210,7 +208,7 @@ class WebThread extends Thread implements DatabaseEventListener {
}
}
}
}
private
boolean
process
()
throws
IOException
,
SQLException
{
private
boolean
process
()
throws
IOException
{
boolean
keepAlive
=
false
;
boolean
keepAlive
=
false
;
String
head
=
readHeaderLine
();
String
head
=
readHeaderLine
();
if
(
head
.
startsWith
(
"GET "
)
||
head
.
startsWith
(
"POST "
))
{
if
(
head
.
startsWith
(
"GET "
)
||
head
.
startsWith
(
"POST "
))
{
...
@@ -254,11 +252,7 @@ class WebThread extends Thread implements DatabaseEventListener {
...
@@ -254,11 +252,7 @@ class WebThread extends Thread implements DatabaseEventListener {
if
(
session
!=
null
&&
file
.
endsWith
(
".jsp"
))
{
if
(
session
!=
null
&&
file
.
endsWith
(
".jsp"
))
{
String
page
=
StringUtils
.
utf8Decode
(
bytes
);
String
page
=
StringUtils
.
utf8Decode
(
bytes
);
page
=
PageParser
.
parse
(
page
,
session
.
map
);
page
=
PageParser
.
parse
(
page
,
session
.
map
);
try
{
bytes
=
StringUtils
.
utf8Encode
(
page
);
bytes
=
StringUtils
.
utf8Encode
(
page
);
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
}
}
}
message
=
"HTTP/1.1 200 OK\n"
;
message
=
"HTTP/1.1 200 OK\n"
;
message
+=
"Content-Type: "
+
mimeType
+
"\n"
;
message
+=
"Content-Type: "
+
mimeType
+
"\n"
;
...
...
h2/src/main/org/h2/util/IOUtils.java
浏览文件 @
71603295
...
@@ -21,7 +21,6 @@ import java.io.StringReader;
...
@@ -21,7 +21,6 @@ import java.io.StringReader;
import
java.io.StringWriter
;
import
java.io.StringWriter
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.io.Writer
;
import
java.io.Writer
;
import
java.sql.SQLException
;
import
org.h2.constant.SysProperties
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
...
@@ -345,12 +344,12 @@ public class IOUtils {
...
@@ -345,12 +344,12 @@ public class IOUtils {
* @param in the input stream or null
* @param in the input stream or null
* @return the reader
* @return the reader
*/
*/
public
static
Reader
getReader
(
InputStream
in
)
throws
SQLException
{
public
static
Reader
getReader
(
InputStream
in
)
{
try
{
try
{
// InputStreamReader may read some more bytes
// InputStreamReader may read some more bytes
return
in
==
null
?
null
:
new
BufferedReader
(
new
InputStreamReader
(
in
,
Constants
.
UTF8
));
return
in
==
null
?
null
:
new
BufferedReader
(
new
InputStreamReader
(
in
,
Constants
.
UTF8
));
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
ToInternal
(
e
);
}
}
}
}
...
@@ -361,11 +360,11 @@ public class IOUtils {
...
@@ -361,11 +360,11 @@ public class IOUtils {
* @param out the output stream or null
* @param out the output stream or null
* @return the writer
* @return the writer
*/
*/
public
static
Writer
getWriter
(
OutputStream
out
)
throws
SQLException
{
public
static
Writer
getWriter
(
OutputStream
out
)
{
try
{
try
{
return
out
==
null
?
null
:
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
Constants
.
UTF8
));
return
out
==
null
?
null
:
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
Constants
.
UTF8
));
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
ToInternal
(
e
);
}
}
}
}
...
@@ -377,7 +376,7 @@ public class IOUtils {
...
@@ -377,7 +376,7 @@ public class IOUtils {
* @param s the string
* @param s the string
* @return the input stream
* @return the input stream
*/
*/
public
static
InputStream
getInputStream
(
String
s
)
throws
SQLException
{
public
static
InputStream
getInputStream
(
String
s
)
{
if
(
s
==
null
)
{
if
(
s
==
null
)
{
return
null
;
return
null
;
}
}
...
@@ -402,11 +401,11 @@ public class IOUtils {
...
@@ -402,11 +401,11 @@ public class IOUtils {
* @param in the input stream
* @param in the input stream
* @return the reader
* @return the reader
*/
*/
public
static
Reader
getAsciiReader
(
InputStream
in
)
throws
SQLException
{
public
static
Reader
getAsciiReader
(
InputStream
in
)
{
try
{
try
{
return
in
==
null
?
null
:
new
InputStreamReader
(
in
,
"US-ASCII"
);
return
in
==
null
?
null
:
new
InputStreamReader
(
in
,
"US-ASCII"
);
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
ToInternal
(
e
);
}
}
}
}
...
...
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
71603295
...
@@ -276,11 +276,11 @@ public class StringUtils {
...
@@ -276,11 +276,11 @@ public class StringUtils {
* @param s the text
* @param s the text
* @return the UTF-8 representation
* @return the UTF-8 representation
*/
*/
public
static
byte
[]
utf8Encode
(
String
s
)
throws
SQLException
{
public
static
byte
[]
utf8Encode
(
String
s
)
{
try
{
try
{
return
s
.
getBytes
(
Constants
.
UTF8
);
return
s
.
getBytes
(
Constants
.
UTF8
);
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
ToInternal
(
e
);
}
}
}
}
...
@@ -390,8 +390,7 @@ public class StringUtils {
...
@@ -390,8 +390,7 @@ public class StringUtils {
try
{
try
{
return
URLEncoder
.
encode
(
s
,
"UTF-8"
);
return
URLEncoder
.
encode
(
s
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
throw
Message
.
convertToInternal
(
e
);
return
s
;
}
}
//## Java 1.4 end ##
//## Java 1.4 end ##
/*## Java 1.3 only begin ##
/*## Java 1.3 only begin ##
...
...
h2/src/tools/org/h2/dev/util/ReaderInputStream.java
浏览文件 @
71603295
...
@@ -14,8 +14,6 @@ import java.io.OutputStreamWriter;
...
@@ -14,8 +14,6 @@ import java.io.OutputStreamWriter;
import
java.io.Reader
;
import
java.io.Reader
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.io.Writer
;
import
java.io.Writer
;
import
java.sql.SQLException
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.message.Message
;
import
org.h2.message.Message
;
...
@@ -33,14 +31,14 @@ public class ReaderInputStream extends InputStream {
...
@@ -33,14 +31,14 @@ public class ReaderInputStream extends InputStream {
private
int
remaining
;
private
int
remaining
;
private
byte
[]
buffer
;
private
byte
[]
buffer
;
public
ReaderInputStream
(
Reader
reader
)
throws
SQLException
{
public
ReaderInputStream
(
Reader
reader
)
{
chars
=
new
char
[
Constants
.
IO_BUFFER_SIZE
];
chars
=
new
char
[
Constants
.
IO_BUFFER_SIZE
];
this
.
reader
=
reader
;
this
.
reader
=
reader
;
out
=
new
ByteArrayOutputStream
(
Constants
.
IO_BUFFER_SIZE
);
out
=
new
ByteArrayOutputStream
(
Constants
.
IO_BUFFER_SIZE
);
try
{
try
{
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
Constants
.
UTF8
));
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
Constants
.
UTF8
));
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
ToInternal
(
e
);
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论