auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Datum generateDatum(final State state, final Integer position, final Random rdn) { final double[] logEmissionProbs = new double[State.values().length]; for (int i = 0; i < logEmissionProbs.length; i++) { logEmissionProbs[i] = logEmissionProbability(Datum.values()[i], state, position); } final double total = Math.exp(MathUtils.approximateLogSumLog(logEmissionProbs)); final double uniform = rdn.nextDouble() * total; double accumulate = 0; for (int i = 0; i < Datum.values().length; i++) { accumulate += Math.exp(logEmissionProbs[i]); if (uniform < accumulate) { return Datum.values()[i]; } } throw new IllegalStateException("may be some of the emission probs is negative?"); }

Target:
private Datum generateDatum(final State state, final Integer position, final Random rdn) { final double[] logEmissionProbs = new double[State.values().length]; for (int i = 0; i < logEmissionProbs.length; i++) { logEmissionProbs[i] = logEmissionProbability(Datum.values()[i], state, position); } final double total = Math.exp(MathUtils.approximateLogSumLog(logEmissionProbs)); final double uniform = rdn.nextDouble() * total; double accumulate = 0; for (int i = 0; i < Datum.values().length; i++) { accumulate += Math.exp(logEmissionProbs[i]); if (uniform < accumulate) { return Datum.values()[i]; } } throw new IllegalStateException("may be some of the emission probs are negative?"); }
Source:
private boolean isDescendantOf(Change.Id child, RevId ancestor) throws OrmException { ReviewDb db = dbProvider.get(); ArrayList<RevId> parents = new ArrayList<RevId>(); parents.add(ancestor); while (!parents.isEmpty()) { RevId parent = parents.remove(0); for (PatchSetAncestor desc : db.patchSetAncestors().descendantsOf(parent)) { PatchSet descPatchSet = db.patchSets().get(desc.getPatchSet()); Change.Id descChangeId = descPatchSet.getId().getParentKey(); if (child.equals(descChangeId)) { PatchSet.Id descCurrentPatchSetId = db.changes().get(descChangeId).currentPatchSetId(); return descPatchSet.getId().equals(descCurrentPatchSetId); } else { parents.add(descPatchSet.getRevision()); } } } return false; }

Target:
private boolean isDescendantOf(Change.Id child, RevId ancestor) throws OrmException { ReviewDb db = dbProvider.get(); ArrayList<RevId> parents = new ArrayList<>(); parents.add(ancestor); while (!parents.isEmpty()) { RevId parent = parents.remove(0); for (PatchSetAncestor desc : db.patchSetAncestors().descendantsOf(parent)) { PatchSet descPatchSet = db.patchSets().get(desc.getPatchSet()); Change.Id descChangeId = descPatchSet.getId().getParentKey(); if (child.equals(descChangeId)) { PatchSet.Id descCurrentPatchSetId = db.changes().get(descChangeId).currentPatchSetId(); return descPatchSet.getId().equals(descCurrentPatchSetId); } else { parents.add(descPatchSet.getRevision()); } } } return false; }
Source:
private void checkThreadLocalField(Symbol field) { if (field.usages().stream().noneMatch(ThreadLocalCleanupCheck::usageIsRemove)) { reportIssue(((VariableTree) field.declaration()).simpleName(), "Call the \"remove()\" on \"" + field.name() + "\" in a \"finally\" block."); } }

Target:
private void checkThreadLocalField(Symbol field) { if (field.usages().stream().noneMatch(ThreadLocalCleanupCheck::usageIsRemove)) { reportIssue(((VariableTree) field.declaration()).simpleName(), "Call \"remove()\" on \"" + field.name() + "\"."); } }
Source:
public boolean replace(Chain expected, Chain replacement) { if (expected.isEmpty()) { if (replacement.isEmpty()) { return true; } else { insertHeader(replacement); return true; } } else if (replacement.isEmpty()) { return removeHeader(expected); } else { return replaceHeader(expected, replacement); } }

Target:
public boolean replace(Chain expected, Chain replacement) { if (expected.isEmpty()) { throw new IllegalArgumentException("Empty expected sequence"); } else if (replacement.isEmpty()) { return removeHeader(expected); } else { return replaceHeader(expected, replacement); } }
Source:
protected static ServiceTypeResolver findService(BrooklynClassLoadingContext context, String type) { String prefix = Splitter.on(":").splitToList(type).get(0); ServiceLoader<ServiceTypeResolver> loader = ServiceLoader.load(ServiceTypeResolver.class, context.getManagementContext().getCatalog().getRootClassLoader()); for (ServiceTypeResolver resolver : loader) { if (prefix.equalsIgnoreCase(resolver.getTypePrefix())) return resolver; } return null; }

Target:
protected static ServiceTypeResolver findService(BrooklynClassLoadingContext context, String type) { if (type.indexOf(':') != -1) { String prefix = Splitter.on(":").splitToList(type).get(0); ServiceLoader<ServiceTypeResolver> loader = ServiceLoader.load(ServiceTypeResolver.class, context.getManagementContext().getCatalog().getRootClassLoader()); for (ServiceTypeResolver resolver : loader) { if (prefix.equals(resolver.getTypePrefix())) { return resolver; } } } return null; }
Source:
private List<Object> extractHits(ProjectionHitMapper<?, ?> projectionHitMapper, IndexSearcher indexSearcher, TopDocs topDocs, SearchProjectionExtractContext projectionExecutionContext) throws IOException { if ( topDocs == null ) { return Collections.emptyList(); } List<Object> extractedData = new ArrayList<>( topDocs.scoreDocs.length ); Map<Integer, Set<Integer>> nestedDocs = fetchNestedDocs( indexSearcher, topDocs.scoreDocs ); for ( ScoreDoc hit : topDocs.scoreDocs ) { indexSearcher.doc( hit.doc, storedFieldVisitor ); Set<Integer> children = nestedDocs.get( hit.doc ); if ( children != null ) { for ( Integer child : children ) { indexSearcher.doc( child, storedFieldVisitor ); } } Document document = storedFieldVisitor.getDocumentAndReset(); LuceneResult luceneResult = new LuceneResult( document, hit.doc, hit.score ); extractedData.add( rootProjection.extract( projectionHitMapper, luceneResult, projectionExecutionContext ) ); } return extractedData; }

