diff --git a/.gitattributes b/.gitattributes
index 20332df7f1..13edf646ed 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/dealing-with-line-endings
-# This setting tells git to always normalize the files specified.
-# When committed they are stored with LF, on checkout they are
+# This setting tells git always to normalize the files specified.
+# When committed they are stored with LF, on checkout they are
# converted to the OS's native line endings.
* text
diff --git a/branch-release.sh b/branch-release.sh
index 5f41191ea7..af26561482 100755
--- a/branch-release.sh
+++ b/branch-release.sh
@@ -19,4 +19,3 @@ git commit pom.xml */pom.xml -m "prepare for next development iteration"
# push all the changes back to the server
git push origin legacy release integration/master
-
diff --git a/zanata-model/src/main/java/org/zanata/hibernate/search/ConfigurableNgramAnalyzer.java b/zanata-model/src/main/java/org/zanata/hibernate/search/ConfigurableNgramAnalyzer.java
index 09fd430ce0..b6b8735b97 100644
--- a/zanata-model/src/main/java/org/zanata/hibernate/search/ConfigurableNgramAnalyzer.java
+++ b/zanata-model/src/main/java/org/zanata/hibernate/search/ConfigurableNgramAnalyzer.java
@@ -69,6 +69,7 @@ public ConfigurableNgramAnalyzer(int ngramMinLength, int ngramMaxLength,
this.foldCase = foldCase;
}
+ @SuppressWarnings("resource") // caller should close
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
TokenStream tokenStream;
diff --git a/zanata-model/src/main/java/org/zanata/model/HTermComment.java b/zanata-model/src/main/java/org/zanata/model/HTermComment.java
index 4c29684231..a1cbec40bd 100644
--- a/zanata-model/src/main/java/org/zanata/model/HTermComment.java
+++ b/zanata-model/src/main/java/org/zanata/model/HTermComment.java
@@ -20,12 +20,15 @@
*/
package org.zanata.model;
+import java.io.Serializable;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+
import javax.validation.constraints.NotNull;
import lombok.NoArgsConstructor;
@@ -46,7 +49,8 @@
@Setter
@NoArgsConstructor
@ToString(of = "comment")
-public class HTermComment {
+public class HTermComment implements Serializable {
+ private static final long serialVersionUID = 1L;
private Long id;
private String comment;
diff --git a/zanata-model/src/main/java/org/zanata/model/HTextFlow.java b/zanata-model/src/main/java/org/zanata/model/HTextFlow.java
index 3a1a57d389..33547b3f14 100644
--- a/zanata-model/src/main/java/org/zanata/model/HTextFlow.java
+++ b/zanata-model/src/main/java/org/zanata/model/HTextFlow.java
@@ -447,8 +447,7 @@ private void updateContentHash() {
this.setContentHash(HashUtil.generateHash(contents));
}
- private String toBCP47(HLocale hLocale) {
- HLocale docLocale = document.getLocale();
+ private static String toBCP47(HLocale docLocale) {
if (docLocale == null) {
// *should* only happen in tests
log.warn("null locale, assuming 'en'");
diff --git a/zanata-model/src/test/java/org/zanata/model/HGlossaryEntryTest.java b/zanata-model/src/test/java/org/zanata/model/HGlossaryEntryTest.java
index 7a575001fc..c37e9a14dc 100644
--- a/zanata-model/src/test/java/org/zanata/model/HGlossaryEntryTest.java
+++ b/zanata-model/src/test/java/org/zanata/model/HGlossaryEntryTest.java
@@ -40,13 +40,13 @@ public class HGlossaryEntryTest {
@BeforeTest
public void setup() {
entry = new HGlossaryEntry();
- entry.setId(new Long(1));
+ entry.setId(1L);
entry.setVersionNum(1);
entry.setCreationDate(new Date());
entry.setLastChanged(new Date());
HLocale srcLang = new HLocale(LocaleId.EN_US);
- setupHLocale(srcLang, new Long(1));
+ setupHLocale(srcLang, 1L);
entry.setSrcLocale(srcLang);
entry.setSourceRef("source ref");
@@ -59,7 +59,7 @@ public void hashMapDataTerm1Test() {
// Glossary Term 1 - EN_US
HLocale term1Locale =
- setupTerm(new Long(1), "TERM 1", LocaleId.EN_US, new Long(1));
+ setupTerm(1L, "TERM 1", LocaleId.EN_US, 1L);
assertEquals(1, entry.getGlossaryTerms().size());
assertEquals(true, entry.getGlossaryTerms().containsKey(term1Locale));
@@ -74,11 +74,11 @@ public void hashMapDataTerm2Test() {
// Glossary Term 1 - EN_US
HLocale term1Locale =
- setupTerm(new Long(1), "TERM 1", LocaleId.EN_US, new Long(1));
+ setupTerm(1L, "TERM 1", LocaleId.EN_US, 1L);
// Glossary Term 2 - DE
HLocale term2Locale =
- setupTerm(new Long(2), "TERM 2", LocaleId.DE, new Long(2));
+ setupTerm(2L, "TERM 2", LocaleId.DE, 2L);
assertEquals(2, entry.getGlossaryTerms().size());
assertEquals(true, entry.getGlossaryTerms().containsKey(term2Locale));
@@ -93,15 +93,15 @@ public void hashMapDataTerm3Test() {
// Glossary Term 1 - EN_US
HLocale term1Locale =
- setupTerm(new Long(1), "TERM 1", LocaleId.EN_US, new Long(1));
+ setupTerm(1L, "TERM 1", LocaleId.EN_US, 1L);
// Glossary Term 2 - DE
HLocale term2Locale =
- setupTerm(new Long(2), "TERM 2", LocaleId.DE, new Long(2));
+ setupTerm(2L, "TERM 2", LocaleId.DE, 2L);
// Glossary Term 3 - ES
HLocale term3Locale =
- setupTerm(new Long(3), "TERM 3", LocaleId.ES, new Long(3));
+ setupTerm(3L, "TERM 3", LocaleId.ES, 3L);
assertEquals(3, entry.getGlossaryTerms().size());
assertEquals(true, entry.getGlossaryTerms().containsKey(term3Locale));
@@ -115,13 +115,13 @@ public void hashMapDataTest() {
entry.getGlossaryTerms().clear();
// Glossary Term 1 - EN_US
- setupTerm(new Long(1), "TERM 1", LocaleId.EN_US, new Long(1));
+ setupTerm(1L, "TERM 1", LocaleId.EN_US, 1L);
// Glossary Term 2 - DE
- setupTerm(new Long(2), "TERM 2", LocaleId.DE, new Long(2));
+ setupTerm(2L, "TERM 2", LocaleId.DE, 2L);
// Glossary Term 3 - ES
- setupTerm(new Long(3), "TERM 3", LocaleId.ES, new Long(3));
+ setupTerm(3L, "TERM 3", LocaleId.ES, 3L);
for (HLocale key : entry.getGlossaryTerms().keySet()) {
assertTrue(entry.getGlossaryTerms().containsKey(key));
diff --git a/zanata-war/pom.xml b/zanata-war/pom.xml
index a38fdf1759..a10ebabe3f 100644
--- a/zanata-war/pom.xml
+++ b/zanata-war/pom.xml
@@ -129,7 +129,6 @@
javax.xml.bind:jaxb-api
com.mattbertolini:liquibase-slf4j
- com.google.code.findbugs:annotations
org.opensymphony.quartz:quartz
org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api
@@ -442,22 +441,17 @@
maven-surefire-plugin
+ 2.16
-Dconcordion.output.dir=${concordion.output.dir}
none:none
org.testng:testng
- once
- -Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC
- -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError
- -XX:HeapDumpPath=${project.build.directory} -Dsun.lang.ClassLoader.allowArraySyntax=true
+ 1.5C
+ false
src/test/resources/AllNonContainerTests.tng.xml
alphabetical
-
diff --git a/zanata-war/src/etc/FillInTranslationGap.groovy b/zanata-war/src/etc/FillInTranslationGap.groovy
index db1f959297..1a5cc6f75a 100644
--- a/zanata-war/src/etc/FillInTranslationGap.groovy
+++ b/zanata-war/src/etc/FillInTranslationGap.groovy
@@ -70,4 +70,3 @@ genPropNames.each {
}
log.info("processed {}", skeleton.name)
}
-
diff --git a/zanata-war/src/main/java/org/zanata/action/ViewAllStatusAction.java b/zanata-war/src/main/java/org/zanata/action/ViewAllStatusAction.java
index 65357fdc30..e0cbecb80e 100644
--- a/zanata-war/src/main/java/org/zanata/action/ViewAllStatusAction.java
+++ b/zanata-war/src/main/java/org/zanata/action/ViewAllStatusAction.java
@@ -159,15 +159,16 @@ public Status(String locale, String nativeName,
@Override
public int compareTo(Status o) {
- int per =
- getStats().getTotal() == 0 ? 0 : (int) Math.ceil(100.0
- * getStats().getApproved() / getStats().getTotal());
- int comparePer =
- o.getStats().getTotal() == 0 ? 0 : (int) Math.ceil(100.0
- * o.getStats().getApproved()
- / o.getStats().getTotal());
-
- return Double.compare(comparePer, per);
+ // TODO compare by locale too?
+ // TODO if totals are the same, we only need to compare approved
+ return Double.compare(o.getPercentApproved(), getPercentApproved());
+ }
+
+ private double getPercentApproved() {
+ // TODO move to TranslationStatistics.getPercentApproved() ?
+ long total = getStats().getTotal();
+ long approved = getStats().getApproved();
+ return total == 0 ? 0 : 100d * approved / total;
}
}
diff --git a/zanata-war/src/main/java/org/zanata/dao/AccountDAO.java b/zanata-war/src/main/java/org/zanata/dao/AccountDAO.java
index 6385d84610..a5b19af6dd 100644
--- a/zanata-war/src/main/java/org/zanata/dao/AccountDAO.java
+++ b/zanata-war/src/main/java/org/zanata/dao/AccountDAO.java
@@ -157,6 +157,6 @@ public List getAllMergedAccounts(HAccount mergedInto) {
"from HAccount as a where a.mergedInto = :mergedInto");
query.setParameter("mergedInto", mergedInto);
query.setComment("AccountDAO.getAllMergedAccounts");
- return query.list();
+ return (List) query.list();
}
}
diff --git a/zanata-war/src/main/java/org/zanata/dao/ActivityDAO.java b/zanata-war/src/main/java/org/zanata/dao/ActivityDAO.java
index e44538b64c..b07b9049a5 100644
--- a/zanata-war/src/main/java/org/zanata/dao/ActivityDAO.java
+++ b/zanata-war/src/main/java/org/zanata/dao/ActivityDAO.java
@@ -98,7 +98,7 @@ public List findLatestActivities(long personId, int offset,
query.setFirstResult(offset);
query.setCacheable(true);
query.setComment("activityDAO.findLatestActivities");
- return query.list();
+ return (List) query.list();
}
public int getActivityCountByActor(Long personId) {
diff --git a/zanata-war/src/main/java/org/zanata/dao/PersonDAO.java b/zanata-war/src/main/java/org/zanata/dao/PersonDAO.java
index ce6fa875bb..b544240adf 100644
--- a/zanata-war/src/main/java/org/zanata/dao/PersonDAO.java
+++ b/zanata-war/src/main/java/org/zanata/dao/PersonDAO.java
@@ -185,13 +185,13 @@ public boolean isUserInLanguageTeamWithRoles(HPerson person,
.setParameter("language", language);
if (isTranslator != null) {
- q.setParameter("isTranslator", isTranslator.booleanValue());
+ q.setParameter("isTranslator", isTranslator);
}
if (isReviewer != null) {
- q.setParameter("isReviewer", isReviewer.booleanValue());
+ q.setParameter("isReviewer", isReviewer);
}
if (isCoordinator != null) {
- q.setParameter("isCoordinator", isCoordinator.booleanValue());
+ q.setParameter("isCoordinator", isCoordinator);
}
q.setCacheable(false).setComment(
@@ -207,7 +207,7 @@ public List getAllLanguageTeamMemberships(HPerson person) {
.setParameter("person", person);
q.setCacheable(false).setComment(
"PersonDAO.getAllLanguageTeamMemberships");
- return q.list();
+ return (List) q.list();
}
}
diff --git a/zanata-war/src/main/java/org/zanata/seam/FixedSafeActions.java b/zanata-war/src/main/java/org/zanata/seam/FixedSafeActions.java
index bead38459f..4d46648881 100644
--- a/zanata-war/src/main/java/org/zanata/seam/FixedSafeActions.java
+++ b/zanata-war/src/main/java/org/zanata/seam/FixedSafeActions.java
@@ -35,6 +35,7 @@
// Implementation copied from
// https://source.jboss.org/browse/Seam/branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/navigation/SafeActions.java?r=14141
// following https://community.jboss.org/message/688860#688860
+// TODO see if this can be removed - see also https://issues.jboss.org/browse/JBSEAM-4800
public class FixedSafeActions extends org.jboss.seam.navigation.SafeActions {
private Set safeActions = Collections
diff --git a/zanata-war/src/main/java/org/zanata/webtrans/client/presenter/UserConfigHolder.java b/zanata-war/src/main/java/org/zanata/webtrans/client/presenter/UserConfigHolder.java
index 4677d95b36..cc5850eed0 100644
--- a/zanata-war/src/main/java/org/zanata/webtrans/client/presenter/UserConfigHolder.java
+++ b/zanata-war/src/main/java/org/zanata/webtrans/client/presenter/UserConfigHolder.java
@@ -33,6 +33,8 @@
import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.inject.Singleton;
+import javax.annotation.Nonnull;
+
@Singleton
public class UserConfigHolder {
public static final Predicate INCOMPLETE_PREDICATE =
@@ -46,7 +48,7 @@ public boolean apply(ContentState contentState) {
public static final Predicate DRAFT_PREDICATE =
new Predicate() {
@Override
- public boolean apply(ContentState contentState) {
+ public boolean apply(@Nonnull ContentState contentState) {
return contentState.isRejectedOrFuzzy();
}
};
diff --git a/zanata-war/src/main/java/org/zanata/webtrans/client/view/TransMemoryView.java b/zanata-war/src/main/java/org/zanata/webtrans/client/view/TransMemoryView.java
index 1fbe51e0e7..dfbe964449 100644
--- a/zanata-war/src/main/java/org/zanata/webtrans/client/view/TransMemoryView.java
+++ b/zanata-war/src/main/java/org/zanata/webtrans/client/view/TransMemoryView.java
@@ -299,7 +299,7 @@ public void renderTable(List memories,
resultTable.getFlexCellFormatter().setStyleName(i + 1,
NUM_TRANS_COL, "txt--align-center");
- if (i % 2 == 1) {
+ if (odd(i)) {
resultTable.getRowFormatter().setStyleName(i + 1, "oddRow");
}
@@ -348,6 +348,10 @@ public void onClick(ClickEvent event) {
}
}
+ private static boolean odd(int n) {
+ return n % 2 != 0;
+ }
+
@Override
public void redrawTable(List memories) {
for (int i = 0; i < memories.size(); i++) {
diff --git a/zanata-war/src/main/java/org/zanata/webtrans/shared/validation/action/TabValidation.java b/zanata-war/src/main/java/org/zanata/webtrans/shared/validation/action/TabValidation.java
index 1c1a2e964c..a04e83294b 100644
--- a/zanata-war/src/main/java/org/zanata/webtrans/shared/validation/action/TabValidation.java
+++ b/zanata-war/src/main/java/org/zanata/webtrans/shared/validation/action/TabValidation.java
@@ -34,11 +34,11 @@ public TabValidation(ValidationId id, ValidationMessages messages) {
super(id, messages.tabValidatorDesc(), messages);
}
+ @edu.umd.cs.findbugs.annotations.SuppressWarnings("GBU_GUAVA_BETA_CLASS_USAGE")
@Override
public List doValidate(String source, String target) {
ArrayList errors = new ArrayList();
- @edu.umd.cs.findbugs.annotations.SuppressWarnings("GBU_GUAVA_BETA_CLASS_USAGE")
CharMatcher tabs = CharMatcher.is('\t');
int sourceTabs = tabs.countIn(source);
int targetTabs = tabs.countIn(target);
diff --git a/zanata-war/src/main/resources/org/zanata/adapter/HTMLAdapterDefaultConfiguration.yml b/zanata-war/src/main/resources/org/zanata/adapter/HTMLAdapterDefaultConfiguration.yml
index 8c6d962804..956064ce54 100644
--- a/zanata-war/src/main/resources/org/zanata/adapter/HTMLAdapterDefaultConfiguration.yml
+++ b/zanata-war/src/main/resources/org/zanata/adapter/HTMLAdapterDefaultConfiguration.yml
@@ -8,12 +8,12 @@
# SCRIPT Embedded scripting language - pass to another extractor
# SERVER Embedded server language tags such as JSP, PHP, Mason etc.
# ATTRIBUTE_TRANS, ATTRIBUTE_WRITABLE, ATTRIBUTE_READONLY, ATTRIBUTE_ID these rules list an attribute, not an element
-# ATTRIBUTES_ONLY only attribute is translatable or localizable
+# ATTRIBUTES_ONLY only attribute is translatable or localizable
-#*********************************************************************************************
+#*********************************************************************************************
# Operators for attribute value compare
#
-# Rules are of the form:
+# Rules are of the form:
# TO_EXTRACT_ATTRIBUTE:[IF_HAS_ATTRIBUTE, OPERATOR, VALUE]
# 'content':['http-equiv', EQUALS, 'keywords']
#
@@ -23,12 +23,12 @@
# Multiple attribute values may be included in a list:
# 'content':['http-equiv', EQUALS, ['content-language', 'content-type']]
#
-# This rule would be read:
-# extract the value of 'content' if the value of 'http-equiv' equals 'content-language' or 'content-type'
+# This rule would be read:
+# extract the value of 'content' if the value of 'http-equiv' equals 'content-language' or 'content-type'
#*******************************************************************************************/
# EQUALS
-# NOT_EQUALS
+# NOT_EQUALS
# MATCH regex match. Must match the entire attribute value
# ELEMENT AND ATTRIBUTE NAMES MUST BE LOWER CASED!!!!!!
@@ -61,7 +61,7 @@ attributes:
elements:
# only attributes are localizable or translatable - no PCDATA
# ATTRIBUTES_ONLY with translatableAttributes implies the tag will be a TEXTUNIT
- # with embedded skeleton
+ # with embedded skeleton
meta:
ruleTypes: [ATTRIBUTES_ONLY]
translatableAttributes: {content: [[http-equiv, EQUALS, keywords], [name, EQUALS, [keywords, description]]]}
@@ -124,7 +124,7 @@ elements:
li:
ruleTypes: [TEXTUNIT]
- translatableAttributes: [value]
+ translatableAttributes: [value]
idAttributes: [id]
marquee:
@@ -233,10 +233,10 @@ elements:
input:
ruleTypes: [INLINE]
- translatableAttributes:
- alt: [type, NOT_EQUALS, [file, hidden, image, Password]]
- value: [type, NOT_EQUALS, [file, hidden, image, Password]]
- accesskey: [type, NOT_EQUALS, [file, hidden, image, Password]]
+ translatableAttributes:
+ alt: [type, NOT_EQUALS, [file, hidden, image, Password]]
+ value: [type, NOT_EQUALS, [file, hidden, image, Password]]
+ accesskey: [type, NOT_EQUALS, [file, hidden, image, Password]]
title: [type, NOT_EQUALS, [file, hidden, image, Password]]
placeholder: null
@@ -371,4 +371,4 @@ elements:
# javascript etc.
script:
- ruleTypes: [EXCLUDE]
\ No newline at end of file
+ ruleTypes: [EXCLUDE]
diff --git a/zanata-war/src/main/webapp/resources/script/components-script.js b/zanata-war/src/main/webapp/resources/script/components-script.js
index 8abc10e84e..fe19a517ae 100644
--- a/zanata-war/src/main/webapp/resources/script/components-script.js
+++ b/zanata-war/src/main/webapp/resources/script/components-script.js
@@ -213,4 +213,3 @@ function registerMouseEvent(autocompleteId, selectItemAction,
function filterList(input, filterFn) {
filterFn(jQuery(input).val());
}
-