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