Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
5fc9d6cc
Commit
5fc9d6cc
authored
11 years ago
by
Kurt Partridge
Browse files
Options
Downloads
Patches
Plain Diff
Avoid an NPE
Change-Id: I174eb8e92820fe6e7f8d3b89afae12d94063ef5d
parent
cbc7acb6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/research/ResearchLogger.java
+10
-10
10 additions, 10 deletions
.../src/com/android/inputmethod/research/ResearchLogger.java
with
10 additions
and
10 deletions
java/src/com/android/inputmethod/research/ResearchLogger.java
+
10
−
10
View file @
5fc9d6cc
...
...
@@ -854,23 +854,22 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// The user has deleted this word and returned to the previous. Check that the word in the
// logUnit matches the expected word. If so, restore the last log unit committed to be the
// current logUnit. I.e., pull out the last LogUnit from all the LogBuffers, and make
//
restore
it t
o
mCurrentLogUnit so the new edits are captured with the word. Optionally
//
dump the
contents of mCurrentLogUnit (useful if they contain deletions of the next word
//
that
should not be reported to protect user privacy)
// it t
he
mCurrentLogUnit so the new edits are captured with the word. Optionally
dump the
// contents of mCurrentLogUnit (useful if they contain deletions of the next word
that
// should not be reported to protect user privacy)
//
// Note that we don't use mLastLogUnit here, because it only goes one word back and is only
// needed for reverts, which only happen one back.
final
LogUnit
oldLogUnit
=
mMainLogBuffer
.
peekLastLogUnit
();
// Check that expected word matches.
// Check that expected word matches. It's ok if both strings are null, because this is the
// case where the LogUnit is storing a non-word, e.g. a separator.
if
(
oldLogUnit
!=
null
)
{
final
String
oldLogUnitWords
=
oldLogUnit
.
getWordsAsString
();
// Because the word is stored in the LogUnit with digits scrubbed, the comparison must
// be made on a scrubbed version of the expectedWord as well.
if
(
oldLogUnitWords
!=
null
&&
!
oldLogUnitWords
.
equals
(
scrubDigitsFromString
(
expectedWord
)))
{
return
;
}
final
String
scrubbedExpectedWord
=
scrubDigitsFromString
(
expectedWord
);
final
String
oldLogUnitWords
=
oldLogUnit
.
getWordsAsString
();
if
(!
TextUtils
.
equals
(
scrubbedExpectedWord
,
oldLogUnitWords
))
return
;
}
// Uncommit, merging if necessary.
...
...
@@ -986,7 +985,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
return
Character
.
isDigit
(
codePoint
)
?
DIGIT_REPLACEMENT_CODEPOINT
:
codePoint
;
}
/* package for test */
static
String
scrubDigitsFromString
(
String
s
)
{
/* package for test */
static
String
scrubDigitsFromString
(
final
String
s
)
{
if
(
s
==
null
)
return
null
;
StringBuilder
sb
=
null
;
final
int
length
=
s
.
length
();
for
(
int
i
=
0
;
i
<
length
;
i
=
s
.
offsetByCodePoints
(
i
,
1
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment