Merged V3.4-BUG-FIX to HEAD

28741: Merged DEV/TEMPORARY to V3.4-BUG-FIX
      28740: ALF-8993: IMAP favourite star is not visible if imap is enabled via JMX
         The org.alfresco.repo.imap.ImapService interface was extended to expose getEnabled() and made the webscript to call ImapService.getEnabled().
   28742: ALF-8801: Broken French strings
   28745: ALF-6470: French string correction
   28746: ALF-5607: Installer deletion of directories on installation cancel.
   28756: ALF-9211: Install fails when path selected that contains accents or double byte chars (e.g. Japanese)
   - Fix from Bitrock
   - Not internationalized yet
   28758: Merged DEV to V3.4-BUG-FIX
      28743: ALF-8029: JSON returned by some audit queries not valide
             Quote user in query.get.json.ftl if it has value.
   28761: Merged DEV to V3.4-BUG-FIX
      28739: ALF-9123 : "Content URL conversion failed" error being thrown
      Note: Actually changed the implementation but the principle remains.
      In future, use a thread-safe boolean e.g. AtomicBoolean to carry data
      around about the running state; don't use a class member variable as
      it can be manipulated by competing threads, etc.
   28762: Fix ALF-9376: Typo in Version2Model
   28763: Merged DEV to V3.4-BUG-FIX
      28754: ALF-8461: Invalid property cm:source (cm:copiedFrom) causes not be become sys:incomplete
             Configurable property called 'propertiesToIgnore' was added to IncompleteNodeTagger,and configured to ignore "cm:source".
      Merge note: I fixed the stored 'propertiesToIgnore' to be a Set<QName> to prevent unnecessary conversions
   28764: ALF-9036: Fix NPE on XForm session timeout
   28765: ALF-9211: Externalized new installer message
   - Needs localizing
   28789: ALF-9407: Single quote characters in messages containing {} need to be doubled


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28793 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2011-07-04 15:00:07 +00:00
parent db4592d439
commit 5e195760fc
16 changed files with 111 additions and 60 deletions

View File

@@ -81,7 +81,7 @@ public class AjaxServlet extends BaseServlet
// dump the request headers
if (headersLogger.isDebugEnabled())
{
final Enumeration headers = request.getHeaderNames();
final Enumeration<?> headers = request.getHeaderNames();
while (headers.hasMoreElements())
{
final String name = (String)headers.nextElement();
@@ -190,9 +190,15 @@ public class AjaxServlet extends BaseServlet
{
msg = cause.toString();
}
// send the error
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg);
// ALF-9036. We need to trap incomplete sessions
if (cause instanceof IllegalStateException)
{
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, cause.getMessage());
}
else
{
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg);
}
}
else
{

View File

@@ -107,7 +107,7 @@ public class InvokeCommand extends BaseAjaxCommand
// all the objects in the session to find the bean we want.
String beanNameSuffix = "?" + variableName;
Enumeration enumNames = request.getSession().getAttributeNames();
Enumeration<?> enumNames = request.getSession().getAttributeNames();
while (enumNames.hasMoreElements())
{
String name = (String)enumNames.nextElement();
@@ -156,35 +156,56 @@ public class InvokeCommand extends BaseAjaxCommand
public Object execute() throws Throwable
{
// invoke the method
method.invoke(beanFinal);
return null;
try
{
method.invoke(beanFinal);
return null;
}
// Let's prevent RuntimeExceptions being wrapped twice by unwrapping InvocationTargetExceptions
catch (InvocationTargetException e)
{
if (e.getCause() != null)
{
throw e.getCause();
}
throw e;
}
}
};
txnHelper.doInTransaction(callback);
}
catch (Throwable err)
catch (EvaluationException e)
{
if (err instanceof EvaluationException)
Throwable err = e.getCause();
if (err == null)
{
final Throwable cause = ((EvaluationException)err).getCause();
if (cause != null)
logger.error("Failed to execute method " + expression + ": " + e.getMessage(), e);
throw e;
}
else
{
logger.error("Failed to execute method " + expression + ": " + err.getMessage(), err);
if (err instanceof RuntimeException)
{
err = cause;
}
}
else if (err instanceof InvocationTargetException)
{
final Throwable cause = ((InvocationTargetException)err).getCause();
if (cause != null)
{
err = cause;
throw (RuntimeException)err;
}
else
{
throw new AlfrescoRuntimeException("Failed to execute method " + expression + ": " + err.getMessage(), err);
}
}
}
catch (RuntimeException err)
{
logger.error("Failed to execute method " + expression + ": " + err.getMessage(),
err);
throw new AlfrescoRuntimeException("Failed to execute method " + expression +
": " + err.getMessage(), err);
logger.error("Failed to execute method " + expression + ": " + err.getMessage(), err);
throw err;
}
catch (Exception err)
{
logger.error("Failed to execute method " + expression + ": " + err.getMessage(), err);
throw new AlfrescoRuntimeException("Failed to execute method " + expression + ": " + err.getMessage(), err);
}
// force the output back to the client

View File

