auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void handlePut() { if (resource.getType() == Type.DIRECTORY) { throw new RestletException("Attempting to write data to a directory.", Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); } else { try { boolean isNew = resource.getType() == Type.UNDEFINED; if (operation == Operation.COPY || operation == Operation.MOVE) { try (InputStream is = getRequest().getEntity().getStream()) { Resource source = store.get(IOUtils.toString(is, "UTF-8")); if (source.getType() == Type.UNDEFINED) { throw new RestletException("Undefined source path.", Status.CLIENT_ERROR_NOT_FOUND); } try { if (operation == Operation.MOVE) { if (!source.renameTo(resource)) { throw new RestletException("Rename operation failed.", Status.SERVER_ERROR_INTERNAL); } } else { if (source.getType() == Type.DIRECTORY) { throw new RestletException("Cannot copy directory.", Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); } IOUtils.copyStream(source.in(), resource.out(), true, true); } } catch (IllegalStateException e) { throw new RestletException("I/O Error", Status.SERVER_ERROR_INTERNAL, e); } } } else { IOUtils.copyStream(getRequest().getEntity().getStream(), resource.out(), true, true); } if (isNew) { getResponse().setStatus(Status.SUCCESS_CREATED); } } catch (IOException e) { throw new RestletException("I/O Error", Status.SERVER_ERROR_INTERNAL, e); } } }

Target:
public void handlePut() { if (resource.getType() == Type.DIRECTORY) { throw new RestletException("Attempting to write data to a directory.", Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); } else { try { boolean isNew = resource.getType() == Type.UNDEFINED; if (operation == Operation.COPY || operation == Operation.MOVE) { try (InputStream is = getRequest().getEntity().getStream()) { Resource source = store.get(IOUtils.toString(is)); if (source.getType() == Type.UNDEFINED) { throw new RestletException("Undefined source path.", Status.CLIENT_ERROR_NOT_FOUND); } try { if (operation == Operation.MOVE) { if (!source.renameTo(resource)) { throw new RestletException("Rename operation failed.", Status.SERVER_ERROR_INTERNAL); } } else { if (source.getType() == Type.DIRECTORY) { throw new RestletException("Cannot copy directory.", Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); } IOUtils.copyStream(source.in(), resource.out(), true, true); } } catch (IllegalStateException e) { throw new RestletException("I/O Error", Status.SERVER_ERROR_INTERNAL, e); } } } else { IOUtils.copyStream(getRequest().getEntity().getStream(), resource.out(), true, true); } if (isNew) { getResponse().setStatus(Status.SUCCESS_CREATED); } } catch (IOException e) { throw new RestletException("I/O Error", Status.SERVER_ERROR_INTERNAL, e); } } }
Source:
private SharingPhysicalSlotRequestBulk createBulk(Map<ExecutionSlotSharingGroup, List<ExecutionVertexID>> executions) { Map<ExecutionSlotSharingGroup, ResourceProfile> pendingRequests = executions .keySet() .stream() .collect(Collectors.toMap( group -> group, group -> sharedSlots.get(group).getPhysicalSlotResourceProfile() )); Map<ExecutionSlotSharingGroup, AllocationID> fulfilledRequests = new HashMap<>(); SharingPhysicalSlotRequestBulk bulk = new SharingPhysicalSlotRequestBulk( executions, pendingRequests, fulfilledRequests, (executionVertexId, cause) -> { ExecutionSlotSharingGroup group = slotSharingStrategy.getExecutionSlotSharingGroup(executionVertexId); sharedSlots.get(group).cancelLogicalSlotRequest(executionVertexId, cause); }); registerPhysicalSlotRequestBulkCallbacks(executions.keySet(), bulk); return bulk; }

Target:
private SharingPhysicalSlotRequestBulk createBulk(Map<ExecutionSlotSharingGroup, List<ExecutionVertexID>> executions) { Map<ExecutionSlotSharingGroup, ResourceProfile> pendingRequests = executions .keySet() .stream() .collect(Collectors.toMap( group -> group, group -> sharedSlots.get(group).getPhysicalSlotResourceProfile() )); SharingPhysicalSlotRequestBulk bulk = new SharingPhysicalSlotRequestBulk( executions, pendingRequests, this::cancelLogicalSlotRequest); registerPhysicalSlotRequestBulkCallbacks(executions.keySet(), bulk); return bulk; }
Source:
private List<Partition> getPartitions(String databaseName, String tableName, String expression) { try { List<Partition> partitions = new ArrayList<>(); String nextToken = null; do { GetPartitionsResult result = glueClient.getPartitions(new GetPartitionsRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withExpression(expression) .withNextToken(nextToken)); result.getPartitions().stream() .forEach(p -> partitions.add(GlueToPrestoConverter.convertPartition(p))); nextToken = result.getNextToken(); } while (nextToken != null); return partitions; } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }

Target:
private List<Partition> getPartitions(String databaseName, String tableName, String expression) { try { List<Partition> partitions = new ArrayList<>(); String nextToken = null; do { GetPartitionsResult result = glueClient.getPartitions(new GetPartitionsRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withExpression(expression) .withNextToken(nextToken)); result.getPartitions().stream() .forEach(partition -> partitions.add(GlueToPrestoConverter.convertPartition(partition))); nextToken = result.getNextToken(); } while (nextToken != null); return partitions; } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }
Source:
public void retry() { synchronized (workerThread) { final Map<K, PullRequest> pendingPullRequests = workerThread.pendingPullRequests; final PullRequest pullRequest = pendingPullRequests.get(encodedKey.getKey()); if (checkPullRequest(pullRequest, requestId)) { final int retryCount = pullRequest.getAndIncrementRetryCount(); if (retryCount >= MAX_PULL_RETRY_COUNT) { throw new RuntimeException("Fail to load a value for pull"); } LOG.log(Level.WARNING, "Retry pull request for key {0}. This is {1}-th retry", new Object[]{encodedKey.getKey(), retryCount + 1}); sendPullMsg(encodedKey, requestId); } else { LOG.log(Level.INFO, "Could not find corresponding pullRequest for key: {0}, requestId: {1}", new Object[]{encodedKey.getKey(), requestId}); } } }