Target:
private List<Object> extractHits(ProjectionHitMapper<?, ?> projectionHitMapper, IndexSearcher indexSearcher, TopDocs topDocs, SearchProjectionExtractContext projectionExecutionContext) throws IOException { if ( topDocs == null ) { return Collections.emptyList(); } List<Object> extractedData = new ArrayList<>( topDocs.scoreDocs.length ); Map<Integer, Set<Integer>> nestedDocs = fetchNestedDocs( indexSearcher, topDocs.scoreDocs, projectionExecutionContext ); for ( ScoreDoc hit : topDocs.scoreDocs ) { indexSearcher.doc( hit.doc, storedFieldVisitor ); if ( nestedDocs.containsKey( hit.doc ) ) { for ( Integer child : nestedDocs.get( hit.doc ) ) { indexSearcher.doc( child, storedFieldVisitor ); } } Document document = storedFieldVisitor.getDocumentAndReset(); LuceneResult luceneResult = new LuceneResult( document, hit.doc, hit.score ); extractedData.add( rootProjection.extract( projectionHitMapper, luceneResult, projectionExecutionContext ) ); } return extractedData; }
Source:
private static void setIfNotNullOrEmpty( MongoProperties.Builder builder, MongoProp prop, String value ) { if ( value != null && value.trim().length() > 0 ) { boolean isPassword = MongoProp.PASSWORD.equals( prop ); boolean isEncrypted = value.startsWith( Encr.PASSWORD_ENCRYPTED_PREFIX ); if ( isPassword && isEncrypted ) { value = Encr.decryptPasswordOptionallyEncrypted( value ); } builder.set( prop, value ); } }

Target:
private static void setIfNotNullOrEmpty( MongoProperties.Builder builder, MongoProp prop, String value ) { if ( value != null && value.trim().length() > 0 ) { boolean isPassword = MongoProp.PASSWORD.equals( prop ); if ( isPassword ) { value = Encr.decryptPasswordOptionallyEncrypted( value ); } builder.set( prop, value ); } }
Source:
public Set<PyKeyValuePairTree> elements() { return elements; }

Target:
public List<PyKeyValuePairTree> elements() { return elements; }
Source:
String encode(String plainMessage, int keyA, int keyB) { return splitIntoFiveLetterWords( translate(plainMessage, keyA, keyB, 0)); }

Target:
String encode(String plainMessage, int keyA, int keyB) { return splitIntoFiveLetterWords( translate(plainMessage, keyA, keyB, Mode.ENCODE)); }
Source:
private void changeUIStateToListening() { voiceIcon.setText(R.string.voice_icon_recognizer_white); voiceIcon.setBackgroundResource(R.drawable.recognizable_voice_blue); message.setText(R.string.list_name_input_speech_message); tryAgain.setVisibility(View.INVISIBLE); }

Target:
private void changeUIStateToListening() { voiceIcon.setText(R.string.voice_icon_recognizer_white); voiceIcon.setBackgroundResource(R.drawable.recognizable_voice_blue); message.setText(R.string.list_name_input_speech_message); tryAgain.setVisibility(View.GONE); }
Source:
public Map<String, String> getDomainAsMap() { String domain = getDomainAsString(); Map<String, String> domainAsMap = new HashMap<>(); if (domain == null || domain.isEmpty()) { return domainAsMap; } String[] pathPairs = domain.trim().split(","); for (String pair : pathPairs) { String[] values = pair.trim().split("="); if (values.length != 2 || values[0].isEmpty() || values[1].isEmpty()) { throw new IllegalArgumentException( String.format("Domain-Value pair %s is not valid.", pair)); } domainAsMap.put(values[0], values[1]); } return domainAsMap; }

Target:
public Map<String, String> getDomainAsMap() { String domain = getDomainAsString(); Map<String, String> domainAsMap = new HashMap<>(); if (domain == null || domain.isEmpty()) { return domainAsMap; } String[] pathPairs = domain.trim().split(","); for (String pair : pathPairs) { String[] values = pair.split("="); if (values.length != 2 || values[0].isEmpty() || values[1].isEmpty()) { throw new IllegalArgumentException( String.format("Domain-Value pair %s is not valid.", pair)); } domainAsMap.put(values[0].trim(), values[1].trim()); } return domainAsMap; }
Source:
protected MongoTranslation findOrCreateTranslation(@Nonnull Mapping field, String lang, String text) { if (!isValidLanguage(lang, field.getName())) { return null; } Optional<MongoTranslation> translation = fetchTranslation(field, lang); if (translation.isPresent()) { return translation.get(); } else { MongoTranslation mongoTranslation = new MongoTranslation(); mongoTranslation.getTranslationData().setOwner(owner.getUniqueName()); mongoTranslation.getTranslationData().setField(field.getName()); mongoTranslation.getTranslationData().setLang(lang); return mongoTranslation; } }

Target:
protected MongoTranslation findOrCreateTranslation(@Nonnull Mapping field, String lang, String text) { assertValidLanguage(lang, field.getName()); Optional<MongoTranslation> translation = fetchTranslation(field, lang); if (translation.isPresent()) { return translation.get(); } else { MongoTranslation mongoTranslation = new MongoTranslation(); mongoTranslation.getTranslationData().setOwner(owner.getUniqueName()); mongoTranslation.getTranslationData().setField(field.getName()); mongoTranslation.getTranslationData().setLang(lang); return mongoTranslation; } }
Source:
public void removeGlobalPropertyListener_shouldNotFailOnNullListener() { GlobalPropertyListener globalPropertyListener = null; assertNull(globalPropertyListener); adminService.removeGlobalPropertyListener(globalPropertyListener); }

Target:
public void removeGlobalPropertyListener_shouldNotFailOnNullListener() { adminService.removeGlobalPropertyListener(null); }
Source:
void shouldReturnScmNameIfAny(String body) { Request request = newRequestWithAuthorizationHeader("repo:push", "", body); BitBucketCloudPushRequest bitBucketCloudPushRequest = new BitBucketCloudPushRequest(request); QueryParamsMap map = mock(QueryParamsMap.class); when(request.queryMap()).thenReturn(map); when(map.hasKey(KEY_SCM_NAME)).thenReturn(false); assertThat(bitBucketCloudPushRequest.getScmNames()).isEmpty(); when(request.queryMap()).thenReturn(map); when(map.hasKey(KEY_SCM_NAME)).thenReturn(true); QueryParamsMap value = mock(QueryParamsMap.class); when(map.get(KEY_SCM_NAME)).thenReturn(value); when(value.values()).thenReturn(singletonList("scm1").toArray(new String[]{})); assertThat(bitBucketCloudPushRequest.getScmNames()).containsExactly("scm1"); }

