mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-30 18:15:39 +00:00
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:
parent
507c4d8bf8
commit
f99a06df88
@ -166,6 +166,7 @@
|
|||||||
<ref bean="patch.db-V4.0-SubscriptionTables" />
|
<ref bean="patch.db-V4.0-SubscriptionTables" />
|
||||||
<ref bean="patch.db-V4.0-SolrTracking" />
|
<ref bean="patch.db-V4.0-SolrTracking" />
|
||||||
<ref bean="patch.db-V4.0-AclChangeSet2" />
|
<ref bean="patch.db-V4.0-AclChangeSet2" />
|
||||||
|
<ref bean="patch.db-V3.4-remove-redundant-jbpm-indexes" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
--
|
||||||
|
-- Title: Upgrade to V3.4 - Remove redundant indexes in jbpm tables
|
||||||
|
-- Database: Generic
|
||||||
|
-- Since: V3.4 schema 4210
|
||||||
|
-- Author: Pavel Yurkevich
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP INDEX IDX_ACTION_ACTNDL ON JBPM_ACTION; -- (optional)
|
||||||
|
DROP INDEX IDX_ACTION_EVENT ON JBPM_ACTION; -- (optional)
|
||||||
|
DROP INDEX IDX_ACTION_PROCDF ON JBPM_ACTION; -- (optional)
|
||||||
|
DROP INDEX IDX_COMMENT_TOKEN ON JBPM_COMMENT; -- (optional)
|
||||||
|
DROP INDEX IDX_COMMENT_TSK ON JBPM_COMMENT; -- (optional)
|
||||||
|
DROP INDEX IDX_DELEG_PRCD ON JBPM_DELEGATION; -- (optional)
|
||||||
|
DROP INDEX IDX_JOB_PRINST ON JBPM_JOB; -- (optional)
|
||||||
|
DROP INDEX IDX_JOB_TOKEN ON JBPM_JOB; -- (optional)
|
||||||
|
DROP INDEX IDX_JOB_TSKINST ON JBPM_JOB; -- (optional)
|
||||||
|
DROP INDEX IDX_MODDEF_PROCDF ON JBPM_MODULEDEFINITION; -- (optional)
|
||||||
|
DROP INDEX IDX_MODINST_PRINST ON JBPM_MODULEINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_NODE_ACTION ON JBPM_NODE; -- (optional)
|
||||||
|
DROP INDEX IDX_NODE_PROCDEF ON JBPM_NODE; -- (optional)
|
||||||
|
DROP INDEX IDX_NODE_SUPRSTATE ON JBPM_NODE; -- (optional)
|
||||||
|
DROP INDEX IDX_PSTATE_SBPRCDEF ON JBPM_NODE; -- (optional)
|
||||||
|
DROP INDEX IDX_PLDACTR_ACTID ON JBPM_POOLEDACTOR; -- (optional)
|
||||||
|
DROP INDEX IDX_TSKINST_SWLANE ON JBPM_POOLEDACTOR; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCDEF_STRTST ON JBPM_PROCESSDEFINITION; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCIN_KEY ON JBPM_PROCESSINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCIN_PROCDEF ON JBPM_PROCESSINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCIN_ROOTTK ON JBPM_PROCESSINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCIN_SPROCTK ON JBPM_PROCESSINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_RTACTN_ACTION ON JBPM_RUNTIMEACTION; -- (optional)
|
||||||
|
DROP INDEX IDX_RTACTN_PRCINST ON JBPM_RUNTIMEACTION; -- (optional)
|
||||||
|
DROP INDEX IDX_SWIMLINST_SL ON JBPM_SWIMLANEINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_TASK_PROCDEF ON JBPM_TASK; -- (optional)
|
||||||
|
DROP INDEX IDX_TASK_TASKMGTDF ON JBPM_TASK; -- (optional)
|
||||||
|
DROP INDEX IDX_TASK_TSKNODE ON JBPM_TASK; -- (optional)
|
||||||
|
DROP INDEX IDX_TASKINST_TOKN ON JBPM_TASKINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_TASKINST_TSK ON JBPM_TASKINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_TASK_ACTORID ON JBPM_TASKINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_TSKINST_SLINST ON JBPM_TASKINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_TSKINST_TMINST ON JBPM_TASKINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_TOKEN_NODE ON JBPM_TOKEN; -- (optional)
|
||||||
|
DROP INDEX IDX_TOKEN_PARENT ON JBPM_TOKEN; -- (optional)
|
||||||
|
DROP INDEX IDX_TOKEN_PROCIN ON JBPM_TOKEN; -- (optional)
|
||||||
|
DROP INDEX IDX_TOKEN_SUBPI ON JBPM_TOKEN; -- (optional)
|
||||||
|
DROP INDEX IDX_TKVARMAP_CTXT ON JBPM_TOKENVARIABLEMAP; -- (optional)
|
||||||
|
DROP INDEX IDX_TKVVARMP_TOKEN ON JBPM_TOKENVARIABLEMAP; -- (optional)
|
||||||
|
DROP INDEX IDX_TRANSIT_FROM ON JBPM_TRANSITION; -- (optional)
|
||||||
|
DROP INDEX IDX_TRANSIT_TO ON JBPM_TRANSITION; -- (optional)
|
||||||
|
DROP INDEX IDX_TRANS_PROCDEF ON JBPM_TRANSITION; -- (optional)
|
||||||
|
DROP INDEX IDX_VARINST_PRCINS ON JBPM_VARIABLEINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_VARINST_TK ON JBPM_VARIABLEINSTANCE; -- (optional)
|
||||||
|
DROP INDEX IDX_VARINST_TKVARMP ON JBPM_VARIABLEINSTANCE; -- (optional)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.4-remove-redundant-jbpm-indexes';
|
||||||
|
INSERT INTO alf_applied_patch
|
||||||
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
'patch.db-V3.4-remove-redundant-jbpm-indexes', 'Manually executed script upgrade V3.4',
|
||||||
|
0, 6010, -1, 6011, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||||
|
);
|
@ -0,0 +1,66 @@
|
|||||||
|
--
|
||||||
|
-- Title: Upgrade to V3.4 - Remove redundant indexes in jbpm tables
|
||||||
|
-- Database: PostgreSQL
|
||||||
|
-- Since: V3.4 schema 4210
|
||||||
|
-- Author: Pavel Yurkevich
|
||||||
|
--
|
||||||
|
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP INDEX IDX_ACTION_ACTNDL; -- (optional)
|
||||||
|
DROP INDEX IDX_ACTION_EVENT; -- (optional)
|
||||||
|
DROP INDEX IDX_ACTION_PROCDF; -- (optional)
|
||||||
|
DROP INDEX IDX_COMMENT_TOKEN; -- (optional)
|
||||||
|
DROP INDEX IDX_COMMENT_TSK; -- (optional)
|
||||||
|
DROP INDEX IDX_DELEG_PRCD; -- (optional)
|
||||||
|
DROP INDEX IDX_JOB_PRINST; -- (optional)
|
||||||
|
DROP INDEX IDX_JOB_TOKEN; -- (optional)
|
||||||
|
DROP INDEX IDX_JOB_TSKINST; -- (optional)
|
||||||
|
DROP INDEX IDX_MODDEF_PROCDF; -- (optional)
|
||||||
|
DROP INDEX IDX_MODINST_PRINST; -- (optional)
|
||||||
|
DROP INDEX IDX_NODE_ACTION; -- (optional)
|
||||||
|
DROP INDEX IDX_NODE_PROCDEF; -- (optional)
|
||||||
|
DROP INDEX IDX_NODE_SUPRSTATE; -- (optional)
|
||||||
|
DROP INDEX IDX_PSTATE_SBPRCDEF; -- (optional)
|
||||||
|
DROP INDEX IDX_PLDACTR_ACTID; -- (optional)
|
||||||
|
DROP INDEX IDX_TSKINST_SWLANE; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCDEF_STRTST; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCIN_KEY; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCIN_PROCDEF; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCIN_ROOTTK; -- (optional)
|
||||||
|
DROP INDEX IDX_PROCIN_SPROCTK; -- (optional)
|
||||||
|
DROP INDEX IDX_RTACTN_ACTION; -- (optional)
|
||||||
|
DROP INDEX IDX_RTACTN_PRCINST; -- (optional)
|
||||||
|
DROP INDEX IDX_SWIMLINST_SL; -- (optional)
|
||||||
|
DROP INDEX IDX_TASK_PROCDEF; -- (optional)
|
||||||
|
DROP INDEX IDX_TASK_TASKMGTDF; -- (optional)
|
||||||
|
DROP INDEX IDX_TASK_TSKNODE; -- (optional)
|
||||||
|
DROP INDEX IDX_TASKINST_TOKN; -- (optional)
|
||||||
|
DROP INDEX IDX_TASKINST_TSK; -- (optional)
|
||||||
|
DROP INDEX IDX_TASK_ACTORID; -- (optional)
|
||||||
|
DROP INDEX IDX_TSKINST_SLINST; -- (optional)
|
||||||
|
DROP INDEX IDX_TSKINST_TMINST; -- (optional)
|
||||||
|
DROP INDEX IDX_TOKEN_NODE; -- (optional)
|
||||||
|
DROP INDEX IDX_TOKEN_PARENT; -- (optional)
|
||||||
|
DROP INDEX IDX_TOKEN_PROCIN; -- (optional)
|
||||||
|
DROP INDEX IDX_TOKEN_SUBPI; -- (optional)
|
||||||
|
DROP INDEX IDX_TKVARMAP_CTXT; -- (optional)
|
||||||
|
DROP INDEX IDX_TKVVARMP_TOKEN; -- (optional)
|
||||||
|
DROP INDEX IDX_TRANSIT_FROM; -- (optional)
|
||||||
|
DROP INDEX IDX_TRANSIT_TO; -- (optional)
|
||||||
|
DROP INDEX IDX_TRANS_PROCDEF; -- (optional)
|
||||||
|
DROP INDEX IDX_VARINST_PRCINS; -- (optional)
|
||||||
|
DROP INDEX IDX_VARINST_TK; -- (optional)
|
||||||
|
DROP INDEX IDX_VARINST_TKVARMP; -- (optional)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Record script finish
|
||||||
|
--
|
||||||
|
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.4-remove-redundant-jbpm-indexes';
|
||||||
|
INSERT INTO alf_applied_patch
|
||||||
|
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
'patch.db-V3.4-remove-redundant-jbpm-indexes', 'Manually executed script upgrade V3.4',
|
||||||
|
0, 6010, -1, 6011, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||||
|
);
|
@ -377,6 +377,16 @@
|
|||||||
statistics="false"
|
statistics="false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- Tagscope Summary Properties -->
|
||||||
|
|
||||||
|
<cache
|
||||||
|
name="org.alfresco.cache.tagscopeSummaryCache"
|
||||||
|
maxElementsInMemory="1000"
|
||||||
|
eternal="true"
|
||||||
|
overflowToDisk="false"
|
||||||
|
statistics="false"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Imap Messages -->
|
<!-- Imap Messages -->
|
||||||
|
|
||||||
<cache
|
<cache
|
||||||
|
@ -225,7 +225,7 @@
|
|||||||
</cache>
|
</cache>
|
||||||
|
|
||||||
<cache
|
<cache
|
||||||
name="org.alfresco.cache.avm.versionRootEntityCache"
|
name="org.alfresco.cache.avm.avmVersionRootEntityCache"
|
||||||
maxElementsInMemory="1000"
|
maxElementsInMemory="1000"
|
||||||
eternal="true"
|
eternal="true"
|
||||||
overflowToDisk="false"
|
overflowToDisk="false"
|
||||||
@ -761,6 +761,24 @@
|
|||||||
|
|
||||||
</cache>
|
</cache>
|
||||||
|
|
||||||
|
<!-- Tagscope Summary Properties -->
|
||||||
|
|
||||||
|
<cache
|
||||||
|
name="org.alfresco.cache.tagscopeSummaryCache"
|
||||||
|
maxElementsInMemory="1000"
|
||||||
|
eternal="true"
|
||||||
|
overflowToDisk="false"
|
||||||
|
statistics="false"
|
||||||
|
>
|
||||||
|
<cacheEventListenerFactory
|
||||||
|
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
|
||||||
|
properties="replicatePuts = false,
|
||||||
|
replicateUpdates = true,
|
||||||
|
replicateRemovals = true,
|
||||||
|
replicateUpdatesViaCopy = false,
|
||||||
|
replicateAsynchronously = false"/>
|
||||||
|
</cache>
|
||||||
|
|
||||||
<!-- Imap Messages -->
|
<!-- Imap Messages -->
|
||||||
|
|
||||||
<cache
|
<cache
|
||||||
|
@ -1275,14 +1275,14 @@
|
|||||||
|
|
||||||
<delete id="delete_Txns_Unused" parameterType="TransactionQuery">
|
<delete id="delete_Txns_Unused" parameterType="TransactionQuery">
|
||||||
delete from
|
delete from
|
||||||
alf_transaction txn
|
alf_transaction
|
||||||
where not exists
|
where not exists
|
||||||
(
|
(
|
||||||
select 1
|
select 1
|
||||||
from
|
from
|
||||||
alf_node node
|
alf_node node
|
||||||
where
|
where
|
||||||
node.transaction_id = txn.id
|
node.transaction_id = alf_transaction.id
|
||||||
)
|
)
|
||||||
<![CDATA[and commit_time_ms >= #{minCommitTime}]]>
|
<![CDATA[and commit_time_ms >= #{minCommitTime}]]>
|
||||||
<![CDATA[and commit_time_ms <= #{maxCommitTime}]]>
|
<![CDATA[and commit_time_ms <= #{maxCommitTime}]]>
|
||||||
|
@ -3222,4 +3222,15 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.db-V3.4-remove-redundant-jbpm-indexes" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
|
<property name="id"><value>patch.db-V3.4-remove-redundant-jbpm-indexes</value></property>
|
||||||
|
<property name="description"><value>patch.schemaUpgradeScript.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>5035</value></property>
|
||||||
|
<property name="targetSchema"><value>5036</value></property>
|
||||||
|
<property name="scriptUrl">
|
||||||
|
<value>classpath:alfresco/dbscripts/upgrade/3.4/${db.script.dialect}/remove-redundant-jbpm-indexes.sql</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@ -19,4 +19,4 @@ version.build=@build-number@
|
|||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
|
|
||||||
version.schema=6010
|
version.schema=6011
|
||||||
|
@ -2022,20 +2022,22 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checkout the node if required
|
ScriptNode originalNode = this;
|
||||||
ScriptNode workingCopy = this;
|
//cancel editing if we want to revert
|
||||||
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
|
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
|
// 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);
|
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
|
* 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
|
* are lost. Note that this method can only be called on a working copy Node. The reference to this working copy
|
||||||
|
@ -67,9 +67,19 @@ public class RemoteConnectorResponseImpl implements RemoteConnectorResponse
|
|||||||
public RemoteConnectorResponseImpl(RemoteConnectorRequest request, String contentType,
|
public RemoteConnectorResponseImpl(RemoteConnectorRequest request, String contentType,
|
||||||
String charset, int status, Header[] headers, byte[] response)
|
String charset, int status, Header[] headers, byte[] response)
|
||||||
{
|
{
|
||||||
this(request, contentType, charset, status, headers, new ByteArrayInputStream(response));
|
this(request, contentType, charset, status, headers, new ByteArrayInputStream(ensureBytes(response)));
|
||||||
this.bodyBytes = 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
|
@Override
|
||||||
public int getStatus()
|
public int getStatus()
|
||||||
|
@ -206,7 +206,10 @@ public class DbObjectXMLTransformer
|
|||||||
simpleEndTag(XML.EL_COLUMNS);
|
simpleEndTag(XML.EL_COLUMNS);
|
||||||
|
|
||||||
// Output primary key
|
// Output primary key
|
||||||
|
if (table.hasPrimaryKey())
|
||||||
|
{
|
||||||
output(table.getPrimaryKey());
|
output(table.getPrimaryKey());
|
||||||
|
}
|
||||||
|
|
||||||
// Output foreign keys
|
// Output foreign keys
|
||||||
simpleStartTag(XML.EL_FOREIGN_KEYS);
|
simpleStartTag(XML.EL_FOREIGN_KEYS);
|
||||||
|
@ -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.fkeys;
|
||||||
import static org.alfresco.util.schemacomp.SchemaCompTestingUtils.indexes;
|
import static org.alfresco.util.schemacomp.SchemaCompTestingUtils.indexes;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@ -264,6 +265,26 @@ public class DbObjectXMLTransformerTest
|
|||||||
assertEquals("</table>", reader.readLine());
|
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
|
@Test
|
||||||
public void transformObjectWithValidators() throws IOException
|
public void transformObjectWithValidators() throws IOException
|
||||||
@ -332,7 +353,7 @@ public class DbObjectXMLTransformerTest
|
|||||||
{
|
{
|
||||||
textToFind = textToFind.trim().
|
textToFind = textToFind.trim().
|
||||||
replace("{", "<").
|
replace("{", "<").
|
||||||
replace("}", "\\s+.*/>");
|
replace("}", ".*/>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -102,6 +102,13 @@ public class Table extends AbstractDbObject
|
|||||||
return this.primaryKey;
|
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
|
* @param primaryKey the primaryKey to set
|
||||||
|
Loading…
x
Reference in New Issue
Block a user