Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE at CodeNarcInspectionTool.java:169 #3

Closed
evgeny-goldin opened this issue Feb 18, 2011 · 6 comments
Closed

NPE at CodeNarcInspectionTool.java:169 #3

evgeny-goldin opened this issue Feb 18, 2011 · 6 comments

Comments

@evgeny-goldin
Copy link

null
java.lang.NullPointerException
at org.codenarc.idea.CodeNarcInspectionTool$2.compute(CodeNarcInspectionTool.java:169)
at org.codenarc.idea.CodeNarcInspectionTool$2.compute(CodeNarcInspectionTool.java:150)
at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:52)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:191)
at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:43)
at org.codenarc.idea.CodeNarcInspectionTool.checkFile(CodeNarcInspectionTool.java:185)
at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:128)
at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:70)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:336)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:323)
at com.intellij.concurrency.JobUtil$2$1.run(JobUtil.java:116)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:233)
at com.intellij.concurrency.JobUtil$2.process(JobUtil.java:114)
at com.intellij.concurrency.JobUtil$1.run(JobUtil.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.intellij.concurrency.PrioritizedFutureTask.access$101(PrioritizedFutureTask.java:31)
at com.intellij.concurrency.PrioritizedFutureTask$1.run(PrioritizedFutureTask.java:70)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1016)
at com.intellij.concurrency.PrioritizedFutureTask.run(PrioritizedFutureTask.java:97)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

java.lang.NullPointerException
at org.codenarc.idea.CodeNarcInspectionTool$2.compute(CodeNarcInspectionTool.java:169)
at org.codenarc.idea.CodeNarcInspectionTool$2.compute(CodeNarcInspectionTool.java:150)
at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:52)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:191)
at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:43)
at org.codenarc.idea.CodeNarcInspectionTool.checkFile(CodeNarcInspectionTool.java:185)
at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:128)
at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:70)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:336)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:323)
at com.intellij.concurrency.JobUtil$2$1.run(JobUtil.java:116)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:233)
at com.intellij.concurrency.JobUtil$2.process(JobUtil.java:114)
at com.intellij.concurrency.JobUtil$1.run(JobUtil.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.intellij.concurrency.PrioritizedFutureTask.access$101(PrioritizedFutureTask.java:31)
at com.intellij.concurrency.PrioritizedFutureTask$1.run(PrioritizedFutureTask.java:70)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1016)
at com.intellij.concurrency.PrioritizedFutureTask.run(PrioritizedFutureTask.java:97)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

java.lang.NullPointerException
at org.codenarc.idea.CodeNarcInspectionTool$2.compute(CodeNarcInspectionTool.java:169)
at org.codenarc.idea.CodeNarcInspectionTool$2.compute(CodeNarcInspectionTool.java:150)
at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:52)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:191)
at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:43)
at org.codenarc.idea.CodeNarcInspectionTool.checkFile(CodeNarcInspectionTool.java:185)
at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:128)
at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:70)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:336)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:323)
at com.intellij.concurrency.JobUtil$2$1.run(JobUtil.java:116)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:233)
at com.intellij.concurrency.JobUtil$2.process(JobUtil.java:114)
at com.intellij.concurrency.JobUtil$1.run(JobUtil.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.intellij.concurrency.PrioritizedFutureTask.access$101(PrioritizedFutureTask.java:31)
at com.intellij.concurrency.PrioritizedFutureTask$1.run(PrioritizedFutureTask.java:70)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1016)
at com.intellij.concurrency.PrioritizedFutureTask.run(PrioritizedFutureTask.java:97)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

The file was (Gradle build script)



import org.gradle.api.tasks.javadoc.Groovydoc.Link
import java.text.SimpleDateFormat

apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'idea'


defaultTasks 'clean', 'build', 'install'

sourceCompatibility = 1.6
group               = 'com.goldin'
version             = '0.6-SNAPSHOT'

groovyVersion       = '1.8.0-beta-4'
antVersion          = '1.8.2'
springVersion       = '3.0.5.RELEASE'
junitVersion        = '4.8.2'
truezipVersion      = '6.8.2'


repositories {
    mavenRepo urls: 'http://evgeny-goldin.org/artifactory/repo/'
}