Target:
void shouldReturnScmNameIfAny(String body) { Request request = newRequestWithAuthorizationHeader("repo:push", "", body); BitBucketCloudPushRequest bitBucketCloudPushRequest = new BitBucketCloudPushRequest(request); QueryParamsMap map = mock(QueryParamsMap.class); when(request.queryMap()).thenReturn(map); when(map.hasKey(KEY_SCM_NAME)).thenReturn(false); assertThat(bitBucketCloudPushRequest.getScmNames()).isEmpty(); when(request.queryMap()).thenReturn(map); when(map.hasKey(KEY_SCM_NAME)).thenReturn(true); QueryParamsMap value = mock(QueryParamsMap.class); when(map.get(KEY_SCM_NAME)).thenReturn(value); when(value.values()).thenReturn(new String[]{"scm1"}); assertThat(bitBucketCloudPushRequest.getScmNames()).containsExactly("scm1"); }
Source:
public static Object [][] filesToCompress(){ return new Object[][]{ {TEST_VARIANT_DIR.resolve("test1.vcf"),".gz",7}, {TEST_VARIANT_DIR.resolve("test1.vcf"),".bfq",7}, {TEST_DATA_DIR.resolve("words_longs.txt"),".gz",8}, {TEST_DATA_DIR.resolve("words_longs.txt"),".bfq",8} }; }

Target:
public static Object[][] filesToCompress() { return new Object[][]{ {WORDS_LONG, ".gz", 8}, {WORDS_LONG, ".bfq", 8}, {TEST_VARIANT_DIR.resolve("test1.vcf"), ".gz", 7}, {TEST_VARIANT_DIR.resolve("test1.vcf"), ".bfq", 7} }; }
Source:
private static List<String> geoCellValues(String value) { String[] geoParts = value.split("\\|"); List<String> cells = new ArrayList<>(); int count = 0; for (count = 0; count < Math.min(geoParts.length,3); count++) { cells.add(geoParts[count]); } for (int j = count; j < 3; j++) { cells.add(""); } return cells; }

Target:
private static List<String> geoCellValues(String value) { String[] geoParts = value.split("\\|"); List<String> cells = new ArrayList<>(); int count = 0; int partsToCopy = Math.min(geoParts.length, GEO_COLUMN_COUNT); for (count = 0; count < partsToCopy; count++) { cells.add(geoParts[count]); } for (int j = count; j < GEO_COLUMN_COUNT; j++) { cells.add(""); } return cells; }
Source:
public InputStream handleException(Request request, Exception exception) throws RuntimeException { throw new RuntimeException("Request to worker failed", exception); }

Target:
public InputStream handleException(Request request, Exception exception) { throw new RuntimeException("Request to worker failed", exception); }
Source:
protected Pair<String, Map<String, List<Object>>> convertPersonAttributesToPrincipal(final String extractedPrincipalId, final Map<String, List<Object>> attributes) { val convertedAttributes = new LinkedHashMap<String, List<Object>>(); attributes.forEach((key, attrValue) -> { val values = CollectionUtils.toCollection(attrValue, ArrayList.class); LOGGER.debug("Found attribute with value(s) [{}]", key, values); convertedAttributes.put(key, values); }); var principalId = extractedPrincipalId; if (StringUtils.isNotBlank(this.principalAttributeNames)) { val attrNames = org.springframework.util.StringUtils.commaDelimitedListToSet(this.principalAttributeNames); val result = attrNames.stream() .map(String::trim) .filter(attributes::containsKey) .map(attributes::get) .findFirst(); if (result.isPresent()) { val values = result.get(); if (!values.isEmpty()) { principalId = CollectionUtils.firstElement(values).get().toString(); LOGGER.debug("Found principal id attribute value and removed it from the collection of attributes", principalId); } } else { LOGGER.warn("Principal resolution is set to resolve the authenticated principal via attribute(s) [{}], and yet " + "the collection of attributes retrieved do not contain any of those attributes. This is likely due to misconfiguration " + "and CAS will switch to use as the final principal id", this.principalAttributeNames, attributes.keySet(), principalId); } } return Pair.of(principalId, convertedAttributes); }

Target:
protected Pair<String, Map<String, List<Object>>> convertPersonAttributesToPrincipal(final String extractedPrincipalId, final Map<String, List<Object>> attributes) { val convertedAttributes = new LinkedHashMap<String, List<Object>>(); attributes.forEach((key, attrValue) -> { val values = ((List<Object>) CollectionUtils.toCollection(attrValue, ArrayList.class)) .stream() .filter(Objects::nonNull) .collect(toList()); LOGGER.debug("Found attribute with value(s) [{}]", key, values); convertedAttributes.put(key, values); }); var principalId = extractedPrincipalId; if (StringUtils.isNotBlank(this.principalAttributeNames)) { val attrNames = org.springframework.util.StringUtils.commaDelimitedListToSet(this.principalAttributeNames); val result = attrNames.stream() .map(String::trim) .filter(attributes::containsKey) .map(attributes::get) .findFirst(); if (result.isPresent()) { val values = result.get(); if (!values.isEmpty()) { principalId = CollectionUtils.firstElement(values).get().toString(); LOGGER.debug("Found principal id attribute value and removed it from the collection of attributes", principalId); } } else { LOGGER.warn("Principal resolution is set to resolve the authenticated principal via attribute(s) [{}], and yet " + "the collection of attributes retrieved do not contain any of those attributes. This is likely due to misconfiguration " + "and CAS will switch to use as the final principal id", this.principalAttributeNames, attributes.keySet(), principalId); } } return Pair.of(principalId, convertedAttributes); }
Source:
private static EventIdentificationType createEventIdentification(String actionCode, Integer eventOutcome, CodedValueType eventId) { EventIdentificationType eventIdentification = new EventIdentificationType(); eventIdentification.setEventActionCode(actionCode); try { java.util.GregorianCalendar today = new java.util.GregorianCalendar(TimeZone.getTimeZone("GMT")); javax.xml.datatype.DatatypeFactory factory = javax.xml.datatype.DatatypeFactory.newInstance(); javax.xml.datatype.XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar( today.get(java.util.GregorianCalendar.YEAR), today.get(java.util.GregorianCalendar.MONTH) + 1, today.get(java.util.GregorianCalendar.DAY_OF_MONTH), today.get(java.util.GregorianCalendar.HOUR_OF_DAY), today.get(java.util.GregorianCalendar.MINUTE), today.get(java.util.GregorianCalendar.SECOND), today.get(java.util.GregorianCalendar.MILLISECOND), 0); eventIdentification.setEventDateTime(calendar); } catch (DatatypeConfigurationException e) { LOG.error("DatatypeConfigurationException when creating XMLGregorian Date"); LOG.error(" message: " + e.getMessage()); } catch (ArrayIndexOutOfBoundsException e) { LOG.error("ArrayIndexOutOfBoundsException when creating XMLGregorian Date"); LOG.error(" message: " + e.getMessage()); } BigInteger eventOutcomeBig = BigInteger.ZERO; if (eventOutcome != null) { eventOutcomeBig = new BigInteger(eventOutcome.toString()); } eventIdentification.setEventOutcomeIndicator(eventOutcomeBig); eventIdentification.setEventID(eventId); return eventIdentification; }

