Page 1 of 1

openkm6.2.2 automation file move java.lang.NullPointerExcept

PostPosted:Mon Feb 25, 2013 10:12 am
by dara
Hello,

I m not sure it is me or a bug (probably me)

In OpenKM 6.2.2 community edition,
I have an action that change node permission. It works fine when the event was set to "fld_create"
If I set the event to "doc_move" I reveive
Code: Select all
ERROR com.openkm.automation.validation.PathContains - java.lang.NullPointerException
I have to note that I receive java.lang.NullPointerException even before my action is parsed.
eg: I can put a working script or code with error and still receive the same java.lang.NullPointerException

Does someone had it in the past? the code for the action is
Code: Select all
//thanks to  http://forum.openkm.com/viewtopic.php?f=5&t=9252&p=21351&hilit=security+move+folder#p21351
import com.openkm.automation;
import com.openkm.api.OKMRepository;
import com.openkm.api.OKMAuth;
import com.openkm.bean.Permission;
import com.openkm.spring.PrincipalUtils;

String path = OKMRepository.getInstance().getNodePath(null, uuid);
OKMAuth oKMAuth = OKMAuth.getInstance();
String user = PrincipalUtils.getUser();

// All Roles only will continue having read grants
Map hm = oKMAuth.getGrantedRoles(null, path);
for (String roleName : hm.keySet()) {
   oKMAuth.revokeRole(null, path, roleName, Permission.WRITE, false);
   oKMAuth.revokeRole(null, path, roleName, Permission.DELETE, false);
   oKMAuth.revokeRole(null, path, roleName, Permission.SECURITY, false);
}

// All users only will continue having read grants
hm = oKMAuth.getGrantedUsers(null, path);
for (String userName : hm.keySet()) {
   if (user.equals(userName)) {
      oKMAuth.revokeUser(null, path, userName, Permission.WRITE, false);
      oKMAuth.revokeUser(null, path, userName, Permission.DELETE, false);
      oKMAuth.revokeUser(null, path, userName, Permission.SECURITY, false);
   }
}
And the error is
Code: Select all
2013-02-25 10:58:20,703 [http-bio-0.0.0.0-8080-exec-29] ERROR com.openkm.automation.validation.PathContains -
java.lang.NullPointerException
        at com.openkm.automation.validation.PathContains.isValid(PathContains.java:51)
        at sun.reflect.GeneratedMethodAccessor5810.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.openkm.util.cl.ClassLoaderUtils.invokeAutomationMethod(ClassLoaderUtils.java:159)
        at com.openkm.automation.AutomationManager.getValidActions(AutomationManager.java:104)
        at com.openkm.automation.AutomationManager.fireEvent(AutomationManager.java:58)
        at com.openkm.module.db.DbDocumentModule.move(DbDocumentModule.java:1064)
        at com.openkm.api.OKMDocument.move(OKMDocument.java:292)
        at com.openkm.servlet.frontend.DocumentServlet.move(DocumentServlet.java:415)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
        at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
        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:169)
        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:999)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Thank you
Dara

Re: openkm6.2.2 automation file move java.lang.NullPointerEx

PostPosted:Tue Feb 26, 2013 6:32 pm
by jllort
have you changed the name of the folder which you're doing comparaison ? verify it ( I'm not sure if your version is working with uuid like professional edition and this could be the cause of the problem, if path is changed could be some problem )