[RTFACT-8990] RPM info isn't retrieved from remote repo cache triggering null pointer exception Created: 12/Jan/16  Updated: 14/Nov/17  Resolved: 07/Jun/16

Status: Resolved
Project: Artifactory Binary Repository
Component/s: YUM
Affects Version/s: 4.4.0
Fix Version/s: 4.9.0

Type: Bug Priority: High
Reporter: Avi Zaig (Inactive) Assignee: Shay Bagants
Resolution: Fixed Votes: 3
Labels: None

Attachments: PNG File rpm.png    
Assigned QA: Mor Iluz (Inactive)

 Description   

Steps to reproduce

1. configure remote yum repoistory with http://pkg.jenkins-ci.org/redhat/ or http://yum.theforeman.org/
2. download any rpm such as jenkins-1.644-1.1.noarch.rpm
3. Under the remote repo cache try to view the rpm info in the artifact tree, it will be empty.
4 check logs for null pointer.



 Comments   
Comment by Avi Zaig (Inactive) [ 12/Jan/16 ]

We are not able to get the rpm info from the remote repository and not handling it properly
This is the error on the log

16-01-12 11:42:17,174 [http-nio-8080-exec-7] [INFO ] (o.a.r.HttpRepo :397) yum-redhat downloaded http://pkg.jenkins-ci.org/redhat/jenkins-1.644-1.1.noarch.rpm 60.54 MB at 661.05 KB/sec
2016-01-12 11:42:32,407 [http-nio-8080-exec-1] [ERROR] (o.a.a.y.YumServiceImpl:190) Error occurred while extracting RPM metadata for yum-redhat-cache:jenkins-1.644-1.1.noarch.rpm with sha1: 97e15aa91742b4ee19eb3b01282cf59982883e72: null
2016-01-12 11:42:32,452 [http-nio-8080-exec-1] [ERROR] (o.a.r.c.e.GlobalExceptionMapper:46) null
java.lang.NullPointerException: null
at org.artifactory.addon.yum.YumAddonImpl.populateRpmMetaDataToModel(YumAddonImpl.java:166) ~[classes/:na]
at org.artifactory.addon.yum.YumAddonImpl.getRpmMetadata(YumAddonImpl.java:155) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) ~[spring-aop-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at com.sun.proxy.$Proxy137.getRpmMetadata(Unknown Source) ~[na:na]

Comment by Avi Zaig (Inactive) [ 12/Jan/16 ]

This is because there is no metadata on rpm packages from remote repo (even in the cache)
So rpm info cannot be retrieved.
The bug is on the null pointer exception.

To get rpm info on the rpm packages, user can move the content of the remote repo cache to a configured local yum repository and to calculate the metadata for it.

Comment by Leigh Jenkin [ 27/Jan/16 ]

This metadata needs to be calculated even for remote repos. Its the rpms that contain the relevant metadata and needs to be extracted on adding to the cache.

Right now there is no functional difference between a remote yum repo and a remote generic repo.

[root@ip-10-0-20-22 ~]# rpm -qpRl http://my-instance/artifactory/jenkins-yum-cache/jenkins-1.642-1.1.noarch.rpm
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/usr/sbin/groupadd
/usr/sbin/useradd
config(jenkins) = 1.642-1.1
procps
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
/etc/init.d/jenkins
/etc/logrotate.d/jenkins
/etc/sysconfig/jenkins
/usr/lib/jenkins
/usr/lib/jenkins/jenkins.war
/usr/sbin/rcjenkins
/var/cache/jenkins
/var/lib/jenkins
/var/log/jenkins

Comment by Shay Bagants [ 06/Jun/16 ]

Now it works for both local and cache artifacts:

Generated at Tue Oct 22 06:42:32 UTC 2019 using JIRA 7.6.16#76018-sha1:9ed376192612a49536ac834c64177a0fed6290f5.