Merged V4.0-BUG-FIX to HEAD

37410: ALF-14386 HttpClient returns a null byte array if there is no response body (eg 204), swap that for an empty array to avoid NPEs and better fit the interface contract
   37439: ALF-13979: Schema comparison NPE when encountering a keyless table 
   37443: Hand merge of second round of PATH query improvements for ALF-13404 to doclib2 API scripts
   37480: Merged V4.0 to V4.0-BUG-FIX
      37470: ALF-14434: Specify a START WITH value for the rebuilt alf_acl_change_set primary key on DB2
      37475: ALF-13839: Transaction purging didn't work on SQL Server!
   37484: Merged PATCHES/V3.4.6 to V4.0-BUG-FIX (RECORD ONLY)
      36821: ALF-13827: Make replicated caches recover from temporary comms failures by flushing when a change in peers is detected
         - We do not flush caches who replicate via copy (e.g. tickets cache) as these may not be recoverable
   37487: Merged V3.4-BUG-FIX to V4.0-BUG-FIX
      37225: ALF-13617 Revert To Version functionality incorrectly reverts to the wrong version/file
      37280: Merged DEV to V3.4-BUG-FIX
         37279: ALF-14360 : Missing caches from ehcache-custom.xml.sample.cluster
            org.alfresco.cache.avm.avmVersionRootEntityCache and org.alfresco.cache.tagscopeSummaryCache were added to the ehcache configuration.
      37473: ALF-12081: Ensure that cancel checkout can both unlock and cancel offline edit
      37478: Merged BRANCHES/DEV/BELARUS/V3.4-BUG-FIX-2012_05_22 to BRANCHES/DEV/V3.4-BUG-FIX:
         37471: ALF-9475 : Remove JBPM indexes present from upgrades
      37485: ALF-9475: Fix up schema versions
   37488: Merged V3.4-BUG-FIX to V4.0-BUG-FIX (RECORD ONLY)
      37330: Merged V4.0-BUG-FIX to V3.4-BUG-FIX
         37323: ALF-13247: Two nodes with the same primary path. 
         -Fixed by initializing zone before parallel batch processing begins.
      37356: ALF-14392: Merged V4.0-BUG-FIX to V3.4-BUG-FIX
         36346: Fix for ALF-9466 - We can search contents sorted by categories in Advanced search in Share, but saved search will not be shown in UI.
      37373: Merged PATCHES/V3.4.6 to V3.4-BUG-FIX
         36821: ALF-13827 / ALF-14402: Make replicated caches recover from temporary comms failures by flushing when a change in peers is detected
         - We do not flush caches who replicate via copy (e.g. tickets cache) as these may not be recoverable
         37122: ALF-13919 / ALF-14403: Merged DEV to PATCHES/V3.4.6
         - Rework of Dmitry's implementation
         - Uses dynamic HQL query to retrieve JBPM workflow instances by specified query criteria
         - WorkflowInstancesGet web script no longer has to iterate over every workflow instance in the database!
         - DB index added to enable efficient querying by string variable
         - Hibernate tastic!
         37188: ALF-13919 / ALF-14403: Worked around HQL polymorphism issues by using explicit variable subclass names in from clause
         37204: ALF-13919 / ALF-14403: Fix to date range handling by Dmitry
      37481: Merged HEAD to V3.4-BUG-FIX
         37388: ALF-13545: First attempt at digitally signing the Windows installers
         37391: ALF-13545: Fix quoting and output directory specification
         37393: ALF-13545: Correct deployment installer signcode command


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37491 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-06-07 11:26:35 +00:00
parent 507c4d8bf8
commit f99a06df88
13 changed files with 241 additions and 17 deletions

View File