Target:
private static EventIdentificationType createEventIdentification(String actionCode, Integer eventOutcome, CodedValueType eventId) { EventIdentificationType eventIdentification = new EventIdentificationType(); eventIdentification.setEventActionCode(actionCode); try { GregorianCalendar today = new java.util.GregorianCalendar(TimeZone.getTimeZone("GMT")); DatatypeFactory factory = javax.xml.datatype.DatatypeFactory.newInstance(); XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar( today.get(java.util.GregorianCalendar.YEAR), today.get(java.util.GregorianCalendar.MONTH) + 1, today.get(java.util.GregorianCalendar.DAY_OF_MONTH), today.get(java.util.GregorianCalendar.HOUR_OF_DAY), today.get(java.util.GregorianCalendar.MINUTE), today.get(java.util.GregorianCalendar.SECOND), today.get(java.util.GregorianCalendar.MILLISECOND), 0); eventIdentification.setEventDateTime(calendar); } catch (DatatypeConfigurationException e) { LOG.error("DatatypeConfigurationException when creating XMLGregorian Date"); LOG.error(" message: " + e.getLocalizedMessage(), e); } catch (ArrayIndexOutOfBoundsException e) { LOG.error("ArrayIndexOutOfBoundsException when creating XMLGregorian Date"); LOG.error(" message: " + e.getLocalizedMessage(), e); } BigInteger eventOutcomeBig = BigInteger.ZERO; if (eventOutcome != null) { eventOutcomeBig = new BigInteger(eventOutcome.toString()); } eventIdentification.setEventOutcomeIndicator(eventOutcomeBig); eventIdentification.setEventID(eventId); return eventIdentification; }
Source:
private static ExpressionTree findBoxedBoolean(ExpressionTree tree) { if (isBooleanIdentifier(tree)) { return tree; } if (tree instanceof BinaryExpressionTree) { BinaryExpressionTree expression = (BinaryExpressionTree) tree; if (!isNullCheck(expression) && !isNullCheck(expression.leftOperand())) { if (isBooleanIdentifier(expression.leftOperand())) { return expression.leftOperand(); } if (isBooleanIdentifier(expression.rightOperand())) { return expression.rightOperand(); } } } return null; }

Target:
private static ExpressionTree findBoxedBoolean(ExpressionTree tree) { if (tree.symbolType().is(BOOLEAN) && !isOptionalInvocation(tree)) { return tree; } if (tree.is(Kind.LOGICAL_COMPLEMENT)) { return findBoxedBoolean(((UnaryExpressionTree) tree).expression()); } if (tree instanceof BinaryExpressionTree) { BinaryExpressionTree expr = (BinaryExpressionTree) tree; if (findBoxedBoolean(expr.leftOperand()) != null && expr.rightOperand().symbolType().isPrimitive(Primitives.BOOLEAN)) { return expr.leftOperand(); } if (findBoxedBoolean(expr.rightOperand()) != null && expr.leftOperand().symbolType().isPrimitive(Primitives.BOOLEAN) && !isNullCheck(expr.leftOperand())) { return expr.rightOperand(); } } return null; }
Source:
public static void populateStockIdInGermplasmListData(final List<GermplasmListData> data , InventoryDataManager inventoryDataManager) { final List<Integer> gids = new ArrayList<>(); if (data != null && !data.isEmpty()) { for (final GermplasmListData germplasmListData : data) { gids.add(germplasmListData.getGid()); } } Map<Integer, String> stockIds = inventoryDataManager.retrieveStockIds(gids); if (data != null && !data.isEmpty()) { for (final GermplasmListData ListData : data) { String stockIdValue = ""; if (stockIds != null) { for (final Integer gid : stockIds.keySet()) { if (ListData.getGid().equals(gid)) { stockIdValue = stockIds.get(gid); break; } } } ListData.setStockIDs(stockIdValue); } } }

Target:
public static void populateStockIdInGermplasmListData(final List<GermplasmListData> data , InventoryDataManager inventoryDataManager) { final List<Integer> gids = new ArrayList<>(); if (data != null && !data.isEmpty()) { for (final GermplasmListData germplasmListData : data) { gids.add(germplasmListData.getGid()); } } Map<Integer, String> stockIds = inventoryDataManager.retrieveStockIds(gids); if (data != null && !data.isEmpty()) { for (final GermplasmListData listData : data) { String stockIdValue = ""; if (stockIds != null) { for (final Integer gid : stockIds.keySet()) { if (listData.getGid().equals(gid)) { stockIdValue = stockIds.get(gid); break; } } } listData.setStockIDs(stockIdValue); } } }
Source:
void doesNotOverwriteConfigSourceProviderIfNotProvidedInConstructor() throws Exception { DropwizardTestSupport<TestConfiguration> support = new DropwizardTestSupport<>( TestApplication.class, "test-config.yaml"); try { support.before(); assertThat(TEST_CONFIG_SOURCE_PROVIDER.openCalled).isTrue(); } catch (Exception e) { Assert.fail(); } finally { support.after(); } }