dependencies {
    groovy      "org.codehaus.groovy:groovy-all:$groovyVersion"
    compile     "org.codehaus.groovy:groovy-all:$groovyVersion",
                "org.springframework:spring-context:$springVersion",
                "de.schlichtherle:truezip:$truezipVersion",
                "org.apache.ant:ant:$antVersion",
                "org.apache.ant:ant-commons-net:$antVersion",
                "commons-net:commons-net:2.2",
                "org.slf4j:slf4j-api:1.6.1",
                "ch.qos.logback:logback-classic:0.9.28"
    testCompile "org.springframework:spring-test:$springVersion",
                "junit:junit:$junitVersion"
}


/**
 * http://gradle.org/0.9.2/docs/dsl/org.gradle.plugins.idea.IdeaModule.html
 */
ideaProject.javaVersion    = '1.6.0_23'
ideaModule {
    javaVersion     = ideaProject.javaVersion
    downloadSources = true
    downloadJavadoc = false
    outputDir       = new File( project.buildDir, 'idea' )
    testOutputDir   = new File( project.buildDir, 'idea/test' )
}


/**
 * http://gradle.org/0.9.2/docs/dsl/org.gradle.api.tasks.testing.Test.html
 * http://gradle.org/0.9.2/docs/javadoc/org/gradle/api/tasks/testing/Test.html
 */
test {
    test.testReportDir    = new File(( File ) project.buildDir, 'test/reports' )
    test.testResultsDir   = new File(( File ) project.buildDir, 'test/results' )
    test.systemProperties = System.properties.containsKey( 'slowTests' ) ? [ slowTests : 'true' ] : [:]
    test.setDebug( System.properties.containsKey( 'debug' ))
}


/**
 * http://gradle.org/0.9.2/docs/dsl/org.gradle.api.tasks.javadoc.Groovydoc.html
 */
def time = new SimpleDateFormat( '' ).format( new Date())
def date = new SimpleDateFormat( '' ).format( new Date())
groovydoc {
    destinationDir = new File(( System.getProperty( 'groovydocDir' ) ?: project.buildDir.path + '/groovydoc' ),
                              ( version.contains( '-SNAPSHOT' ) ? '' : version ))
    header = '<a href="http://evgeny-goldin.com/wiki/GCommons">evgeny-goldin.com/wiki/GCommons</a>'
    footer = '<a href="http://evgeny-goldin.com/">Evgeny Goldin</a>. GrovyDoc is generated at [$time] on []'
    links  = [ new Link( 'http://static.springsource.org/spring/docs/3.0.x/javadoc-api/', 'org.springframework' ),
               new Link( 'http://download.oracle.com/javase/6/docs/api/',                 'java' ),
               new Link( 'http://groovy.codehaus.org/api/',                               'groovy', 'org.codehaus.groovy' ),
               new Link( 'http://commons.apache.org/net/apidocs/',                        'org.apache.commons.net' ),
               new Link( 'http://evgeny-goldin.org/javadoc/truezip/',                     'de.schlichtherle' )] as Set
}

/**
 * Adding sources artifact
 * http://gradle.1045684.n5.nabble.com/javadoc-and-source-jars-td3246213.html
 */
task sourcesJar( type: Jar, dependsOn: classes ) {
     classifier = 'sources'
     from sourceSets.main.allSource
}
artifacts { archives sourcesJar }
@evgeny-goldin
Copy link
Author

Here's the source again: http://dl.dropbox.com/u/4820835/CodeNarc4.txt

@evgeny-goldin
Copy link
Author

Still have it on this source: http://goo.gl/imotP

@melix
Copy link
Owner

melix commented Mar 24, 2011

Could you test the following preview https://github.com/downloads/melix/codenarc-idea/CodeNarcPlugin-0.1.14-SNAPSHOT.zip ?
I can't reproduce locally, but I added some sanity checks.

@evgeny-goldin
Copy link
Author

Still fails: http://dl.dropbox.com/u/4820835/codenarc/2.txt
Here's the file: http://goo.gl/xML00

@melix
Copy link
Owner

melix commented Mar 24, 2011

Ok, this time I reproduce it. It's the ABC complexity rule which doesn't set a line number. As it's an Integer, not an int, it throws an NPE. Release fixing this coming soon.

@evgeny-goldin
Copy link
Author

Great!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants