You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2010/01/28 00:36:27 UTC
svn commit: r903907 [1/11] - in
/myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src:
main/java/org/apache/myfaces/trinidadinternal/io/
main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/
test/java/org/apache/myfaces/trinidadinter...
Author: jwaldman
Date: Wed Jan 27 23:36:24 2010
New Revision: 903907
URL: http://svn.apache.org/viewvc?rev=903907&view=rev
Log:
TRINIDAD-1647 HTML Escapes writes out characters illegal in HTML
backport to 1.2.12.1-branch.
Modified:
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HtmlResponseWriter.java
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XMLEscapes.java
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XhtmlResponseWriter.java
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/XmlResponseWriter.java
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chooseDate-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chooseDate-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chooseDate-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chooseDate-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chooseDate-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/columnGroup-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/editableTable-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/legend-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/legend-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/legend-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/legend-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/legend-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/legend-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/legend-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/navigationTree-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/navigationTree-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/navigationTree-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/navigationTree-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/navigationTree-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/navigationTree-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputDocument-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputDocument-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputDocument-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputDocument-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputDocument-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputDocument-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputDocument-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputFormatted-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputFormatted-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputFormatted-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputFormatted-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputFormatted-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputFormatted-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputFormatted-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputLabel-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputLabel-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputLabel-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputLabel-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputLabel-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputLabel-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/outputLabel-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/page-facets-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelAccordion-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelAccordion-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelAccordion-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelAccordion-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelAccordion-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelAccordion-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelButtonBar-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelPage-facets-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelPage-facets-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelPage-facets-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelPage-facets-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelPage-facets-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelPage-facets-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelPage-facets-pda-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelTip-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelTip-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelTip-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelTip-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelTip-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelTip-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelTip-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/processChoiceBar-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyCheckbox-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyCheckbox-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyCheckbox-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyCheckbox-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyCheckbox-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyCheckbox-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyCheckbox-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectRangeChoiceBar-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectRangeChoiceBar-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectRangeChoiceBar-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectRangeChoiceBar-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectRangeChoiceBar-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectRangeChoiceBar-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectRangeChoiceBar-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectRangeChoiceBarBig-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailHeader-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailHeader-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailHeader-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailHeader-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailHeader-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailHeader-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithPrompt-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithPrompt-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithPrompt-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithPrompt-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithPrompt-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithPrompt-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithoutPrompt-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithoutPrompt-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithoutPrompt-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithoutPrompt-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithoutPrompt-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/showDetailWithoutPrompt-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/singleStepButtonBar-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/table-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/table-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/table-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/table-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/table-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/table-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/table-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectMany-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectMany-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectMany-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectMany-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectMany-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectMany-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectMany-minimalScrRdr-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectOne-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/treeTable-minimal-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/treeTable-minimalIE-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/treeTable-minimalIERtl-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/treeTable-minimalInacc-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/treeTable-minimalPPC-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/treeTable-minimalSaf-golden.xml
myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/treeTable-minimalScrRdr-golden.xml
Modified: myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java?rev=903907&r1=903906&r2=903907&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java (original)
+++ myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HTMLEscapes.java Wed Jan 27 23:36:24 2010
@@ -27,120 +27,10 @@
*/
public class HTMLEscapes
{
- /**
- * Returns an escaped String of text
- */
- public static String escapeText(
- String text
- )
- {
- int length = text.length();
-
- int escapedIndex = _getEscapedIndex(text);
-
- if (escapedIndex == length)
- {
- // no escaping necessary
- return text;
- }
-
- //
- // copy the text up to here in a buffer and escape the rest
- //
- char[] buffer = new char[length * 8];
-
- int buffIndex = 0;
-
- for (; buffIndex < escapedIndex; buffIndex++)
- {
- buffer[buffIndex] = text.charAt(buffIndex);
- }
-
-
- for (int i = escapedIndex; i < length; i++)
- {
- char ch = text.charAt(i);
-
- if (ch < 0xA0)
- {
- // If "?" or over...
- if (ch >= 0x3f)
- {
- buffer[buffIndex++] = ch;
- }
- // If "'" or over...
- else if (ch >= 0x27)
- {
- if (ch < 0x3c)
- {
- buffer[buffIndex++] = ch;
- }
- else if (ch == '<')
- {
- // =-= bts argh!! "<" isn't supposed to be escaped in attributes,
- // as per HTML spec
- buffIndex = _addStringToBuffer(buffer, buffIndex, "<");
- }
- else if (ch == '>')
- {
- buffIndex = _addStringToBuffer(buffer, buffIndex, ">");
- }
- else
- {
- buffer[buffIndex++] = ch;
- }
- }
- else
- {
- if (ch == '&')
- {
- // HTML 4.0, section B.7.1: ampersands followed by
- // an open brace don't get escaped
- if ((i + 1 < length) &&
- (text.charAt(i + 1) == '{'))
- {
- buffer[buffIndex++] = ch;
- }
- else
- {
- buffIndex = _addStringToBuffer(buffer, buffIndex, "&");
- }
- }
- else if (ch == '"')
- {
- buffIndex = _addStringToBuffer(buffer, buffIndex, """);
- }
- else
- {
- buffer[buffIndex++] = ch;
- }
- }
- }
- else
- {
- buffIndex = _addDecRefToBuffer(buffer, buffIndex, ch);
- }
- }
-
- return new String(buffer, 0, buffIndex);
- }
-
// =-=AEW Performance - look at whether text and attributes
// should be stored as character arrays or strings (might be
// different decision for each), and make this class conform.
- static public void writeText(
- Writer out,
- char[] buffer,
- char[] text
- )
- throws IOException
- {
- writeText(out, buffer, text, 0, text.length);
- }
-
-
-
/**
* Write char array text. Note that this code is duplicated below
* for Strings - change both places if you make any changes!!!
@@ -153,803 +43,534 @@
int length
) throws IOException
{
- int buffLength = buff.length;
- int buffIndex = 0;
-
- int end = start + length;
- for (int i = start; i < end; i++)
- {
- char ch = text[i];
-
- if (ch < 0xA0)
- {
- // If "?" or over...
- if (ch >= 0x3f)
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- // If "'" or over...
- else if (ch >= 0x27)
- {
- if (ch < 0x3c)
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- else if (ch == '<')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write("<");
- }
- else if (ch == '>')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write(">");
- }
- else
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- }
- else
- {
- if (ch == '&')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write("&");
- }
- else if (ch == 0x0A)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _println(out);
- if ((i + 1 < end) && (text[i + 1] == 0x0D))
- i++;
- }
- else if (ch == 0x0D)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _println(out);
- if ((i + 1 < end) && (text[i + 1] == 0x0A))
- i++;
- }
- else
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- }
- }
- else if (ch <= 0xff)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write('&');
- out.write(_sISO8859_1_Entities[ch - 0xA0]);
- out.write(';');
- }
- else
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- // RFE 1709817: we need a way to force a line break in
- // random strings. And here this Unicode codepoint lies,
- // all waiting for us - it means "force a line break",
- // unambiguously, and the odds are about 10-zillion-to-one
- // that anyone's using it. So, treat this special character,
- // well, specially.
- if (ch == _UNICODE_LINE_BREAK)
- out.write("<br>");
- else if (ch == _UNICODE_HYPHENATION_POINT)
- out.write("<wbr>");
- else
- _writeDecRef(out, ch);
- }
- }
-
- _flushBuffer(out, buff, buffIndex);
+ _writeText(out, XMLEscapes.__BODY_ENTITIES, buff, text, start, length, true);
}
-
-
-
+
/**
- * Write String text. Note that this code is duplicated above for
- * character arrays - change both places if you make any changes!!!
+ * Write String text.
*/
static public void writeText(
Writer out,
- char[] buff,
- String text
+ char[] buff,
+ String text
) throws IOException
{
- int buffLength = buff.length;
- int buffIndex = 0;
-
- int length = text.length();
-
- for (int i = 0; i < length; i++)
- {
- char ch = text.charAt(i);
-
- if (ch < 0xA0)
- {
- // If "?" or over...
- if (ch >= 0x3f)
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- // If "'" or over...
- else if (ch >= 0x27)
- {
- if (ch < 0x3c)
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- else if (ch == '<')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write("<");
- }
- else if (ch == '>')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write(">");
- }
- else
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- }
- else
- {
- if (ch == '&')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write("&");
- }
- else if (ch == 0x0A)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _println(out);
- if ((i + 1 < length) && (text.charAt(i + 1) == 0x0D))
- i++;
- }
- else if (ch == 0x0D)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _println(out);
- if ((i + 1 < length) && (text.charAt(i + 1) == 0x0A))
- i++;
- }
- else
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- }
- }
- else if (ch <= 0xff)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write('&');
- out.write(_sISO8859_1_Entities[ch - 0xA0]);
- out.write(';');
- }
- else
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- // See above for what _UNICODE_LINE_BREAK means...
- if (ch == _UNICODE_LINE_BREAK)
- out.write("<br>");
- else if (ch == _UNICODE_HYPHENATION_POINT)
- out.write("<wbr>");
- else
- _writeDecRef(out, ch);
- }
- }
-
- _flushBuffer(out, buff, buffIndex);
+ _writeText(out, XMLEscapes.__BODY_ENTITIES, buff, text, true);
}
-
/**
- * Write a string attribute. Note that this code
- * is duplicated below for character arrays - change both
- * places if you make any changes!!!
+ * Write a string attribute
*/
static public void writeAttribute(
Writer out,
- char[] buff,
- String text
+ char[] buff,
+ String attributeValue
)
throws IOException
{
- int buffLength = buff.length;
+ _writeText(out, _ATTRIBUTE_ENTITIES, buff, attributeValue, false);
+ }
+
+ /**
+ * Write char array text. Note that this code is duplicated below
+ * for Strings - change both places if you make any changes!!!
+ */
+ static private void _writeText(
+ final Writer out,
+ final String[] entities,
+ final char[] buff,
+ final char[] text,
+ final int start,
+ final int length,
+ final boolean isBodyText
+ ) throws IOException
+ {
int buffIndex = 0;
- int length = text.length();
- for (int i = 0; i < length; i++)
+ final int end = start + length;
+
+ for (int i = 0; i < end; i++)
{
- char ch = text.charAt(i);
+ final char ch = text[i];
if (ch < 0xA0)
{
- // If "?" or over...
+ // text is in the US7ASCII range
if (ch >= 0x3f)
{
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- // If "'" or over...
- else if (ch >= 0x27)
- {
- if (ch < 0x3c)
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- // Note - "<" isn't escaped in attributes, as per HTML spec
- }
- else if (ch == '>')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write(">");
- }
- else
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
+ // US7ASCII text at "?" and above never needs to be escaped
+ buffIndex = _addToBuffer(out, buff, buffIndex, ch);
}
else
{
- if (ch == '&')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- // HTML 4.0, section B.7.1: ampersands followed by
- // an open brace don't get escaped
- if ((i + 1 < length) &&
- (text.charAt(i + 1) == '{'))
- out.write(ch);
+ // speed up handling of common characters like the space character by splitting the
+ // range with possible entities into two parts--the high part where a null entity means
+ // write the chacter through straight and the low part where a null entity means that
+ // we have a line feed or carriage return, which require special handling
+ if (ch > 0xD)
+ {
+ // high part of entities. Null entry means write ch through to buffer
+ String entity = entities[ch];
+
+ if (entity == null)
+ {
+ buffIndex = _addToBuffer(out, buff, buffIndex, ch);
+ }
else
- out.write("&");
- }
- else if (ch == '"')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write(""");
- }
- else if (ch == 0x0A)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _println(out);
- if ((i + 1 < length) && (text.charAt(i + 1) == 0x0D))
- i++;
- }
- else if (ch == 0x0D)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _println(out);
- if ((i + 1 < length) && (text.charAt(i + 1) == 0x0A))
- i++;
+ {
+ // special case handling of & in attributes to support macros in future versions
+ // of HTML
+ if (ch == '&' && !isBodyText && (i + 1 < length) && (text[i + 1] == '{'))
+ buffIndex = _addToBuffer(out, buff, buffIndex, ch);
+ else
+ {
+ // not weird & attribute case, so write the entity
+ buffIndex = _addToBuffer(out, buff, buffIndex, entity);
+ }
+ }
}
else
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
+ {
+ // low part of entities. Null entry means we have a carriage return or line feed
+ String entity = entities[ch];
+
+ if (entity != null)
+ {
+ buffIndex = _addToBuffer(out, buff, buffIndex, entity);
+ }
+ else
+ {
+ buffIndex = _flushBuffer(out, buff, buffIndex);
+ // handle carriage return/line feed
+
+ // write out a newline
+ _println(out);
+
+ // collapse combinations of carriage return/line feed or line feed/carriage return
+ // together
+ char checkChar = (char)((ch == 0xD) ? 0xA : 0xD);
+
+ if ((i + 1 < length) && (text[i + 1] == checkChar))
+ i++;
+ }
}
}
}
else if (ch <= 0xff)
{
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write('&');
- out.write(_sISO8859_1_Entities[ch - 0xA0]);
- out.write(';');
- }
- else
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _writeDecRef(out, ch);
+ // character is in the hight ISO range, so use HTML entity
+ buffIndex = _addToBuffer(out, buff, buffIndex, _sISO8859_1_Entities[ch - 0xA0]);
}
- }
-
- _flushBuffer(out, buff, buffIndex);
- }
-
-
- static public void writeAttribute(
- Writer out,
- char[] buffer,
- char[] text
- )
- throws IOException
- {
- writeAttribute(out, buffer, text, 0, text.length);
- }
-
-
- /**
- * Write a character array attribute. Note that this code
- * is duplicated below for character arrays - change both
- * places if you make any changes!!!
- */
- static public void writeAttribute(
- Writer out,
- char[] buff,
- char[] text,
- int start,
- int length) throws IOException
- {
- int buffLength = buff.length;
- int buffIndex = 0;
-
- int end = start + length;
- for (int i = start; i < end; i++)
- {
- char ch = text[i];
-
- if (ch < 0xA0)
+ else if (ch < 0xfffe) // characters fffe and ffff are considered outside of unicode
{
- // If "?" or over...
- if (ch >= 0x3f)
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- // If "'" or over...
- else if (ch >= 0x27)
+ // character is outside of the ISO range
+ if (isBodyText)
{
- if (ch < 0x3c)
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
- // Note - "<" isn't escaped in attributes, as per HTML spec
- else if (ch == '>')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write(">");
- }
+ // See above for what _UNICODE_LINE_BREAK means...
+ if (ch == _UNICODE_LINE_BREAK)
+ buffIndex = _addToBuffer(out, buff, buffIndex, "<br>");
+ else if (ch == _UNICODE_HYPHENATION_POINT)
+ buffIndex = _addToBuffer(out, buff, buffIndex, "wbr>");
else
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
+ buffIndex = _writeDecRef(out, buff, buffIndex, ch);
}
else
{
- if (ch == '&')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- // HTML 4.0, section B.7.1: ampersands followed by
- // an open brace don't get escaped
- if ((i + 1 < end) &&
- (text[i + 1] == '{'))
- out.write(ch);
- else
- out.write("&");
- }
- else if (ch == '"')
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write(""");
- }
- else if (ch == 0x0A)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _println(out);
- if ((i + 1 < end) && (text[i + 1] == 0x0D))
- i++;
- }
- else if (ch == 0x0D)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _println(out);
- if ((i + 1 < end) && (text[i + 1] == 0x0A))
- i++;
- }
- else
- {
- buffIndex = _addToBuffer(out, buff, buffIndex, buffLength, ch);
- }
+ buffIndex = _writeDecRef(out, buff, buffIndex, ch);
}
}
- else if (ch <= 0xff)
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- out.write('&');
- out.write(_sISO8859_1_Entities[ch - 0xA0]);
- out.write(';');
- }
- else
- {
- buffIndex = _flushBuffer(out, buff, buffIndex);
-
- _writeDecRef(out, ch);
- }
}
+ // flush the buffer, since the caller doesn't try to maintain the buffer index betweeen calls
_flushBuffer(out, buff, buffIndex);
}
-
-
+
/**
- * Returns the index at which the first escaped character appears
+ * Write String text. Note that this code is duplicated above for
+ * character arrays - change both places if you make any changes!!!
*/
- private static int _getEscapedIndex(
- String text
- )
+ static private void _writeText(
+ final Writer out,
+ final String[] entities,
+ final char[] buff,
+ final String text,
+ final boolean isBodyText
+ ) throws IOException
{
- int length = text.length();
+ int buffIndex = 0;
- int i = 0;
+ final int length = text.length();
- for (; i < length; i++)
+ for (int i = 0; i < length; i++)
{
- char ch = text.charAt(i);
+ final char ch = text.charAt(i);
if (ch < 0xA0)
{
- // If "?" or over...
+ // text is in the US7ASCII range
if (ch >= 0x3f)
{
- continue;
- }
- // If "'" or over...
- else if (ch >= 0x27)
- {
- if (ch < 0x3c)
- {
- continue;
- }
- else if (ch == '<')
- {
- // =-= bts argh!! "<" isn't supposed to be escaped in attributes,
- // as per HTML spec
- break;
- }
- else if (ch == '>')
- {
- break;
- }
- else
- {
- continue;
- }
+ // US7ASCII text at "?" and above never needs to be escaped
+ buffIndex = _addToBuffer(out, buff, buffIndex, ch);
}
else
{
- if (ch == '&')
- {
- // HTML 4.0, section B.7.1: ampersands followed by
- // an open brace don't get escaped
- if ((i + 1 < length) &&
- (text.charAt(i + 1) == '{'))
+ // speed up handling of common characters like the space character by splitting the
+ // range with possible entities into two parts--the high part where a null entity means
+ // write the chacter through straight and the low part where a null entity means that
+ // we have a line feed or carriage return, which require special handling
+ if (ch > 0xD)
+ {
+ // high part of entities. Null entry means write ch through to buffer
+ String entity = entities[ch];
+
+ if (entity == null)
{
- continue;
+ buffIndex = _addToBuffer(out, buff, buffIndex, ch);
}
else
{
- break;
+ // special case handling of & in attributes to support macros in future versions
+ // of HTML
+ if (ch == '&' && !isBodyText && (i + 1 < length) && (text.charAt(i + 1) == '{'))
+ buffIndex = _addToBuffer(out, buff, buffIndex, ch);
+ else
+ {
+ // not weird & attribute case, so write the entity
+ buffIndex = _addToBuffer(out, buff, buffIndex, entity);
+ }
}
}
- else if (ch == '"')
- {
- break;
- }
else
- {
- continue;
+ {
+ // low part of entities. Null entry means we have a carriage return or line feed
+ String entity = entities[ch];
+
+ if (entity != null)
+ {
+ buffIndex = _addToBuffer(out, buff, buffIndex, entity);
+ }
+ else
+ {
+ buffIndex = _flushBuffer(out, buff, buffIndex);
+
+ // handle carriage return/line feed
+
+ // write out a newline
+ _println(out);
+
+ // collapse combinations of carriage return/line feed or line feed/carriage return
+ // together
+ char checkChar = (char)((ch == 0xD) ? 0xA : 0xD);
+
+ if ((i + 1 < length) && (text.charAt(i + 1) == checkChar))
+ i++;
+ }
}
}
}
- else
+ else if (ch <= 0xff)
+ {
+ // character is in the hight ISO range, so use HTML entity
+ buffIndex = _addToBuffer(out, buff, buffIndex, _sISO8859_1_Entities[ch - 0xA0]);
+ }
+ else if (ch < 0xfffe) // characters fffe and ffff are considered outside of unicode
{
- break;
+ // character is outside of the ISO range
+ if (isBodyText)
+ {
+ // See above for what _UNICODE_LINE_BREAK means...
+ if (ch == _UNICODE_LINE_BREAK)
+ buffIndex = _addToBuffer(out, buff, buffIndex, "<br>");
+ else if (ch == _UNICODE_HYPHENATION_POINT)
+ buffIndex = _addToBuffer(out, buff, buffIndex, "<wbr>");
+ else
+ buffIndex = _writeDecRef(out, buff, buffIndex, ch);
+ }
+ else
+ {
+ buffIndex = _writeDecRef(out, buff, buffIndex, ch);
+ }
}
}
- return i;
+ // flush the buffer, since the caller doesn't try to maintain the buffer index betweeen calls
+ _flushBuffer(out, buff, buffIndex);
}
/**
- * Append a String to a buffer at an offset and return the new buffer offset
- */
- static private int _addStringToBuffer(
- char[] buffer,
- int offset,
- String text
- )
- {
- int length = text.length();
-
- for (int i = 0; i < length; i++)
- {
- buffer[offset++] = text.charAt(i);
- }
-
- return offset;
- }
-
-
- /**
- * Append a decimal character entitity to a buffer at an offset and return
- * the new buffer offset
+ * Writes the output as a decimal escape. This is the same size or smaller than the hex
+ * equivalent and works on versions of Netscape before 4.74. See bug #1491321.
+ * <p>
*/
- static private int _addDecRefToBuffer(
- char[] buffer,
- int offset,
- char ch
- )
+ static private int _writeDecRef(
+ final Writer out,
+ final char[] buff,
+ int buffIndex,
+ final char ch
+ ) throws IOException
{
- buffer[offset++] = '&';
- buffer[offset++] = '#';
-
// Formerly used String.valueOf(). This version tests out
// about 40% faster (and on systems where GC is going gonzo,
// it should be massively better)
- int i = ch;
- if (i > 10000)
- {
- buffer[offset++] = (char)('0' + (i / 10000));
- i = i % 10000;
- buffer[offset++] = (char)('0' + (i / 1000));
- i = i % 1000;
- buffer[offset++] = (char)('0' + (i / 100));
- i = i % 100;
- buffer[offset++] = (char)('0' + (i / 10));
- i = i % 10;
- buffer[offset++] = (char)('0' + i);
- }
- else if (i > 1000)
+
+ // two branches, one using the buffer and one not
+ if (buffIndex + 8 > buff.length)
{
- buffer[offset++] = (char)('0' + (i / 1000));
- i = i % 1000;
- buffer[offset++] = (char)('0' + (i / 100));
- i = i % 100;
- buffer[offset++] = (char)('0' + (i / 10));
- i = i % 10;
- buffer[offset++] = (char)('0' + i);
+ // not enough room for biggest possible numeric character entry,
+ // so flush buffer before we write to the output stream directly
+ buffIndex = _flushBuffer(out, buff, buffIndex);
+
+ // use XML escaping code
+ XMLEscapes.__writeDecRef(out, ch);
}
else
{
- buffer[offset++] = (char)('0' + (i / 100));
- i = i % 100;
- buffer[offset++] = (char)('0' + (i / 10));
- i = i % 10;
- buffer[offset++] = (char)('0' + i);
- }
+ int i = ch;
- buffer[offset++] = ';';
+ // we have enough space for the biggest string, so use buffer
+ buff[buffIndex++] = '&';
+ buff[buffIndex++] = '#';
+
+ if (i > 10000)
+ {
+ buff[buffIndex++] = (char)('0' + (i / 10000));
+ i = i % 10000;
+ buff[buffIndex++] = (char)('0' + (i / 1000));
+ i = i % 1000;
+ buff[buffIndex++] = (char)('0' + (i / 100));
+ i = i % 100;
+ buff[buffIndex++] = (char)('0' + (i / 10));
+ i = i % 10;
+ buff[buffIndex++] = (char)('0' + i);
+ }
+ else if (i > 1000)
+ {
+ buff[buffIndex++] = (char)('0' + (i / 1000));
+ i = i % 1000;
+ buff[buffIndex++] = (char)('0' + (i / 100));
+ i = i % 100;
+ buff[buffIndex++] = (char)('0' + (i / 10));
+ i = i % 10;
+ buff[buffIndex++] = (char)('0' + i);
+ }
+ else
+ {
+ buff[buffIndex++] = (char)('0' + (i / 100));
+ i = i % 100;
+ buff[buffIndex++] = (char)('0' + (i / 10));
+ i = i % 10;
+ buff[buffIndex++] = (char)('0' + i);
+ }
- return offset;
- }
+ buff[buffIndex++] = ';';
+ }
+
+ return buffIndex;
+ }
/**
- * Writes the output as a decimal escape. This is larger than the hex
- * equivalent but works on versions of Netscape before 4.74, and should
- * be faster than the hex version. See bug #1491321.
- * <p>
+ * Add a character to the buffer, flushing the buffer if the buffer is full,
+ * and returning the new buffer index
*/
- static private void _writeDecRef(
+ private static int _addToBuffer(
Writer out,
- char ch
+ char[] buffer,
+ int bufferIndex,
+ char ch
) throws IOException
{
- out.write("&#");
- // Formerly used String.valueOf(). This version tests out
- // about 40% faster (and on systems where GC is going gonzo,
- // it should be massively better)
- int i = ch;
- if (i > 10000)
- {
- out.write('0' + (i / 10000));
- i = i % 10000;
- out.write('0' + (i / 1000));
- i = i % 1000;
- out.write('0' + (i / 100));
- i = i % 100;
- out.write('0' + (i / 10));
- i = i % 10;
- out.write('0' + i);
- }
- else if (i > 1000)
- {
- out.write('0' + (i / 1000));
- i = i % 1000;
- out.write('0' + (i / 100));
- i = i % 100;
- out.write('0' + (i / 10));
- i = i % 10;
- out.write('0' + i);
- }
- else
+ if (bufferIndex >= buffer.length)
{
- out.write('0' + (i / 100));
- i = i % 100;
- out.write('0' + (i / 10));
- i = i % 10;
- out.write('0' + i);
+ out.write(buffer, 0, bufferIndex);
+ bufferIndex = 0;
}
- out.write(';');
- }
+ buffer[bufferIndex] = ch;
+ return bufferIndex + 1;
+ }
/**
- * Add a character to the buffer, flushing the buffer if the buffer is full,
+ * Add a String to the buffer, flushing the buffer if the buffer is full,
* and returning the new buffer index
*/
private static int _addToBuffer(
Writer out,
- char[] buffer,
- int bufferIndex,
- int bufferLength,
- char ch
+ char[] buffer,
+ int bufferIndex,
+ String outString
) throws IOException
{
- if (bufferIndex >= bufferLength)
+ int writeSize = outString.length();
+ int outSize = bufferIndex + writeSize;
+
+ if (outSize >= buffer.length)
{
+ // flush the buffer
out.write(buffer, 0, bufferIndex);
bufferIndex = 0;
+
+ // we will be the first chars in the buffer
+ outSize = writeSize;
}
- buffer[bufferIndex] = ch;
-
- return bufferIndex + 1;
+ // copy into the buffer
+ outString.getChars(0, writeSize, buffer, bufferIndex);
+
+ return outSize;
}
-
/**
* Flush the contents of the buffer to the output stream
* and return the reset buffer index
*/
private static int _flushBuffer(
Writer out,
- char[] buffer,
- int bufferIndex
+ char[] buffer,
+ int bufferIndex
) throws IOException
{
if (bufferIndex > 0)
{
out.write(buffer, 0, bufferIndex);
- bufferIndex = 0;
}
- return bufferIndex;
+ return 0;
}
private static void _println(Writer out) throws IOException
{
out.write('\n');
}
+
private HTMLEscapes()
{
}
+ // array of entities that need to be output in attributes for code points 0 - 62
+ private static final String[] _ATTRIBUTE_ENTITIES;
+
+ static
+ {
+ // initialize the entities that need to be escaped for attributes
+
+ // we also need to escape the quote in attributes, but not the less-than
+ _ATTRIBUTE_ENTITIES = XMLEscapes.__BASE_ENTITIES.clone();
+ _ATTRIBUTE_ENTITIES['"'] = """;
+ }
+
//
// Entities from HTML 4.0, section 24.2.1; character codes 0xA0 to 0xFF
+ // If content size is important, all entities longer than four characters should be replaced
+ // by their numeric equivalents
//
static private String[] _sISO8859_1_Entities = new String[]
{
- "nbsp",
- "iexcl",
- "cent",
- "pound",
- "curren",
- "yen",
- "brvbar",
- "sect",
- "uml",
- "copy",
- "ordf",
- "laquo",
- "not",
- "shy",
- "reg",
- "macr",
- "deg",
- "plusmn",
- "sup2",
- "sup3",
- "acute",
- "micro",
- "para",
- "middot",
- "cedil",
- "sup1",
- "ordm",
- "raquo",
- "frac14",
- "frac12",
- "frac34",
- "iquest",
- "Agrave",
- "Aacute",
- "Acirc",
- "Atilde",
- "Auml",
- "Aring",
- "AElig",
- "Ccedil",
- "Egrave",
- "Eacute",
- "Ecirc",
- "Euml",
- "Igrave",
- "Iacute",
- "Icirc",
- "Iuml",
- "ETH",
- "Ntilde",
- "Ograve",
- "Oacute",
- "Ocirc",
- "Otilde",
- "Ouml",
- "times",
- "Oslash",
- "Ugrave",
- "Uacute",
- "Ucirc",
- "Uuml",
- "Yacute",
- "THORN",
- "szlig",
- "agrave",
- "aacute",
- "acirc",
- "atilde",
- "auml",
- "aring",
- "aelig",
- "ccedil",
- "egrave",
- "eacute",
- "ecirc",
- "euml",
- "igrave",
- "iacute",
- "icirc",
- "iuml",
- "eth",
- "ntilde",
- "ograve",
- "oacute",
- "ocirc",
- "otilde",
- "ouml",
- "divide",
- "oslash",
- "ugrave",
- "uacute",
- "ucirc",
- "uuml",
- "yacute",
- "thorn",
- "yuml"
+ " ",
+ "¡",
+ "¢",
+ "£",
+ "¤",
+ "¥",
+ "¦",
+ "§",
+ "¨",
+ "©",
+ "ª",
+ "«",
+ "¬",
+ "­",
+ "®",
+ "¯",
+ "°",
+ "±",
+ "²",
+ "³",
+ "´",
+ "µ",
+ "¶",
+ "·",
+ "¸",
+ "¹",
+ "º",
+ "»",
+ "¼",
+ "½",
+ "¾",
+ "¿",
+ "À",
+ "Á",
+ "Â",
+ "Ã",
+ "Ä",
+ "Å",
+ "Æ",
+ "Ç",
+ "È",
+ "É",
+ "Ê",
+ "Ë",
+ "Ì",
+ "Í",
+ "Î",
+ "Ï",
+ "Ð",
+ "Ñ",
+ "Ò",
+ "Ó",
+ "Ô",
+ "Õ",
+ "Ö",
+ "×",
+ "Ø",
+ "Ù",
+ "Ú",
+ "Û",
+ "Ü",
+ "Ý",
+ "Þ",
+ "ß",
+ "à",
+ "á",
+ "â",
+ "ã",
+ "ä",
+ "å",
+ "æ",
+ "ç",
+ "è",
+ "é",
+ "ê",
+ "ë",
+ "ì",
+ "í",
+ "î",
+ "ï",
+ "ð",
+ "ñ",
+ "ò",
+ "ó",
+ "ô",
+ "õ",
+ "ö",
+ "÷",
+ "ø",
+ "ù",
+ "ú",
+ "û",
+ "ü",
+ "ý",
+ "þ",
+ "ÿ"
};
// =-=AEW Need entities from 24.3.1 and 24.4.1
// Constant for the Unicode line break character
static private final char _UNICODE_LINE_BREAK = 0x2028;
-
+
// Constant for the Unicode hyphenation point character.
// UIFunctions.hyphenate(..) uses this character to indicate where to insert
// the <wbr> tag. This tag inserts a no-width-space so that the browser may
Modified: myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HtmlResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HtmlResponseWriter.java?rev=903907&r1=903906&r2=903907&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HtmlResponseWriter.java (original)
+++ myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/HtmlResponseWriter.java Wed Jan 27 23:36:24 2010
@@ -418,13 +418,15 @@
return;
}
+ String stringValue = value.toString();
+
if (isAttribute)
{
- HTMLEscapes.writeAttribute(_out, _buffer, value.toString());
+ HTMLEscapes.writeAttribute(_out, _buffer, stringValue);
}
else
{
- HTMLEscapes.writeText(_out, _buffer, value.toString());
+ HTMLEscapes.writeText(_out, _buffer, stringValue);
}
}
Modified: myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XMLEscapes.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XMLEscapes.java?rev=903907&r1=903906&r2=903907&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XMLEscapes.java (original)
+++ myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XMLEscapes.java Wed Jan 27 23:36:24 2010
@@ -27,111 +27,288 @@
*/
public class XMLEscapes
{
+ /**
+ * Write String text.
+ */
+ static public void writeText(
+ Writer out,
+ String text
+ ) throws IOException
+ {
+ _writeText(out, text, __BODY_ENTITIES);
+ }
+
+ /**
+ * Write char[] text.
+ */
+ static public void writeText(
+ Writer out,
+ char[] text,
+ int start,
+ int length) throws IOException
+ {
+ _writeText(out, text, start, length, __BODY_ENTITIES);
+ }
+
+ /**
+ * Write a string attribute
+ */
static public void writeAttribute(
- Appendable out,
- CharSequence text) throws IOException
+ Writer out,
+ String attributeValue
+ )
+ throws IOException
+ {
+ _writeText(out, attributeValue, _ATTRIBUTE_ENTITIES);
+ }
+
+ /**
+ * Writes out char[] text encoded with the specified entities. Passing in the entities allows
+ * us to cover the differences between attribute and body text encoding in a single definition.
+ *
+ * This code is duplicated below for the String version
+ * @param text
+ * @param start
+ * @param length
+ * @param entities
+ * @throws IOException
+ */
+ private static void _writeText(
+ final Writer out,
+ final char[] text,
+ final int start,
+ final int length,
+ final String[] entities) throws IOException
{
- int length = text.length();
- for (int i = 0; i < length; i++)
+ final int end = start + length;
+
+ for (int i = start; i < end; i++)
{
- // =-=AEW It could be more efficient using append(CharSequence, int, int)
- // to write out large subsequences. However, Writers don't seem to optimize
- // that method, so would it really be better?
- char ch = text.charAt(i);
+ char ch = text[i];
+
+ // check for US7ASCII first, as that is the most common
if (ch <= 0x7f)
{
- if (ch == '>')
- out.append(">");
- else if (ch == '<')
- out.append("<");
- // AEW We probably shouldn't be doing this (unless we're
- // in an attribute)
- else if (ch == '"')
- out.append(""");
- else if (ch == '&')
- out.append("&");
+ if (ch >= 0x3f)
+ {
+ // US7ASCII characters at ? and above never need to be escaped
+ out.write(ch);
+ }
else
- out.append(ch);
+ {
+ String entity = entities[ch];
+
+ // if we have an entity, use it., otherwise the character needs no escaping
+ if (entity != null)
+ out.write(entity);
+ else
+ out.write(ch);
+ }
}
else
{
- _writeHexRef(out, ch);
+ // make sure we are a valid high character
+ if ((ch <= '\uD7FF') || ((ch >= '\uE000')) && (ch <= '\uFFFD'))
+ __writeDecRef(out, ch);
}
}
-
}
-
-
- // =-=AEW Performance - look at whether text and attributes
- // should be stored as character arrays or strings (might be
- // different decision for each), and make this class conform.
- static public void writeText(Writer out, char[] text)
- throws IOException
+ /**
+ * Writes out String text encoded with the specified entities. Passing in the entities allows
+ * us to cover the differences between attribute and body text encoding in a single definition.
+ *
+ * This code is duplicated above for the char[] version
+ * @param text
+ * @param entities
+ * @throws IOException
+ */
+ private static void _writeText(
+ final Writer out,
+ final String text,
+ final String[] entities) throws IOException
{
- writeText(out, text, 0, text.length);
- }
+ final int end = text.length();
- static public void writeText(
- Writer out,
- char[] text,
- int start,
- int length) throws IOException
- {
- int end = start + length;
- for (int i = start; i < end; i++)
+ for (int i = 0; i < end; i++)
{
- char ch = text[i];
-
+ char ch = text.charAt(i);
+
+ // check for US7ASCII first, as that is the most common
if (ch <= 0x7f)
{
- if (ch == '>')
- out.write(">");
- else if (ch == '<')
- out.write("<");
- // AEW We probably shouldn't be doing this (unless we're
- // in an attribute)
- else if (ch == '"')
- out.write(""");
- else if (ch == '&')
- out.write("&");
+ if (ch >= 0x3f)
+ {
+ // US7ASCII characters at ? and above never need to be escaped
+ out.write(ch);
+ }
else
{
- out.write(ch);
+ String entity = entities[ch];
+
+ // if we have an entity, use it., otherwise the character needs no escaping
+ if (entity != null)
+ out.write(entity);
+ else
+ out.write(ch);
}
}
else
{
- _writeHexRef(out, ch);
+ // make sure we are a valid high character
+ if ((ch <= '\uD7FF') || ((ch >= '\uE000')) && (ch <= '\uFFFD'))
+ __writeDecRef(out, ch);
}
}
}
- static public void writeAttribute(Writer out, char[] text)
- throws IOException
+ /**
+ * Writes the output as a decimal escape. This is the same size or smaller than the hex
+ * equivalent and works on versions of Netscape before 4.74. See bug #1491321.
+ * <p>
+ */
+ static void __writeDecRef(
+ final Writer out,
+ final char ch
+ ) throws IOException
{
- writeText(out, text);
- }
+ // Formerly used String.valueOf(). This version tests out
+ // about 40% faster (and on systems where GC is going gonzo,
+ // it should be massively better
+ out.write("&#");
- static public void writeAttribute(
- Writer out,
- char[] text,
- int start,
- int length) throws IOException
- {
- writeText(out, text, start, length);
+ int i = ch;
+
+ if (i > 10000)
+ {
+ out.write('0' + (i / 10000));
+ i = i % 10000;
+ out.write('0' + (i / 1000));
+ i = i % 1000;
+ out.write('0' + (i / 100));
+ i = i % 100;
+ out.write('0' + (i / 10));
+ i = i % 10;
+ out.write('0' + i);
+ }
+ else if (i > 1000)
+ {
+ out.write('0' + (i / 1000));
+ i = i % 1000;
+ out.write('0' + (i / 100));
+ i = i % 100;
+ out.write('0' + (i / 10));
+ i = i % 10;
+ out.write('0' + i);
+ }
+ else
+ {
+ out.write('0' + (i / 100));
+ i = i % 100;
+ out.write('0' + (i / 10));
+ i = i % 10;
+ out.write('0' + i);
+ }
+
+ out.write(';');
}
- static private void _writeHexRef(
- Appendable out,
- char ch
- ) throws IOException
+ // intersection array of entities that need to be output in attributes for code points 0 - 62
+ // regardless of whether the output in XML/HTML or body text or attribute text. In particular,
+ // the less than character is not escaped. as it doesn't need to be escaped in HTML attributes.
+ //
+ // The array covers the first 63 code points of HTML/XML.
+ // By combining the the numberic character references needed for the
+ // illegal HTML/XML characters with the
+ // other entities needed for escaping we simplify the code and allow the attribute and
+ // body text escaping to share the same logic
+ // for unused characters, see http://www.w3.org/TR/REC-html40/sgml/sgmldecl.html
+ // Shared with HTML Escapes
+ static final String[] __BASE_ENTITIES =
{
- out.append("&#x");
- // =-=AEW Could easily be more efficient.
- out.append(Integer.toHexString(ch));
- out.append(';');
- }
+ "", // invalid HTML/XML characet
+ // suppress the 0 character because IE can't display its entity correctly
+ "", // invalid HTML/XML character
+ "", // invalid HTML/XML character
+ "", // invalid HTML/XML character
+ "", // invalid HTML/XML character
+ "", // invalid HTML/XML character
+ "", // invalid HTML/XML character
+ "", // invalid HTML/XML character
+ "", // invalid HTML/XML character
+ "	", // invalid HTML/XML character
+ null, // 10, newline
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ null, // 13, newline
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ "",// invalid HTML/XML character
+ null, // 32 space
+ null, // 33 !
+ null, // 34 "
+ null, // 35 #
+ null, // 36 $
+ null, // 37 %
+ "&",// 38 &
+ null, // 39 '
+ null, // 40 (
+ null, // 41 )
+ null, // 42 *
+ null, // 43 +
+ null, // 44 ,
+ null, // 45 -
+ null, // 46 .
+ null, // 47 /
+ null, // 48 0
+ null, // 49 1
+ null, // 50 2
+ null, // 51 3
+ null, // 52 4
+ null, // 53 5
+ null, // 54 6
+ null, // 55 7
+ null, // 56 8
+ null, // 57 9
+ null, // 58 :
+ null, // 59 ;
+ null, // 60 <
+ null, // 61 =
+ ">", // 62 >
+ };
+
+ // array of entities that need to be output in attributes for code points 0 - 62
+ // Shared with HTML Escapes
+ static final String[] __BODY_ENTITIES;
+
+ // array of entities that need to be output in attributes for code points 0 - 62
+ private static final String[] _ATTRIBUTE_ENTITIES;
+
+ static
+ {
+ // we need to escape the less than in body text, but not the quote
+ __BODY_ENTITIES = __BASE_ENTITIES.clone();
+ __BODY_ENTITIES['<'] = "<";
+
+ // we also need to escape the quote in attributes
+ _ATTRIBUTE_ENTITIES = __BODY_ENTITIES.clone();
+ _ATTRIBUTE_ENTITIES['"'] = """;
+ }
private XMLEscapes()
{
Modified: myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XhtmlResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XhtmlResponseWriter.java?rev=903907&r1=903906&r2=903907&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XhtmlResponseWriter.java (original)
+++ myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/io/XhtmlResponseWriter.java Wed Jan 27 23:36:24 2010
@@ -240,6 +240,8 @@
{
if (text != null)
{
+ String valueString = text.toString();
+
if (_dontEscape)
{
write(text.toString());
@@ -248,7 +250,7 @@
{
_closeStartIfNecessary();
- XMLEscapes.writeText(_out, text.toString().toCharArray());
+ XMLEscapes.writeText(_out, valueString);
}
}
}
@@ -349,13 +351,15 @@
return;
}
+ String stringValue = value.toString();
+
if (isAttribute)
{
- XMLEscapes.writeAttribute(_out, value.toString().toCharArray());
+ XMLEscapes.writeAttribute(_out, stringValue);
}
else
{
- XMLEscapes.writeText(_out, value.toString().toCharArray());
+ XMLEscapes.writeText(_out, stringValue);
}
}
Modified: myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/XmlResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/XmlResponseWriter.java?rev=903907&r1=903906&r2=903907&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/XmlResponseWriter.java (original)
+++ myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/XmlResponseWriter.java Wed Jan 27 23:36:24 2010
@@ -25,6 +25,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.ResponseWriter;
+import org.apache.myfaces.trinidadinternal.io.XMLEscapes;
+
public class XmlResponseWriter extends ResponseWriter
{
public XmlResponseWriter(
@@ -76,11 +78,12 @@
return;
Writer out = _out;
+
// write the attribute value
out.write(' ');
out.write(name);
out.write("=\"");
- writeAttributeText(value, attrName);
+ XMLEscapes.writeAttribute(out, value.toString());
out.write("\"");
}
@@ -99,14 +102,14 @@
}
public void writeText(
- char[] buffer,
+ char[] text,
int offset,
int length) throws IOException
{
- if (buffer != null)
+ if (text != null)
{
closeStartIfNecessary();
- _writeBodyText(buffer, offset, length);
+ XMLEscapes.writeText(_out, text, offset, length);
}
}
@@ -117,8 +120,7 @@
if (text != null)
{
closeStartIfNecessary();
- //_openCDATAIfNecessary();
- writeBodyText(text, attrName);
+ XMLEscapes.writeText(_out, text.toString());
}
}
@@ -141,7 +143,6 @@
}
else
{
- //_closeCDATAIfNecessary();
out.write("</");
out.write(name);
out.write(">");
@@ -202,22 +203,6 @@
_out.flush();
}
- protected void writeAttributeText(
- Object text,
- String attrName) throws IOException
- {
- char[] buffer = text.toString().toCharArray();
- _writeAttributeText(buffer, 0, buffer.length);
- }
-
- protected void writeBodyText(
- Object text,
- String attrName) throws IOException
- {
- char[] buffer = text.toString().toCharArray();
- _writeBodyText(buffer, 0, buffer.length);
- }
-
protected void closeStartIfNecessary() throws IOException
{
if (_closeStart)
@@ -227,116 +212,8 @@
_closeStart = false;
}
}
-
- /*
- private void _openCDATAIfNecessary() throws IOException
- {
- if (!_closeCDATA)
- {
- Writer out = _out;
- out.write("<![CDATA[");
- _closeCDATA = true;
- }
- }
-
- private void _closeCDATAIfNecessary() throws IOException
- {
- if (_closeCDATA)
- {
- Writer out = _out;
- out.write("]]>");
- _closeCDATA = false;
- }
- }
- */
-
- private void _writeAttributeText(
- char[] text,
- int start,
- int length) throws IOException
- {
- Writer out = _out;
- int end = start + length;
- for (int i = start; i < end; i++)
- {
- char ch = text[i];
-
- if (ch <= 0x7f)
- {
- switch (ch)
- {
- case '>':
- out.write(">");
- break;
- case '<':
- out.write("<");
- break;
- case '"':
- out.write(""");
- break;
- case '&':
- out.write("&");
- break;
- default:
- out.write(ch);
- break;
- }
- }
- else
- {
- _writeHexRef(ch);
- }
- }
- }
-
- private void _writeBodyText(
- char[] text,
- int start,
- int length) throws IOException
- {
- Writer out = _out;
- int end = start + length;
- for (int i = start; i < end; i++)
- {
- char ch = text[i];
-
- if (ch <= 0x7f)
- {
- switch (ch)
- {
- case '>':
- out.write(">");
- break;
- case '<':
- out.write("<");
- break;
- case '&':
- out.write("&");
- break;
- default:
- out.write(ch);
- break;
- }
- }
- else
- {
- _writeHexRef(ch);
- }
- }
- }
-
- private void _writeHexRef(
- char ch) throws IOException
- {
- Writer out = _out;
- out.write("&#x");
- // =-=AEW Could easily be more efficient.
- out.write(Integer.toHexString(ch));
- out.write(';');
- }
private final Writer _out;
private final String _encoding;
private boolean _closeStart;
- // private boolean _closeCDATA;
}
Modified: myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java?rev=903907&r1=903906&r2=903907&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java (original)
+++ myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java Wed Jan 27 23:36:24 2010
@@ -348,7 +348,7 @@
}
else
{
- XMLEscapes.writeText(_out, text.toString().toCharArray());
+ XMLEscapes.writeText(_out, text.toString());
}
}
}
@@ -461,13 +461,15 @@
return;
}
+ String valueString = value.toString();
+
if (isAttribute)
{
- XMLEscapes.writeAttribute(_out, value.toString().toCharArray());
+ XMLEscapes.writeAttribute(_out, valueString);
}
else
{
- XMLEscapes.writeText(_out, value.toString().toCharArray());
+ XMLEscapes.writeText(_out, valueString);
}
}
Modified: myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimal-golden.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimal-golden.xml?rev=903907&r1=903906&r2=903907&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimal-golden.xml (original)
+++ myfaces/trinidad/branches/1.2.12.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/breadCrumbs-minimal-golden.xml Wed Jan 27 23:36:24 2010
@@ -20,7 +20,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -38,7 +38,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -80,7 +80,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -98,7 +98,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -143,7 +143,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
</div>
<div
@@ -151,7 +151,7 @@
<nobr
>
-           
+           
<span
dir="ltr"
>
@@ -165,7 +165,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
</div>
<div
@@ -173,7 +173,7 @@
<nobr
>
-                     
+                     
<span
dir="ltr"
>
@@ -212,7 +212,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -230,7 +230,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -273,7 +273,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -291,7 +291,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -334,7 +334,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -352,7 +352,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -395,7 +395,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -413,7 +413,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -456,7 +456,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -474,7 +474,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -517,7 +517,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -535,7 +535,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -578,7 +578,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -596,7 +596,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -639,7 +639,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -657,7 +657,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -700,7 +700,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -718,7 +718,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -761,7 +761,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -779,7 +779,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -822,7 +822,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -840,7 +840,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -883,7 +883,7 @@
>
First
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>
@@ -901,7 +901,7 @@
>
fifth
</a>
- </span>  >  
+ </span>  >  
</nobr>
<nobr
>