[opencms-dev] Quote character bug in HTML editor (?)

Joe Desbonnet jdesbonnet at gmail.com
Sun May 8 16:18:43 CEST 2005


If I use the HTML editor to enter code such as this in HTML mode:

< a href = "blah.html" onClick = "alert('Hello');">blah< / a >

and save it, using Edit Control Code I can see that it gets mangled to:
< a href = "blah.html" onClick = "alert("Hello");"blah< / a >

(notice the single quotes around Hello are now double quotes). At this
point the HTML editor does not work anymore (will not save or switch
between WYSIWYG and HTML mode).

I'm using OpenCMS 6b3 running on Tomcat 4.1.31, JDK 1.4.2_08 and
browser Firefox 1.0.3.
The spaces in example above are intentional.

Joe.



On 5/7/05, Alexander Kandzior <alex at opencms.org> wrote:
> John,
> 
> You are right, the method CmsObject#readAllProjectResources(int) does not
> work. It's a bug. It's apparently so that the method is a leftover from very
> old, since it's only used on one location in the code that's apparently
> never really executed. That's why I removed that method in CVS HEAD.
> 
> The replacement method that does work is
> CmsObject#readProjectResources(CmsProject). However, this method does not
> return all resources in the project, but only the list of resources that
> compose the project "view" (Strings). Internally the other method used the
> same code, that's why there was a classcast exception.
> 
> Best Regards,
> Alex.
> 
> Alexander Kandzior
> Alkacon Software - The OpenCms Experts
> http://www.alkacon.com
> 
> 
> > -----Original Message-----
> > From: opencms-dev-bounces at opencms.org
> > [mailto:opencms-dev-bounces at opencms.org] On Behalf Of John Emmer
> > Sent: Saturday, May 07, 2005 2:34 AM
> > To: opencms-dev at opencms.org
> > Subject: [opencms-dev] CmsObject#readAllProjectResources(id)
> > throwsClassCastException
> >
> >
> >
> >
> >
> > I'm just poking around trying to learn my way around the OpenCMS APIs.
> > I've deployed the 6.0 beta 2 release and added a simple
> > servlet that contains the following code:
> >
> >         PrintWriter out = response.getWriter();
> >
> >         try {
> >
> >             CmsObject cms = OpenCms.initCmsObject("Guest");
> >             cms.loginUser("Admin","admin");
> >             out.println("Accessible Projects<BR>");
> >             out.println("<UL>");
> >             for ( Iterator projIter =
> > cms.getAllAccessibleProjects().iterator(); projIter.hasNext();) {
> >                 CmsProject project = (CmsProject)projIter.next();
> >                 out.println( "<LI>"+project.toString()+"</LI>" );
> >                 out.println("Project Resources<BR>");
> >                 out.println("<OL>");
> >                 List resources =
> > cms.readAllProjectResources(project.getId());
> >                 for ( Iterator resIter =
> > resources.iterator(); resIter.hasNext(); ) {
> >                     CmsResource resource =
> > (CmsResource)resIter.next();
> >                     I_CmsResourceType type =
> > OpenCms.getResourceManager().getResourceType(resource.getTypeId());
> >                     out.println(
> > "<LI>"+resource.getResourceId().toString()+" : "+type+" : "
> >                             +resource.getName()+" :
> > "+resource.getRootPath()+"</LI>" );
> >                 }
> >                 out.println("</OL>");
> >             }
> >             out.println("</UL>");
> >         } catch (CmsException e) {
> >             e.printStackTrace(out);
> >         }
> >
> > When I access my servlet, I get the following:
> >
> > org.opencms.main.CmsException: Exception during database
> > operation [Code 0
> > - Unknown exception] Root cause was:
> > java.lang.ClassCastException at
> > org.opencms.db.CmsDbContext.report(CmsDbContext.java:197)
> > at
> > org.opencms.db.CmsSecurityManager.readAllProjectResources(CmsS
> > ecurityManager.java:2679)
> >
> > at
> > org.opencms.file.CmsObject.readAllProjectResources(CmsObject.j
> > ava:1982)
> > at com.avega.cms.OpenCMSProbe.examineCmsObject(OpenCMSProbe.java:95)
> > at com.avega.cms.OpenCMSProbe.service(OpenCMSProbe.java:69)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(ApplicationFilterChain.java:252)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilterChain.java:173)
> >
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> > rapperValve.java:213)
> >
> > at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardC
> > ontextValve.java:178)
> >
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> > Valve.java:126)
> >
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> > Valve.java:105)
> >
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> > gineValve.java:107)
> >
> > at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdap
> > ter.java:148)
> > at
> > org.apache.coyote.http11.Http11Processor.process(Http11Process
> > or.java:856)
> > at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> r.processConnection(Http11Protocol.java:744)
> >
> > at
> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolT
> > cpEndpoint.java:527)
> >
> > at
> > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(Le
> > aderFollowerWorkerThread.java:80)
> >
> > at
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:684)
> >
> > at java.lang.Thread.run(Thread.java:534)
> > >-----------
> > >Root cause:
> > >java.lang.ClassCastException
> > > at
> > org.opencms.db.CmsDriverManager.updateContextDates(CmsDriverMa
> > nager.java:7025)
> >
> > > at
> > org.opencms.db.CmsDriverManager.readAllProjectResources(CmsDri
> > verManager.java:4824)
> >
> > > at
> > org.opencms.db.CmsSecurityManager.readAllProjectResources(CmsS
> > ecurityManager.java:2677)
> >
> > > at
> > org.opencms.file.CmsObject.readAllProjectResources(CmsObject.j
> > ava:1982)
> > > at com.avega.cms.OpenCMSProbe.examineCmsObject(OpenCMSProbe.java:95)
> > > at com.avega.cms.OpenCMSProbe.service(OpenCMSProbe.java:69)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(ApplicationFilterChain.java:252)
> >
> > > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilterChain.java:173)
> >
> > > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> > rapperValve.java:213)
> >
> > > at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardC
> > ontextValve.java:178)
> >
> > > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> > Valve.java:126)
> >
> > > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> > Valve.java:105)
> >
> > > at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> > gineValve.java:107)
> >
> > > at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdap
> > ter.java:148)
> > > at
> > org.apache.coyote.http11.Http11Processor.process(Http11Process
> > or.java:856)
> > > at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> r.processConnection(Http11Protocol.java:744)
> >
> > > at
> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolT
> > cpEndpoint.java:527)
> >
> > > at
> > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(Le
> > aderFollowerWorkerThread.java:80)
> >
> > > at
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:684)
> >
> > > at java.lang.Thread.run(Thread.java:534)
> >
> > What am I doing wrong?  At this point, I just want to walk
> > the resource tree to see what everything looks like from the
> > API point of view.
> >
> > Thanks!
> >
> > --------------------------------------------------------------
> > ---------------
> >
> > John Emmer
> > Senior Software Engineer
> > Avega
> > 200 N. Sepulveda, Suite 600   El Segundo, CA 90245
> > 310-563-3322    jemmer at avega.com
> >
> >
> >
> >
> > _______________________________________________
> > This mail is send to you from the opencms-dev mailing list To
> > change your list options, or to unsubscribe from the list,
> > please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> >
> >
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list