@@ -2022,20 +2022,22 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
return null;
}
// Checkout the node if required
ScriptNode workingCopy = this;
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
ScriptNode originalNode = this;
//cancel editing if we want to revert
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
{
workingCopy = checkout();
originalNode = cancelCheckout();
}
// Checkin the node - to get the new version
workingCopy = workingCopy.checkin(history, majorVersion);
// Revert the new (current) version of the node
services.getVersionService().revert(workingCopy.nodeRef, version, deep);
services.getVersionService().revert(originalNode.getNodeRef(), version, deep);
return workingCopy;
// Checkout/Checkin the node - to store the new version in version history
ScriptNode workingCopy = originalNode.checkout();
originalNode = workingCopy.checkin(history, majorVersion);
return originalNode;
}
/**
@@ -2414,6 +2416,15 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
return newInstance(original, this.services, this.scope);
}
/**
* Removes the lock on a node.
*
*/
public void unlock()
{
this.services.getLockService().unlock(this.nodeRef);
}
/**
* Cancel the check-out of a working copy document. The working copy will be deleted and any changes made to it
* are lost. Note that this method can only be called on a working copy Node. The reference to this working copy

View File

@@ -67,9 +67,19 @@ public class RemoteConnectorResponseImpl implements RemoteConnectorResponse
public RemoteConnectorResponseImpl(RemoteConnectorRequest request, String contentType,
String charset, int status, Header[] headers, byte[] response)
{
this(request, contentType, charset, status, headers, new ByteArrayInputStream(response));
this.bodyBytes = response;
this(request, contentType, charset, status, headers, new ByteArrayInputStream(ensureBytes(response)));
this.bodyBytes = ensureBytes(response);
}
/**
* HttpClient will return a null response body for things like 204 (No Content).
* We want to treat that as an empty byte array, to meet our contracts
*/
private static byte[] ensureBytes(byte[] bytes)
{
if (bytes == null) return EMPTY_BYTE_ARRAY;
return bytes;
}
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
@Override
public int getStatus()

View File

@@ -206,7 +206,10 @@ public class DbObjectXMLTransformer
simpleEndTag(XML.EL_COLUMNS);
// Output primary key
output(table.getPrimaryKey());
if (table.hasPrimaryKey())
{
output(table.getPrimaryKey());
}
// Output foreign keys
simpleStartTag(XML.EL_FOREIGN_KEYS);

View File

@@ -24,6 +24,7 @@ import static org.alfresco.util.schemacomp.SchemaCompTestingUtils.fk;
import static org.alfresco.util.schemacomp.SchemaCompTestingUtils.fkeys;
import static org.alfresco.util.schemacomp.SchemaCompTestingUtils.indexes;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import java.io.BufferedReader;
@@ -264,6 +265,26 @@ public class DbObjectXMLTransformerTest
assertEquals("</table>", reader.readLine());
}
/**
* ALF-13979: empty table causes NPE during schema export.
* @throws IOException
*/
@Test
public void transformTableWithoutPrimaryKey() throws IOException
{
Table table = new Table("my_table");
assertFalse(table.hasPrimaryKey());
transformer.output(table);
BufferedReader reader = new BufferedReader(new StringReader(writer.toString()));
dumpOutput();
assertHasPreamble(reader);
skipUntilEnd(" {columns}", reader, true);
skipUntilEnd(" {foreignkeys}", reader, true);
skipUntilEnd(" {indexes}", reader, true);
assertEquals("</table>", reader.readLine());
}
@Test
public void transformObjectWithValidators() throws IOException
@@ -332,7 +353,7 @@ public class DbObjectXMLTransformerTest
{
textToFind = textToFind.trim().
replace("{", "<").
replace("}", "\\s+.*/>");
replace("}", ".*/>");
}
else
{

View File

@@ -102,6 +102,13 @@ public class Table extends AbstractDbObject
return this.primaryKey;
}
/**
* @return Whether there is a primary key on this table.
*/
public boolean hasPrimaryKey()
{
return (primaryKey != null);
}
/**
* @param primaryKey the primaryKey to set