Target:
void doesNotOverwriteConfigSourceProviderIfNotProvidedInConstructor() throws Exception { DropwizardTestSupport<TestConfiguration> support = new DropwizardTestSupport<>( TestApplication.class, "test-config.yaml"); try { support.before(); assertThat(TEST_CONFIG_SOURCE_PROVIDER.openCalled).isTrue(); } finally { support.after(); } }
Source:
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) { requireNonNull(catalogName, "connectorId is null"); requireNonNull(config, "config is null"); try { Bootstrap app = new Bootstrap( new JsonModule(), new KafkaConnectorModule(), binder -> { binder.bind(KafkaConnectorId.class).toInstance(new KafkaConnectorId(catalogName)); binder.bind(TypeManager.class).toInstance(context.getTypeManager()); binder.bind(NodeManager.class).toInstance(context.getNodeManager()); if (tableDescriptionSupplier.isPresent()) { binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KafkaTopicDescription>>>() {}).toInstance(tableDescriptionSupplier.get()); } else { binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KafkaTopicDescription>>>() {}).to(KafkaTableDescriptionSupplier.class).in(Scopes.SINGLETON); } }); Injector injector = app.strictConfig() .doNotInitializeLogging() .setRequiredConfigurationProperties(config) .initialize(); return injector.getInstance(KafkaConnector.class); } catch (Exception e) { throwIfUnchecked(e); throw new RuntimeException(e); } }

Target:
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) { requireNonNull(catalogName, "catalogName is null"); requireNonNull(config, "config is null"); try { Bootstrap app = new Bootstrap( new JsonModule(), new KafkaConnectorModule(), binder -> { binder.bind(KafkaConnectorId.class).toInstance(new KafkaConnectorId(catalogName)); binder.bind(TypeManager.class).toInstance(context.getTypeManager()); binder.bind(NodeManager.class).toInstance(context.getNodeManager()); if (tableDescriptionSupplier.isPresent()) { binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KafkaTopicDescription>>>() {}).toInstance(tableDescriptionSupplier.get()); } else { binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KafkaTopicDescription>>>() {}).to(KafkaTableDescriptionSupplier.class).in(Scopes.SINGLETON); } }); Injector injector = app.strictConfig() .doNotInitializeLogging() .setRequiredConfigurationProperties(config) .initialize(); return injector.getInstance(KafkaConnector.class); } catch (Exception e) { throwIfUnchecked(e); throw new RuntimeException(e); } }
Source:
ScopePassingSpanSubscriber(Subscriber<? super T> subscriber, Context ctx, Tracing tracing) { this.subscriber = subscriber; this.tracing = tracing; this.currentTraceContext = this.tracing.currentTraceContext(); TraceContext root = ctx != null ? ctx.getOrDefault(TraceContext.class, this.currentTraceContext.get()) : null; this.root = root; this.context = ctx != null && root != null ? ctx.put(TraceContext.class, root) : ctx != null ? ctx : Context.empty(); if (log.isTraceEnabled()) { log.trace("Root traceContext [" + root + "], context [" + this.context + "]"); } }

Target:
ScopePassingSpanSubscriber(Subscriber<? super T> subscriber, Context ctx, Tracing tracing) { this.subscriber = subscriber; this.tracer = tracing.tracer(); this.currentTraceContext = tracing.currentTraceContext(); Span root = ctx != null ? ctx.hasKey(Span.class) ? ctx.get(Span.class) : this.tracer.currentSpan() : null; this.traceContext = root == null ? null : root.context(); this.context = ctx != null && root != null ? ctx.put(Span.class, root) : ctx != null ? ctx : Context.empty(); if (log.isTraceEnabled()) { log.trace("Root span [" + root + "], context [" + this.context + "]"); } }
Source:
private void preserve() { List<BreakpointDto> breakpoints2save = new LinkedList<>(); for (Breakpoint breakpoint : breakpoints) { breakpoints2save.add(dtoFactory.createDto(BreakpointDto.class) .withLocation(dtoFactory.createDto(LocationDto.class) .withTarget(breakpoint.getPath()) .withLineNumber(breakpoint.getLineNumber()))); } String storageKey = LOCAL_STORAGE_BREAKPOINTS_KEY + appContext.getWorkspaceId(); storage.setItem(storageKey, dtoFactory.toJson(breakpoints2save)); }

Target:
private void preserve() { if (storage == null) { return; } List<BreakpointDto> breakpoints2save = new LinkedList<>(); for (Breakpoint breakpoint : breakpoints) { breakpoints2save.add(dtoFactory.createDto(BreakpointDto.class) .withLocation(dtoFactory.createDto(LocationDto.class) .withTarget(breakpoint.getPath()) .withLineNumber(breakpoint.getLineNumber()))); } storage.setItem(storageKey, dtoFactory.toJson(breakpoints2save)); }
Source:
public void setSidebarPosition(boolean fixed) { String userPageSideBarStyle = "userPageSideBarFixed"; String userPageFaveListStyle = "userPageFaveList"; if (fixed) { userPageSideBar.addStyleName(userPageSideBarStyle); userPageFaveList.addStyleName(userPageFaveListStyle); } else { userPageSideBar.removeStyleName(userPageSideBarStyle); userPageFaveList.removeStyleName(userPageFaveListStyle); } }

Target:
public void setSidebarPosition(boolean fixed) { if (fixed) { userPageSideBar.addStyleName(USER_PAGE_SIDE_BAR_FIXED_STYLE); userPageFaveList.addStyleName(USER_PAGE_FAVE_LIST_STYLE); } else { userPageSideBar.removeStyleName(USER_PAGE_SIDE_BAR_FIXED_STYLE); userPageFaveList.removeStyleName(USER_PAGE_FAVE_LIST_STYLE); } }
Source:
public void testConcurrencyExecutorShutdown() throws Exception { ModelNode content = new ModelNode(); content.get("archive").set(true); content.get("path").set(new File(tmpDir, "archives/" + ARCHIVE_FILE_NAME).getAbsolutePath()); ModelNode deploymentOpMain = createDeploymentOperation(content, MAIN_SERVER_GROUP_DEPLOYMENT_ADDRESS); executeOnMaster(deploymentOpMain); this.stopServer(FIRST_SERVER_NAME); }

