我突然开始在我的项目中获取XMLStreamException。昨天一切正常,今天我做了一些小改动,但是坏了。我试图将其基础恢复为以前的版本,但是什么都没有改变。
这是我的xml文件:
from itertools import cycle
def get_points(b, c, a, li):
num_points_left, num_points_right = li
final_left = [*range(0, num_points_left * c, c)]
final_right = [*range(b, b - num_points_right * c, -c)][::-1]
final_center = []
points_left = a - (len(final_left) + len(final_right))
if points_left > 0:
step = (final_right[0] - final_left[-1]) // (points_left+1)
final_center = [final_left[-1] + step*i for i in range(1, points_left+1)]
elif points_left < 0:
cycle_list = [lambda: final_left.pop() if len(final_left) > 1 else None,
lambda: final_right.pop(0) if len(final_right) > 1 else None]
if len(final_left) > len(final_right):
remove_cycle = cycle(cycle_list)
else:
remove_cycle = cycle(cycle_list[::-1])
while len(final_left) + len(final_right) > a:
next(remove_cycle)()
return final_left + final_center + final_right
def test(b, c, a, li, expected):
print('Testing parameters:', b, c, a, li)
print('Expected:', expected)
returned = get_points(b, c, a, li)
print('Returned:', returned)
if returned == expected:
print('* PASSED! *')
else:
print('!!! Fail !!!')
test(400, 25, 5 , [2,2], [ 0, 25, 200, 375, 400])
test(200, 30, 3 , [1,1], [0, 100 ,200])
test(300, 35, 4 , [2,2], [ 0, 35, 265, 300])
test(350, 40, 3 , [4,2], [ 0, 40, 350])
还有例外:
Testing parameters: 400 25 5 [2, 2]
Expected: [0, 25, 200, 375, 400]
Returned: [0, 25, 200, 375, 400]
* PASSED! *
Testing parameters: 200 30 3 [1, 1]
Expected: [0, 100, 200]
Returned: [0, 100, 200]
* PASSED! *
Testing parameters: 300 35 4 [2, 2]
Expected: [0, 35, 265, 300]
Returned: [0, 35, 265, 300]
* PASSED! *
Testing parameters: 350 40 3 [4, 2]
Expected: [0, 40, 350]
Returned: [0, 40, 350]
* PASSED! *
答案 0 :(得分:0)
我开始遇到同样的问题。我没有更新任何内容,但是重新启动tomcat失败,出现了许多新的异常。我注意到以下文件今天已更新,并且想知道它是否是源文件(在我的每个实体映射中都引用了该文件):
http://hibernate.org/dtd/hibernate-mapping-3.0.dtd
因此,我从以下位置更新了映射以使用DTD:“ hibernate.sourceforge.net/hibernate-mapping-3.0.dtd”-并且可以正常工作。因此,这似乎是由Hibernate更新的DTD文件引起的。
我想您的选择是: