You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Karl-Heinz Golz <ka...@t-online.de> on 2012/11/15 16:52:56 UTC

ConcurrentModificationException with Fancybox

hello,

I'm using wicket 1.5.9.
My application shows some dynamic pictures via fancybox (native without
e.g. visural wicket).
That works almost well, i.e. you click the small picture and you get the
big picture via fancybox. And you can click through the show (up to 3
pictures) properly.

But sometimes (about 1 of 10) when you click on a picture a
ConcurrentModificationException is thrown.

Below you find the exception and an extract of my coding.

Maybe someone can give me a hint what's wrong.
Many thanks in advance
Karl-Heinz

org.apache.wicket.DefaultExceptionMapper: Unexpected error occurred
java.util.ConcurrentModificationException
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
    at java.util.ArrayList$ListItr.previous(ArrayList.java:846)
    at
org.apache.wicket.util.collections.ReverseListIterator.next(ReverseListIterator.java:51)
    at
org.apache.wicket.markup.html.SecurePackageResourceGuard.acceptAbsolutePath(SecurePackageResourceGuard.java:179)
    at
org.apache.wicket.markup.html.PackageResourceGuard.accept(PackageResourceGuard.java:71)
    at
org.apache.wicket.request.resource.PackageResource.accept(PackageResource.java:468)
    at
org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:445)
    at
org.apache.wicket.request.resource.PackageResource.getResourceStream(PackageResource.java:410)
    at
org.apache.wicket.request.resource.PackageResource.newResourceResponse(PackageResource.java:240)
    at
org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:497)
    at
org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:74)
    at
org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:105)
    at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
    at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
    at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
    at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
    at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
    at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
    at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)



<a wicket:id="img1big" >
   <img wicket:id="img1small" title="" alt="" />
</a>

-------------------

Link<Object> linkImg1 = new Link<Object>("img1big") {
    private static final long serialVersionUID = 1L;

    @Override
    public void onClick() {
            setResponsePage(new ShowImage(fall.getImage1Big(),
fall.getImage1ContentType(),
            fall.getImage1Title()));
    }
};
add(linkImg1);

Image img1 = new NonCachingImage("img1small");
if (fall.getImage1Small() != null) {
    img1.setImageResource(new
ByteArrayResource(fall.getImage1ContentType(), fall.getImage1Small()));
    linkImg1.add(AttributeModifier.replace("rel", "fancyshow"));
} else {
    img1.setImageResourceReference(new
PackageResourceReference(StartPage.class, "images/null.png"));
    img1.add(AttributeModifier.replace("class", "hideme"));
}
linkImg1.add(img1);


--------------------------------------------
_ShowImage.html_

<body>
    <div>
        <p><img wicket:id="imgid" alt="" /></p>
        <br />
        <p wicket:id="imgtitle" ></p>
    </div>
</body>

-------------------
_ShowImage.class_

public class ShowImage extends WebPage implements Serializable {
    private static final long serialVersionUID = 1L;

    public ShowImage (byte[] img, String contentType, String title) {
      Image img2 = new Image("imgid", new ByteArrayResource(contentType,
img));
      add(img2);

      Label title2 = new Label("imgtitle", title);
      add(title2);
    }
}




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ConcurrentModificationException with Fancybox

Posted by Karl-Heinz Golz <ka...@t-online.de>.
Now it works :))
Thank you very much for your prompt support.


Am 15.11.2012 17:15, schrieb Martin Grigorov:
> Yes. There is no need to add it again and again for each request.
> 
> 
> On Thu, Nov 15, 2012 at 6:11 PM, Karl-Heinz Golz <
> karl-heinz.golz@t-online.de> wrote:
> 
>>
>> Yes, I do it in getHomePage:
>>
>> public class StartApplication extends WebApplication {
>>
>>     @Override
>>     public void init() {
>>         . . .
>>     }
>>
>>  @Override
>>     public Class<? extends Page> getHomePage() {
>>
>>         IPackageResourceGuard packageResourceGuard =
>> getResourceSettings().getPackageResourceGuard();
>>         if (packageResourceGuard instanceof SecurePackageResourceGuard)
>>         {
>>             SecurePackageResourceGuard guard = (SecurePackageResourceGuard)
>> packageResourceGuard;
>>             guard.addPattern("+*.htm");
>>         }
>>
>>         return Anmelden.class;
>>     }
>> }
>>
>>
>> I have to move it to Init?
>>
>>
>> Am 15.11.2012 17:02, schrieb Martin Grigorov:
>>> Hi,
>>>
>>> Do you add white-list patterns to SecurePackageResourceGuard somewhere
>>> outside of MyApplication#init() ?
>>>
>>> The exception says that SecurePackageResourceGuard's patterns list is
>> being
>>> modified during the request processing.
>>> It should be changed only at application startup.
>>>
>>>
>>> On Thu, Nov 15, 2012 at 5:52 PM, Karl-Heinz Golz <
>>> karl-heinz.golz@t-online.de> wrote:
>>>
>>>>
>>>> hello,
>>>>
>>>> I'm using wicket 1.5.9.
>>>> My application shows some dynamic pictures via fancybox (native without
>>>> e.g. visural wicket).
>>>> That works almost well, i.e. you click the small picture and you get the
>>>> big picture via fancybox. And you can click through the show (up to 3
>>>> pictures) properly.
>>>>
>>>> But sometimes (about 1 of 10) when you click on a picture a
>>>> ConcurrentModificationException is thrown.
>>>>
>>>> Below you find the exception and an extract of my coding.
>>>>
>>>> Maybe someone can give me a hint what's wrong.
>>>> Many thanks in advance
>>>> Karl-Heinz
>>>>
>>>> org.apache.wicket.DefaultExceptionMapper: Unexpected error occurred
>>>> java.util.ConcurrentModificationException
>>>>     at
>> java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
>>>>     at java.util.ArrayList$ListItr.previous(ArrayList.java:846)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.util.collections.ReverseListIterator.next(ReverseListIterator.java:51)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.markup.html.SecurePackageResourceGuard.acceptAbsolutePath(SecurePackageResourceGuard.java:179)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.markup.html.PackageResourceGuard.accept(PackageResourceGuard.java:71)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.resource.PackageResource.accept(PackageResource.java:468)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:445)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.resource.PackageResource.getResourceStream(PackageResource.java:410)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.resource.PackageResource.newResourceResponse(PackageResource.java:240)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:497)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:74)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:105)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>>>     at
>>>>
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
>>>>     at
>>>>
>>>>
>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
>>>>     at
>>>>
>>>>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>>>>     at
>>>>
>>>>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>>>     at
>>>>
>>>>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
>>>>     at
>>>>
>>>>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>>>>     at
>>>>
>>>>
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>>>>     at
>>>>
>>>>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
>>>>     at
>>>>
>>>>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>>>>     at
>>>>
>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
>>>>     at
>>>>
>>>>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>>>>     at
>>>>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>>>>     at
>>>>
>>>>
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
>>>>     at
>>>>
>>>>
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
>>>>     at
>>>>
>>>>
>> org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
>>>>     at
>>>>
>>>>
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>>>>     at
>>>>
>>>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>>>>     at java.lang.Thread.run(Thread.java:722)
>>>>
>>>>
>>>>
>>>> <a wicket:id="img1big" >
>>>>    <img wicket:id="img1small" title="" alt="" />
>>>> </a>
>>>>
>>>> -------------------
>>>>
>>>> Link<Object> linkImg1 = new Link<Object>("img1big") {
>>>>     private static final long serialVersionUID = 1L;
>>>>
>>>>     @Override
>>>>     public void onClick() {
>>>>             setResponsePage(new ShowImage(fall.getImage1Big(),
>>>> fall.getImage1ContentType(),
>>>>             fall.getImage1Title()));
>>>>     }
>>>> };
>>>> add(linkImg1);
>>>>
>>>> Image img1 = new NonCachingImage("img1small");
>>>> if (fall.getImage1Small() != null) {
>>>>     img1.setImageResource(new
>>>> ByteArrayResource(fall.getImage1ContentType(), fall.getImage1Small()));
>>>>     linkImg1.add(AttributeModifier.replace("rel", "fancyshow"));
>>>> } else {
>>>>     img1.setImageResourceReference(new
>>>> PackageResourceReference(StartPage.class, "images/null.png"));
>>>>     img1.add(AttributeModifier.replace("class", "hideme"));
>>>> }
>>>> linkImg1.add(img1);
>>>>
>>>>
>>>> --------------------------------------------
>>>> _ShowImage.html_
>>>>
>>>> <body>
>>>>     <div>
>>>>         <p><img wicket:id="imgid" alt="" /></p>
>>>>         <br />
>>>>         <p wicket:id="imgtitle" ></p>
>>>>     </div>
>>>> </body>
>>>>
>>>> -------------------
>>>> _ShowImage.class_
>>>>
>>>> public class ShowImage extends WebPage implements Serializable {
>>>>     private static final long serialVersionUID = 1L;
>>>>
>>>>     public ShowImage (byte[] img, String contentType, String title) {
>>>>       Image img2 = new Image("imgid", new ByteArrayResource(contentType,
>>>> img));
>>>>       add(img2);
>>>>
>>>>       Label title2 = new Label("imgtitle", title);
>>>>       add(title2);
>>>>     }
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ConcurrentModificationException with Fancybox

Posted by Martin Grigorov <mg...@apache.org>.
Yes. There is no need to add it again and again for each request.


On Thu, Nov 15, 2012 at 6:11 PM, Karl-Heinz Golz <
karl-heinz.golz@t-online.de> wrote:

>
> Yes, I do it in getHomePage:
>
> public class StartApplication extends WebApplication {
>
>     @Override
>     public void init() {
>         . . .
>     }
>
>  @Override
>     public Class<? extends Page> getHomePage() {
>
>         IPackageResourceGuard packageResourceGuard =
> getResourceSettings().getPackageResourceGuard();
>         if (packageResourceGuard instanceof SecurePackageResourceGuard)
>         {
>             SecurePackageResourceGuard guard = (SecurePackageResourceGuard)
> packageResourceGuard;
>             guard.addPattern("+*.htm");
>         }
>
>         return Anmelden.class;
>     }
> }
>
>
> I have to move it to Init?
>
>
> Am 15.11.2012 17:02, schrieb Martin Grigorov:
> > Hi,
> >
> > Do you add white-list patterns to SecurePackageResourceGuard somewhere
> > outside of MyApplication#init() ?
> >
> > The exception says that SecurePackageResourceGuard's patterns list is
> being
> > modified during the request processing.
> > It should be changed only at application startup.
> >
> >
> > On Thu, Nov 15, 2012 at 5:52 PM, Karl-Heinz Golz <
> > karl-heinz.golz@t-online.de> wrote:
> >
> >>
> >> hello,
> >>
> >> I'm using wicket 1.5.9.
> >> My application shows some dynamic pictures via fancybox (native without
> >> e.g. visural wicket).
> >> That works almost well, i.e. you click the small picture and you get the
> >> big picture via fancybox. And you can click through the show (up to 3
> >> pictures) properly.
> >>
> >> But sometimes (about 1 of 10) when you click on a picture a
> >> ConcurrentModificationException is thrown.
> >>
> >> Below you find the exception and an extract of my coding.
> >>
> >> Maybe someone can give me a hint what's wrong.
> >> Many thanks in advance
> >> Karl-Heinz
> >>
> >> org.apache.wicket.DefaultExceptionMapper: Unexpected error occurred
> >> java.util.ConcurrentModificationException
> >>     at
> java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
> >>     at java.util.ArrayList$ListItr.previous(ArrayList.java:846)
> >>     at
> >>
> >>
> org.apache.wicket.util.collections.ReverseListIterator.next(ReverseListIterator.java:51)
> >>     at
> >>
> >>
> org.apache.wicket.markup.html.SecurePackageResourceGuard.acceptAbsolutePath(SecurePackageResourceGuard.java:179)
> >>     at
> >>
> >>
> org.apache.wicket.markup.html.PackageResourceGuard.accept(PackageResourceGuard.java:71)
> >>     at
> >>
> >>
> org.apache.wicket.request.resource.PackageResource.accept(PackageResource.java:468)
> >>     at
> >>
> >>
> org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:445)
> >>     at
> >>
> >>
> org.apache.wicket.request.resource.PackageResource.getResourceStream(PackageResource.java:410)
> >>     at
> >>
> >>
> org.apache.wicket.request.resource.PackageResource.newResourceResponse(PackageResource.java:240)
> >>     at
> >>
> >>
> org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:497)
> >>     at
> >>
> >>
> org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:74)
> >>     at
> >>
> >>
> org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:105)
> >>     at
> >>
> >>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
> >>     at
> >>
> >>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> >>     at
> >>
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
> >>     at
> >>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
> >>     at
> >>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
> >>     at
> >>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
> >>     at
> >>
> >>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
> >>     at
> >>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> >>     at
> >>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> >>     at
> >>
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
> >>     at
> >>
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
> >>     at
> >>
> >>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
> >>     at
> >>
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
> >>     at
> >>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
> >>     at
> >>
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
> >>     at
> >>
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> >>     at
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> >>     at
> >>
> >>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
> >>     at
> >>
> >>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
> >>     at
> >>
> >>
> org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
> >>     at
> >>
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> >>     at
> >>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> >>     at java.lang.Thread.run(Thread.java:722)
> >>
> >>
> >>
> >> <a wicket:id="img1big" >
> >>    <img wicket:id="img1small" title="" alt="" />
> >> </a>
> >>
> >> -------------------
> >>
> >> Link<Object> linkImg1 = new Link<Object>("img1big") {
> >>     private static final long serialVersionUID = 1L;
> >>
> >>     @Override
> >>     public void onClick() {
> >>             setResponsePage(new ShowImage(fall.getImage1Big(),
> >> fall.getImage1ContentType(),
> >>             fall.getImage1Title()));
> >>     }
> >> };
> >> add(linkImg1);
> >>
> >> Image img1 = new NonCachingImage("img1small");
> >> if (fall.getImage1Small() != null) {
> >>     img1.setImageResource(new
> >> ByteArrayResource(fall.getImage1ContentType(), fall.getImage1Small()));
> >>     linkImg1.add(AttributeModifier.replace("rel", "fancyshow"));
> >> } else {
> >>     img1.setImageResourceReference(new
> >> PackageResourceReference(StartPage.class, "images/null.png"));
> >>     img1.add(AttributeModifier.replace("class", "hideme"));
> >> }
> >> linkImg1.add(img1);
> >>
> >>
> >> --------------------------------------------
> >> _ShowImage.html_
> >>
> >> <body>
> >>     <div>
> >>         <p><img wicket:id="imgid" alt="" /></p>
> >>         <br />
> >>         <p wicket:id="imgtitle" ></p>
> >>     </div>
> >> </body>
> >>
> >> -------------------
> >> _ShowImage.class_
> >>
> >> public class ShowImage extends WebPage implements Serializable {
> >>     private static final long serialVersionUID = 1L;
> >>
> >>     public ShowImage (byte[] img, String contentType, String title) {
> >>       Image img2 = new Image("imgid", new ByteArrayResource(contentType,
> >> img));
> >>       add(img2);
> >>
> >>       Label title2 = new Label("imgtitle", title);
> >>       add(title2);
> >>     }
> >> }
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: ConcurrentModificationException with Fancybox

Posted by Karl-Heinz Golz <ka...@t-online.de>.
Yes, I do it in getHomePage:

public class StartApplication extends WebApplication {

    @Override
    public void init() {
	. . .
    }	

 @Override
    public Class<? extends Page> getHomePage() {

	IPackageResourceGuard packageResourceGuard =
getResourceSettings().getPackageResourceGuard();
	if (packageResourceGuard instanceof SecurePackageResourceGuard)
	{
	    SecurePackageResourceGuard guard = (SecurePackageResourceGuard)
packageResourceGuard;
	    guard.addPattern("+*.htm");
	}

	return Anmelden.class;
    }
}


I have to move it to Init?


Am 15.11.2012 17:02, schrieb Martin Grigorov:
> Hi,
> 
> Do you add white-list patterns to SecurePackageResourceGuard somewhere
> outside of MyApplication#init() ?
> 
> The exception says that SecurePackageResourceGuard's patterns list is being
> modified during the request processing.
> It should be changed only at application startup.
> 
> 
> On Thu, Nov 15, 2012 at 5:52 PM, Karl-Heinz Golz <
> karl-heinz.golz@t-online.de> wrote:
> 
>>
>> hello,
>>
>> I'm using wicket 1.5.9.
>> My application shows some dynamic pictures via fancybox (native without
>> e.g. visural wicket).
>> That works almost well, i.e. you click the small picture and you get the
>> big picture via fancybox. And you can click through the show (up to 3
>> pictures) properly.
>>
>> But sometimes (about 1 of 10) when you click on a picture a
>> ConcurrentModificationException is thrown.
>>
>> Below you find the exception and an extract of my coding.
>>
>> Maybe someone can give me a hint what's wrong.
>> Many thanks in advance
>> Karl-Heinz
>>
>> org.apache.wicket.DefaultExceptionMapper: Unexpected error occurred
>> java.util.ConcurrentModificationException
>>     at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
>>     at java.util.ArrayList$ListItr.previous(ArrayList.java:846)
>>     at
>>
>> org.apache.wicket.util.collections.ReverseListIterator.next(ReverseListIterator.java:51)
>>     at
>>
>> org.apache.wicket.markup.html.SecurePackageResourceGuard.acceptAbsolutePath(SecurePackageResourceGuard.java:179)
>>     at
>>
>> org.apache.wicket.markup.html.PackageResourceGuard.accept(PackageResourceGuard.java:71)
>>     at
>>
>> org.apache.wicket.request.resource.PackageResource.accept(PackageResource.java:468)
>>     at
>>
>> org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:445)
>>     at
>>
>> org.apache.wicket.request.resource.PackageResource.getResourceStream(PackageResource.java:410)
>>     at
>>
>> org.apache.wicket.request.resource.PackageResource.newResourceResponse(PackageResource.java:240)
>>     at
>>
>> org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:497)
>>     at
>>
>> org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:74)
>>     at
>>
>> org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:105)
>>     at
>>
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
>>     at
>>
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>     at
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
>>     at
>>
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
>>     at
>>
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
>>     at
>>
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
>>     at
>>
>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
>>     at
>>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>>     at
>>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>     at
>>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
>>     at
>>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>>     at
>>
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>>     at
>>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
>>     at
>>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>>     at
>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
>>     at
>>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>>     at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>>     at
>>
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
>>     at
>>
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
>>     at
>>
>> org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
>>     at
>>
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>>     at
>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>>     at java.lang.Thread.run(Thread.java:722)
>>
>>
>>
>> <a wicket:id="img1big" >
>>    <img wicket:id="img1small" title="" alt="" />
>> </a>
>>
>> -------------------
>>
>> Link<Object> linkImg1 = new Link<Object>("img1big") {
>>     private static final long serialVersionUID = 1L;
>>
>>     @Override
>>     public void onClick() {
>>             setResponsePage(new ShowImage(fall.getImage1Big(),
>> fall.getImage1ContentType(),
>>             fall.getImage1Title()));
>>     }
>> };
>> add(linkImg1);
>>
>> Image img1 = new NonCachingImage("img1small");
>> if (fall.getImage1Small() != null) {
>>     img1.setImageResource(new
>> ByteArrayResource(fall.getImage1ContentType(), fall.getImage1Small()));
>>     linkImg1.add(AttributeModifier.replace("rel", "fancyshow"));
>> } else {
>>     img1.setImageResourceReference(new
>> PackageResourceReference(StartPage.class, "images/null.png"));
>>     img1.add(AttributeModifier.replace("class", "hideme"));
>> }
>> linkImg1.add(img1);
>>
>>
>> --------------------------------------------
>> _ShowImage.html_
>>
>> <body>
>>     <div>
>>         <p><img wicket:id="imgid" alt="" /></p>
>>         <br />
>>         <p wicket:id="imgtitle" ></p>
>>     </div>
>> </body>
>>
>> -------------------
>> _ShowImage.class_
>>
>> public class ShowImage extends WebPage implements Serializable {
>>     private static final long serialVersionUID = 1L;
>>
>>     public ShowImage (byte[] img, String contentType, String title) {
>>       Image img2 = new Image("imgid", new ByteArrayResource(contentType,
>> img));
>>       add(img2);
>>
>>       Label title2 = new Label("imgtitle", title);
>>       add(title2);
>>     }
>> }
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ConcurrentModificationException with Fancybox

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Do you add white-list patterns to SecurePackageResourceGuard somewhere
outside of MyApplication#init() ?

