Skip to content

Commit 39fa4a9

Browse files
author
Li
committed
Fix the location None error, #1373
Signed-off-by: Li <[email protected]>
1 parent e300896 commit 39fa4a9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/packagedcode/maven.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -813,14 +813,15 @@ def _get_maven_pom(location=None, text=None, check_is_pom=False, extra_propertie
813813
if not extra_properties:
814814
extra_properties = {}
815815
# do we have a pom.properties file side-by-side?
816-
parent = fileutils.parent_directory(location)
817-
pom_properties = os.path.join(parent, 'pom.properties')
818-
if os.path.exists(pom_properties):
819-
with open(pom_properties) as props:
820-
properties = javaproperties.load(props) or {}
821-
if TRACE:
822-
logger.debug('_get_mavenpom: properties: {}'.format(repr(properties)))
823-
extra_properties.update(properties)
816+
if location and os.path.exists(location):
817+
parent = fileutils.parent_directory(location)
818+
pom_properties = os.path.join(parent, 'pom.properties')
819+
if os.path.exists(pom_properties):
820+
with open(pom_properties) as props:
821+
properties = javaproperties.load(props) or {}
822+
if TRACE:
823+
logger.debug('_get_mavenpom: properties: {}'.format(repr(properties)))
824+
extra_properties.update(properties)
824825
pom.resolve(**extra_properties)
825826
# TODO: we cannot do much without these??
826827
if check_is_pom and not has_basic_pom_attributes(pom):

0 commit comments

Comments
 (0)