Skip to content

Commit

Permalink
EA-3717 sonarq issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SrishtiSingh-eu committed Feb 7, 2024
1 parent b48ccc5 commit 8f75899
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ build/
**/*.user.properties
**/*auth.json
# NOTE: use externalized log4j2.xml
**/log4j2.xml
**/log4j2.xml

**/src/main/resources/translation_service_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
* @author srishti singh
* @since 5 Feb 2024
*/
public interface LanguageObj {
public interface LanguageObj {

public String getText();
String getText();

public void setText(String text);
void setText(String text);

public String getCacheKey();
String getCacheKey();

public void setCacheKey(String cacheKey);
void setCacheKey(String cacheKey);

public boolean isAvailableInCache();
boolean isAvailableInCache();

public void setAvailableInCache(boolean cached);
void setAvailableInCache(boolean cached);

public boolean isTranslatable();
boolean isTranslatable();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public interface LanguageDetectionService {
* To fetch the source language for the list of texts. If passed, langHint is used a hint in the
* method
*
* @param languageDetectionObjs
* @return
* @param languageDetectionObjs languge detection input object list
* @throws LanguageDetectionException if an error occurred when invoking the external service
*/
void detectLang(List<LanguageDetectionObj> languageDetectionObjs) throws LanguageDetectionException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void detectLang(List<LanguageDetectionObj> languageDetectionObjs) throws
return;
}

List<String> detectedLangs = new ArrayList<>();
List<String> detectedLangs = new ArrayList<>(languageDetectionObjs.size());
List<LanguageResult> tikaLanguages=null;
for(LanguageDetectionObj obj : languageDetectionObjs) {
//returns all tika languages sorted by score
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class LangDetectionPreProcessor implements LanguageDetectionService {

Pattern langDetectEligibleValuesPattern;

/**
* LangDetectionPreProcessor constructor to initialise the pattern
* @param langDetectEligibleValuesPattern eligible values pattern
*/
public LangDetectionPreProcessor(Pattern langDetectEligibleValuesPattern) {
this.langDetectEligibleValuesPattern = langDetectEligibleValuesPattern;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public class TranslationPreProcessor implements TranslationService {

Pattern translationEligibleValuesPattern;

/**
* TranslationPreProcessor constructor to initialise the pattern
* @param translationEligibleValuesPattern eligible values pattern
*/
public TranslationPreProcessor(Pattern translationEligibleValuesPattern) {
this.translationEligibleValuesPattern = translationEligibleValuesPattern;
}
Expand Down

0 comments on commit 8f75899

Please sign in to comment.