This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 207724 - Allow listening for DoS events
Summary: Allow listening for DoS events
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 7.1
Hardware: PC All
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2012-01-25 13:56 UTC by Petr Hejl
Modified: 2012-02-01 11:32 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
the patch (9.39 KB, patch)
2012-01-25 14:08 UTC, Petr Hejl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Hejl 2012-01-25 13:56:22 UTC
Java EE projects should be able to register listeners which will be notified on DoS event.
Comment 1 Denis Anisimov 2012-01-25 14:00:01 UTC
Thank you!
Comment 2 Petr Hejl 2012-01-25 14:08:10 UTC
Created attachment 115234 [details]
the patch

Denis, please prototype and verify your usage and add it to the patch if possible.
Comment 3 Petr Hejl 2012-01-25 14:10:16 UTC
Please review.
Comment 4 Denis Anisimov 2012-01-26 13:22:36 UTC
There is a bug in the patch .
Current code is (inside DeployOnSaveManager) :
                deployNow = toDeploy;
                toDeploy = new HashMap<J2eeModuleProvider, Set<Artifact>>();
                
                // copy the listeners
                for (Map.Entry<J2eeModuleProvider, List<J2eeModuleProvider.DeployOnSaveListener>> entry : projectListeners.entrySet()) {
                    if (!toDeploy.containsKey(entry.getKey())) {
                        continue;
                    }
                    listeners.put(entry.getKey(), new ArrayList<J2eeModuleProvider.DeployOnSaveListener>(entry.getValue()));
                }

toDeploy is obviously empty and check toDeploy.containsKey(entry.getKey())
has no sense.
I suppose toDeploy should be changed to the deployNow :

                deployNow = toDeploy;
                toDeploy = new HashMap<J2eeModuleProvider, Set<Artifact>>();
                
                // copy the listeners
                for (Map.Entry<J2eeModuleProvider, List<J2eeModuleProvider.DeployOnSaveListener>> entry : projectListeners.entrySet()) {
                    if (!deployNow.containsKey(entry.getKey())) {
                        continue;
                    }
                    listeners.put(entry.getKey(), new ArrayList<J2eeModuleProvider.DeployOnSaveListener>(entry.getValue()));
                }

Corrected code works for me.
Comment 5 Petr Hejl 2012-01-26 14:02:34 UTC
Yep, deployNow is right. I plan to write some test(s) anyway. I just wanted to give you a sketch soon enough. Sorry for the mistake.

(In reply to comment #4)
> There is a bug in the patch .
> Current code is (inside DeployOnSaveManager) :
>                 deployNow = toDeploy;
>                 toDeploy = new HashMap<J2eeModuleProvider, Set<Artifact>>();
> 
>                 // copy the listeners
>                 for (Map.Entry<J2eeModuleProvider,
> List<J2eeModuleProvider.DeployOnSaveListener>> entry :
> projectListeners.entrySet()) {
>                     if (!toDeploy.containsKey(entry.getKey())) {
>                         continue;
>                     }
>                     listeners.put(entry.getKey(), new
> ArrayList<J2eeModuleProvider.DeployOnSaveListener>(entry.getValue()));
>                 }
> 
> toDeploy is obviously empty and check toDeploy.containsKey(entry.getKey())
> has no sense.
> I suppose toDeploy should be changed to the deployNow :
> 
>                 deployNow = toDeploy;
>                 toDeploy = new HashMap<J2eeModuleProvider, Set<Artifact>>();
> 
>                 // copy the listeners
>                 for (Map.Entry<J2eeModuleProvider,
> List<J2eeModuleProvider.DeployOnSaveListener>> entry :
> projectListeners.entrySet()) {
>                     if (!deployNow.containsKey(entry.getKey())) {
>                         continue;
>                     }
>                     listeners.put(entry.getKey(), new
> ArrayList<J2eeModuleProvider.DeployOnSaveListener>(entry.getValue()));
>                 }
> 
> Corrected code works for me.
Comment 6 Denis Anisimov 2012-01-26 14:03:34 UTC
(In reply to comment #5)
> Yep, deployNow is right. I plan to write some test(s) anyway. I just wanted to
> give you a sketch soon enough. Sorry for the mistake.
> 
No problem.
Comment 7 Petr Hejl 2012-02-01 11:32:01 UTC
Thanks for the review. The patch is integrated into easel_css_72 branch and will be eventually merged to trunk together with the client.