Skip to content

Commit

Permalink
Fixes StringIndexOutOfBoundsException in OpenTypeHierarchyView
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanue1 committed Jun 19, 2015
1 parent f42d34c commit 9479d79
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions app/src/main/groovy/jd/gui/view/OpenTypeHierarchyView.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,7 @@ class OpenTypeHierarchyView {
def type = api.getTypeFactory(treeNode.entry).make(api, treeNode.entry, treeNode.typeName)
def superTypeName = type.superName

if (superTypeName == null) {
// super type undefined
return treeNode
} else {
if (superTypeName) {
def superEntries = getEntriesClosure(superTypeName)

// Search entry in the sane container of 'entry'
Expand All @@ -207,8 +204,15 @@ class OpenTypeHierarchyView {
superEntry = null
}

if (superEntry == null) {
// Entry not found --> Most likely hypothesis : Java type entry
if (superEntry) {
// Create parent tree node
def superTreeNode = createTreeNode(superEntry, superTypeName)
// Populate parent tree node
populateTreeNode(superTreeNode, treeNode)
// Recursive call
return createParentTreeNode(superTreeNode)
} else {
// Entry not found --> Most probable hypothesis : Java type entry
int lastPackageSeparatorIndex = superTypeName.lastIndexOf('/')
def package_ = superTypeName.substring(0, lastPackageSeparatorIndex).replace('/', '.')
def name = superTypeName.substring(lastPackageSeparatorIndex + 1).replace('$', '.')
Expand All @@ -224,14 +228,10 @@ class OpenTypeHierarchyView {
}

return rootTreeNode
} else {
// Create parent tree node
def superTreeNode = createTreeNode(superEntry, superTypeName)
// Populate parent tree node
populateTreeNode(superTreeNode, treeNode)
// Recursive call
return createParentTreeNode(superTreeNode)
}
} else {
// super type undefined
return treeNode
}
}

Expand Down

0 comments on commit 9479d79

Please sign in to comment.