Hi Martin,

Generally, you should be able to avoid the 'Internal error occurred' and
the redirection to the 'HOME' page by using the cancel exception, however
it seems that currently the cancel exception is not handled correctly in
this clouser.

First, I have opened an issue about the 'CancelException' you can follow
here:
https://www.jfrog.com/jira/browse/RTFACT-5980

Shay,


On Thu, Sep 12, 2013 at 6:24 PM, Martin Schoepf
<[email protected]>wrote:

> Hi Folks !
>
> I'm fiddling around with Artifactory PRO Evaluation and tried to write a
> user Plugin (my first groovy code ever) :
> The purpose of this piece of code is to protect artifacts with the
> Property 'frozen' from being deleted forever :
>
>     beforeDelete { item ->
>         def path   = item.getRepoPath ()
>         def frozen = repositories.getProperties(path).getFirst
> ("Status.persistency")
>         echo "frozen of '${path}' is ${frozen}"
>         if (frozen == "frozen")
>         {
>             echo "Artifactory Police"
>             throw new CancelException("Artifactory Police : Nobody can
> kill frozen artifacts", 403)
>         }
>      }
>      /**
>      * Handle after create events.
>      *
>      * Closure parameters:
>      * item (org.artifactory.fs.ItemInfo) - the original item deleted.
>      */
>     afterDelete { item ->
>         echo "Why I'm here now ?"
>     }
>
> So this looks strightforeward.
>
> Anyway it doesn't work. The item is deleted, though the CancelException is
> raised (at least it seems as it it were raised). here is the output from
> the logfile :
>
> 2013-09-12 17:07:36,270 [http-bio-8081-exec-6] [WARN ] (MyPlugin
>  :427) - ##### Artifactory Police
> 2013-09-12 17:07:36,283 [http-bio-8081-exec-6] [ERROR]
> (o.a.r.i.s.StorageInterceptorsImpl:72) - Delete rejected: Artifactory
> Police : Nobody can kill frozen artifacts: Artifactory Police : Nobody can
> kill frozen artifacts
> 2013-09-12 17:07:36,289 [http-bio-8081-exec-6] [WARN ] (MyPlugin
>  :427) - ##### Why I'm here now ?
>
> What is wrong with my code ?
>
> THX in advance
> Martin
>
>
> ________________________________________________________
> Martin Schoepf - Software Testing
> TTTech Computertechnik AG - Ensuring Reliable Networks
> Commercial Reg. No.: 165 664z, Commercial Court Vienna
>
> Schoenbrunner Strasse 7, A-1040 Vienna, Austria
> Phone: +43 1 585 34 34-46, Fax: +43 1 585 34 34-90
> [email protected], http://www.tttech.com
> _______________________________________________________
>
> CONFIDENTIALITY: The contents of this e-mail are confidential and
> intended only for the above addressee(s). If you are not the intended
> recipient, or the person responsible for delivering it to the intended
> recipient, copying or delivering it to anyone else or using it in any
> unauthorized manner is prohibited and may be unlawful. If you
> receive this e-mail by mistake, please notify the sender and the
> systems administrator at [email protected] immediately.
>
>
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. Consolidate legacy IT systems to a single system of record for IT
> 2. Standardize and globalize service processes across IT
> 3. Implement zero-touch automation to replace manual, redundant tasks
> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> _______________________________________________
> Artifactory-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>
>
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to