mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.9 to HEAD
9846: Merged V2.2 to V2.9 9805: Merged V2.1 to V2.2 9450: WCM - fix minor typo 9456: Added direct QName child node handling test 9462: ACT-759 - nested forks issue. 9495: Lowered thread priority for index merge threads to default 5 9534: Fixed ETWOONE-242: ContentMetadataExtracter can optionally ditch unextracted aspect-linked properties 9559: Fixed SDK classpath 9560: Fix ETWOONE-241 9583: Fix for ETWOONE-250 (FacesContext null issue when authenticating via a ticket or guest auth) 9592: (ALREADY ON HEAD) 9709: Upgrade commons pool git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10607 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -184,6 +184,7 @@ public final class AuthenticationHelper
|
|||||||
session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
|
session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
|
||||||
|
|
||||||
// Set the current locale
|
// Set the current locale
|
||||||
|
FacesHelper.getFacesContext(req, res, sc);
|
||||||
I18NUtil.setLocale(Application.getLanguage(req.getSession()));
|
I18NUtil.setLocale(Application.getLanguage(req.getSession()));
|
||||||
|
|
||||||
// remove the session invalidated flag
|
// remove the session invalidated flag
|
||||||
@@ -331,6 +332,7 @@ public final class AuthenticationHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the current locale
|
// Set the current locale
|
||||||
|
FacesHelper.getFacesContext(httpRequest, httpResponse, context);
|
||||||
I18NUtil.setLocale(Application.getLanguage(httpRequest.getSession()));
|
I18NUtil.setLocale(Application.getLanguage(httpRequest.getSession()));
|
||||||
|
|
||||||
return AuthenticationStatus.Success;
|
return AuthenticationStatus.Success;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@@ -49,11 +49,8 @@ import org.xml.sax.SAXException;
|
|||||||
*/
|
*/
|
||||||
public class XMLUtil
|
public class XMLUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final Log LOGGER = LogFactory.getLog(XMLUtil.class);
|
private static final Log LOGGER = LogFactory.getLog(XMLUtil.class);
|
||||||
|
|
||||||
private static DocumentBuilder documentBuilder;
|
|
||||||
|
|
||||||
/** utility function for creating a document */
|
/** utility function for creating a document */
|
||||||
public static Document newDocument()
|
public static Document newDocument()
|
||||||
{
|
{
|
||||||
@@ -174,11 +171,7 @@ public class XMLUtil
|
|||||||
/** provides a document builder that is namespace aware but not validating by default */
|
/** provides a document builder that is namespace aware but not validating by default */
|
||||||
public static DocumentBuilder getDocumentBuilder()
|
public static DocumentBuilder getDocumentBuilder()
|
||||||
{
|
{
|
||||||
if (XMLUtil.documentBuilder == null)
|
return XMLUtil.getDocumentBuilder(true, false);
|
||||||
{
|
|
||||||
XMLUtil.documentBuilder = XMLUtil.getDocumentBuilder(true, false);
|
|
||||||
}
|
|
||||||
return XMLUtil.documentBuilder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
147
source/java/org/alfresco/web/forms/XMLUtilTest.java
Normal file
147
source/java/org/alfresco/web/forms/XMLUtilTest.java
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.web.forms;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple XMLUtil test
|
||||||
|
*/
|
||||||
|
public class XMLUtilTest extends TestCase
|
||||||
|
{
|
||||||
|
public static final String SOME_XML =
|
||||||
|
" <model name='test1:testModelOne' xmlns='http://www.alfresco.org/model/dictionary/1.0'>" +
|
||||||
|
" <description>Test model one</description>" +
|
||||||
|
" <author>Alfresco</author>" +
|
||||||
|
" <published>2008-01-01</published>" +
|
||||||
|
" <version>1.0</version>" +
|
||||||
|
" <imports>" +
|
||||||
|
" <import uri='http://www.alfresco.org/model/dictionary/1.0' prefix='d'/>" +
|
||||||
|
" </imports>" +
|
||||||
|
" <namespaces>" +
|
||||||
|
" <namespace uri='http://www.alfresco.org/test/testmodel1/1.0' prefix='test1'/>" +
|
||||||
|
" </namespaces>" +
|
||||||
|
" <types>" +
|
||||||
|
" <type name='test1:base'>" +
|
||||||
|
" <title>Base</title>" +
|
||||||
|
" <description>The Base Type</description>" +
|
||||||
|
" <properties>" +
|
||||||
|
" <property name='test1:prop1'>" +
|
||||||
|
" <type>d:text</type>" +
|
||||||
|
" </property>" +
|
||||||
|
" </properties>" +
|
||||||
|
" </type>" +
|
||||||
|
" </types>" +
|
||||||
|
" </model>";
|
||||||
|
|
||||||
|
|
||||||
|
private final static int threadCount = 5;
|
||||||
|
|
||||||
|
private final static int loopCount = 50;
|
||||||
|
private final static int randomNextInt = 100;
|
||||||
|
|
||||||
|
private Map<String, Throwable> errors = new HashMap<String, Throwable>();
|
||||||
|
|
||||||
|
|
||||||
|
protected void setUp() throws Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://issues.alfresco.com/browse/ETWOONE-241
|
||||||
|
public void testConcurrentParse()
|
||||||
|
{
|
||||||
|
ThreadGroup threadGroup = new ThreadGroup(getName());
|
||||||
|
Thread[] threads = new Thread[threadCount];
|
||||||
|
|
||||||
|
for (int i = 0; i < threadCount; i++)
|
||||||
|
{
|
||||||
|
threads[i] = new Thread(threadGroup, new TestRun(""+i), String.format("XMLUtilTest-%02d", i));
|
||||||
|
threads[i].start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// join each thread so that we wait for them all to finish
|
||||||
|
for (int i = 0; i < threads.length; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
threads[i].join();
|
||||||
|
}
|
||||||
|
catch (InterruptedException e)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errors.size() != 0)
|
||||||
|
{
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestRun extends Thread
|
||||||
|
{
|
||||||
|
private String arg;
|
||||||
|
|
||||||
|
public TestRun(String arg)
|
||||||
|
{
|
||||||
|
this.arg = arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArg()
|
||||||
|
{
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Random random = new Random(System.currentTimeMillis());
|
||||||
|
|
||||||
|
for (int i = 0; i < loopCount; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
XMLUtil.parse(SOME_XML); // ignore returned doc
|
||||||
|
}
|
||||||
|
catch (Throwable t)
|
||||||
|
{
|
||||||
|
t.printStackTrace();
|
||||||
|
errors.put(arg, t);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// random delay ...
|
||||||
|
if (randomNextInt != 0)
|
||||||
|
{
|
||||||
|
int msecs = random.nextInt(randomNextInt);
|
||||||
|
try {Thread.sleep(msecs);} catch (Exception exception){};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user