Chris2011 / minifierbeans

Plugin to minify JS , CSS and HTML for quicken page load times by reducing the size of js/css/html files.
http://plugins.netbeans.org/plugin/49666/js-css-minify-compress
Apache License 2.0
37 stars 9 forks source link

Exception in minifying JS in NB 12.3 and 12.4 #70

Closed Ilya-Zhulin closed 3 years ago

Ilya-Zhulin commented 3 years ago

After save or "MinifyJS" command I have this exception: java.lang.NullPointerException at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify.jsMinify(JSMinify.java:124) at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify.access$000(JSMinify.java:54) at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify$1.run(JSMinify.java:72) 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) Can you fix it, please, I used to use your extension. Thanks

Chris2011 commented 3 years ago

Hi,

I need more information please. Which version of the Plugin you use, exact steps to reproduce, everythine what it needs to help me. Also a little reproducable script. Thx :)

Ilya-Zhulin commented 3 years ago

Hi. Plugin version 3.3, downloaded from here today. NB 12.3 also installed yesterday. I've just installed Netbeans, plugins and started to work - no some special steps. Experimentally I see, that all minifying command lead to exception. I can only copy as minified from context menu - this works only.

Chris2011 commented 3 years ago

I need all steps that you did :). No need for special steps but did you do a right click on a file? Or did you do a save on that or what exactly? I can't guess.

Experimentally I see, that all minifying command lead to exception How was your experiment? What did you do? Tell me all what I need to reproduce it.

Ilya-Zhulin commented 3 years ago

Hello. Please, watch this https://yadi.sk/d/C8zIo33aT5eSog screen video. I have also showed that checkbox "Minify on Save" doesn't keep its state.

Ilya-Zhulin commented 3 years ago

Hi Do you have enough information?

Chris2011 commented 3 years ago

Hey thx for asking again. I didn't find time to check this. I will do it in the next couple of days. Thx for your patience :).

Chris2011 commented 3 years ago

Unfortunately, I can't reproduce this problem. You are under windows I see, which JDK do you use?

Ilya-Zhulin commented 3 years ago

it was JDK14, but after I had this issue, I downloaded JDK 16. Portable version. I see, this is my only trouble..

Chris2011 commented 3 years ago

So it didn't work with JDK 14 but it worked with 16, right? Or you have the problem on both JDKs? Can you please try to use JDK 11? I will try JDK 14 too to see whether this is the problem or not. Thx for the infos.

Chris2011 commented 3 years ago

Hey @Ilya-Zhulin I didn't try JDK 14 yet. I know that 16 is not supported with 12.3 but it will comes in 12.4. Can you try please different JDKs too like JDK 9, 10 or 11? I really want to help you, but as you can see I can't reproduce the problem. So I need more information.

JuergenLaas commented 3 years ago

Hello, i want to install Minifierbeans-3.3.0.nbm on Netbeans 12.3 i use last OpenJDK 11 and get an error: netbeans error cannot decrease processed workunit count(-2011422090) to lower value than before (0)

What happened?

Chris2011 commented 3 years ago

Hey @JuergenLaas please create a new ticket with all the information and the whole stracktrace. Otherwise I can't help without any information. Thx.

Chris2011 commented 3 years ago

@Ilya-Zhulin did you try Oracle JDK 14 or Open JDK 14?

Ilya-Zhulin commented 3 years ago

I use Oracle JDK

Ilya-Zhulin commented 3 years ago

I've updated NB to version 12.4 and now this error looks like this: java.lang.NullPointerException: Cannot invoke "java.util.concurrent.Future.get(long, java.util.concurrent.TimeUnit)" because "task" is null at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify.jsMinify(JSMinify.java:124) at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify.access$000(JSMinify.java:54) at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify$1.run(JSMinify.java:72) 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)

Chris2011 commented 3 years ago

Still with Oracle JDK 14?

Ilya-Zhulin commented 3 years ago

Hi. Now I've downloaded previous major version - Oracle jdk-11.0.11 and have the same problem:

java.lang.NullPointerException
    at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify.jsMinify(JSMinify.java:124)
    at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify.access$000(JSMinify.java:54)
    at io.github.chris2011.netbeans.minifierbeans.javascript.JSMinify$1.run(JSMinify.java:72)
    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)
Chris2011 commented 3 years ago

Why did you close the ticket? Is it working now? If not, i guess you have Windows, right? Can you check whether the folder in your user path exists or not: users\username.netbeans\minifierbeans\custom-packages with a node_modules folder and some scripts?

Ilya-Zhulin commented 3 years ago

Sorry with closing - my bad. There is this folder on the screenshot. I see a package in zip archive (on the left panel), but folder contains json file only (shown on the right panel) image

Ilya-Zhulin commented 3 years ago

OK, it's working now. I unpacked this archive, started NetBeans. The program started to download and unpack a new minifyneans archive, but it was finished by error of unpacking. I tried twice but with the same result. After this I found that custom_packages.zip become 36 Mb instead of 5. I unpacked it by hand and started NB again. It works from that.

Ilya-Zhulin commented 3 years ago

Only moment - NB doesn't store Minify on save checkbox for all tabs - CSS, JS etc. It is unchecked every time after restart of NB. Do you know something about it? image

Chris2011 commented 3 years ago

Only moment - NB doesn't store Minify on save checkbox for all tabs - CSS, JS etc. It is unchecked every time after restart of NB. Do you know something about it? image

Please see the issue section first, I already created it #73.

OK, it's working now. I unpacked this archive, started NetBeans. The program started to download and unpack a new minifyneans archive, but it was finished by error of unpacking. I tried twice but with the same result. After this I found that custom_packages.zip become 36 Mb instead of 5. I unpacked it by hand and started NB again. It works from that.

Can you please have a look, what the error was? If I don't show it, please have a look into the ide.log file.

So the original NPE was the error of missing CLIs I will handle this, by showing a notification, check them and to trigger the download/unpacking again. But if there is a problem while unpacking, I need to know what the problem is. Thx.

Ilya-Zhulin commented 3 years ago

This one (if I think correct )- this repeats many times in the message.log.

INFO [org.netbeans.modules.progress.spi.InternalHandle]: Cannot process more work than scheduled. Progress handle with name "Extracting minifierbeans archive" has requested progress to workunit no.745547391 but the total number of workunits is 0. That means the progress bar UI will not display real progress and will stay at 100%.
java.lang.IllegalArgumentException
[catch] at org.netbeans.modules.progress.spi.InternalHandle.progress(InternalHandle.java:329)
    at org.netbeans.api.progress.ProgressHandle.progress(ProgressHandle.java:264)
    at org.netbeans.api.progress.ProgressHandle.progress(ProgressHandle.java:242)
    at io.github.chris2011.netbeans.minifierbeans.Installer.extractArchive(Installer.java:229)
    at io.github.chris2011.netbeans.minifierbeans.Installer.access$400(Installer.java:33)
    at io.github.chris2011.netbeans.minifierbeans.Installer$2.run(Installer.java:164)
    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)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

And this is finish picture image

Chris2011 commented 3 years ago

Thx, will have a look :)

Chris2011 commented 3 years ago

Fixed in release 3.3.1, please test it @Ilya-Zhulin.

Chris2011 commented 3 years ago

The problem was, that I didn't know how the Progressbar in NetBeans worked but now I handled it.

Ilya-Zhulin commented 3 years ago

Hi, problem with exception is solved. Sorry for delay - it was vacation. Thank you.

Chris2011 commented 3 years ago

No problem :). Thx for the info.