Target:
public void retry() { synchronized (workerThread) { final Map<K, PullRequest> pendingPullRequests = workerThread.pendingPullRequests; final PullRequest pullRequest = pendingPullRequests.get(encodedKey.getKey()); if (pendingPullRequestExists(pullRequest, requestId)) { pullRequest.processRetry(); } else { LOG.log(Level.INFO, "Could not find corresponding pullRequest for key: {0}, requestId: {1}", new Object[]{encodedKey.getKey(), requestId}); } } }
Source:
private static void populateSchemaFields(Schema schema, Set<BoundField> fields) { for (BoundField field: schema.fields()) { fields.add(field); if (field.def.type.arrayElementType().isPresent()) { Type innerType = field.def.type.arrayElementType().get(); if (innerType instanceof Schema) populateSchemaFields((Schema) innerType, fields); } else if (field.def.type instanceof Schema) populateSchemaFields((Schema) field.def.type, fields); } }

Target:
private static void populateSchemaFields(Schema schema, Set<BoundField> fields) { for (BoundField field: schema.fields()) { fields.add(field); if (field.def.type.isArray()) { Type innerType = field.def.type.arrayElementType().get(); if (innerType instanceof Schema) populateSchemaFields((Schema) innerType, fields); } else if (field.def.type instanceof Schema) populateSchemaFields((Schema) field.def.type, fields); } }
Source:
private void checkIdent(DetailAST ast) { final Deque<String> currentVariables = getCurrentVariables(); if (currentVariables != null && !getCurrentVariables().isEmpty()) { final DetailAST identAST = ast.getFirstChild(); if (identAST != null && identAST.getType() == TokenTypes.IDENT && getCurrentVariables().contains(identAST.getText())) { log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY, identAST.getText()); } } }

Target:
private void checkIdent(DetailAST ast) { if (!getCurrentVariables().isEmpty()) { final DetailAST identAST = ast.getFirstChild(); if (identAST != null && identAST.getType() == TokenTypes.IDENT && getCurrentVariables().contains(identAST.getText())) { log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY, identAST.getText()); } } }
Source:
public void setPassword(String password) { Preconditions.checkArgument(!Strings.isNullOrEmpty(password)); synchronized(random) { this.salt = SHA512(new BigInteger(130, random).toString(32)); } this.password = SHA512(SHA512(password).concat(this.salt)); }

Target:
public void setPassword(String password) { Preconditions.checkArgument(!Strings.isNullOrEmpty(password)); this.password = BCrypt.hashpw(password, BCrypt.gensalt()); }
Source:
public void handleSuccess(List<Media> collection) { presenter.addItemsToQueryList(collection); if (gridAdapter == null) { setAdapter(collection); } else { if (gridAdapter.containsAll(collection)) { return; } gridAdapter.addItems(collection); try { ((WikidataItemDetailsActivity) getContext()).viewPagerNotifyDataSetChanged(); } catch (Exception e) { e.printStackTrace(); } } progressBar.setVisibility(GONE); isLoading = false; statusTextView.setVisibility(GONE); for (Media m : collection) { presenter.replaceTitlesWithCaptions("M"+m.getPageId(), mediaSize++); } }

Target:
public void handleSuccess(List<Media> collection) { presenter.addItemsToQueryList(collection); if (gridAdapter == null) { setAdapter(collection); } else { if (gridAdapter.containsAll(collection)) { return; } gridAdapter.addItems(collection); try { ((WikidataItemDetailsActivity) getContext()).viewPagerNotifyDataSetChanged(); } catch (RuntimeException e) { Timber.e(e); } } progressBar.setVisibility(GONE); isLoading = false; statusTextView.setVisibility(GONE); for (Media media : collection) { final String pageId = media.getPageId(); if (pageId != null) { presenter.replaceTitlesWithCaptions(PAGE_ID_PREFIX + pageId, mediaSize++); } } }
Source:
public void addMember(PerunSession sess, Group group, Member member) throws InternalErrorException, MemberNotExistsException, PrivilegeException, AlreadyMemberException, GroupNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, group); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, group) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "addMember"); } if (member.getVoId() != (group.getVoId())) { throw new MembershipMismatchException("Member and group are form the different VO"); } Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME); if (Objects.equals("true", (String) attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) { throw new ExternallyManagedException("Adding of member is not allowed. Group is externally managed."); } getGroupsManagerBl().addMember(sess, group, member); }

Target:
public void addMember(PerunSession sess, Group group, Member member) throws InternalErrorException, MemberNotExistsException, PrivilegeException, AlreadyMemberException, GroupNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, group); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, group) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "addMember"); } if (member.getVoId() != (group.getVoId())) { throw new MembershipMismatchException("Member and group are form the different VO"); } Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME); if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) { throw new ExternallyManagedException("Adding of member is not allowed. Group is externally managed."); } getGroupsManagerBl().addMember(sess, group, member); }
Source:
public void testEvaluateRightFunc() throws Exception { Literal<Object> value = Literal.of(DataTypes.STRING, "crate.io"); assertEvaluate("right(name, 10)", null, Literal.of((String) null)); assertEvaluate("right(name, null)", null, value); assertEvaluate("right(name, 0)", "", value); assertEvaluate("right(name, 100)", "", Literal.of("")); assertEvaluate("right('crate.io', 2)","io", value); assertEvaluate("right('crate.io', -6)","io", value); }

