Bug 1095668

Summary: [abrt] system-switch-java: switch_java_functions.py:138:get_java_identifiers:UnboundLocalError: local variable 'best_identifier_index' referenced before assignment
Product: [Fedora] Fedora Reporter: iliketurtlesbro
Component: system-switch-javaAssignee: Deepak Bhole <dbhole>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dbhole, jvanek, omajid
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/fbbd8e9b29efe0d7c0197d31de55f55b2ddbeaa9
Whiteboard: abrt_hash:11d079306037c24036e2f319bd157420f36ac1b7
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-09 16:22:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: environ none

Description iliketurtlesbro 2014-05-08 10:39:04 UTC
Description of problem:
ran 'system-switch-java' as root in terminal. 

Version-Release number of selected component:
system-switch-java-1.1.5-10.fc21

Additional info:
reporter:       libreport-2.2.2
cmdline:        python /sbin/system-switch-java
executable:     /sbin/system-switch-java
kernel:         3.15.0-0.rc4.git1.1.fc21.x86_64
runlevel:       N 5
type:           Python
uid:            0

Truncated backtrace:
switch_java_functions.py:138:get_java_identifiers:UnboundLocalError: local variable 'best_identifier_index' referenced before assignment

Traceback (most recent call last):
  File "/sbin/system-switch-java", line 89, in <module>
    main()
  File "/sbin/system-switch-java", line 50, in main
    java_identifiers, best_identifier = get_java_identifiers()
  File "/usr/share/system-switch-java/switch_java_functions.py", line 138, in get_java_identifiers
    best_identifier = identifiers_and_jdks[best_identifier_index][0]
UnboundLocalError: local variable 'best_identifier_index' referenced before assignment

Local variables in innermost frame:
jre_search: None
java: None
identifiers_and_jdks: [('1.8.0-openjdk.x86_64', False)]
i: 1
alternatives: ['/usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java', '/usr/java/latest/bin/java']
jre_expression: <_sre.SRE_Pattern object at 0x12b6dd0>
jdk_expression: <_sre.SRE_Pattern object at 0x12e9930>
best: 1
best_identifier: None
jdks: [False]
best_indentifier_index: -1
alternative: '/usr/java/latest/bin/java'
jdk_search: None
java_identifiers: ['1.8.0-openjdk.x86_64']

Potential duplicate: bug 1069832

Comment 1 iliketurtlesbro 2014-05-08 10:39:07 UTC
Created attachment 893591 [details]
File: backtrace

Comment 2 iliketurtlesbro 2014-05-08 10:39:09 UTC
Created attachment 893592 [details]
File: environ

Comment 3 Omair Majid 2014-05-08 19:54:08 UTC
I agree that system-switch-java should not crash like this. This was fixed upstream recently:
https://fedorahosted.org/system-switch-java/changeset/f9d437fc662ae76e988434b7fa9a50be0a044c16/


On the other hand, /usr/java/latest is an unsupported/proprietary java package. It is not installed following the jpackage or Fedora conventions. As such, system-switch-java will probably fail in other ways when this bug is fixed.

Comment 4 Deepak Bhole 2014-05-09 16:22:20 UTC
Marking CLOSED based on commit Omair referenced in Comment #3.