Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
Dragonwell11
提交
368e67d9
D
Dragonwell11
项目概览
LinuxSuRen
/
Dragonwell11
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
368e67d9
编写于
5月 31, 2019
作者:
J
joehw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8224532: Better Path supports
Reviewed-by: rriggs, lancea, dfuchs, mschoene
上级
6e09f00a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
53 addition
and
18 deletion
+53
-18
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPath.java
...hare/classes/com/sun/org/apache/xpath/internal/XPath.java
+7
-5
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java
.../sun/org/apache/xpath/internal/axes/FilterExprWalker.java
+4
-4
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java
...com/sun/org/apache/xpath/internal/axes/WalkerFactory.java
+4
-4
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Compiler.java
.../com/sun/org/apache/xpath/internal/compiler/Compiler.java
+32
-4
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java
...un/org/apache/xpath/internal/res/XPATHErrorResources.java
+6
-1
未找到文件。
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPath.java
浏览文件 @
368e67d9
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017,
2019,
Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
...
...
@@ -40,7 +40,7 @@ import javax.xml.transform.TransformerException;
* The XPath class wraps an expression object and provides general services
* for execution of that expression.
* @xsl.usage advanced
* @LastModified:
Oct 2017
* @LastModified:
May 2019
*/
public
class
XPath
implements
Serializable
,
ExpressionOwner
{
...
...
@@ -179,10 +179,12 @@ public class XPath implements Serializable, ExpressionOwner
else
if
(
MATCH
==
type
)
parser
.
initMatchPattern
(
compiler
,
exprString
,
prefixResolver
);
else
throw
new
RuntimeException
(
XSLMessages
.
createXPATHMessage
(
XPATHErrorResources
.
ER_CANNOT_DEAL_XPATH_TYPE
,
new
Object
[]{
Integer
.
toString
(
type
)}));
//"Can not deal with XPath type: " + type);
throw
new
RuntimeException
(
XSLMessages
.
createXPATHMessage
(
XPATHErrorResources
.
ER_CANNOT_DEAL_XPATH_TYPE
,
new
Object
[]{
Integer
.
toString
(
type
)}));
// System.out.println("----------------");
Expression
expr
=
compiler
.
compile
(
0
);
Expression
expr
=
compiler
.
compile
Expression
(
0
);
// System.out.println("expr: "+expr);
this
.
setExpression
(
expr
);
...
...
@@ -234,7 +236,7 @@ public class XPath implements Serializable, ExpressionOwner
//"Can not deal with XPath type: " + type);
// System.out.println("----------------");
Expression
expr
=
compiler
.
compile
(
0
);
Expression
expr
=
compiler
.
compile
Expression
(
0
);
// System.out.println("expr: "+expr);
this
.
setExpression
(
expr
);
...
...
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java
浏览文件 @
368e67d9
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017,
2019,
Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
...
...
@@ -37,7 +37,7 @@ import java.util.List;
* Walker for the OP_VARIABLE, or OP_EXTFUNCTION, or OP_FUNCTION, or OP_GROUP,
* op codes.
* @see <a href="http://www.w3.org/TR/xpath#NT-FilterExpr">XPath FilterExpr descriptions</a>
* @LastModified:
Oct 2017
* @LastModified:
May 2019
*/
public
class
FilterExprWalker
extends
AxesWalker
{
...
...
@@ -77,7 +77,7 @@ public class FilterExprWalker extends AxesWalker
m_mustHardReset
=
true
;
case
OpCodes
.
OP_GROUP
:
case
OpCodes
.
OP_VARIABLE
:
m_expr
=
compiler
.
compile
(
opPos
);
m_expr
=
compiler
.
compile
Expression
(
opPos
);
m_expr
.
exprSetParent
(
this
);
//if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof com.sun.org.apache.xalan.internal.templates.FuncKey))
if
(
m_expr
instanceof
com
.
sun
.
org
.
apache
.
xpath
.
internal
.
operations
.
Variable
)
...
...
@@ -87,7 +87,7 @@ public class FilterExprWalker extends AxesWalker
}
break
;
default
:
m_expr
=
compiler
.
compile
(
opPos
+
2
);
m_expr
=
compiler
.
compile
Expression
(
opPos
+
2
);
m_expr
.
exprSetParent
(
this
);
}
// if(m_expr instanceof WalkingIterator)
...
...
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java
浏览文件 @
368e67d9
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017,
2019,
Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
...
...
@@ -41,7 +41,7 @@ import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
* which are built from the opcode map output, and an analysis engine
* for the location path expressions in order to provide optimization hints.
*
* @LastModified:
Oct 2017
* @LastModified:
May 2019
*/
public
class
WalkerFactory
{
...
...
@@ -1008,10 +1008,10 @@ public class WalkerFactory
case
OpCodes
.
OP_EXTFUNCTION
:
case
OpCodes
.
OP_FUNCTION
:
case
OpCodes
.
OP_GROUP
:
expr
=
compiler
.
compile
(
opPos
);
expr
=
compiler
.
compile
Expression
(
opPos
);
break
;
default
:
expr
=
compiler
.
compile
(
opPos
+
2
);
expr
=
compiler
.
compile
Expression
(
opPos
+
2
);
}
axis
=
Axis
.
FILTEREDLIST
;
...
...
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Compiler.java
浏览文件 @
368e67d9
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
...
...
@@ -70,9 +69,12 @@ import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
* of operation codes (op map) and then builds from that into an Expression
* tree.
* @xsl.usage advanced
* @LastModified: May 2019
*/
public
class
Compiler
extends
OpMap
{
// count the number of operations or calls to compileOperation
int
countOp
;
/**
* Construct a Compiler object with a specific ErrorListener and
...
...
@@ -106,15 +108,40 @@ public class Compiler extends OpMap
/**
* Execute the XPath object from a given opcode position.
*
* Note that this method is added so that when StackOverflowError is caught
* the address space can be freed to this point allowing further activities
* such as reporting the error.
*
* @param opPos The current position in the xpath.m_opMap array.
* @return The result of the XPath.
*
* @throws TransformerException if there is a syntax or other error.
* @xsl.usage advanced
*/
public
Expression
compile
(
int
opPos
)
throws
TransformerException
{
public
Expression
compileExpression
(
int
opPos
)
throws
TransformerException
{
try
{
countOp
=
0
;
return
compile
(
opPos
);
}
catch
(
StackOverflowError
sof
)
{
error
(
XPATHErrorResources
.
ER_COMPILATION_TOO_MANY_OPERATION
,
new
Object
[]{
countOp
});
}
return
null
;
}
/**
* This method handles the actual compilation process. It is called from the
* compileExpression method as well as the subsequent processes. See the note
* for compileExpression.
*
* @param opPos The current position in the xpath.m_opMap array.
* @return The result of the XPath.
*
* @throws TransformerException if there is a syntax or other error.
*/
private
Expression
compile
(
int
opPos
)
throws
TransformerException
{
int
op
=
getOp
(
opPos
);
Expression
expr
=
null
;
...
...
@@ -210,6 +237,7 @@ public class Compiler extends OpMap
private
Expression
compileOperation
(
Operation
operation
,
int
opPos
)
throws
TransformerException
{
++
countOp
;
int
leftPos
=
getFirstChildPos
(
opPos
);
int
rightPos
=
getNextOpPos
(
leftPos
);
...
...
src/java.xml/share/classes/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java
浏览文件 @
368e67d9
...
...
@@ -152,6 +152,8 @@ public class XPATHErrorResources extends ListResourceBundle
"ER_PREDICATE_ILLEGAL_SYNTAX"
;
public
static
final
String
ER_PREDICATE_TOO_MANY_OPEN
=
"ER_PREDICATE_TOO_MANY_OPEN"
;
public
static
final
String
ER_COMPILATION_TOO_MANY_OPERATION
=
"ER_COMPILATION_TOO_MANY_OPERATION"
;
public
static
final
String
ER_ILLEGAL_AXIS_NAME
=
"ER_ILLEGAL_AXIS_NAME"
;
public
static
final
String
ER_UNKNOWN_NODETYPE
=
"ER_UNKNOWN_NODETYPE"
;
public
static
final
String
ER_PATTERN_LITERAL_NEEDS_BE_QUOTED
=
...
...
@@ -467,7 +469,10 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
"'..[predicate]' or '.[predicate]' is illegal syntax. Use 'self::node()[predicate]' instead."
},
{
ER_PREDICATE_TOO_MANY_OPEN
,
"Stack overflow while parsing {0} at {1}. Too many open predicates {2}."
},
"Stack overflow while parsing {0} at {1}. Too many open predicates({2})."
},
{
ER_COMPILATION_TOO_MANY_OPERATION
,
"Stack overflow while compiling the expression. Too many operations({0})."
},
{
ER_ILLEGAL_AXIS_NAME
,
"illegal axis name: {0}"
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录