Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Check source hash (if provided) when translations are uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Nov 11, 2013
1 parent c4152ef commit 0a3971e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -31,7 +31,7 @@
<gwteventservice.version>1.2.1</gwteventservice.version>
<okapi.version>0.22</okapi.version>

<zanata.api.version>3.1.2-SNAPSHOT</zanata.api.version>
<zanata.api.version>3.2-SNAPSHOT</zanata.api.version>
<!-- This should always be the previous version of the used api version above (but only 3.0.1 or later will work) -->
<zanata.api.compat.version>3.1.0</zanata.api.compat.version>
<zanata.client.version>3.0.1</zanata.client.version>
Expand Down
Expand Up @@ -20,6 +20,7 @@
*/
package org.zanata.service.impl;

import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
Expand Down Expand Up @@ -628,6 +629,7 @@ protected Boolean work() throws Exception {

for (TextFlowTarget incomingTarget : batch) {
String resId = incomingTarget.getResId();
String sourceHash = incomingTarget.getSourceHash();
HTextFlow textFlow =
textFlowDAO.getById(document, resId);
if (textFlow == null) {
Expand All @@ -640,6 +642,19 @@ protected Boolean work() throws Exception {
log.warn(
"skipping TextFlowTarget with unknown resId: {}",
resId);
} else if (sourceHash != null && !sourceHash.equals(textFlow.getContentHash())) {
String warning = MessageFormat.format(
"TextFlowTarget {0} may be obsolete; "
+ "associated source hash: {1}; "
+ "expected hash is {2} for source: {3}",
resId,
sourceHash,
textFlow.getContentHash(),
textFlow.getContents());
warnings.add(warning);
log.warn(
"skipping TextFlowTarget {} with unknown sourceHash: {}",
resId, sourceHash);
} else {
String validationMessage =
validateTranslations(
Expand Down

0 comments on commit 0a3971e

Please sign in to comment.