[ 
https://issues.apache.org/jira/browse/NETBEANS-3002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16958552#comment-16958552
 ] 

Junichi Yamamoto commented on NETBEANS-3002:
--------------------------------------------

It seems that the values of name attributes are changed. 

old version (0.10.5):
{code:xml}
"/usr/bin/php" "/home/junichi11/phars/phpstan.phar" "analyse" "--no-ansi" 
"--no-progress" "--no-interaction" "--error-format=checkstyle" "--level=7" 
"/home/junichi11/Downloads/PHPStanException/app"
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle>
<file name="Something.php">
  <error line="13" column="1" severity="error" message="Binary operation 
&quot;+&quot; between string and 2 results in an error." />
</file>
<file name="index.php">
  <error line="9" column="1" severity="error" message="Anonymous function 
should return string but returns void." />
  <error line="9" column="1" severity="error" message="Result of closure (void) 
is used." />
</file>
</checkstyle>
{code}

> NullPointerExceptions during PHPStan inspection
> -----------------------------------------------
>
>                 Key: NETBEANS-3002
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-3002
>             Project: NetBeans
>          Issue Type: Bug
>          Components: php - Code Analysis
>    Affects Versions: 11.0, 11.1
>         Environment: Windows 10
>            Reporter: Czukowski
>            Assignee: Junichi Yamamoto
>            Priority: Major
>         Attachments: PHPStanException.zip
>
>
> PHPStan code analysis support reports NullPointerExceptions at some 
> occasions. When the exception occurs, the Inspect dialog window is not closed 
> on its own.
> I've been able to reproduce it using the uploaded sample project. Run 
> {{composer install}}, then configure NetBeans to use PHPStan from 
> {{vendor/bin}} and the configuration from {{phpstan.neon}} file in the 
> project root.
> The configuration file contains {{ignoreErrors}} section with a pattern to 
> ignore known errors. The exception seems to depend on whether this pattern is 
> there or not (to disable, comment the line with {{#}}). 
> To reproduce, select the {{app}} folder and run PHPStan inspection with the 
> scope: Current folder (app).
> With the setup above I've encountered two types of the stack traces:
> *Without ignore pattern (commented line)*
> Output:
> {code}
> "C:\Workspace\Test\PHPStanException\vendor\bin\phpstan.bat" "analyse" 
> "--no-ansi" "--no-progress" "--no-interaction" "--error-format=checkstyle" 
> "--level=5" "--configuration=C:\Workspace\Test\PHPStanException\phpstan.neon" 
> "C:\Workspace\Test\PHPStanException\app"
> <?xml version="1.0" encoding="UTF-8"?>
> <checkstyle>
> <file name="app\Something.php">
>   <error line="13" column="1" severity="error" message="Binary operation 
> &quot;+&quot; between string and 2 results in an error." />
> </file>
> <file name="app\index.php">
>   <error line="9" column="1" severity="error" message="Anonymous function 
> should return string but returns void." />
>   <error line="9" column="1" severity="error" message="Result of closure 
> (void) is used." />
> </file>
> </checkstyle>
> Done.
> {code}
> Stack trace:
> {code}
> java.lang.NullPointerException
>       at org.netbeans.modules.php.analysis.util.Mappers.map(Mappers.java:54)
>       at 
> org.netbeans.modules.php.analysis.PHPStanAnalyzerImpl.doAnalyze(PHPStanAnalyzerImpl.java:140)
>       at 
> org.netbeans.modules.php.analysis.PHPStanAnalyzerImpl.analyze(PHPStanAnalyzerImpl.java:92)
>       at 
> org.netbeans.modules.analysis.RunAnalysis$1$1.doRunAnalyzer(RunAnalysis.java:186)
>       at 
> org.netbeans.modules.analysis.RunAnalysis$1$1.run(RunAnalysis.java:142)
>       at 
> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
>       at 
> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
>       at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
> [catch] at 
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
> {code}
> *With ignore pattern*
> Output:
> {code}
> "C:\Workspace\Test\PHPStanException\vendor\bin\phpstan.bat" "analyse" 
> "--no-ansi" "--no-progress" "--no-interaction" "--error-format=checkstyle" 
> "--level=5" "--configuration=C:\Workspace\Test\PHPStanException\phpstan.neon" 
> "C:\Workspace\Test\PHPStanException\app"
> <?xml version="1.0" encoding="UTF-8"?>
> <checkstyle>
> <file name="app\Something.php">
>   <error line="13" column="1" severity="error" message="Binary operation 
> &quot;+&quot; between string and 2 results in an error." />
> </file>
> <file name="app\index.php">
>   <error line="9" column="1" severity="error" message="Anonymous function 
> should return string but returns void." />
>   <error line="9" column="1" severity="error" message="Result of closure 
> (void) is used." />
> </file>
> <file>
>   <error severity="error" message="Ignored error pattern #Call to an 
> undefined method Cz\\Test\\Nothing# was not matched in reported errors." />
> </file>
> </checkstyle>
> Done.
> {code}
> Stack trace:
> {code}
> java.lang.NullPointerException
>       at 
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.sanitizeFileName(PHPStanReportParser.java:199)
>       at 
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.getCurrentFile(PHPStanReportParser.java:180)
>       at 
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.processFileStart(PHPStanReportParser.java:133)
>       at 
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.startElement(PHPStanReportParser.java:114)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1397)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
>       at 
> java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
>       at 
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.create(PHPStanReportParser.java:68)
>       at 
> org.netbeans.modules.php.analysis.parsers.PHPStanReportParser.parse(PHPStanReportParser.java:77)
>       at 
> org.netbeans.modules.php.analysis.commands.PHPStan.analyze(PHPStan.java:117)
>       at 
> org.netbeans.modules.php.analysis.PHPStanAnalyzerImpl.doAnalyze(PHPStanAnalyzerImpl.java:133)
>       at 
> org.netbeans.modules.php.analysis.PHPStanAnalyzerImpl.analyze(PHPStanAnalyzerImpl.java:92)
>       at 
> org.netbeans.modules.analysis.RunAnalysis$1$1.doRunAnalyzer(RunAnalysis.java:186)
>       at 
> org.netbeans.modules.analysis.RunAnalysis$1$1.run(RunAnalysis.java:142)
>       at 
> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
>       at 
> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
>       at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
> [catch] at 
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to