From: SourceForge.net <no...@so...> - 2012-05-17 13:37:18
|
Bugs item #3481757, was opened at 2012-01-30 13:07 Message generated for change (Settings changed) made by didierbr You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=520347&aid=3481757&group_id=68187 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Application Group: SVN Status: Open Resolution: None Priority: 5 Private: No Submitted By: Guido Leenders (guido_leenders) >Assigned to: Alex Buloichik (alex73) Summary: NullPointerException during resegmentation Initial Comment: During resegmentation to sentence segmentation, I received a NPE. See call stack. Suggested change to avoid it: Index: Segmenter.java =================================================================== --- Segmenter.java (revision 4063) +++ Segmenter.java (working copy) @@ -310,6 +310,12 @@ public static void segmentEntries(boolean needResegment, Language sourceLang, String sourceEntry, Language targetLang, String targetEntry, List<String> sourceSegments, List<String> targetSegments) { if (needResegment) { + // + // Only try to segment entries when both are available. + // Remember that a TMX may contain entries for both languages, but does not have to. + // + if (sourceEntry != null && targetEntry != null) + { List<String> srcSegments = Segmenter.segment(sourceLang, sourceEntry, null, null); List<String> tarSegments = Segmenter.segment(targetLang, targetEntry, null, null); @@ -318,6 +324,7 @@ targetSegments.addAll(tarSegments); return; } + } } // not need to resegment, or segments counts not equals sourceSegments.add(sourceEntry); -- 92541: Info: Reading TMX file /home/gle3/ws/translate/demo/nl2en/omegat/project_save.tmx (TMXR_INFO_READING_FILE) 92541: Info: Created by: OmegaT (TMXR_INFO_CREATION_TOOL) 92541: Info: Version: 2.5.0_2 (TMXR_INFO_CREATION_TOOL_VERSION) 92541: Info: Segmentation method: paragraph (TMXR_INFO_SEG_TYPE) 92541: Info: Source language: NL-NL (TMXR_INFO_SOURCE_LANG) 92541: Warning: Your current project uses sentence segmentation, but TMX file was created using paragraph segmentation. OmegaT will try to resegment the TMX file... (TMXR_WARNING_UPGRADE_SENTSEG) Source=Demo: 1001, target = null 1=<br\d+/?> 2=null 92541: Error: Exception while parsing: (TMXR_EXCEPTION_WHILE_PARSING) 92541: Error: java.lang.NullPointerException 92541: Error: at java.util.regex.Matcher.getTextLength(Matcher.java:1140) 92541: Error: at java.util.regex.Matcher.reset(Matcher.java:291) 92541: Error: at java.util.regex.Matcher.<init>(Matcher.java:211) 92541: Error: at java.util.regex.Pattern.matcher(Pattern.java:888) 92541: Error: at org.omegat.core.segmentation.Segmenter.getBreaks(Segmenter.java:185) 92541: Error: at org.omegat.core.segmentation.Segmenter.breakParagraph(Segmenter.java:128) 92541: Error: at org.omegat.core.segmentation.Segmenter.segment(Segmenter.java:74) 92541: Error: at org.omegat.core.segmentation.Segmenter.segmentEntries(Segmenter.java:328) 92541: Error: at org.omegat.core.data.ProjectTMX$Loader.onEntry(ProjectTMX.java:233) 92541: Error: at org.omegat.util.TMXReader2.readTMX(TMXReader2.java:146) 92541: Error: at org.omegat.core.data.ProjectTMX.<init>(ProjectTMX.java:99) 92541: Error: at org.omegat.core.data.RealProject.loadTranslations(RealProject.java:558) 92541: Error: at org.omegat.core.data.RealProject.loadProject(RealProject.java:231) 92541: Error: at org.omegat.Main.selectProjectConsoleMode(Main.java:429) 92541: Error: at org.omegat.Main.runConsoleTranslate(Main.java:246) 92541: Error: at org.omegat.Main.main(Main.java:173) 92541: Error: Failed to load specified project! (TF_LOAD_ERROR) ---------------------------------------------------------------------- Comment By: Didier Briel (didierbr) Date: 2012-02-18 00:57 Message: Yes, it would be fine it you could solve both issues. Didier ---------------------------------------------------------------------- Comment By: Guido Leenders (guido_leenders) Date: 2012-02-05 13:49 Message: Hi Didier, should I try to solve 3425237 also after testing whether the patch listed above works? Or what do you recommend? ---------------------------------------------------------------------- Comment By: Didier Briel (didierbr) Date: 2012-01-30 13:31 Message: See also - Exception if new non-default /tm contains TMs to segment http://sourceforge.net/support/tracker.php?aid=3425237 Didier ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=520347&aid=3481757&group_id=68187 |