mirror of https://github.com/apache/lucene.git
LUCENE-4430: check for/warn about javax.* and java.* class in any Lucene/Solr, or dependency JARs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1390534 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a4cd03cab9
commit
f86a366b97
|
@ -162,17 +162,32 @@ def noJavaPackageClasses(desc, file):
|
||||||
with zipfile.ZipFile(file) as z2:
|
with zipfile.ZipFile(file) as z2:
|
||||||
for name2 in z2.namelist():
|
for name2 in z2.namelist():
|
||||||
if name2.endswith('.class') and (name2.startswith('java/') or name2.startswith('javax/')):
|
if name2.endswith('.class') and (name2.startswith('java/') or name2.startswith('javax/')):
|
||||||
raise RuntimeError('%s contains sheisty class "%s"' % \
|
raise RuntimeError('%s contains sheisty class "%s"' % (desc, name2))
|
||||||
(desc, name2))
|
|
||||||
|
|
||||||
def checkAllLuceneJARs(root):
|
def normSlashes(path):
|
||||||
print(' make sure Lucene JARs don\'t have javax.* or java.* classes...')
|
return path.replace(os.sep, '/')
|
||||||
for root, dirs, files in os.walk(root):
|
|
||||||
|
def checkAllJARs(topDir, project):
|
||||||
|
print(' make sure JARs don\'t have javax.* or java.* classes...')
|
||||||
|
for root, dirs, files in os.walk(topDir):
|
||||||
|
|
||||||
|
normRoot = normSlashes(root)
|
||||||
|
|
||||||
|
if project == 'solr' and normRoot.endswith('/example/lib'):
|
||||||
|
# Solr's example intentionally ships servlet JAR:
|
||||||
|
continue
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.lower().endswith('.jar'):
|
if file.lower().endswith('.jar'):
|
||||||
|
if project == 'solr':
|
||||||
|
|
||||||
|
if normRoot.endswith('/contrib/dataimporthandler/lib') and (file.startswith('mail-') or file.startswith('activation-')):
|
||||||
|
print(' **WARNING**: skipping check of %s/%s: it has javax.* classes' % (root, file))
|
||||||
|
continue
|
||||||
|
|
||||||
fullPath = '%s/%s' % (root, file)
|
fullPath = '%s/%s' % (root, file)
|
||||||
noJavaPackageClasses('JAR file "%s"' % fullPath, fullPath)
|
noJavaPackageClasses('JAR file "%s"' % fullPath, fullPath)
|
||||||
|
|
||||||
def checkSolrWAR(warFileName):
|
def checkSolrWAR(warFileName):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -561,8 +576,10 @@ def verifyUnpacked(project, artifact, unpackPath, version, tmpDir):
|
||||||
testNotice(unpackPath)
|
testNotice(unpackPath)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
checkAllJARs(os.getcwd(), project)
|
||||||
|
|
||||||
if project == 'lucene':
|
if project == 'lucene':
|
||||||
checkAllLuceneJARs(os.getcwd())
|
|
||||||
testDemo(isSrc, version)
|
testDemo(isSrc, version)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue