Skip to content

Commit

Permalink
Merge pull request #1 from kfiravr2/kfiravr2-patch-1
Browse files Browse the repository at this point in the history
Memory-leak fix
  • Loading branch information
kfiravr2 authored Oct 29, 2019
2 parents 35b2bb7 + 7f1e0cc commit 90f5441
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions storage/uniqueNugetDeploy/uniqueNugetDeploy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ try {
ngas = org.artifactory.addon.nuget.repomd.NuGetArtifactoryService.class
} catch (MissingPropertyException ex) {}

def cpath = "plugins/uniqueNugetDeploy.properties"
def cfile = new File(ctx.artifactoryHome.haAwareEtcDir, cpath)
def config = new ConfigSlurper().parse(cfile.toURL())


class FakeUriInfo implements UriInfo {
MultivaluedMap<String,String> ps;
public FakeUriInfo(MultivaluedMap<String,String> ps) {this.ps = ps}
Expand All @@ -63,9 +68,6 @@ class FakeUriInfo implements UriInfo {

storage {
beforeCreate { item ->
def cpath = "plugins/uniqueNugetDeploy.properties"
def cfile = new File(ctx.artifactoryHome.haAwareEtcDir, cpath)
def config = new ConfigSlurper().parse(cfile.toURL())
def repoKeys = config.checkedRepos as String[]
def filtKeys = config.filteredRepos as String[]
if (!item || !(item.repoKey in filtKeys)) return
Expand Down Expand Up @@ -98,7 +100,12 @@ storage {
} catch (MissingPropertyException ex) {}
if (ngsps4 != null) {
def params = [ps4] as Object[]
context.nuGetSearchParameters = ngsps4.newInstance(params)
try {
context.nuGetSearchParameters = ngsps4.newInstance(params)
} catch (GroovyRuntimeException e) {
params = [ps4, true] as Object[]
context.nuGetSearchParameters = ngsps4.newInstance(params)
}
} else {
def params = [ps3, ''] as Object[]
context.nuGetSearchParameters = ngsps3.newInstance(params)
Expand Down

0 comments on commit 90f5441

Please sign in to comment.