| Index: source/common/filteredbrk.cpp
|
| diff --git a/source/common/filteredbrk.cpp b/source/common/filteredbrk.cpp
|
| index 5a8f0b0873e645647bf9bac071547b66c9e5c9bb..acba9592f0d239ddd8918c402b86d264ba8b30ad 100644
|
| --- a/source/common/filteredbrk.cpp
|
| +++ b/source/common/filteredbrk.cpp
|
| @@ -1,3 +1,5 @@
|
| +// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
| +// License & terms of use: http://www.unicode.org/copyright.html
|
| /*
|
| *******************************************************************************
|
| * Copyright (C) 2014-2015, International Business Machines Corporation and
|
| @@ -401,7 +403,8 @@ SimpleFilteredSentenceBreakIterator::next() {
|
|
|
| int32_t
|
| SimpleFilteredSentenceBreakIterator::first(void) {
|
| - return internalNext(fDelegate->first());
|
| + // Don't suppress a break opportunity at the beginning of text.
|
| + return fDelegate->first();
|
| }
|
|
|
| int32_t
|
| @@ -415,7 +418,9 @@ SimpleFilteredSentenceBreakIterator::previous(void) {
|
| }
|
|
|
| UBool SimpleFilteredSentenceBreakIterator::isBoundary(int32_t offset) {
|
| - if(!fDelegate->isBoundary(offset)) return false; // no break to suppress
|
| + if (!fDelegate->isBoundary(offset)) return false; // no break to suppress
|
| +
|
| + if (fData->fBackwardsTrie.isNull()) return true; // no data = no suppressions
|
|
|
| UErrorCode status = U_ZERO_ERROR;
|
| resetState(status);
|
| @@ -476,13 +481,42 @@ SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Loc
|
| : fSet(status)
|
| {
|
| if(U_SUCCESS(status)) {
|
| - LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &status));
|
| - LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &status));
|
| - LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &status));
|
| - if(U_FAILURE(status)) return; // leaves the builder empty, if you try to use it.
|
| + UErrorCode subStatus = U_ZERO_ERROR;
|
| + LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &subStatus));
|
| + if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
|
| + status = subStatus; // copy the failing status
|
| +#if FB_DEBUG
|
| + fprintf(stderr, "open BUNDLE %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
|
| +#endif
|
| + return; // leaves the builder empty, if you try to use it.
|
| + }
|
| + LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &subStatus));
|
| + if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
|
| + status = subStatus; // copy the failing status
|
| +#if FB_DEBUG
|
| + fprintf(stderr, "open EXCEPTIONS %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
|
| +#endif
|
| + return; // leaves the builder empty, if you try to use it.
|
| + }
|
| + LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &subStatus));
|
| +
|
| +#if FB_DEBUG
|
| + {
|
| + UErrorCode subsub = subStatus;
|
| + fprintf(stderr, "open SentenceBreak %s => %s, %s\n", fromLocale.getBaseName(), ures_getLocale(breaks.getAlias(), &subsub), u_errorName(subStatus));
|
| + }
|
| +#endif
|
| +
|
| + if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
|
| + status = subStatus; // copy the failing status
|
| +#if FB_DEBUG
|
| + fprintf(stderr, "open %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
|
| +#endif
|
| + return; // leaves the builder empty, if you try to use it.
|
| + }
|
|
|
| LocalUResourceBundlePointer strs;
|
| - UErrorCode subStatus = status;
|
| + subStatus = status; // Pick up inherited warning status now
|
| do {
|
| strs.adoptInstead(ures_getNextResource(breaks.getAlias(), strs.orphan(), &subStatus));
|
| if(strs.isValid() && U_SUCCESS(subStatus)) {
|
|
|