Target:
public void testConcurrencyExecutorShutdown() throws Exception { ModelNode content = new ModelNode(); content.get("archive").set(true); content.get("path").set(new File(tmpDir, "archives/" + ARCHIVE_FILE_NAME).getAbsolutePath()); ModelNode deploymentOpMain = createDeploymentOperation(content, MAIN_SERVER_GROUP_DEPLOYMENT_ADDRESS); executeForResult(deploymentOpMain, masterClient); this.stopServer(FIRST_SERVER_NAME); }
Source:
private void initializeFromLocalSearch(LocalSearch search) { this.search = search; singleFolderMode = false; if (search.searchAllAccounts()) { account = null; } else { String[] accountUuids = search.getAccountUuids(); if (accountUuids.length == 1) { account = preferences.getAccount(accountUuids[0]); List<String> folderServerIds = search.getFolderServerIds(); singleFolderMode = folderServerIds.size() == 1; } } configureDrawer(); actionBarSubTitle.setVisibility((!singleFolderMode) ? View.GONE : View.VISIBLE); }

Target:
private void initializeFromLocalSearch(LocalSearch search) { this.search = search; singleFolderMode = false; if (search.searchAllAccounts()) { account = null; } else { String[] accountUuids = search.getAccountUuids(); if (accountUuids.length == 1) { account = preferences.getAccount(accountUuids[0]); List<String> folderServerIds = search.getFolderServerIds(); singleFolderMode = folderServerIds.size() == 1; } else { account = null; } } configureDrawer(); actionBarSubTitle.setVisibility((!singleFolderMode) ? View.GONE : View.VISIBLE); }
Source:
public void testSetDateExpiresToNull() throws Exception, UpdateException { ArrayList<Coordinate> coordinates = new ArrayList<>(); Coordinate coordinate = new Coordinate(0, 3); coordinates.add(coordinate); table52.getData() .get(0) .get(3) .setDateValue(null); updateManager.update(table52, coordinates); verify(analyzer).update(anySet()); }

Target:
public void testSetDateExpiresToNull() throws Exception { ArrayList<Coordinate> coordinates = new ArrayList<>(); Coordinate coordinate = new Coordinate(0, 3); coordinates.add(coordinate); table52.getData() .get(0) .get(3) .setDateValue(null); updateManager.update(table52, coordinates); verify(analyzer).update(setArgumentCaptor.capture()); Set value = setArgumentCaptor.getValue(); assertEquals(1, value.size()); assertEquals(0, value.iterator().next()); }
Source:
public M fromBytes(byte[] messageBuffer, int offset, int len) throws InvalidProtocolBufferException, UninitializedMessageException { try { if (defaultInstance == null) { defaultInstance = Protobufs.getMessageBuilder(typeRef.getRawClass()) .getDefaultInstanceForType(); } return (M) defaultInstance.newBuilderForType() .mergeFrom(messageBuffer, offset, len) .build(); } catch (InvalidProtocolBufferException e) { logWarning("Invalid Protobuf exception while building " + typeRef.getRawClass().getName(), e); throw e; } catch(UninitializedMessageException ume) { logWarning("Uninitialized Message Exception while building " + typeRef.getRawClass().getName(), ume); throw ume; } }

Target:
public M fromBytes(byte[] messageBuffer, int offset, int len) throws InvalidProtocolBufferException, UninitializedMessageException { if (defaultInstance == null) { defaultInstance = Protobufs.getMessageBuilder(typeRef.getRawClass()) .getDefaultInstanceForType(); } return (M) defaultInstance.newBuilderForType() .mergeFrom(messageBuffer, offset, len) .build(); }
Source:
public boolean shouldCreateEndpoint(Method method, List<Annotation> annotations) { String inputChannel = MessagingAnnotationUtils.resolveAttribute(annotations, "inputChannel", String.class); return StringUtils.hasText(inputChannel); }