Target:
public void testEvaluateRightFunc() throws Exception { Literal<Object> value = Literal.of(DataTypes.STRING, "crate.io"); assertEvaluate("right(name, 10)", null, Literal.of((String) null)); assertEvaluate("right(name, null)", null, value); assertEvaluate("right(name, 0)", "", value); assertEvaluate("right(name, 100)", "", Literal.of("")); assertEvaluate("right(name, 2)","io", value); assertEvaluate("right(name, -6)","io", value); assertEvaluate("right('crate.io', age)","io", Literal.of(2)); assertEvaluate("right('crate.io', age)","io", Literal.of(-6)); }
Source:
public void testSeekStatistics() throws IOException { describe("Testing the values of statistics from seek operations in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path seekStatPath = path(getMethodName()); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, seekStatPath); out.write(defBuffer); out.hflush(); in = abfss.openFileForRead(seekStatPath, fs.getFsStatistics()); int result = in.read(defBuffer, 0, ONE_MB); LOG.info("Result of read : {}", result); for (int i = 0; i < OPERATIONS; i++) { in.seek(0); in.seek(ONE_MB); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); assertEquals("Mismatch in seekOps value", 2 * OPERATIONS, stats.getSeekOperations()); assertEquals("Mismatch in backwardSeekOps value", OPERATIONS, stats.getBackwardSeekOperations()); assertEquals("Mismatch in forwardSeekOps value", OPERATIONS, stats.getForwardSeekOperations()); assertEquals("Mismatch in bytesBackwardsOnSeek value", -1 * OPERATIONS * ONE_MB, stats.getBytesBackwardsOnSeek()); assertEquals("Mismatch in bytesSkippedOnSeek value", 0, stats.getBytesSkippedOnSeek()); assertEquals("Mismatch in seekInBuffer value", 2 * OPERATIONS, stats.getSeekInBuffer()); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }

Target:
public void testSeekStatistics() throws IOException { describe("Testing the values of statistics from seek operations in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path seekStatPath = path(getMethodName()); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, seekStatPath); out.write(defBuffer); out.hflush(); in = abfss.openFileForRead(seekStatPath, fs.getFsStatistics()); int result = in.read(defBuffer, 0, ONE_MB); LOG.info("Result of read : {}", result); for (int i = 0; i < OPERATIONS; i++) { in.seek(0); in.seek(ONE_MB); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); LOG.info("STATISTICS: {}", stats.toString()); assertEquals("Mismatch in seekOps value", 2 * OPERATIONS, stats.getSeekOperations()); assertEquals("Mismatch in backwardSeekOps value", OPERATIONS, stats.getBackwardSeekOperations()); assertEquals("Mismatch in forwardSeekOps value", OPERATIONS, stats.getForwardSeekOperations()); assertEquals("Mismatch in bytesBackwardsOnSeek value", -1 * OPERATIONS * ONE_MB, stats.getBytesBackwardsOnSeek()); assertEquals("Mismatch in bytesSkippedOnSeek value", 0, stats.getBytesSkippedOnSeek()); assertEquals("Mismatch in seekInBuffer value", 2 * OPERATIONS, stats.getSeekInBuffer()); in.close(); LOG.info("STATISTICS after closing: {}", stats.toString()); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }
Source:
public void testNoAuthentication() { assertNull(this.action.createCredentials(requestContext, getCredentials(), "usrPsw")); }

Target:
public void testNoAuthentication() { this.action.createCredentials(requestContext, getCredentials(), "usrPsw"); }
Source:
public Long getId() { return base + counter.getAndIncrement(); }

Target:
public Long getId() throws IdGenerationException { if (counter.get() == 0x100000000L) { throw new IdGenerationException("No more id available"); } return base + counter.getAndIncrement(); }
Source:
public Sha256Hash hashForSignature( int inputIndex, Script redeemScript, SigHash type, boolean anyoneCanPay) { return hashForSignature(inputIndex, redeemScript.getProgram(), type, anyoneCanPay); }

Target:
public Sha256Hash hashForSignature(int inputIndex, Script redeemScript, SigHash type, boolean anyoneCanPay) { int sigHash = TransactionSignature.calcSigHashValue(type, anyoneCanPay); return hashForSignature(inputIndex, redeemScript.getProgram(), (byte) sigHash); }
Source:
public void handleGetSpecificAttributeValueResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final String resultData) { LOGGER.debug("handleGetSpecificAttributeValueResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_UNEXPECTED_EXCEPTION, exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send( ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withDataObject(resultData) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleGetSpecificAttributeValueResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final String resultData) { LOGGER.debug("handleGetSpecificAttributeValueResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_UNEXPECTED_EXCEPTION, exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withDataObject(resultData) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send( responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
public Set<String> getPluginsThatSupportsWebBasedAuthentication() { return getPluginsThatSupports(SupportedAuthType.Web); }

Target:
public Set<AuthorizationPluginInfo> getPluginsThatSupportsWebBasedAuthentication() { return getPluginsThatSupports(SupportedAuthType.Web); }
Source:
public int getWeight(EStructuralFeature feature) { if (irrelevant(feature)) { return 0; } Integer found = weights.get(feature); if (found == null) { found = Integer.valueOf(SMALL); if ("name".equals(feature.getName()) || "id".equals(feature.getName())) { found = Integer.valueOf(SIGNIFICANT); } if (feature instanceof EReference && ((EReference)feature).isContainment()) { found = Integer.valueOf(NORMAL); } if (feature instanceof EReference) { found = Integer.valueOf(referenceChangeCoef * found.intValue()); } else { found = Integer.valueOf(attributeChangeCoef * found.intValue()); } weights.put(feature, found); } return found.intValue(); }

Target:
public int getWeight(EStructuralFeature feature) { if (irrelevant(feature)) { return 0; } Integer found = weights.get(feature); if (found == null) { found = Integer.valueOf(SMALL); if ("name".equals(feature.getName()) || "id".equals(feature.getName())) { found = Integer.valueOf(SIGNIFICANT); } if (feature instanceof EReference) { found = Integer.valueOf(referenceChangeCoef * found.intValue()); } else { found = Integer.valueOf(attributeChangeCoef * found.intValue()); } weights.put(feature, found); } return found.intValue(); }
Source:
public void testWithoutCustomPrefix() { mockPrefix(null); ninjaGraphite.start(); Mockito.verify(builder, Mockito.times(1)).prefixedWith(TEST_HOSTNAME); }

Target:
public void testWithoutCustomPrefix() { Mockito.when(ninjaProperties.get(Mockito.eq("metrics.graphite.prefix"))).thenReturn(null); ninjaGraphite.start(); Mockito.verify(builder, Mockito.times(1)).prefixedWith(TEST_HOSTNAME); }
Source:
public void addReply(String reply){ waitForElementByElement(replyCommentButton); String url = driver.getCurrentUrl(); executeScript("document.querySelectorAll('.cmnRpl')[0].click()"); verifyURL(url + modal); replyInputArea.sendKeys(reply); replyInputArea.submit(); verifyURL(url + modal); verifyAddedReplyOnCommentPage(reply); PageObjectLogging.log("addReply", "reply "+reply+" added", true, driver); }

Target:
public void addReply(String reply){ waitForElementByElement(replyCommentButton); String url = driver.getCurrentUrl(); replyCommentButton.click(); verifyURL(url + modal); replyInputArea.sendKeys(reply); replyInputArea.submit(); verifyURL(url + modal); verifyAddedReplyOnCommentPage(reply); PageObjectLogging.log("addReply", "reply "+reply+" added", true, driver); }
Source:
public void clear() { checkForParentModification(); final List<IonValue> toRemove = new ArrayList<IonValue>(size); for(int i = 0; i < size; i++) { toRemove.add(get(i)); } parent.removeAll(toRemove); size = 0; this.structuralModificationCount = IonSequenceLite.this.structuralModificationCount; }

Target:
public void clear() { checkForParentModification(); int parentIndex = toParentIndex(0); for (int i = 0; i < size; i++) { IonSequenceLite.this.remove(parentIndex); } size = 0; this.structuralModificationCount = IonSequenceLite.this.structuralModificationCount; }
Source:
public Config(Map<String, String> properties) { this.properties.putAll(properties); }

Target:
public Config(Map<String, String> properties) { super(properties); }
Source:
private static boolean isExistingDomain(String domain, int tenantId, Connection connection) throws UserStoreException { Connection dbConnection = null; PreparedStatement prepStmt = null; ResultSet rs = null; boolean isExisting = false; try { dbConnection = connection; prepStmt = dbConnection.prepareStatement(JDBCRealmConstants.IS_DOMAIN_EXISTING_SQL); if (domain != null) { domain = domain.toUpperCase(); } prepStmt.setString(1, domain); prepStmt.setInt(2, tenantId); rs = prepStmt.executeQuery(); if (rs.next()) { isExisting = true; } return isExisting; } catch (SQLException e) { String errorMessage = "DB error occurred while checking is existing domain : " + domain + " & tenant id : " + tenantId; if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } }

Target:
private static boolean isExistingDomain(String domain, int tenantId, Connection connection) throws UserStoreException { PreparedStatement prepStmt = null; ResultSet rs = null; boolean isExisting = false; try { prepStmt = connection.prepareStatement(JDBCRealmConstants.IS_DOMAIN_EXISTING_SQL); if (domain != null) { domain = domain.toUpperCase(); } prepStmt.setString(1, domain); prepStmt.setInt(2, tenantId); rs = prepStmt.executeQuery(); if (rs.next()) { isExisting = true; } return isExisting; } catch (SQLException e) { String errorMessage = "DB error occurred while checking is existing domain : " + domain + " & tenant id : " + tenantId; if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } finally { DatabaseUtil.closeAllConnections( null, rs, prepStmt ); } }
Source:
public void reconciled(CompilationUnit ast, boolean forced, IProgressMonitor progressMonitor) { final ISourceViewerExtension5 sourceViewer = fSourceViewer; if (sourceViewer != null) { reconciledViewers.add(fSourceViewer); sourceViewer.updateCodeMinings(); } }

Target:
public void reconciled(CompilationUnit ast, boolean forced, IProgressMonitor progressMonitor) { final ISourceViewerExtension5 sourceViewer= fSourceViewer; if (sourceViewer != null) { reconciledViewers.add(sourceViewer); sourceViewer.updateCodeMinings(); } }
Source:
public GraphQLFieldDefinition(String name, String description, GraphQLOutputType type, DataFetcherFactory dataFetcherFactory, List<GraphQLArgument> arguments, String deprecationReason, FieldDefinition definition) { assertValidName(name); assertNotNull(dataFetcherFactory, "dataFetcherFactory can't be null"); assertNotNull(type, "type can't be null"); assertNotNull(arguments, "arguments can't be null"); this.name = name; this.description = description; this.type = type; this.dataFetcherFactory = dataFetcherFactory; this.arguments = Collections.unmodifiableList(new ArrayList<>(arguments)); this.deprecationReason = deprecationReason; this.definition = definition; }

Target:
public GraphQLFieldDefinition(String name, String description, GraphQLOutputType type, DataFetcherFactory dataFetcherFactory, List<GraphQLArgument> arguments, String deprecationReason, FieldDefinition definition) { assertValidName(name); assertNotNull(dataFetcherFactory, "you have to provide a DataFetcher (or DataFetcherFactory)"); assertNotNull(type, "type can't be null"); assertNotNull(arguments, "arguments can't be null"); this.name = name; this.description = description; this.type = type; this.dataFetcherFactory = dataFetcherFactory; this.arguments = Collections.unmodifiableList(new ArrayList<>(arguments)); this.deprecationReason = deprecationReason; this.definition = definition; }
Source:
private void crossfadePreviewViews() { final View topView = isInVisualPreview() ? mViewPager : mVisualPreviewContainer; final View bottomView = isInVisualPreview() ? mVisualPreviewContainer : mViewPager; topView.setAlpha(0f); topView.setVisibility(View.VISIBLE); topView.animate() .alpha(1f) .setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setListener(null); bottomView.animate() .alpha(0f) .setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { bottomView.setVisibility(View.GONE); } }); }

Target:
private void crossfadePreviewViews() { final View fadeInView = isInVisualPreview() ? mViewPager : mVisualPreviewContainer; final View fadeOutView = isInVisualPreview() ? mVisualPreviewContainer : mViewPager; mVisualPreviewContainer.smoothScrollTo(0, 0); mVisualPreviewContainer.post(new Runnable() { @Override public void run() { AniUtils.fadeIn(fadeInView, Duration.SHORT); AniUtils.fadeOut(fadeOutView, Duration.SHORT); } }); }
Source:
public void runVm(VM vm) { try { getKubevirtApi().start(vm.getNamespace(), vm.getName()); } catch (ApiException e) { KubevirtUtils.auditAuthorizationIssues(e, auditLogDirector, provider); throw new EngineException(EngineError.unexpected, "failed to interact with kubevirt start endpoint"); } }

Target:
public void runVm(VM vm) { try { getKubevirtApi().start(vm.getNamespace(), vm.getName()); } catch (ApiException e) { handleException(e, "failed to interact with kubevirt start endpoint"); } }
Source:
public void deleteCloudWatchAlarmsForSystemFailures(CloudStack stack, String regionName, AwsCredentialView credentialView, List<String> instanceIds) { String isCreate = stack.getParameters().get(CLOUDWATCH_CREATE_PARAMETER); if (isCreate != null && isCreate.equals(Boolean.TRUE.toString())) { List<String> instanceIdsFromStack = stack.getGroups().stream() .flatMap(group -> group.getInstances().stream()) .map(CloudInstance::getInstanceId) .collect(Collectors.toList()); List<String> instanceIdsNotInStack = instanceIds.stream() .filter(instanceId -> !instanceIdsFromStack.contains(instanceId)) .collect(Collectors.toList()); if (!instanceIdsNotInStack.isEmpty()) { LOGGER.error("Instance IDs are not part of stack {}", instanceIdsFromStack, stack); throw new CloudConnectorException("Unable to delete cloud watch alarms for system failure because instances ID are not a part of the stack."); } deleteCloudWatchAlarmsForSystemFailures(regionName, credentialView, instanceIds); } }

Target:
public void deleteCloudWatchAlarmsForSystemFailures(CloudStack stack, String regionName, AwsCredentialView credentialView, List<String> instanceIds) { if (isCloudwatchEnabled(stack)) { List<String> instanceIdsFromStack = stack.getGroups().stream() .flatMap(group -> group.getInstances().stream()) .map(CloudInstance::getInstanceId) .collect(Collectors.toList()); List<String> instanceIdsNotInStack = instanceIds.stream() .filter(instanceId -> !instanceIdsFromStack.contains(instanceId)) .collect(Collectors.toList()); if (!instanceIdsNotInStack.isEmpty()) { LOGGER.error("Instance IDs are not part of stack {}", instanceIdsFromStack, stack); throw new CloudConnectorException("Unable to delete cloud watch alarms for system failure because instances ID are not a part of the stack."); } deleteCloudWatchAlarmsForSystemFailures(regionName, credentialView, instanceIds); } }
Source:
protected void onLayout(boolean changed, int left, int top, int right, int bottom) { boolean isLtr = isLayoutLtr(); int clientLeft = left + getPaddingLeft(); int clientTop = top + getPaddingTop(); int clientRight = right - getPaddingRight(); int clientBottom = bottom - getPaddingBottom(); int firstRowBottom = layoutFirstRow(clientLeft, clientTop, clientRight, isLtr); int secondRowBottom = layoutSecondRow(clientLeft, clientRight, firstRowBottom); layoutThirdRow(clientLeft, clientRight, clientBottom, secondRowBottom, isLtr); trackLineBounds.set(0f, 0f, (float) getWidth(), trackLineHeightPx * 2); }

Target:
protected void onLayout(boolean changed, int left, int top, int right, int bottom) { boolean isLtr = isLayoutLtr(); int clientLeft = left + getPaddingLeft(); int clientTop = top + getPaddingTop(); int clientRight = right - getPaddingRight(); int clientBottom = bottom - getPaddingBottom(); int firstRowBottom = layoutFirstRow(clientLeft, clientTop, clientRight, isLtr); int secondRowBottom = layoutSecondRow(clientLeft, clientRight, firstRowBottom); layoutThirdRow(clientLeft, clientRight, clientBottom, secondRowBottom, isLtr); updateTrackLineBounds(); }
Source:
public GibbsSampler(final int numSamples, final ParameterizedModel<V, S, T> model) { ParamUtils.isPositive(numSamples, "Number of samples must be positive."); if (model.getUpdateMethod() != ParameterizedModel.UpdateMethod.GIBBS) { throw new IllegalArgumentException("ParameterizedModel must be constructed to update using Gibbs sampling."); } this.numSamples = numSamples; this.model = model; numSamplesPerLogEntry = NUMBER_OF_SAMPLES_PER_LOG_ENTRY; samples = new ArrayList<>(numSamples); samples.add(model.state()); }

Target:
public GibbsSampler(final int numSamples, final ParameterizedModel<V, S, T> model) { ParamUtils.isPositive(numSamples, "Number of samples must be positive."); Utils.validateArg(model.getUpdateMethod() == ParameterizedModel.UpdateMethod.GIBBS, "ParameterizedModel must be constructed to update using Gibbs sampling."); this.numSamples = numSamples; this.model = model; numSamplesPerLogEntry = NUMBER_OF_SAMPLES_PER_LOG_ENTRY; samples = new ArrayList<>(numSamples); samples.add(model.state()); }
Source:
Point resizeCalculationsGTK3(long widget, int width, int height) { Point size = super.resizeCalculationsGTK3(widget, width, height); if (widget == handle && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { GtkRequisition naturalSize = new GtkRequisition(); GtkRequisition minimumSize = new GtkRequisition(); GTK.gtk_widget_get_preferred_size(handle, minimumSize, naturalSize); if ((getStyle() & SWT.VERTICAL) != 0) { size.x = Math.max(size.x, minimumSize.width); } if ((getStyle() & SWT.HORIZONTAL) != 0) { size.y = Math.max(size.y, minimumSize.height); } } return size; }

Target:
Point resizeCalculationsGTK3(long widget, int width, int height) { Point size = super.resizeCalculationsGTK3(widget, width, height); if (widget == handle && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { GtkRequisition naturalSize = new GtkRequisition(); GtkRequisition minimumSize = new GtkRequisition(); GTK.gtk_widget_get_preferred_size(handle, minimumSize, naturalSize); if ((style & SWT.VERTICAL) != 0) { size.x = Math.max(size.x, minimumSize.width); } if ((style & SWT.HORIZONTAL) != 0) { size.y = Math.max(size.y, minimumSize.height); } } return size; }
Source:
public void testCaseSensitivity() throws Exception { long timestamp = System.currentTimeMillis(); IncrementalIndex index = indexCreator.createIndex(defaultAggregatorFactories); closer.register(index); populateIndex(timestamp, index); Assert.assertEquals(Arrays.asList("dim1", "dim2"), index.getDimensionNames()); Assert.assertEquals(2, index.size()); final Iterator<Row> rows = index.iterator(); Row row = rows.next(); Assert.assertEquals(timestamp, row.getTimestampFromEpoch()); Assert.assertEquals(Arrays.asList("1"), row.getDimension("dim1")); Assert.assertEquals(Arrays.asList("2"), row.getDimension("dim2")); row = rows.next(); Assert.assertEquals(timestamp, row.getTimestampFromEpoch()); Assert.assertEquals(Arrays.asList("3"), row.getDimension("dim1")); Assert.assertEquals(Arrays.asList("4"), row.getDimension("dim2")); }

Target:
public void testCaseSensitivity() throws Exception { long timestamp = System.currentTimeMillis(); IncrementalIndex index = closer.closeLater(indexCreator.createIndex(defaultAggregatorFactories)); populateIndex(timestamp, index); Assert.assertEquals(Arrays.asList("dim1", "dim2"), index.getDimensionNames()); Assert.assertEquals(2, index.size()); final Iterator<Row> rows = index.iterator(); Row row = rows.next(); Assert.assertEquals(timestamp, row.getTimestampFromEpoch()); Assert.assertEquals(Arrays.asList("1"), row.getDimension("dim1")); Assert.assertEquals(Arrays.asList("2"), row.getDimension("dim2")); row = rows.next(); Assert.assertEquals(timestamp, row.getTimestampFromEpoch()); Assert.assertEquals(Arrays.asList("3"), row.getDimension("dim1")); Assert.assertEquals(Arrays.asList("4"), row.getDimension("dim2")); }
Source:
public ReleaseRemovalResult removeReleasesFromMavenRepository( final MavenRepository repository, final ReleaseRemovalRequest request, final ReleaseRemovalResult result, final Target repositoryTarget ) { TaskUtil.checkInterruption(); if ( !repository.getLocalStatus().shouldServiceRequest() ) { return result; } getLogger().debug( "Collecting deletable releases on repository '" + repository.getId() + "' from storage directory " + repository.getLocalUrl() ); DefaultWalkerContext ctxMain = new DefaultWalkerContext( repository, new ResourceStoreRequest( "/" ), determineFilter( repositoryTarget ) ); ctxMain.getContext().put( DeleteOperation.DELETE_OPERATION_CTX_KEY, DeleteOperation.MOVE_TO_TRASH ); ctxMain.getProcessors().add( new ReleaseRemovalWalkerProcessor( repository, request, result ) ); walker.walk( ctxMain ); if ( ctxMain.getStopCause() != null ) { result.setSuccessful( false ); } return result; }

Target:
private void removeReleasesFromMavenRepository( final MavenRepository repository, final ReleaseRemovalRequest request, final ReleaseRemovalResult result, final Target repositoryTarget ) { TaskUtil.checkInterruption(); if ( !repository.getLocalStatus().shouldServiceRequest() ) { return; } getLogger().debug( "Collecting deletable releases on repository '" + repository.getId() + "' from storage directory " + repository.getLocalUrl() ); DefaultWalkerContext ctxMain = new DefaultWalkerContext( repository, new ResourceStoreRequest( "/" ), determineFilter( repositoryTarget ) ); ctxMain.getContext().put( DeleteOperation.DELETE_OPERATION_CTX_KEY, DeleteOperation.MOVE_TO_TRASH ); ctxMain.getProcessors().add( new ReleaseRemovalWalkerProcessor( repository, request, result ) ); walker.walk( ctxMain ); if ( ctxMain.getStopCause() != null ) { result.setSuccessful( false ); } }
Source:
private static int findNotEscapedCharacterPosition(String pattern, int currentIndex, char characterToFind) { for (int i = currentIndex; i < pattern.length(); i++) { final char c = pattern.charAt(i); if (c != characterToFind) { continue; } final boolean isEscaped = i > 0 && pattern.charAt(i - 1) == '\\'; if (isEscaped) { continue; } return i; } return -1; }

Target:
private static int findNotEscapedCharacterPosition(String pattern, int currentIndex, char characterToFind) { for (int i = currentIndex; i < pattern.length(); i++) { final char c = pattern.charAt(i); if (c != characterToFind) continue; final boolean isEscaped = i > 0 && pattern.charAt(i - 1) == '\\'; if (isEscaped) continue; return i; } return -1; }
Source:
public static VmPropertiesUtils getInstance() { if (vmPropertiesUtils == null) { synchronized (VmPropertiesUtils.class) { if (vmPropertiesUtils == null) { vmPropertiesUtils = new VmPropertiesUtils(); } } } return vmPropertiesUtils; }

Target:
public static VmPropertiesUtils getInstance() { return vmPropertiesUtils; }
Source:
private void openInNewTab(PageTitle title, HistoryEntry entry) { Tab tab = new Tab(); if (tabList.size() > 0) { tabList.add(tabList.size() - 1, tab); } else { tabList.add(tab); } tab.getBackStack().add(new PageBackStackItem(title, entry)); tabsProvider.showAndHideTabs(); }

Target:
private void openInNewTab(PageTitle title, HistoryEntry entry) { Tab tab = new Tab(); tabList.add(Math.max(0, tabList.size() - 1), tab); tab.getBackStack().add(new PageBackStackItem(title, entry)); tabsProvider.showAndHideTabs(); }
Source:
public void run() { while (true) { if (stop) { break; } try { Thread.sleep(100); } catch (InterruptedException e) { log.warn("error refreshing index searchers", e); } openIndex.maybeRefresh(); closedIndex.maybeRefresh(); } }

Target:
public void run() { while (true) { if (stop) { break; } openIndex.maybeRefresh(); closedIndex.maybeRefresh(); synchronized (this) { try { wait(100); } catch (InterruptedException e) { log.warn("error refreshing index searchers", e); } } } }
Source:
public void unregisterModelAdapter(Class<?> adapterType) { if (DsfDebugOptions.DEBUG && DsfDebugOptions.DEBUG_SESSION && DsfDebugOptions.DEBUG_SESSION_MODEL_ADAPTERS) { String msg = new Formatter().format( "%s Unregistering model adapter of type %s from session %s (%s)", DsfPlugin.getDebugTime(), adapterType.getName(), LoggingUtils.toString(this), getId() ).toString(); DsfDebugOptions.trace(msg); } fAdapters.remove(adapterType); }

Target:
public void unregisterModelAdapter(Class<?> adapterType) { if (DsfDebugOptions.DEBUG_SESSION_MODEL_ADAPTERS) { String msg = new Formatter().format( "%s Unregistering model adapter of type %s from session %s (%s)", DsfPlugin.getDebugTime(), adapterType.getName(), LoggingUtils.toString(this), getId() ).toString(); DsfDebugOptions.trace(msg); } fAdapters.remove(adapterType); }
Source:
public Compressor borrowCompressor(){ try { return (Compressor) compressorPool.borrowObject(); } catch (Exception e) { throw new ParquetCompressionCodecException(e); } }

Target:
public Compressor borrowCompressor(){ return borrow(compressorPool); }
Source:
public void testOtherFieldsNotValidatedInImport() { ImportVmParameters parameters = createParameters(); String stringOf5000Chars = StringUtils.repeat("A", 5000); assertFalse(BusinessEntitiesDefinitions.GENERAL_MAX_SIZE > stringOf5000Chars.length()); parameters.getVm().setUserDefinedProperties(stringOf5000Chars); parameters.setImportAsNewEntity(true); ImportVmCommand command = new ImportVmCommand(parameters); Set<ConstraintViolation<ImportVmParameters>> validate = ValidationUtils.getValidator().validate(parameters, command.getValidationGroups().toArray(new Class<?>[0])); assertTrue(validate.isEmpty()); parameters.getVm().setUserDefinedProperties(stringOf5000Chars); parameters.setImportAsNewEntity(false); command = new ImportVmCommand(parameters); validate = ValidationUtils.getValidator().validate(parameters, command.getValidationGroups().toArray(new Class<?>[0])); assertTrue(validate.isEmpty()); }

Target:
public void testOtherFieldsNotValidatedInImport() { ImportVmParameters parameters = createParameters(); String stringOf5000Chars = StringUtils.repeat("A", BusinessEntitiesDefinitions.GENERAL_MAX_SIZE + 1); parameters.getVm().setUserDefinedProperties(stringOf5000Chars); parameters.setImportAsNewEntity(true); ImportVmCommand command = new ImportVmCommand(parameters); Set<ConstraintViolation<ImportVmParameters>> validate = ValidationUtils.getValidator().validate(parameters, command.getValidationGroups().toArray(new Class<?>[0])); assertTrue(validate.isEmpty()); parameters.getVm().setUserDefinedProperties(stringOf5000Chars); parameters.setImportAsNewEntity(false); command = new ImportVmCommand(parameters); validate = ValidationUtils.getValidator().validate(parameters, command.getValidationGroups().toArray(new Class<?>[0])); assertTrue(validate.isEmpty()); }
Source:
public String getStatData() throws IOException { JSONObject o = new JSONObject(); for (UsageStatisticsContributor contributor : UsageStatisticsContributor.all()) { JSONObject contributed = contributor.getStatData(); for (java.util.Iterator<String> it = contributed.keys(); it.hasNext();) { String key = it.next(); if (o.has(key)) { throw new IllegalStateException( contributor.getClass().getName() + " tried to use an already used UsageStatistics key: " + key); } o.put(key, contributed.get(key)); } } try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStreamWriter w = new OutputStreamWriter(new GZIPOutputStream(new CombinedCipherOutputStream(baos,getKey(),"AES")), "UTF-8"); try { o.write(w); } finally { IOUtils.closeQuietly(w); } return new String(Base64.encode(baos.toByteArray())); } catch (GeneralSecurityException e) { throw new Error(e); } }

Target:
public String getStatData() throws IOException { Jenkins j = Jenkins.getInstance(); JSONObject data = new JSONObject(); ExtensionList<UsageStatisticsContributor> contributors = UsageStatisticsContributor.all(); List<JSONObject> nodes = new ArrayList<JSONObject>(); for (Computer computer : j.getComputers()) { JSONObject nodeData = new JSONObject(); for (UsageStatisticsContributor contributor : contributors) { try { contributor.contributeNodeData(computer, nodeData); } catch (Exception e) { LOGGER.log(Level.WARNING, null, e); } } nodes.add(nodeData); } data.put("nodes", nodes); for (UsageStatisticsContributor contributor : contributors) { Class<? extends UsageStatisticsContributor> contributorClass = contributor.getClass(); LOGGER.finest(String.format("Calling '%s' usage stats contributor", contributorClass)); try { contributor.contributeData(data); } catch (Exception e) { LOGGER.log(Level.WARNING, null, e); } } try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStreamWriter w = new OutputStreamWriter(new GZIPOutputStream(new CombinedCipherOutputStream(baos,getKey(),"AES")), "UTF-8"); try { data.write(w); } finally { IOUtils.closeQuietly(w); } return new String(Base64.encode(baos.toByteArray())); } catch (GeneralSecurityException e) { throw new Error(e); } }
Source:
public void showInvalidLoginOrPasswordSnackbar() { Snackbar snackbar = Snackbar .make(mRootView, getResources().getString(R.string.invalid_login_or_password_message), Snackbar.LENGTH_LONG) .setAction("EDIT", view -> { mPassword.requestFocus(); mPassword.selectAll(); }); snackbar.show(); }

Target:
public void showInvalidLoginOrPasswordSnackbar() { String message = getResources().getString(R.string.invalid_login_or_password_message); createSnackbar(message) .setAction(getResources().getString(R.string.snackbar_edit), view -> { mPassword.requestFocus(); mPassword.selectAll(); }) .show(); }
Source:
private boolean isSymbolShadowed(Tree tree) { Tree scopedTree = CheckUtils.getFirstAncestor( tree, TreeKinds.FUNCTION_KINDS, Kind.SCRIPT); return getContext().getSymbolModel().getScope(scopedTree).lookupSymbol(SYMBOL) != null; }

Target:
private boolean isSymbolShadowed(Tree tree) { Tree scopedTree = CheckUtils.getFirstAncestor(tree, KindSet.FUNCTION_KINDS, Kind.SCRIPT); Symbol symbolSymbol = getContext().getSymbolModel().getScope(scopedTree).lookupSymbol(SYMBOL); return !symbolSymbol.external() || hasWriteUsage(symbolSymbol); }
Source:
public Retrofit build() { if (baseUrl == null) { throw new IllegalStateException("Base URL required."); } okhttp3.Call.Factory callFactory = this.callFactory; if (callFactory == null) { callFactory = new OkHttpClient(); } Executor callbackExecutor = this.callbackExecutor; if (callbackExecutor == null) { callbackExecutor = platform.defaultCallbackExecutor(); } List<CallAdapter.Factory> adapterFactories = new ArrayList<>(this.adapterFactories); adapterFactories.add(platform.defaultCallAdapterFactory(callbackExecutor)); List<Converter.Factory> converterFactories = new ArrayList<>(this.converterFactories); converterFactories.add(0, new BuiltInConverters()); return new Retrofit(callFactory, baseUrl, converterFactories, adapterFactories, callbackExecutor, validateEagerly); }

Target:
public Retrofit build() { if (baseUrl == null) { throw new IllegalStateException("Base URL required."); } okhttp3.Call.Factory callFactory = this.callFactory; if (callFactory == null) { callFactory = new OkHttpClient(); } Executor callbackExecutor = this.callbackExecutor; if (callbackExecutor == null) { callbackExecutor = platform.defaultCallbackExecutor(); } List<CallAdapter.Factory> adapterFactories = new ArrayList<>(this.adapterFactories); adapterFactories.add(platform.defaultCallAdapterFactory(callbackExecutor)); List<Converter.Factory> converterFactories = new ArrayList<>(); converterFactories.add(new BuiltInConverters()); converterFactories.addAll(this.converterFactories); return new Retrofit(callFactory, baseUrl, converterFactories, adapterFactories, callbackExecutor, validateEagerly); }
Source:
public boolean storeMessage(MessageContext synCtx) { if (synCtx == null) { return false; } if (connection == null) { log.error(getId() + " cannot proceed. RabbitMQ Connection is null. Ignored MessageId: " + synCtx.getMessageID()); return false; } boolean result = false; try (Channel channel = connection.createChannel()) { channel.confirmSelect(); StorableMessage storableMessage = MessageConverter.toStorableMessage(synCtx); final byte[] message = serializeMessage(storableMessage); final AMQP.BasicProperties basicProperties = getBasicProperties(synCtx, storableMessage); publishMessage(channel, exchangeName, routingKey, basicProperties, message); result = channel.waitForConfirms(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (TimeoutException | IOException e) { String errorMsg = getId() + ". Ignored MessageId: " + synCtx.getMessageID() + ". " + "Could not store message to store [" + store.getName() + "]. " + "Error:" + e.getLocalizedMessage(); log.error(errorMsg, e); } if (log.isDebugEnabled()) { log.debug(getId() + ". Stored MessageId: " + synCtx.getMessageID()); } store.enqueued(); return result; }

Target:
public boolean storeMessage(MessageContext synCtx) { if (synCtx == null) { return false; } if (connection == null) { log.error(getId() + " cannot proceed. RabbitMQ Connection is null. Ignored MessageId: " + synCtx.getMessageID()); return false; } boolean result = false; try (Channel channel = connection.createChannel()) { if (publisherConfirmsEnabled) { channel.confirmSelect(); } StorableMessage storableMessage = MessageConverter.toStorableMessage(synCtx); final byte[] message = serializeMessage(storableMessage); final AMQP.BasicProperties basicProperties = getBasicProperties(synCtx, storableMessage); publishMessage(channel, exchangeName, routingKey, basicProperties, message); if (publisherConfirmsEnabled) { result = channel.waitForConfirms(); } else { result = true; } if (log.isDebugEnabled()) { log.debug(getId() + ". Stored MessageId: " + synCtx.getMessageID()); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (TimeoutException | IOException e) { String errorMsg = getId() + ". Ignored MessageId: " + synCtx.getMessageID() + ". " + "Could not store message to store [" + store.getName() + "]. " + "Error:" + e.getLocalizedMessage(); log.error(errorMsg, e); } store.enqueued(); return result; }