[
https://issues.apache.org/jira/browse/NIFI-6795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16989419#comment-16989419
]
ASF subversion and git services commented on NIFI-6795:
-------------------------------------------------------
Commit 885f1d1e5e7097794e2fe76198f6ffd9eddbd656 in nifi's branch
refs/heads/master from John Fortin
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=885f1d1 ]
NIFI-6795 - fix for CouchbaseMapCacheClient to allow new objects to be created
Signed-off-by: John Fortin <[email protected]>
Signed-off-by: Pierre Villard <[email protected]>
This closes #3833.
> Fix bug in CouchbaseMapCacheClient.java which prevents new Couchbase Object
> from being created
> ----------------------------------------------------------------------------------------------
>
> Key: NIFI-6795
> URL: https://issues.apache.org/jira/browse/NIFI-6795
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Reporter: John E Fortin
> Priority: Major
> Time Spent: 1h
> Remaining Estimate: 0h
>
> The function below has a bug:
> {code:java}
> @Override
> public <K, V> boolean replace(AtomicCacheEntry<K, V, Long> entry,
> Serializer<K> keySerializer, Serializer<V> valueSerializer) throws
> IOException {
> final Long revision = entry.getRevision().orElse(0L);
> final String docId = toDocumentId(entry.getKey(), keySerializer);
> final Document doc = toDocument(docId, entry.getValue(), valueSerializer,
> revision);
> try {
> if (revision < 0) {
> // If the document does not exist yet, try to create one.
> try {
> bucket.insert(doc);
> return true;
> } catch (DocumentAlreadyExistsException e) {
> return false;
> }{code}
> {code:java}
> final Long revision = entry.getRevision().orElse(0L);{code}
> should be
> {code:java}
> final Long revision = entry.getRevision().orElse(-1L);{code}
> otherwise a new document never gets created in the check
> {code:java}
> if (revision < 0) {
> // If the document does not exist yet, try to create one.
> try {
> bucket.insert(doc);
> return true;
> } catch (DocumentAlreadyExistsException e) {
> return false;
> }{code}
> I have tested the code change locally and it works properly...
>
> --John
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)