@@ -166,6 +166,21 @@ public class XFormsBean implements Serializable
{
return this.formInstanceDataName;
}
public Schema2XForms getSchema2XForms()
{
return this.schema2XForms;
}
public ChibaBean getChibaBean()
{
return this.chibaBean;
}
public List<XMLEvent> getEventLog()
{
return this.eventLog;
}
}
/////////////////////////////////////////////////////////////////////////////
@@ -183,6 +198,15 @@ public class XFormsBean implements Serializable
public static String BEAN_NAME = "XFormsBean";
public XFormsSession getXformsSession()
{
if (this.xformsSession == null)
{
throw new IllegalStateException("Incomplete user session. Please restart the form.");
}
return this.xformsSession;
}
/**
* @param schema2XFormsProperties the schema2XFormsProperties to set.
*/
@@ -332,7 +356,7 @@ public class XFormsBean implements Serializable
readLock.lock();
try
{
final ChibaBean chibaBean = this.xformsSession.chibaBean;
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
final Node xformsDocument = chibaBean.getXMLContainer();
XMLUtil.print(xformsDocument, out);
}
@@ -358,7 +382,7 @@ public class XFormsBean implements Serializable
writeLock.lock();
try
{
final ChibaBean chibaBean = this.xformsSession.chibaBean;
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
if (chibaBean.getContainer().lookup(id) instanceof Upload)
{
@@ -397,7 +421,7 @@ public class XFormsBean implements Serializable
final int index = Integer.parseInt((String)requestParameters.get(id));
if (LOGGER.isDebugEnabled())
LOGGER.debug(this + ".setRepeatIndex(" + id + ", " + index + ")");
final ChibaBean chibaBean = this.xformsSession.chibaBean;
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
chibaBean.updateRepeatIndex(id, index);
}
final ResponseWriter out = context.getResponseWriter();
@@ -425,7 +449,7 @@ public class XFormsBean implements Serializable
writeLock.lock();
try
{
final ChibaBean chibaBean = this.xformsSession.chibaBean;
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
chibaBean.dispatch(id, DOMEventNames.ACTIVATE);
final ResponseWriter out = context.getResponseWriter();
@@ -452,7 +476,7 @@ public class XFormsBean implements Serializable
context.getExternalContext().getRequest();
final Document result = XMLUtil.parse(request.getInputStream());
this.handleSubmit(result);
final Document instanceData = this.xformsSession.getFormInstanceData();
final Document instanceData = this.getXformsSession().getFormInstanceData();
final ResponseWriter out = context.getResponseWriter();
XMLUtil.print(instanceData, out, false);
out.close();
@@ -465,7 +489,7 @@ public class XFormsBean implements Serializable
public void handleSubmit(Node result)
{
final Document instanceData = this.xformsSession.getFormInstanceData();
final Document instanceData = this.getXformsSession().getFormInstanceData();
Element documentElement = instanceData.getDocumentElement();
if (documentElement != null)
{
@@ -497,16 +521,16 @@ public class XFormsBean implements Serializable
writeLock.lock();
try
{
final ChibaBean chibaBean = this.xformsSession.chibaBean;
final ChibaBean chibaBean = this.getXformsSession().getChibaBean();
final RepeatItem from = (RepeatItem)chibaBean.getContainer().lookup(fromItemId);
if (from == null)
{
throw new NullPointerException("unable to find source repeat item " + fromItemId);
throw new IllegalArgumentException("unable to find source repeat item " + fromItemId);
}
final RepeatItem to = (RepeatItem)chibaBean.getContainer().lookup(toItemId);
if (to == null)
{
throw new NullPointerException("unable to find destination repeat item " + toItemId);
throw new IllegalArgumentException("unable to find destination repeat item " + toItemId);
}
this.swapRepeatItems(from, to);
@@ -683,7 +707,7 @@ public class XFormsBean implements Serializable
final Element eventsElement = result.createElement("events");
result.appendChild(eventsElement);
for (XMLEvent xfe : this.xformsSession.eventLog)
for (XMLEvent xfe : this.getXformsSession().getEventLog())
{
final String type = xfe.getType();
if (LOGGER.isDebugEnabled())
@@ -724,7 +748,7 @@ public class XFormsBean implements Serializable
LOGGER.debug("performing full revalidate");
try
{
final Model model = this.xformsSession.chibaBean.getContainer().getDefaultModel();
final Model model = this.getXformsSession().getChibaBean().getContainer().getDefaultModel();
final Instance instance = model.getDefaultInstance();
model.getValidator().validate(instance, "/", new DefaultValidatorMode());
final Iterator<ModelItem> it = instance.iterateModelItems("/");
@@ -785,7 +809,7 @@ public class XFormsBean implements Serializable
throws FormBuilderException
{
String path = null;
if (this.xformsSession.form.isWebForm())
if (this.getXformsSession().getForm().isWebForm())
{
path = this.getCurrentAVMPath();
}
@@ -812,7 +836,7 @@ public class XFormsBean implements Serializable
XFormsBean.rewriteInlineURIs(schemaDocument, path);
final String rootElementName = this.xformsSession.form.getSchemaRootElementName();
final Pair<Document, XSModel> result =
this.xformsSession.schema2XForms.buildXForm(this.xformsSession.formInstanceData,
this.getXformsSession().getSchema2XForms().buildXForm(this.getXformsSession().getFormInstanceData(),
schemaDocument,
rootElementName,
resourceBundle);