You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org> on 2017/04/27 09:23:04 UTC

[jira] [Resolved] (SANTUARIO-463) ConcurrentModificationException from Canonicalizer.canonicalize

     [ https://issues.apache.org/jira/browse/SANTUARIO-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh resolved SANTUARIO-463.
-------------------------------------------
    Resolution: Fixed

I updated the documentation for CanonicalizerBase to indicate that it is not thread safe. For 2.1.0, I fixed the specific issue that you ran in to. However I'm sure there are other thread safety problems looking at the code. 

> ConcurrentModificationException from Canonicalizer.canonicalize
> ---------------------------------------------------------------
>
>                 Key: SANTUARIO-463
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-463
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 2.0.7
>         Environment: java 1.7
>            Reporter: Jason Pyeron
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 2.1.0
>
>
> The API documentation does not indicate the class/method is not thread safe.
> Either fix the bug in code or documentation.
> {noformat}
> Caused By: java.util.ConcurrentModificationException
>                 at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1115)
>                 at java.util.TreeMap$KeyIterator.next(TreeMap.java:1169)
>                 at org.apache.xml.security.c14n.implementations.CanonicalizerBase.canonicalizeSubTree(CanonicalizerBase.java:296)
>                 at org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(CanonicalizerBase.java:197)
>                 at org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(CanonicalizerBase.java:117)
>                 at org.apache.xml.security.c14n.Canonicalizer.canonicalizeSubtree(Canonicalizer.java:303)
>                 at org.apache.xml.security.c14n.Canonicalizer.canonicalize(Canonicalizer.java:290)
>                 at gov.state.irm.ops.sio.esb.customer.hr.universalservice.pairs.support.OSBJavaCallOutUtil.canonizeAsByteArray(OSBJavaCallOutUtil.java:610)
> {noformat}
> Workaround:
> {code}
> 	public static final ThreadLocal<Canonicalizer> canons=new ThreadLocal<Canonicalizer>()
>     {
> 	    {
>             org.apache.xml.security.Init.init();
>         } 
> 	    @Override
> 	    protected Canonicalizer initialValue()
> 	    {
> 	        try
>             {
>                 return Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS);
>             }
> 	        catch (InvalidCanonicalizerException e)
>             {
>                 throw new Error(e);
>             }
> 	    }
> 	    
>     };
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)