Target:
public boolean shouldCreateEndpoint(Method method, List<Annotation> annotations) { String inputChannel = MessagingAnnotationUtils.resolveAttribute(annotations, getInputChannelAttribute(), String.class); return StringUtils.hasText(inputChannel); }
Source:
public OfflinePlayer getOfflinePlayer(String name) { try { return getOfflinePlayerAsync(name).get(5, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException ex) { Logger.getLogger(GlowServer.class.getName()).log(Level.SEVERE, "UUID lookup interrupted: ", ex); } catch (TimeoutException ex) { Logger.getLogger(GlowServer.class.getName()).log(Level.WARNING, "UUID lookup timeout: ", ex); } return getOfflinePlayerFallback(name); }

Target:
public OfflinePlayer getOfflinePlayer(String name) { try { if (getProfileLookupTimeout() <= 0) { return getOfflinePlayerAsync(name).get(); } else { return getOfflinePlayerAsync(name).get(getProfileLookupTimeout(), TimeUnit.SECONDS); } } catch (InterruptedException | ExecutionException ex) { GlowServer.logger.log(Level.SEVERE, "UUID lookup interrupted: ", ex); } catch (TimeoutException ex) { GlowServer.logger.log(Level.WARNING, "UUID lookup timeout: ", ex); } return getOfflinePlayerFallback(name); }
Source:
protected void onLoad() { super.onLoad(); Iterator<MatrixChildParametersAction> i = this.getActions(MatrixChildParametersAction.class).iterator(); while(i.hasNext()) { MatrixChildParametersAction a = i.next(); a.onLoad(this); } }

Target:
protected void onLoad() { super.onLoad(); for (MatrixChildParametersAction action : this.getActions(MatrixChildParametersAction.class)){ action.onLoad(this); } }
Source:
protected void testExecute() throws Exception { gaeSimulation.logoutUser(); ______TS("Normal case: valid report with all fields populated"); ErrorReportRequest report = new ErrorReportRequest(REQUEST_ID, SUBJECT, CONTENT); SendErrorReportAction action = getAction(report, PARAMS); JsonResult jsonResult = getJsonResult(action); String expectedLogMessage = "====== USER FEEDBACK ABOUT ERROR ======" + System.lineSeparator() + "USER: Non-logged in user" + System.lineSeparator() + "REQUEST ID: " + REQUEST_ID + System.lineSeparator() + "SUBJECT: " + SUBJECT + System.lineSeparator() + "CONTENT: " + CONTENT; assertEquals(HttpStatus.SC_OK, jsonResult.getStatusCode()); assertEquals(expectedLogMessage, action.getUserErrorReportLogMessage(report)); ______TS("Failure: Invalid report with null requestId"); assertThrows(InvalidHttpRequestBodyException.class, () -> { ErrorReportRequest badReport = new ErrorReportRequest(null, SUBJECT, CONTENT); SendErrorReportAction a = getAction(badReport, PARAMS); getJsonResult(a); }); ______TS("Failure: Invalid report with null SUBJECT"); assertThrows(InvalidHttpRequestBodyException.class, () -> { ErrorReportRequest badReport = new ErrorReportRequest(REQUEST_ID, null, CONTENT); SendErrorReportAction a = getAction(badReport, PARAMS); getJsonResult(a); }); ______TS("Failure: Invalid report with null CONTENT"); assertThrows(InvalidHttpRequestBodyException.class, () -> { ErrorReportRequest badReport = new ErrorReportRequest(REQUEST_ID, SUBJECT, null); SendErrorReportAction a = getAction(badReport, PARAMS); getJsonResult(a); }); }

Target:
protected void testExecute() throws Exception { gaeSimulation.logoutUser(); ______TS("Normal case: valid report with all fields populated"); ErrorReportRequest report = new ErrorReportRequest(REQUEST_ID, SUBJECT, CONTENT); SendErrorReportAction action = getAction(report, PARAMS); JsonResult jsonResult = getJsonResult(action); String expectedLogMessage = "====== USER FEEDBACK ABOUT ERROR ======" + System.lineSeparator() + "USER: Non-logged in user" + System.lineSeparator() + "REQUEST ID: " + REQUEST_ID + System.lineSeparator() + "SUBJECT: " + SUBJECT + System.lineSeparator() + "CONTENT: " + CONTENT; assertEquals(HttpStatus.SC_OK, jsonResult.getStatusCode()); assertEquals(expectedLogMessage, action.getUserErrorReportLogMessage(report)); ______TS("Failure: Invalid report with null requestId"); assertThrows(InvalidHttpRequestBodyException.class, () -> { ErrorReportRequest badReport = new ErrorReportRequest(null, SUBJECT, CONTENT); getAction(badReport, PARAMS).execute(); }); ______TS("Failure: Invalid report with null SUBJECT"); assertThrows(InvalidHttpRequestBodyException.class, () -> { ErrorReportRequest badReport = new ErrorReportRequest(REQUEST_ID, null, CONTENT); getAction(badReport, PARAMS).execute(); }); ______TS("Failure: Invalid report with null CONTENT"); assertThrows(InvalidHttpRequestBodyException.class, () -> { ErrorReportRequest badReport = new ErrorReportRequest(REQUEST_ID, SUBJECT, null); getAction(badReport, PARAMS).execute(); }); }
Source:
public Response getAccountBundles(@PathParam("accountId") final String accountId, @QueryParam(QUERY_EXTERNAL_KEY) final String externalKey, @QueryParam(QUERY_BUNDLES_FILTER) final String bundlesFilter, @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException, SubscriptionApiException { final TenantContext tenantContext = context.createContext(request); final UUID uuid = UUID.fromString(accountId); final Account account = accountUserApi.getAccountById(uuid, tenantContext); boolean filter = (null != bundlesFilter && !bundlesFilter.isEmpty()); final List<SubscriptionBundle> bundles = (externalKey != null) ? ((filter) ? filterBundles(subscriptionApi.getSubscriptionBundlesForAccountIdAndExternalKey(uuid, externalKey, tenantContext), Arrays.asList(bundlesFilter.split(","))) : subscriptionApi.getSubscriptionBundlesForAccountIdAndExternalKey(uuid, externalKey, tenantContext)): ((filter) ? filterBundles(subscriptionApi.getSubscriptionBundlesForAccountId(uuid, tenantContext), Arrays.asList(bundlesFilter.split(","))) : subscriptionApi.getSubscriptionBundlesForAccountId(uuid, tenantContext)); final Collection<BundleJson> result = Collections2.transform(bundles, new Function<SubscriptionBundle, BundleJson>() { @Override public BundleJson apply(final SubscriptionBundle input) { try { return new BundleJson(input, account.getCurrency(), null); } catch (final CatalogApiException e) { throw new RuntimeException(e); } } }); return Response.status(Status.OK).entity(result).build(); }

Target:
public Response getAccountBundles(@PathParam("accountId") final String accountId, @QueryParam(QUERY_EXTERNAL_KEY) final String externalKey, @QueryParam(QUERY_BUNDLES_FILTER) final String bundlesFilter, @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException, SubscriptionApiException { final TenantContext tenantContext = context.createContext(request); final UUID uuid = UUID.fromString(accountId); final Account account = accountUserApi.getAccountById(uuid, tenantContext); final List<SubscriptionBundle> bundles = (externalKey != null) ? subscriptionApi.getSubscriptionBundlesForAccountIdAndExternalKey(uuid, externalKey, tenantContext) : subscriptionApi.getSubscriptionBundlesForAccountId(uuid, tenantContext); boolean filter = (null != bundlesFilter && !bundlesFilter.isEmpty()); final Collection<BundleJson> result = Collections2.transform( (filter) ? filterBundles(bundles, Arrays.asList(bundlesFilter.split(","))) : bundles, new Function<SubscriptionBundle, BundleJson>() { @Override public BundleJson apply(final SubscriptionBundle input) { try { return new BundleJson(input, account.getCurrency(), null); } catch (final CatalogApiException e) { throw new RuntimeException(e); } } }); return Response.status(Status.OK).entity(result).build(); }
Source:
private boolean computeNext() { if (next == null) { try { while (fileStatusIterator.hasNext()) { LocatedFileStatus status = fileStatusIterator.next(); if (pathFilter.isPresent()) { if (pathFilter.get().accept(status.getPath())) { next = status; return true; } } else { next = status; return true; } } return false; } catch (IOException e) { throw processException(e); } } return true; }

Target:
private void computeNext() { if (next != null) { return; } try { while (fileStatusIterator.hasNext()) { HiveFileInfo hiveFileInfo = fileStatusIterator.next(); if (!pathFilter.isPresent() || pathFilter.get().accept(hiveFileInfo.getPath())) { next = hiveFileInfo; return; } } } catch (IOException e) { throw processException(e); } }
Source:
protected String addReferenceData() { final boolean caseSensitive = (_caseSensitive != null && _caseSensitive.equals("on")); final Dictionary dictionary = new TextFileDictionary(_name, _filePath, _encoding, caseSensitive); getReferenceDataDao().addDictionary(getWizardContext().getTenantContext(), dictionary); return _name; }

Target:
protected String addReferenceData() { copyUploadedFileToReferenceDataDirectory(); final boolean caseSensitive = (_caseSensitive != null && _caseSensitive.equals("on")); final Dictionary dictionary = new TextFileDictionary(_name, _filePath, _encoding, caseSensitive); getReferenceDataDao().addDictionary(getWizardContext().getTenantContext(), dictionary); return _name; }
Source:
private void rejoinModifies(ProgressMonitor pm) { HashMap<String, DiffEntry> nameMap = new HashMap<String, DiffEntry>(); ArrayList<DiffEntry> newAdded = new ArrayList<DiffEntry>(added.size()); pm.beginTask(JGitText.get().renamesRejoiningModifies, added.size() + deleted.size()); for (DiffEntry src : deleted) { nameMap.put(src.oldName, src); pm.update(1); } for (DiffEntry dst : added) { DiffEntry src = nameMap.get(dst.newName); if (src != null && sameType(src.oldMode, dst.newMode)) { entries.add(DiffEntry.pair(ChangeType.MODIFY, src, dst, src.score)); nameMap.remove(src.oldName); } else { newAdded.add(dst); } pm.update(1); } added = newAdded; deleted = new ArrayList<DiffEntry>(nameMap.values()); }

Target:
private void rejoinModifies(ProgressMonitor pm) { HashMap<String, DiffEntry> nameMap = new HashMap<String, DiffEntry>(); ArrayList<DiffEntry> newAdded = new ArrayList<DiffEntry>(added.size()); pm.beginTask(JGitText.get().renamesRejoiningModifies, added.size() + deleted.size()); for (DiffEntry src : deleted) { nameMap.put(src.oldName, src); pm.update(1); } for (DiffEntry dst : added) { DiffEntry src = nameMap.remove(dst.newName); if (src != null) { if (sameType(src.oldMode, dst.newMode)) { entries.add(DiffEntry.pair(ChangeType.MODIFY, src, dst, src.score)); } else { nameMap.put(src.oldName, src); newAdded.add(dst); } } else { newAdded.add(dst); } pm.update(1); } added = newAdded; deleted = new ArrayList<DiffEntry>(nameMap.values()); }
Source:
public boolean onToolRightClick(GlowPlayer player, ItemStack holding, GlowBlock target, BlockFace face, Vector clickedLoc) { if (target.getType() == Material.OBSIDIAN) { fireNetherPortal(); } if (target.getType() == Material.TNT) { fireTnt(target); } if (target.isFlammable()) { setBlockOnFire(player, target, face, holding, clickedLoc); } return true; }

Target:
public boolean onToolRightClick(GlowPlayer player, ItemStack holding, GlowBlock target, BlockFace face, Vector clickedLoc) { if (target.getType() == Material.OBSIDIAN) { fireNetherPortal(); return true; } if (target.getType() == Material.TNT) { fireTnt(target); return true; } if (target.isFlammable() || target.getType().isOccluding()) { setBlockOnFire(player, target, face, holding, clickedLoc); return true; } return false; }
Source:
void commit(final boolean startNewTransaction, final Map<TopicPartition, Long> partitionTimes) { final long startNs = time.nanoseconds(); log.debug("Committing"); flushState(); if (!eosEnabled) { stateMgr.checkpoint(activeTaskCheckpointableOffsets()); } final Map<TopicPartition, OffsetAndMetadata> consumedOffsetsAndMetadata = new HashMap<>(consumedOffsets.size()); for (final Map.Entry<TopicPartition, Long> entry : consumedOffsets.entrySet()) { final TopicPartition partition = entry.getKey(); final long offset = entry.getValue() + 1; final long partitionTime = partitionTimes.get(partition); consumedOffsetsAndMetadata.put(partition, new OffsetAndMetadata(offset, encodeTimestamp(partitionTime))); } try { if (eosEnabled) { producer.sendOffsetsToTransaction(consumedOffsetsAndMetadata, applicationId); producer.commitTransaction(); transactionInFlight = false; if (startNewTransaction) { producer.beginTransaction(); transactionInFlight = true; } } else { consumer.commitSync(consumedOffsetsAndMetadata); } } catch (final CommitFailedException | ProducerFencedException error) { throw new TaskMigratedException(this, error); } catch (final RetriableCommitFailedException error) { log.info("Committing failed with a non-fatal error, we can ignore this since commit may succeed still"); } commitNeeded = false; commitRequested = false; commitSensor.record(time.nanoseconds() - startNs); }

Target:
void commit(final boolean startNewTransaction, final Map<TopicPartition, Long> partitionTimes) { final long startNs = time.nanoseconds(); log.debug("Committing"); flushState(); if (!eosEnabled) { stateMgr.checkpoint(activeTaskCheckpointableOffsets()); } final Map<TopicPartition, OffsetAndMetadata> consumedOffsetsAndMetadata = new HashMap<>(consumedOffsets.size()); for (final Map.Entry<TopicPartition, Long> entry : consumedOffsets.entrySet()) { final TopicPartition partition = entry.getKey(); final long offset = entry.getValue() + 1; final long partitionTime = partitionTimes.get(partition); consumedOffsetsAndMetadata.put(partition, new OffsetAndMetadata(offset, encodeTimestamp(partitionTime))); } try { if (eosEnabled) { producer.sendOffsetsToTransaction(consumedOffsetsAndMetadata, applicationId); producer.commitTransaction(); transactionInFlight = false; if (startNewTransaction) { producer.beginTransaction(); transactionInFlight = true; } } else { consumer.commitSync(consumedOffsetsAndMetadata); } } catch (final CommitFailedException | ProducerFencedException | UnknownProducerIdException error) { throw new TaskMigratedException(this, error); } catch (final RebalanceInProgressException error) { log.info("Committing failed with a non-fatal error: {}, " + "we can ignore this since commit may succeed still", error.toString()); } commitNeeded = false; commitRequested = false; commitSensor.record(time.nanoseconds() - startNs); }