How to enable assert in CQ5/ OSGi Bundle (Java)? -


We also enable java -ea xxx in a core Java application, I also To know that commandline options have been changed to eclipse.

But how to enable the OSGI bundle to emphasize. I have a bundle that I want to test with the claim and I want to disable them at the time of deployment (disable by default will be easy to disable) but how do you enable it?

You can use ClassLoader # setDefaultAssertionStatus (Boolean) method Sets the claim status only for those sections which have not yet been loaded. Therefore, the best place to tell this statement would be a bundle activator:

  implements the public class catalyst bundleactivator {@ Override Public Voode Start (Bundle Contact Bundle Concert) Exception {getClass () Throws GetClassLoader () .setDefaultAssertionStatus (right); } @ Override Public VoIP Stop (Bundle Contact Reference) exception to {}}   

in the maven-bundle-plugin configuration to register the activator Remember for: & lt; Project & gt; & Lt; Construction & gt; & Lt; Plugins & gt; & Lt; Plugin & gt; & Lt; Group & gt; Org.apache.felix & lt; / Group & gt; & Lt; ArtifactId & gt; Maven Wrap-Plugin & lt; / ArtifactId> & Lt; Configuration & gt; & Lt; Instructions & gt; & Lt; Bundle-catalyst & gt; my.project.Activator & lt; / Bundle-catalyst & gt; ...

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -