cancel
Showing results for 
Search instead for 
Did you mean: 

500- Internal Error when admin tries to unshare a file in users' private site

arjuncbe
Champ in-the-making
Champ in-the-making
Hello people,

Alfresco community edition returns 500 internal error when trying to unshare a file which is in users' private site.

To reproduce:
   
   1.User creates a private site
   2.User creates a file
   3.User shares it
        4.A rest call to unshare this file with admin credentials returns

<blockcode>
Failed to execute http://localhost:8080/alfresco/s/api/internal/shared/unshare/3uIfYLFlSlGIJXLURf2opg?alf_ticket=TICKE...  {
    "status" :
  {
    "code" : 500,
    "name" : "Internal Error",
    "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
  }, 
 
  "message" : "01250010 Wrapped Exception (with status template): null", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 01250010 Wrapped Exception (with status template): null",
 
  "callstack" :
  [
       ""      ,"java.lang.NullPointerException"
      ,"org.alfresco.repo.web.scripts.quickshare.UnshareContentDelete.executeImpl(UnshareContentDelete.java:96)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:489)"
      ,"org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:551)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:619)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:399)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:280)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:727)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)"
      ,"org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)"
      ,"org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)"
      ,"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)"
      ,"org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)"
      ,"org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)"
      ,"org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)"
      ,"org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)"
      ,"org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)"
      ,"java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)"
      ,"java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)"
      ,"org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)"
      ,"java.lang.Thread.run(Thread.java:745)"
      ,"org.springframework.extensions.webscripts.WebScriptException: 01250010 Wrapped Exception (with status template): null"
      ,"org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1127)"

  ],
      
"server" : "Community v5.0.0 (d r99759-b2) schema 8,022",
  "time" : "Feb 25, 2016 3:23:43 PM"
}

</blockcode>


I think because admin is not a collaborator on the site, he doesn't have a role associated which causes the null pointer exception at UnshareContentDelete.java:96
 if (role.equals(SiteModel.SITE_CONSUMER) || role.equals(SiteModel.SITE_CONTRIBUTOR)) 

   
If admin is manually added as a collaborator to the site, the rest call succeeds.

I'm able to download the file with admin credentials, so the admin does have read access and should be able to unshare as per http://docs.alfresco.com/5.0/references/RESTful-QuickshareUnshareDelete.html. This makes me think the issue is at webscripts and not internal API.

Is there any other temporary quick fix for testing (making the admin a site manager, unsharing the file and removing?)


Thanks
2 REPLIES 2

romschn
Star Collaborator
Star Collaborator
I think you may want to raise a JIRA issue for this.

Yes, as an alternate solution, as you rightly mentioned if it is feasible for you then Make admin as a site manager temporarily and unshare the content and again remove admin as site manager.
For a quick reference you can do this as following.
Login as admin -> Go to admin console -> From Sites Manager, Become Site Manager for the given site.
Then unshare the content. Next, again being logged in as admin, Leave the site. This way you are back to the original scenario.

Hope this helps.

arjuncbe
Champ in-the-making
Champ in-the-making
Thanks Ramesh. Temporary fix works fine. Reported the issue @ https://issues.alfresco.com/jira/browse/ALF-21564