[jbosstools-issues] [JBoss JIRA] (JBIDE-22713) IOException in CentralHelper.extractIfNeeded

Rob Stryker (JIRA) issues at jboss.org
Mon Mar 5 14:20:00 EST 2018


    [ https://issues.jboss.org/browse/JBIDE-22713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13541610#comment-13541610 ] 

Rob Stryker commented on JBIDE-22713:
-------------------------------------

The only way the code manages to get to line 203 with extractIfNeeded in the stack only once is if extractedFile is not a file, and, it is not the case that extracted=true && overwrite==false. 

Importantly, the stacktrace only lists extractIfNeeded once. This means it didn't recurse into itself. It failed on the first pass.  In order to reach that error on the first pass, overwrite must be true, or, extracted must be false. 

A call heirarchy and grep of the code indicates that there are no callers, other than the recursive call, where overwrite=true. This means, since there is only one extractIfNeeded, overwrite must be false. If overwrite is false, the line 203 exception cannot be reached unless extracted is also false. 

'extracted' gets its value on line 193. A value of false here means either the destination folder does not exist, or, the destination folder is a file. In either case, the code would attempt to enter lines 195/196 and extract. If the destination folder was in fact a file, the UnArchiver would throw an exception while trying to extract a zip into a file location... like below:

{code}

java.io.FileNotFoundException: /home/rob/apps/eclipse/workspaces/runtime-New_configuration/.metadata/.plugins/org.jboss.tools.central/central/d794065/css/jboss-app.css (Not a directory)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
	at org.jboss.tools.project.examples.internal.UnArchiver.extract(UnArchiver.java:109)
	at org.jboss.tools.central.internal.CentralHelper.extractIfNeeded(CentralHelper.java:196)
{code}

Because such an exception is not thrown, we can assume it is not a file. Therefore, we can deduct that the folder did not exist before attempting to extract, and, at least the index.html still does not exist after it attempts to extract. The only way I can imagine this happening is if the file to be extracted somehow is wrong. 

Looking at the code, well... I just can't imagine it's correct, specifically getEmbeddedFilePath.   There are dozens of implementations of this type of method in our codebase alone, and none of them look like this. Manually replacing the space with a %20 seems wrong. In fact, using an intermediate URI at all also seems wrong. 

> IOException in CentralHelper.extractIfNeeded
> --------------------------------------------
>
>                 Key: JBIDE-22713
>                 URL: https://issues.jboss.org/browse/JBIDE-22713
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: central
>    Affects Versions: 4.3.0.Final
>            Reporter: Automated Error Reporting Bot
>            Assignee: Jeff MAURY
>             Fix For: 4.5.x
>
>
> The following problem was reported via the automated error reporting:
> Message: Unable to open C:\eclipse\plugins\org.jboss.tools.central_2.0.1.Final-v20160401-1059-B103\resources\jbosstools-central-webpage.zip
> {noformat}
> java.io.IOException: D:\OneDrive\TreinaWeb\Java Básico\JSE\.metadata\.plugins\org.jboss.tools.central\central\bc8a80b\index.html can not be found
>     at org.jboss.tools.central.internal.CentralHelper.extractIfNeeded(CentralHelper.java:203)
>     at org.jboss.tools.central.internal.CentralHelper.getCentralPageUrl(CentralHelper.java:122)
>     at org.jboss.tools.central.internal.CentralHelper.getCentralUrl(CentralHelper.java:60)
>     at org.jboss.tools.central.editors.GettingStartedHtmlPage$5.run(GettingStartedHtmlPage.java:252)
>     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
> {noformat}
> Bundles:
> | org.eclipse.core.jobs | 3.7.0.v20150330-2103 | 3.8.0.v20160509-0411 |
> | org.jboss.tools.central | 2.0.1.Final-v20160401-1059-B103 | 2.1.0.qualifier |
> Operating Systems:
> | Linux | 3.2.0 | 4.5.7.fc23 |
> | MacOSX | 10.10.5 | 10.11.5 |
> | Windows | 5.1.0 | 10.0.0 |
> The above information is a snapshot of the collected data. Visit [this page|https://redhat.ctrlflow.com/reviewers/#!/problems/571659e0e4b055563f567b43] for the latest data.
> Thank you for your assistance.
>  Your friendly error-reports-inbox.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)



More information about the jbosstools-issues mailing list