The exception says that SecurePackageResourceGuard's patterns list is being
modified during the request processing.
It should be changed only at application startup.


On Thu, Nov 15, 2012 at 5:52 PM, Karl-Heinz Golz <
karl-heinz.golz@t-online.de> wrote:

>
> hello,
>
> I'm using wicket 1.5.9.
> My application shows some dynamic pictures via fancybox (native without
> e.g. visural wicket).
> That works almost well, i.e. you click the small picture and you get the
> big picture via fancybox. And you can click through the show (up to 3
> pictures) properly.
>
> But sometimes (about 1 of 10) when you click on a picture a
> ConcurrentModificationException is thrown.
>
> Below you find the exception and an extract of my coding.
>
> Maybe someone can give me a hint what's wrong.
> Many thanks in advance
> Karl-Heinz
>
> org.apache.wicket.DefaultExceptionMapper: Unexpected error occurred
> java.util.ConcurrentModificationException
>     at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
>     at java.util.ArrayList$ListItr.previous(ArrayList.java:846)
>     at
>
> org.apache.wicket.util.collections.ReverseListIterator.next(ReverseListIterator.java:51)
>     at
>
> org.apache.wicket.markup.html.SecurePackageResourceGuard.acceptAbsolutePath(SecurePackageResourceGuard.java:179)
>     at
>
> org.apache.wicket.markup.html.PackageResourceGuard.accept(PackageResourceGuard.java:71)
>     at
>
> org.apache.wicket.request.resource.PackageResource.accept(PackageResource.java:468)
>     at
>
> org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:445)
>     at
>
> org.apache.wicket.request.resource.PackageResource.getResourceStream(PackageResource.java:410)
>     at
>
> org.apache.wicket.request.resource.PackageResource.newResourceResponse(PackageResource.java:240)
>     at
>
> org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:497)
>     at
>
> org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:74)
>     at
>
> org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:105)
>     at
>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
>     at
>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>     at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
>     at
>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
>     at
>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
>     at
>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
>     at
>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
>     at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>     at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>     at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
>     at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>     at
>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>     at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
>     at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>     at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
>     at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>     at
>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
>     at
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
>     at
>
> org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
>     at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>     at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>     at java.lang.Thread.run(Thread.java:722)
>
>
>
> <a wicket:id="img1big" >
>    <img wicket:id="img1small" title="" alt="" />
> </a>
>
> -------------------
>
> Link<Object> linkImg1 = new Link<Object>("img1big") {
>     private static final long serialVersionUID = 1L;
>
>     @Override
>     public void onClick() {
>             setResponsePage(new ShowImage(fall.getImage1Big(),
> fall.getImage1ContentType(),
>             fall.getImage1Title()));
>     }
> };
> add(linkImg1);
>
> Image img1 = new NonCachingImage("img1small");
> if (fall.getImage1Small() != null) {
>     img1.setImageResource(new
> ByteArrayResource(fall.getImage1ContentType(), fall.getImage1Small()));
>     linkImg1.add(AttributeModifier.replace("rel", "fancyshow"));
> } else {
>     img1.setImageResourceReference(new
> PackageResourceReference(StartPage.class, "images/null.png"));
>     img1.add(AttributeModifier.replace("class", "hideme"));
> }
> linkImg1.add(img1);
>
>
> --------------------------------------------
> _ShowImage.html_
>
> <body>
>     <div>
>         <p><img wicket:id="imgid" alt="" /></p>
>         <br />
>         <p wicket:id="imgtitle" ></p>
>     </div>
> </body>
>
> -------------------
> _ShowImage.class_
>
> public class ShowImage extends WebPage implements Serializable {
>     private static final long serialVersionUID = 1L;
>
>     public ShowImage (byte[] img, String contentType, String title) {
>       Image img2 = new Image("imgid", new ByteArrayResource(contentType,
> img));
>       add(img2);
>
>       Label title2 = new Label("imgtitle", title);
>       add(title2);
>     }
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>