- changed status to resolved
Issue with sending empty textunits to BatchTmLeveraging step
Original issue 331 created by anoopsing... on 2013-04-26T07:19:52.000Z:
What steps will reproduce the problem?
1.Create an XLIFF with few text units having no text.
2.Create a pipeline with BatchTmLeveragingStep with xliff filter to raw document and writer in place.
3.Pass the xliff with empty text units through this pipeline. You will see exception
java.lang.IndexOutOfBoundsException: Index: 29, Size: 29
at java.util.ArrayList.rangeCheck(ArrayList.java:604)
at java.util.ArrayList.get(ArrayList.java:382)
at
net.sf.okapi.lib.translation.BaseConnector.batchLeverageUsingBatchQuery(BaseConnector.java:333)
at
net.sf.okapi.connectors.microsoft.MicrosoftMTConnector.batchLeverage(MicrosoftMTConnector.java:492)
at
net.sf.okapi.steps.leveraging.BatchTmLeveragingStep.batchLeverage(BatchTmLeveragingStep.java:245)
at
net.sf.okapi.steps.leveraging.BatchTmLeveragingStep.handleTextUnit(BatchTmLeveragingStep.java:139)
at
net.sf.okapi.steps.leveraging.BatchTmLeveragingStep.handleEvent(BatchTmLeveragingStep.java:106)
at net.sf.okapi.common.pipeline.Pipeline.execute(Pipeline.java:123)
at net.sf.okapi.common.pipeline.Pipeline.process(Pipeline.java:235)
at net.sf.okapi.common.pipeline.Pipeline.process(Pipeline.java:205)
at
net.sf.okapi.common.pipelinedriver.PipelineDriver.processBatch(PipelineDriver.java:162)
What is the expected output? What do you see instead?
We should not be sending the text units for MT.
What version of the product are you using? On what operating system?
M20 on RHEL 5.4
Please provide any additional information below.
I did fixed this issue on my local by changing the method canLeverageTU()
*********************************
private boolean canLeverageTu(ITextUnit tu) {
// Do not leverage non-translatable entries
if (!tu.isTranslatable()) {
return false;
}
boolean approved = false;
Property prop = tu.getTargetProperty(targetLocale, Property.APPROVED);
if (prop != null) {
if ("yes".equals(prop.getValue())) {
approved = true;
}
}
// Do not leverage pre-approved entries
if (approved) {
return false;
}
// do not leverage if has been Diff Leveraged
if (wasDiffLeveraged(tu)) {
return false;
}
//This code was specifically added not to send any empty textunit/ place holders for leveraging
//As it wont make sense to translate empty texts.
if (tu.getSource().getFirstContent().getText().equals("")) {
return false;
}
return true;
}
*********************************
Not sure if its a right approach but this fixes the exception and i dont see this issue happening any more.
Comments (1)
-
Account Deleted - Log in to comment
Comment 1. originally posted by @ysavourel on 2013-04-30T12:40:50.000Z:
Using:
// Do not leverage entries without text
if ( !tu.getSource().hasText() ) {
return false;
}
should work better.
I've made the change. It's in the dev branch and will be in the next snapshot.