cancel
Showing results for 
Search instead for 
Did you mean: 

Links to Blog 'Archives' error

rays
Confirmed Champ
Confirmed Champ
HI,

Whenever I try to use the auto-generated "Month Year" links listed under Archive in a Share Site Blog, I get an error "An error occured when retrieving the blog posts" in the browser.

I have checked and this happens with every Month Year link, irrespective of whether there are posts for that clicked on month or not.

Associated error from catalina.out is:

2012-06-06 14:11:52,729  ERROR [extensions.webscripts.AbstractRuntime] [http-8080-45] Exception from executeScript - redirecting to status template error: 05060061 Wrapped Exception (with status template): For input string: "1335823200000"
org.springframework.extensions.webscripts.WebScriptException: 05060061 Wrapped Exception (with status template): For input string: "1335823200000"
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
        at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:393)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NumberFormatException: For input string: "1335823200000"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:461)
        at java.lang.Integer.parseInt(Integer.java:499)
        at org.alfresco.repo.web.scripts.blogs.posts.AbstractGetBlogWebScript.parseDateParam(AbstractGetBlogWebScript.java:174)
        at org.alfresco.repo.web.scripts.blogs.posts.AbstractGetBlogWebScript.executeImpl(AbstractGetBlogWebScript.java:66)
        at org.alfresco.repo.web.scripts.blogs.AbstractBlogWebScript.executeImpl(AbstractBlogWebScript.java:294)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
        … 25 more


Has anyone else experienced this? I'm not finding this error message particularly informative. I'd appreciate support in correcting whatever is going on here as I see these archive links as a valuable new addition in share sites in CE 4.0d.

Thanks, in advance, for your time.

Ray
1 REPLY 1

technaton
Champ in-the-making
Champ in-the-making
This happens because the date is given as a Unix timestamp to the Java code, but it is parsed as Integer there. Timestamps are always Long, though, so it fails.

This is fixed in the current reversion of alfresco. You have now two possible solutions:
  • You wait for the next upstream release

  • You patch it yourself
If you want to patch it yourself, you need to check out the Alfresco code from Subversion and apply a simple patch. It's pretty straightforward, so no worries.

First, checkout the alfresco sources. See the wiki at http://wiki.alfresco.com/wiki/Alfresco_SVN_Development_Environment for more instructions. Basically, the SVN URL is http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD, so you issue a
svn co http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD
in whatever directory you wish.

Now, make sure you're at the exact revision that was the base of the 4.0.d community release. The release notes tell us this was r33365.

Open
root/projects/remote-api/source/java/org/alfresco/repo/web/scripts/blogs/posts/AbstractGetBlogWebScript.java
and apply this patch:
Index: root/projects/remote-api/source/java/org/alfresco/repo/web/scripts/blogs/posts/AbstractGetBlogWebScript.java
===================================================================
— root/projects/remote-api/source/java/org/alfresco/repo/web/scripts/blogs/posts/AbstractGetBlogWebScript.java        (Revision 33365)
+++ root/projects/remote-api/source/java/org/alfresco/repo/web/scripts/blogs/posts/AbstractGetBlogWebScript.java        (Arbeitskopie)
@@ -82,7 +82,7 @@
         if (this.getClass().equals(BlogPostsNewGet.class))
         {
             // Default is for 'now' minus seven days.
-            final int oneDayInMilliseconds = 24 * 60 * 60 * 1000;
+            final long oneDayInMilliseconds = 24 * 60 * 60 * 1000;
             final long sevenDaysInMilliseconds = 7 * oneDayInMilliseconds;
             fromDate = new Date(System.currentTimeMillis() - sevenDaysInMilliseconds);
            
@@ -171,7 +171,7 @@
         Date result = null;
         if (dateStr != null)
         {
-            result = new Date(Integer.parseInt(dateStr));
+            result = new Date(Long.parseLong(dateStr));
         }
         return result;
     }

Rebuild alfresco:
ant build
Wait for it to complete, fetch yourself a cup of coffee or do other funny things while compiling.

Place the new
root/projects/remote-api/build/dist/alfresco-remote-api-4.0.d.jar
in your webapp deploy directory, thereby overwriting the old one.

HTH.