auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void doFailureOccured(CommandContext ctx) throws Exception { if (keyStoreName != null) { if(useLetsEncrypt && caAccount == null) { ModelNode req = ElytronUtil.removeCertificateAuthorityAccount(ctx, certAuthorityAccountName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER); req = ElytronUtil.removeKeyStore(ctx, accountKeyStoreName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER); } ModelNode req = ElytronUtil.removeKeyStore(ctx, keyStoreName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER); } }

Target:
public void doFailureOccured(CommandContext ctx) throws Exception { if (keyStoreName != null) { if(useLetsEncrypt && caAccount == null) { ModelNode req = ElytronUtil.removeCertificateAuthorityAccount(certAuthorityAccountName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER, false); req = ElytronUtil.removeKeyStore(ctx, accountKeyStoreName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER, false); } ModelNode req = ElytronUtil.removeKeyStore(ctx, keyStoreName); SecurityCommand.execute(ctx, req, SecurityCommand.DEFAULT_FAILURE_CONSUMER, false); } }
Source:
public String call() throws OrmException { StringBuilder errorMessage = null; Project.NameKey parentNameKey; if (parentName != null && parentName.isEmpty()) { parentNameKey = wildProject; } else { parentNameKey = new Project.NameKey(parentName); } if (projectCache.get(parentNameKey) == null) { errorMessage = new StringBuilder(); errorMessage.append("error: Project '" + parentName + "' not found\n"); errorMessage.append("All:"); } if (errorMessage == null) { final PerformSetParent perfSetParent = performSetParent.create(parentName, childProjects); errorMessage = perfSetParent.setParent(); } String message = ""; if (errorMessage != null) { message = errorMessage.toString(); } return message; }

Target:
public VoidResult call() throws OrmException, NoSuchProjectException, OperationNotExecutedException { final Project.NameKey parentNameKey = new Project.NameKey(parentName); final PerformSetParent perfSetParent = performSetParent.create(parentNameKey, childProjects); perfSetParent.setParent(); return VoidResult.INSTANCE; }
Source:
public Attachment createAttachmentFromBackupLink(Document document, AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink) throws IOException { File formFile = downloadFile(accountingXmlDocumentBackupLink); if (formFile != null) { String uploadFileName = accountingXmlDocumentBackupLink.getFileName(); String mimeType = URLConnection.guessContentTypeFromName(formFile.getName()); int fileSize = (int) formFile.length(); String attachmentType = null; if (LOG.isDebugEnabled()) { LOG.debug("createAttachmentFromBackupLink, uploadFileName: " + uploadFileName + " mimeType: " + mimeType + " fileSize: " + fileSize); } InputStream fileContents = new FileInputStream(formFile); Attachment attachment = attachmentService.createAttachment(document, uploadFileName, mimeType, fileSize, fileContents, attachmentType); formFile.delete(); return attachment; } else { LOG.error("createAttachmentFromBackupLink, the form file is NULL"); } throw new IOException ("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); }

Target:
public Attachment createAttachmentFromBackupLink(Document document, AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink) throws IOException { byte[] formFile = downloadByteArray(accountingXmlDocumentBackupLink); if (formFile.length > 0) { String uploadFileName = accountingXmlDocumentBackupLink.getFileName(); String mimeType = URLConnection.guessContentTypeFromName(uploadFileName); int fileSize = (int) formFile.length; String attachmentType = null; if (LOG.isDebugEnabled()) { LOG.debug("createAttachmentFromBackupLink, uploadFileName: " + uploadFileName + " mimeType: " + mimeType + " fileSize: " + fileSize); } InputStream inputStream = new ByteArrayInputStream(formFile); Attachment attachment = attachmentService.createAttachment(document, uploadFileName, mimeType, fileSize, inputStream, attachmentType); return attachment; } else { LOG.error("createAttachmentFromBackupLink, the form file is NULL"); } throw new IOException("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); }
Source:
public float getRegionalDifficulty() { final float moonPhase = world.getMoonPhase(); final long worldTime = world.getFullTime(); final Difficulty worldDifficulty = world.getDifficulty(); float totalTimeFactor; if (worldTime > (21 * TickUtil.TICKS_PER_HOUR)) { totalTimeFactor = 0.25f; } else if (worldTime < TickUtil.TICKS_PER_HOUR) { totalTimeFactor = 0; } else { totalTimeFactor = (float) (worldTime - TickUtil.TICKS_PER_HOUR) / 5760000; } float chunkFactor; if (inhabitedTime > (50 * TickUtil.TICKS_PER_HOUR)) { chunkFactor = 1; } else { chunkFactor = (float) inhabitedTime / 3600000; } if (worldDifficulty != Difficulty.HARD) { chunkFactor *= (3f / 4f); } if (moonPhase / 4 > totalTimeFactor) { chunkFactor += totalTimeFactor; } else { chunkFactor += moonPhase / 4; } if (worldDifficulty == Difficulty.EASY) { chunkFactor /= 2; } float regionalDifficulty = 0.75f + totalTimeFactor + chunkFactor; if (worldDifficulty == Difficulty.NORMAL) { regionalDifficulty *= 2; } if (worldDifficulty == Difficulty.HARD) { regionalDifficulty *= 3; } return regionalDifficulty; }

Target:
public double getRegionalDifficulty() { final double moonPhase = world.getMoonPhase(); final long worldTime = world.getFullTime(); final Difficulty worldDifficulty = world.getDifficulty(); double totalTimeFactor; if (worldTime > (21 * TickUtil.TICKS_PER_HOUR)) { totalTimeFactor = 0.25; } else if (worldTime < TickUtil.TICKS_PER_HOUR) { totalTimeFactor = 0; } else { totalTimeFactor = (worldTime - TickUtil.TICKS_PER_HOUR) / 5760000d; } double chunkFactor; if (inhabitedTime > (50 * TickUtil.TICKS_PER_HOUR)) { chunkFactor = 1; } else { chunkFactor = inhabitedTime / 3600000d; } if (worldDifficulty != Difficulty.HARD) { chunkFactor *= 3d / 4d; } if (moonPhase / 4 > totalTimeFactor) { chunkFactor += totalTimeFactor; } else { chunkFactor += moonPhase / 4; } if (worldDifficulty == Difficulty.EASY) { chunkFactor /= 2; } double regionalDifficulty = 0.75 + totalTimeFactor + chunkFactor; if (worldDifficulty == Difficulty.NORMAL) { regionalDifficulty *= 2; } if (worldDifficulty == Difficulty.HARD) { regionalDifficulty *= 3; } return regionalDifficulty; }
Source:
protected void contributePinActionToToolBar() { if (fPinAction == null) { fPinAction = new PinTmfViewAction(); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); toolBarManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(fPinAction); } fPinAction.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { Object value = event.getNewValue(); if (!(value instanceof Boolean)) { throw new IllegalStateException(); } setPinned((Boolean) value); } } }); }

Target:
protected void contributePinActionToToolBar() { if (fPinAction == null) { fPinAction = new PinTmfViewAction(); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); toolBarManager.add(fPinAction); } fPinAction.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { Object value = event.getNewValue(); if (!(value instanceof Boolean)) { throw new IllegalStateException(); } if (TmfView.this instanceof ITmfPinnable) { ITmfPinnable view = (ITmfPinnable) TmfView.this; view.setPinned((Boolean) value); } } } }); }
Source:
public Object compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); return sketch.toString(); }

Target:
public String compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); return sketch.toString(); }
Source:
public SliceBlocksReadStreams(final SliceBlocks sliceBlocks, final CompressorCache compressorCache) { ValidationUtils.nonNull(sliceBlocks.getCoreBlock(), "sliceBlocks must have been initialized"); ValidationUtils.nonNull(sliceBlocks.getNumberOfExternalBlocks() > 0, "sliceBlocks must have been initialized"); if (sliceBlocks.getCoreBlock() == null || sliceBlocks.getNumberOfExternalBlocks() == 0) { throw new CRAMException("slice blocks must be initialized before being used with a reader"); } coreBlockInputStream = new DefaultBitInputStream( new ByteArrayInputStream( sliceBlocks.getCoreBlock().getUncompressedContent(compressorCache))); final List<Integer> externalContentIDs = sliceBlocks.getExternalContentIDs(); for (final Integer contentID : externalContentIDs) { final Block block = sliceBlocks.getExternalBlock(contentID); externalInputStreams.put(contentID, new ByteArrayInputStream(block.getUncompressedContent(compressorCache))); } }

Target:
public SliceBlocksReadStreams(final SliceBlocks sliceBlocks, final CompressorCache compressorCache) { ValidationUtils.nonNull(sliceBlocks.getCoreBlock(), "sliceBlocks must have been initialized"); ValidationUtils.validateArg(sliceBlocks.getNumberOfExternalBlocks() > 0, "sliceBlocks must have been initialized"); if (sliceBlocks.getCoreBlock() == null || sliceBlocks.getNumberOfExternalBlocks() == 0) { throw new CRAMException("slice blocks must be initialized before being used with a reader"); } coreBlockInputStream = new DefaultBitInputStream( new ByteArrayInputStream( sliceBlocks.getCoreBlock().getUncompressedContent(compressorCache))); final List<Integer> externalContentIDs = sliceBlocks.getExternalContentIDs(); for (final Integer contentID : externalContentIDs) { final Block block = sliceBlocks.getExternalBlock(contentID); externalInputStreams.put(contentID, new ByteArrayInputStream(block.getUncompressedContent(compressorCache))); } }
Source:
public DelegatingSystemTablesProvider(List<SystemTablesProvider> delegates) { requireNonNull(delegates, "delegates is null"); Preconditions.checkArgument(delegates.size() >= 1, "empty delegates"); this.delegates = ImmutableList.copyOf(delegates); }

Target:
public DelegatingSystemTablesProvider(List<SystemTablesProvider> delegates) { requireNonNull(delegates, "delegates is null"); checkArgument(delegates.size() >= 1, "empty delegates"); this.delegates = ImmutableList.copyOf(delegates); }
Source:
public void sendUpdateInternal(Receiver receiver, Direction direction, Tuple updateElement) { Mailbox mailbox = receiver.getMailbox(); MessagePostEffect effect = mailbox.postMessage(direction, updateElement); Logger logger = getNetwork().getEngine().getLogger(); if (effect == MessagePostEffect.BECAME_ACTIVE) { boolean result = activeMailboxes.add(mailbox); if (!result) { logger.error("[INTERNAL ERROR] Mailbox " + mailbox + " was already active and it became active again!"); } } else if (effect == MessagePostEffect.BECAME_INACTIVE) { boolean result = activeMailboxes.remove(mailbox); if (!result) { logger.error( "[INTERNAL ERROR] Mailbox " + mailbox + " was already inactive and it became inactive again!"); } } }

Target:
public void sendUpdateInternal(Receiver receiver, Direction direction, Tuple updateElement) { Mailbox mailbox = receiver.getMailbox(); MessagePostEffect effect = mailbox.postMessage(direction, updateElement); if (effect == MessagePostEffect.BECAME_ACTIVE) { boolean result = activeMailboxes.add(mailbox); if (!result) { logger.error("[INTERNAL ERROR] Mailbox " + mailbox + " was already active and it became active again!"); } } else if (effect == MessagePostEffect.BECAME_INACTIVE) { boolean result = activeMailboxes.remove(mailbox); if (!result) { logger.error( "[INTERNAL ERROR] Mailbox " + mailbox + " was already inactive and it became inactive again!"); } } }
Source:
private synchronized void setBhRestToken(String bhRestToken) { this.bhRestToken = bhRestToken; if(restCredentials.credentialCheck()) { updateDateTimeBhRestTokenWillExpire(); } }

Target:
private synchronized void setBhRestToken(String bhRestToken) { this.bhRestToken = bhRestToken; if (!this.isSessionProvided) { updateDateTimeBhRestTokenWillExpire(); } }
Source:
public void verifyTableProperty(String propertyName, int propertyValue) { waitForElementByElement(tables.get(tables.size()-1)); Assertion.assertEquals(tables.get(tables.size()-1).getAttribute(propertyName), Integer.toString(propertyValue)); PageObjectLogging.log("verifyTableProperty", "table has correct " + propertyName + " property", true); }

Target:
private void verifyTableProperty(String propertyName, int propertyValue) { waitForElementByElement(table); Assertion.assertEquals(table.getAttribute(propertyName), Integer.toString(propertyValue)); PageObjectLogging.log( "verifyTableProperty", "table has correct " + propertyName + " property", true ); }
Source:
public void updatePlayerPosition(PlayerCubeMap cubeMap, EntityPlayerMP player, CubePos managedPos) { if (!CubicChunksConfig.allowVanillaClients) { return; } CubePos offset = playerOffsets.getOrDefault(player, CubePos.ZERO); int idx = managedPos.getX() + offset.getX(); int idy = managedPos.getY() + offset.getY(); int idz = managedPos.getZ() + offset.getZ(); boolean shouldSliceTransition = idy < 2 || idy >= 14; boolean isHorizontalSlices = CubicChunksConfig.vanillaClients.horizontalSlices; if (!shouldSliceTransition && isHorizontalSlices && (!CubicChunksConfig.vanillaClients.horizontalSlicesBedrockOnly || ((IBedrockPlayer) player).isBedrock())) { int horizontalSliceSize = CubicChunksConfig.vanillaClients.horizontalSliceSize; int maxHorizontalOffset = Math.max(Math.abs(idx), Math.abs(idz)); shouldSliceTransition = maxHorizontalOffset >= Coords.blockToCube(horizontalSliceSize); } if (shouldSliceTransition) { int newXOffset = isHorizontalSlices ? -managedPos.getX() : 0; int newYOffset = 8 - managedPos.getY(); int newZOffset = isHorizontalSlices ? -managedPos.getZ() : 0; CubePos newOffset = new CubePos(newXOffset, newYOffset, newZOffset); playerOffsets.put(player, newOffset); switchPlayerOffset(cubeMap, player, offset, newOffset); } }

Target:
public void updatePlayerPosition(PlayerCubeMap cubeMap, EntityPlayerMP player, CubePos managedPos) { if (!CubicChunksConfig.allowVanillaClients) { return; } CubePos offset = playerOffsets.get(player); boolean isFirst = offset == null; if (isFirst) { playerOffsets.put(player, offset = CubePos.ZERO); } int posX = managedPos.getX() + offset.getX(); int posY = managedPos.getY() + offset.getY(); int posZ = managedPos.getZ() + offset.getZ(); boolean shouldSliceTransition = posY < 2 || posY >= 14; boolean isHorizontalSlices = CubicChunksConfig.vanillaClients.horizontalSlices && (!CubicChunksConfig.vanillaClients.horizontalSlicesBedrockOnly || bedrockPlayers.contains(player.getUniqueID())); if (isHorizontalSlices) { int horizontalSliceSize = CubicChunksConfig.vanillaClients.horizontalSliceSize; int maxHorizontalOffset = Math.max(Math.abs(posX), Math.abs(posZ)); shouldSliceTransition |= maxHorizontalOffset >= Coords.blockToCube(horizontalSliceSize); } if (shouldSliceTransition) { int newXOffset = isHorizontalSlices ? -managedPos.getX() : 0; int newYOffset = 8 - managedPos.getY(); int newZOffset = isHorizontalSlices ? -managedPos.getZ() : 0; CubePos newOffset = new CubePos(newXOffset, newYOffset, newZOffset); playerOffsets.put(player, newOffset); if (isFirst) { playerOffsetsC2S.put(player, newOffset); } else { switchPlayerOffset(cubeMap, player, offset, newOffset); } } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Container)) { return false; } Container container = (Container) o; if (id != container.id) { return false; } if (isPrivate != container.isPrivate) { return false; } if (!name.equals(container.name)) { return false; } if (status != null ? !status.equals(container.status) : container.status != null) { return false; } if (description != null ? !description.equals(container.description) : container.description != null) { return false; } return parentAccount.equals(container.parentAccount); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Container)) { return false; } Container container = (Container) o; if (!id.equals(container.id)) { return false; } if (!name.equals(container.name)) { return false; } if (status != container.status) { return false; } if (!isPrivate.equals(container.isPrivate)) { return false; } return parentAccountId.equals(container.parentAccountId); }
Source:
public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } session.save(); return null; }

Target:
public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } if (save) { session.save(); } return input; }
Source:
public void testDeleteAll() { Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify(); final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<Long> countMono = repository.count(); StepVerifier.create(countMono).expectNext(0L).verifyComplete(); }

Target:
public void testDeleteAll() { Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).expectNextCount(2).verifyComplete(); final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<Long> countMono = repository.count(); StepVerifier.create(countMono).expectNext(0L).verifyComplete(); }
Source:
private void flushCodec() throws ExoPlaybackException { codecHotswapTimeMs = -1; inputIndex = -1; outputIndex = -1; waitingForFirstSyncFrame = true; decodeOnlyPresentationTimestamps.clear(); if (Util.SDK_INT >= 18 && codecReinitState == REINIT_STATE_NONE) { codec.flush(); } else { codecReinitState = REINIT_STATE_NONE; releaseCodec(); maybeInitCodec(); } if (codecReconfigured && format != null) { codecReconfigurationState = RECONFIGURATION_STATE_WRITE_PENDING; } hasQueuedOneInputBuffer = false; }

Target:
private void flushCodec() throws ExoPlaybackException { codecHotswapTimeMs = -1; inputIndex = -1; outputIndex = -1; waitingForFirstSyncFrame = true; decodeOnlyPresentationTimestamps.clear(); if (Util.SDK_INT >= 18 && codecReinitState == REINIT_STATE_NONE) { codec.flush(); } else { codecReinitState = REINIT_STATE_NONE; releaseCodec(); maybeInitCodec(); } if (codecReconfigured && format != null) { codecReconfigurationState = RECONFIGURATION_STATE_WRITE_PENDING; } hasQueuedInputBuffer = false; }
Source:
public void createPayment_responseWith422_whenZeroAmountForDirectDebitAccount() { publicAuthMockClient.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID, DIRECT_DEBIT); String payload = new JsonStringBuilder() .add("amount", 0) .add("reference", REFERENCE) .add("description", DESCRIPTION) .add("return_url", RETURN_URL) .add("agreement_id", "1234") .build(); postPaymentResponse(payload) .statusCode(422) .contentType(JSON) .body("code", is("P0102")) .body("field", is("amount")) .body("description", is("Invalid attribute value: amount. Must be greater than or equal to 1")); }

Target:
public void createPayment_responseWith422_whenZeroAmountForDirectDebitAccount() { publicAuthMockClient.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID, DIRECT_DEBIT); String payload = new JsonStringBuilder() .add("amount", 0) .add("reference", REFERENCE) .add("description", DESCRIPTION) .add("agreement_id", "1234") .build(); postPaymentResponse(payload) .statusCode(422) .contentType(JSON) .body("code", is("P0102")) .body("field", is("amount")) .body("description", is("Invalid attribute value: amount. Must be greater than or equal to 1")); }
Source:
public void write(DataOutput dataOutput) throws IOException { dataOutput.writeUTF(structureRecordJSON); dataOutput.writeUTF(sortFieldsJSON); dataOutput.writeUTF(schemaJSON); }

Target:
public void write(DataOutput dataOutput) throws IOException { dataOutput.writeUTF(structuredRecordJSON); dataOutput.writeUTF(sortFieldsJSON); dataOutput.writeUTF(schemaJSON); }
Source:
public DataRadioStation getPreviousById(String id) { if (listStations.size() == 0) return null; for (int i = 1; i < listStations.size(); i++) { if (listStations.get(i).ID.equals(id)) { return listStations.get(i - 1); } } return listStations.get(listStations.size()-1); }

Target:
public DataRadioStation getPreviousById(String id) { if (listStations.isEmpty()) return null; for (int i = 1; i < listStations.size(); i++) { if (listStations.get(i).ID.equals(id)) { return listStations.get(i - 1); } } return listStations.get(listStations.size()-1); }
Source:
public void testCanNotReadWithoutPath() { try { ConfigLoader loader = new PropertiesConfigLoaderFactory().getLoader(new MapConfig()); loader.getConfig(); fail("should have gotten a samza exception"); } catch (SamzaException e) { } }

Target:
public void testCanNotReadWithoutPath() { ConfigLoader loader = new PropertiesConfigLoaderFactory().getLoader(new MapConfig()); loader.getConfig(); }
Source:
public void testEnableTetheringPermission() throws Exception { if (!mTM.isTetheringSupported()) return; final TestTetheringEventCallback tetherEventCallback = new TestTetheringEventCallback(); mTM.registerTetheringEventCallback(c -> c.run(), tetherEventCallback); tetherEventCallback.expectCallbackStarted(); final TestSoftApCallback softApCallback = new TestSoftApCallback(); mWm.registerSoftApCallback(c -> c.run(), softApCallback); final StartTetheringCallback wifiCallback = new StartTetheringCallback(); mTM.startTethering(new TetheringRequest.Builder(TETHERING_WIFI).build(), c -> c.run(), wifiCallback); wifiCallback.verifyTetheringStarted(); softApCallback.expectSoftApState(WifiManager.WIFI_AP_STATE_ENABLED, DEFAULT_TIMEOUT_MS); mTM.stopAllTethering(); softApCallback.expectSoftApState(WifiManager.WIFI_AP_STATE_DISABLED, DEFAULT_TIMEOUT_MS); mTM.unregisterTetheringEventCallback(tetherEventCallback); mUiAutomation.dropShellPermissionIdentity(); mTM.startTethering(new TetheringRequest.Builder(TETHERING_WIFI).build(), c -> c.run(), wifiCallback); wifiCallback.expectTetheringFailed(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION); }

Target:
public void testEnableTetheringPermission() throws Exception { mUiAutomation.dropShellPermissionIdentity(); final StartTetheringCallback startTetheringCallback = new StartTetheringCallback(); mTM.startTethering(new TetheringRequest.Builder(TETHERING_WIFI).build(), c -> c.run(), startTetheringCallback); startTetheringCallback.expectTetheringFailed(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION); }
Source:
public void testAppendCustomFileAbsoluteDirCompletion() throws Exception { Path tempFile = Files.createTempFile("tempFile", ".tmp"); String tempFileStringPath = tempFile.toString(); try { ctx.handle("version >" + tempFileStringPath); List<String> paths = new ArrayList<>(); paths.add(tempFile.toAbsolutePath().getRoot().toString()); for (int i=0; i < tempFile.toAbsolutePath().getNameCount(); i++) { paths.add(tempFile.toAbsolutePath().getName(i).toString()); } String cmd = "version >>"; String testPath = ""; List<String> candidates = new ArrayList<>(); for (int i = 0; i < (paths.size() - 1); i++) { String p = paths.get(i); if (i == 0 || (i == paths.size() - 1)) { testPath += p; } else { testPath += p + File.separator; } if (i < tempFile.toAbsolutePath().getNameCount() - 1) { candidates = complete(ctx, cmd + testPath, null); assertThat("No candidate for completion match with the expected content.", candidates, CoreMatchers.hasItem(paths.get(i+1) + File.separator)); } else { candidates = complete(ctx, cmd + testPath, null); assertThat("No candidate for completion match with the expected content.", candidates, CoreMatchers.hasItem((paths.get(paths.size()-1)))); } } } finally { Files.delete(tempFile); } }

Target:
public void testAppendCustomFileAbsoluteDirCompletion() throws Exception { Path tempFile = Files.createTempFile("tempFile", ".tmp"); String tempFileStringPath = tempFile.toString(); try { ctx.handle("version >" + tempFileStringPath); List<String> paths = new ArrayList<>(); paths.add(tempFile.toAbsolutePath().getRoot().toString()); for (int i=0; i < tempFile.toAbsolutePath().getNameCount(); i++) { paths.add(tempFile.toAbsolutePath().getName(i).toString()); } String cmd = "version >>"; String testPath = ""; List<String> candidates; for (int i = 0; i < paths.size() - 1; i++) { String p = paths.get(i); if (i == 0 || (i == paths.size() - 1)) { testPath += p; } else { testPath += p + File.separator; } candidates = complete(ctx, cmd + testPath, null); if (i < tempFile.toAbsolutePath().getNameCount() - 1) { assertThat("No candidate for completion match with the expected content.", candidates, CoreMatchers.hasItem(paths.get(i+1) + File.separator)); } else { assertThat("No candidate for completion match with the expected content.", candidates, CoreMatchers.hasItem((paths.get(paths.size()-1)))); } } } finally { Files.delete(tempFile); } }
Source:
public void setActivityCalendar(final DlmsDeviceMessageMetadata messageMetadata, final ActivityCalendar activityCalendar, final DeviceResponseMessageSender responseMessageSender) { this.logStart(LOGGER, messageMetadata, "setActivityCalendar"); ClientConnection conn = null; DlmsDevice device = null; try { final String deviceIdentification = messageMetadata.getDeviceIdentification(); device = this.domainHelperService.findDlmsDevice(deviceIdentification); LOGGER.info("Device for Activity Calendar is: {}", device); conn = this.dlmsConnectionFactory.getConnection(device); this.setActivityCalendarCommandExecutor.execute(conn, activityCalendar); final MethodResultCode methodResult = this.setActivityCalendarCommandActivationExecutor.execute(conn, null); if (MethodResultCode.SUCCESS != methodResult) { throw new ProtocolAdapterException("AccessResultCode for set Activity Calendar: " + methodResult); } this.sendResponseMessage(messageMetadata, ResponseMessageResultType.OK, null, responseMessageSender, "Set Activity Calendar Result is OK for device id: " + deviceIdentification + " calendar name: " + activityCalendar.getCalendarName()); } catch (final Exception e) { LOGGER.error("Unexpected exception during setActivityCalendar", e); final OsgpException ex = this.ensureOsgpException(e); this.sendResponseMessage(messageMetadata, ResponseMessageResultType.NOT_OK, ex, responseMessageSender); } finally { if (conn != null && conn.isConnected()) { LOGGER.info("Closing connection with {}", device.getDeviceIdentification()); conn.close(); } } }

Target:
public void setActivityCalendar(final DlmsDeviceMessageMetadata messageMetadata, final ActivityCalendar activityCalendar, final DeviceResponseMessageSender responseMessageSender) { this.logStart(LOGGER, messageMetadata, "setActivityCalendar"); ClientConnection conn = null; DlmsDevice device = null; try { final String deviceIdentification = messageMetadata.getDeviceIdentification(); device = this.domainHelperService.findDlmsDevice(deviceIdentification); LOGGER.info("Device for Activity Calendar is: {}", device); conn = this.dlmsConnectionFactory.getConnection(device); this.setActivityCalendarCommandExecutor.execute(conn, activityCalendar); final MethodResultCode methodResult = this.setActivityCalendarCommandActivationExecutor.execute(conn, null); if (!MethodResultCode.SUCCESS.equals(methodResult)) { throw new ProtocolAdapterException("AccessResultCode for set Activity Calendar: " + methodResult); } this.sendResponseMessage(messageMetadata, ResponseMessageResultType.OK, null, responseMessageSender, "Set Activity Calendar Result is OK for device id: " + deviceIdentification + " calendar name: " + activityCalendar.getCalendarName()); } catch (final Exception e) { LOGGER.error("Unexpected exception during setActivityCalendar", e); final OsgpException ex = this.ensureOsgpException(e); this.sendResponseMessage(messageMetadata, ResponseMessageResultType.NOT_OK, ex, responseMessageSender); } finally { if (conn != null && conn.isConnected()) { LOGGER.info("Closing connection with {}", device.getDeviceIdentification()); conn.close(); } } }
Source:
private int getExampleColumn(TableSupport tableSupport) { Row headerRow = tableSupport.getLastHeaderRow(); for (Element e : headerRow.getCells()) { String exampleText = e.getAttributeValue("exampleName", ConcordionBuilder.NAMESPACE_CONCORDION_2007); if (exampleText != null) { int exampleNameIndex = headerRow.getIndexOfCell(e); return exampleNameIndex; } } return -1; }

Target:
private int getExampleColumn(TableSupport tableSupport) { Row headerRow = tableSupport.getLastHeaderRow(); for (Element e : headerRow.getCells()) { String exampleText = e.getAttributeValue("example", ConcordionBuilder.NAMESPACE_CONCORDION_2007); if (exampleText != null) { int exampleNameIndex = headerRow.getIndexOfCell(e); return exampleNameIndex; } } return -1; }
Source:
protected void addPidToResource(ResourceTable theEntity, IBaseResource theResource) { if (theResource instanceof IAnyResource) { IDao.RESOURCE_PID.put((IAnyResource) theResource, theEntity.getId()); } }

Target:
protected void addPidToResource(ResourceTable theEntity, IBaseResource theResource) { if (theResource instanceof IAnyResource) { IDao.RESOURCE_PID.put((IAnyResource) theResource, theEntity.getId()); } else if (theResource instanceof IResource) { IDao.RESOURCE_PID.put((IResource) theResource, theEntity.getId()); } }
Source:
public GeofencingApiImpl() { }

Target:
public GeofencingApiImpl() { pendingIntentMap = new HashMap<>(); }
Source:
public synchronized void put(String originalQuery, String parameterizedQuery, AdHocPlannedStatement planIn, String[] extractedLiterals, boolean hasUserQuestionMarkParameters, boolean hasAutoParameterizedException) { assert(originalQuery != null); assert(parameterizedQuery != null); assert(planIn != null); AdHocPlannedStatement plan = planIn; assert(!hasUserQuestionMarkParameters || !hasAutoParameterizedException); if (! hasAutoParameterizedException) { CorePlan corePlan = m_coreCache.get(parameterizedQuery); if (corePlan == null) { corePlan = planIn.core; m_coreCache.put(parameterizedQuery, corePlan); ++m_planInsertions; } else { assert(corePlan.equals(plan.core)); } } if (! hasUserQuestionMarkParameters) { AdHocPlannedStatement cachedPlan = m_literalCache.get(originalQuery); if (cachedPlan == null) { / System.out.println("DEBUG: Caching literal '" + sql + "'"); m_literalCache.put(originalQuery, plan); ++m_literalInsertions; } else { assert(cachedPlan.equals(plan)); } } }

Target:
public synchronized void put(String originalQuery, String parameterizedQuery, AdHocPlannedStatement planIn, String[] extractedLiterals, boolean hasUserQuestionMarkParameters, boolean hasAutoParameterizedException) { Preconditions.checkNotNull(originalQuery); Preconditions.checkNotNull(parameterizedQuery); Preconditions.checkNotNull(planIn); assert(!hasUserQuestionMarkParameters || !hasAutoParameterizedException); if (! hasAutoParameterizedException) { CorePlan corePlan = m_coreCache.get(parameterizedQuery); if (corePlan == null) { corePlan = planIn.core; m_coreCache.put(parameterizedQuery, corePlan); ++m_planInsertions; } else { assert(corePlan.equals(planIn.core)); } } if (! hasUserQuestionMarkParameters) { AdHocPlannedStatement cachedPlan = m_literalCache.get(originalQuery); if (cachedPlan == null) { / System.out.println("DEBUG: Caching literal '" + sql + "'"); m_literalCache.put(originalQuery, planIn); ++m_literalInsertions; } else { assert(cachedPlan.equals(planIn)); } } }
Source:
public void visitNode(Tree tree) { if (tree.is(Kind.BITWISE_AND, Kind.BITWISE_OR) && !((BinaryExpressionTree) tree).rightOperand().is(Kind.NUMERIC_LITERAL)) { SyntaxToken operator = ((BinaryExpressionTree) tree).operator(); bitwiseAndOrOperators.add(operator); } else { fileContainsBitwiseOperations = true; } }

Target:
public void visitNode(Tree tree) { if (lonelyBitwiseAndOr == null && tree.is(Kind.BITWISE_AND, Kind.BITWISE_OR) && !((BinaryExpressionTree) tree).rightOperand().is(Kind.NUMERIC_LITERAL)) { lonelyBitwiseAndOr = ((BinaryExpressionTree) tree).operator(); } else { fileContainsBitwiseOperations = true; } }
Source:
public static void saveJksTo(KeyStore keystore, String storePass, String storeLoc) { try (FileOutputStream os = new FileOutputStream(storeLoc)) { keystore.store(os, storePass.toCharArray()); } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { LOG.error("error unable to save to the keystore: {}", storeLoc, e.getLocalizedMessage(), e); } }

Target:
public static void saveJksTo(KeyStore keystore, String storePass, String storeLoc) throws UtilException { try (FileOutputStream os = new FileOutputStream(storeLoc)) { keystore.store(os, storePass.toCharArray()); } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { throw new UtilException("Unable to save to the tempKeystore.", e); } }
Source:
public void testInvalidHttpsConfiguration() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("http-server.https.enabled", "true") .put("http-server.https.keystore.key", "keystore password") .build(); ConfigurationFactory configurationFactory = new ConfigurationFactory(properties); assertThatThrownBy(() -> configurationFactory.build(HttpServerConfig.class)) .isInstanceOf(ConfigurationException.class) .hasMessageContaining("PEM keystore path/password must be provided when HTTPS is enabled"); }

Target:
public void testInvalidHttpsConfiguration() { assertFailsValidation( new HttpServerConfig() .setHttpsEnabled(true) .setKeystorePassword("keystore password"), "httpsConfigurationValid", "Keystore path/password must be provided when HTTPS is enabled", AssertTrue.class); }
Source:
public void visitNode(Tree tree) { MethodTree methodTree = (MethodTree) tree; List<VariableSymbol> booleanParameterSymbols = getBooleanParametersAsSymbol(methodTree.parameters()); BlockTree blockTree = methodTree.block(); if (isPublic(methodTree) && blockTree != null && !booleanParameterSymbols.isEmpty()) { for (VariableSymbol variable : booleanParameterSymbols) { Collection<IdentifierTree> usages = getSemanticModel().getUsages(variable); if (usages.size() == 1) { blockTree.accept(new ConditionnalStatementVisitor(variable.getName(), getSingleUsage(usages), tree)); } } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; List<VariableSymbol> booleanParameterSymbols = getBooleanParametersAsSymbol(methodTree.parameters()); BlockTree blockTree = methodTree.block(); if (isPublic(methodTree) && blockTree != null && !booleanParameterSymbols.isEmpty()) { for (VariableSymbol variable : booleanParameterSymbols) { Collection<IdentifierTree> usages = getSemanticModel().getUsages(variable); if (usages.size() == 1) { blockTree.accept(new ConditionalStatementVisitor(variable.getName(), Iterables.get(usages, 0), tree)); } } } }
Source:
public static <T extends Object> List<T> distinctListByClassOfObjects(List<T> listToDistinct) { List<T> distinctList = new ArrayList<>(); HashMap<Class, T> uniqueMap = new HashMap<>(); for (T objectInstance : listToDistinct) { uniqueMap.put(objectInstance.getClass(), objectInstance); } distinctList.addAll(uniqueMap.values()); return distinctList; }

Target:
public static <T> List<T> distinctListByClassOfObjects(List<T> listToDistinct) { Map<Class, T> uniqueMap = new HashMap<>(); for (T objectInstance : listToDistinct) { uniqueMap.put(objectInstance.getClass(), objectInstance); } return new ArrayList<>(uniqueMap.values()); }
Source:
private MessageMetadata getMetadata(Map<Utf8, Utf8> metadata) { if (metadata == null) { long timestamp = clock.millis(); return new MessageMetadata(timestamp, MessageId.empty(), Collections.EMPTY_MAP); } else { long timestamp = metadata.containsKey(METADATA_TIMESTAMP_KEY) ? timestampFromMetadata(metadata) : clock.millis(); String messageId = metadata.containsKey(METADATA_MESSAGE_ID_KEY) ? messageIdFromMetadata(metadata) : MessageId.empty(); return new MessageMetadata(timestamp, messageId, extractMetadata(metadata)); } }

Target:
private MessageMetadata getMetadata(Map<Utf8, Utf8> metadata) { if (metadata == null) { long timestamp = clock.millis(); return new MessageMetadata(timestamp, Collections.EMPTY_MAP); } else { long timestamp = metadata.containsKey(METADATA_TIMESTAMP_KEY) ? timestampFromMetadata(metadata) : clock.millis(); Map<String, String> extractedMetadata = extractMetadata(metadata); return metadata.containsKey(METADATA_MESSAGE_ID_KEY) ? new MessageMetadata(timestamp, messageIdFromMetadata(metadata), extractedMetadata) : new MessageMetadata(timestamp, extractedMetadata); } }
Source:
private void checkGroupingSetsCount(GroupBy node) { int crossProduct = 1; for (GroupingElement element : node.getGroupingElements()) { try { int product; if (element instanceof Cube) { int exponent = ((Cube) element).getColumns().size(); if (exponent > 30) { throw new ArithmeticException(); } product = 1 << exponent; } else if (element instanceof Rollup) { product = ((Rollup) element).getColumns().size() + 1; } else { product = element.enumerateGroupingSets().size(); } crossProduct = Math.multiplyExact(crossProduct, product); } catch (ArithmeticException e) { throw new SemanticException(INVALID_PROCEDURE_ARGUMENTS, node, "GROUP BY has more than %s grouping sets but can contain at most %s", Integer.MAX_VALUE, getMaxGroupingSets(session)); } if (crossProduct > getMaxGroupingSets(session)) { throw new SemanticException(INVALID_PROCEDURE_ARGUMENTS, node, "GROUP BY has %s grouping sets but can contain at most %s", crossProduct, getMaxGroupingSets(session)); } } }

Target:
private void checkGroupingSetsCount(GroupBy node) { int crossProduct = 1; for (GroupingElement element : node.getGroupingElements()) { try { int product; if (element instanceof Cube) { int exponent = ((Cube) element).getColumns().size(); if (exponent > 30) { throw new ArithmeticException(); } product = 1 << exponent; } else if (element instanceof Rollup) { product = ((Rollup) element).getColumns().size() + 1; } else { product = element.enumerateGroupingSets().size(); } crossProduct = Math.multiplyExact(crossProduct, product); } catch (ArithmeticException e) { throw new SemanticException(TOO_MANY_GROUPING_SETS, node, "GROUP BY has more than %s grouping sets but can contain at most %s", Integer.MAX_VALUE, getMaxGroupingSets(session)); } if (crossProduct > getMaxGroupingSets(session)) { throw new SemanticException(TOO_MANY_GROUPING_SETS, node, "GROUP BY has %s grouping sets but can contain at most %s", crossProduct, getMaxGroupingSets(session)); } } }
Source:
public dClass(String s) { path=s; dclass_index=0; if (!isDClassInitialized) { init(); isDClassInitialized = true; } }

Target:
public dClass(String s) { path=s; dclass_index=0; isDClassInitialized = ( init() >= 0); }
Source:
public Predicate<String> getFilterEventPredicate() { return dataSetId -> getDataSetQueryHelper() != null && getDataSetQueryHelper() != null && getDataSetQueryHelper().getCurrentTableSettings() != null && dataSetId != null && dataSetId.equals(getDataSetQueryHelper().getCurrentTableSettings().getUUID()); }

Target:
public Predicate<String> getFilterEventPredicate() { return dataSetId -> getDataSetQueryHelper() != null && getDataSetQueryHelper().getCurrentTableSettings() != null && dataSetId != null && dataSetId.equals(getDataSetQueryHelper().getCurrentTableSettings().getUUID()); }
Source:
public boolean isDue() { final Jenkins j = Jenkins.getInstance(); if(j == null || j.isUsageStatisticsCollected() || DISABLED || COMPLETED.compareTo(j.getInitLevel()) > 0) return false; long now = System.currentTimeMillis(); if(now - lastAttempt > DAY) { lastAttempt = now; return true; } return false; }

Target:
public boolean isDue() { final Jenkins j = Jenkins.getInstance(); if (j == null || j.isUsageStatisticsCollected() || DISABLED || COMPLETED.compareTo(j.getInitLevel()) > 0) { return false; } long now = System.currentTimeMillis(); if(now - lastAttempt > DAY) { lastAttempt = now; return true; } return false; }
Source:
private static List<Community> convert(Concept concept, String acknowledgementParamName) { List<Community> communities = new ArrayList<>(); for (Param param : concept.getParams()) { if (acknowledgementParamName.equals(param.getName())) { communities.add(buildCommunity(concept.getId(), concept.getLabel(), StringUtils.isNotBlank(param.getValue()) ? param.getValue() : "")); } } return communities; }

Target:
private static List<Community> convert(Concept concept, String acknowledgementParamName) { return concept.getParams().stream() .filter(x -> acknowledgementParamName.equals(x.getName().toString())) .map(x -> buildCommunity(concept.getId(), concept.getLabel(), StringUtils.defaultIfBlank(x.getValue(), ""))) .collect(Collectors.toList()); }
Source:
public short getDatacenterId() { return datacenterId; }

Target:
public byte getDatacenterId() { return datacenterId; }
Source:
public static InetAddress resolveIpAddress() throws UnknownHostException { if (ipAddress != null) { return ipAddress; } Enumeration<NetworkInterface> netInterfaces = null; try { netInterfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { LOGGER.error("Socket error during resolving IP socketAddress", e); } while (netInterfaces != null && netInterfaces.hasMoreElements()) { NetworkInterface ni = netInterfaces.nextElement(); Enumeration<InetAddress> address = ni.getInetAddresses(); while (address.hasMoreElements()) { InetAddress addr = address.nextElement(); if (!addr.isLoopbackAddress() && addr.getAddress().length == 4) { return ipAddress = addr; } } } throw new UnsupportedOperationException(); }

Target:
public static InetAddress resolveIpAddress() throws UnknownHostException { if (ipAddress != null) { return ipAddress; } Enumeration<NetworkInterface> netInterfaces = null; try { netInterfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { LOGGER.error("Socket error during resolving IP address", e); } while (netInterfaces != null && netInterfaces.hasMoreElements()) { NetworkInterface ni = netInterfaces.nextElement(); Enumeration<InetAddress> address = ni.getInetAddresses(); while (address.hasMoreElements()) { InetAddress addr = address.nextElement(); if (!addr.isLoopbackAddress() && addr.getAddress().length == 4) { return ipAddress = addr; } } } return InetAddress.getLocalHost(); }
Source:
public void testConversionForByteFields() { TestableZoomObject2 pojo = new TestableZoomObject2(); TestMessage proto = pojo.toProto(TestMessage.class); assertTrue(pojo.compare(proto)); TestableZoomObject2 convertedPojo = ZoomConvert.fromProto(proto, TestableZoomObject2.class); assertTrue(pojo.equals(convertedPojo)); }

Target:
public void testConversionForByteFields() { TestableZoomObject2 pojo = new TestableZoomObject2(); TestMessage proto = pojo.toProto(TestMessage.class); assertTrue(pojo.compare(proto)); TestableZoomObject2 convertedPojo = ZoomConvert.fromProto(proto, TestableZoomObject2.class); assertEquals(pojo, convertedPojo); }
Source:
void validateJoinKeySchemas(Map<String, Schema> inputSchemas, Map<String, List<String>> joinKeys, FailureCollector collector) { if (!containsMacro(JoinerConfig.JOIN_KEYS) && !inputSchemas.isEmpty() && !inputSchemas.values().stream().anyMatch(v -> v == null) && joinKeys.size() != inputSchemas.size()) { collector.addFailure("There should be join keys present from each stage.", "Ensure join keys are present from each stage.") .withConfigProperty(JoinerConfig.JOIN_KEYS); } }

Target:
void validateJoinKeySchemas(Map<String, Schema> inputSchemas, Map<String, List<String>> joinKeys, FailureCollector collector) { if (!containsMacro(JoinerConfig.JOIN_KEYS) && inputSchemasAvailable(inputSchemas) && joinKeys.size() != inputSchemas.size()) { collector.addFailure("There should be join keys present from each stage.", "Ensure join keys are present from each stage.") .withConfigProperty(JoinerConfig.JOIN_KEYS); } }
Source:
public void cancel() { while (!TASK_STOPPABLE) { try { Thread.sleep(1000L); } catch (Exception e) { } } super.cancel(); }

Target:
public void cancel() { try { latch.await(); } catch (Exception e) { } super.cancel(); }
Source:
public boolean relationshipAlreadyExists(String fieldName, PersistentResource toAdd) { Object relation = this.getValueUnchecked(fieldName); String toAddId = toAdd.getId(); if (toAddId == null) { return false; } if (relation instanceof Collection) { return ((Collection) relation).stream().anyMatch((obj -> dictionary.getId(obj).equals(toAddId))); } else { return toAddId.equals(dictionary.getId(relation)); } }

Target:
public boolean relationshipAlreadyExists(String fieldName, PersistentResource toAdd) { Object relation = this.getValueUnchecked(fieldName); String toAddId = toAdd.getId(); if (toAddId == null) { return false; } if (relation instanceof Collection) { return ((Collection) relation).stream().anyMatch((obj -> toAddId.equals(dictionary.getId(obj)))); } else { return toAddId.equals(dictionary.getId(relation)); } }
Source:
private List<VM> getVmsForUpdate(List<Guid> vmsIds) { if (vmsIds.isEmpty()) { return Collections.emptyList(); } List<Guid> idsToProcess = getIdsToProcess(vmsIds); List<VM> toReturn = new ArrayList<VM>(); List<VM> vms = getVmDao().getVmsByIds(idsToProcess); for (VM vm : vms) { if (VMStatus.ImageLocked != vm.getstatus()) { VmHandler.updateDisksFromDb(vm); Long currentDbGeneration = getVmAndTemplatesGenerationsDAO().getDbGeneration(vm.getId()); if (vm.getStaticData().getDb_generation() == currentDbGeneration) { boolean verifyDisksNotLocked = verifyDisksNotLocked(vm.getDiskList()); if (verifyDisksNotLocked) { toReturn.add(vm); } } } } return toReturn; }

Target:
private List<VM> getVmsForUpdate(List<Guid> vmsIds) { if (vmsIds.isEmpty()) { return Collections.emptyList(); } List<Guid> idsToProcess = getIdsToProcess(vmsIds); List<VM> toReturn = new ArrayList<VM>(); List<VM> vms = getVmDao().getVmsByIds(idsToProcess); for (VM vm : vms) { if (VMStatus.ImageLocked != vm.getstatus()) { VmHandler.updateDisksFromDb(vm); boolean verifyDisksNotLocked = verifyDisksNotLocked(vm.getDiskList()); if (verifyDisksNotLocked) { Long currentDbGeneration = getVmAndTemplatesGenerationsDAO().getDbGeneration(vm.getId()); if (vm.getStaticData().getDb_generation() == currentDbGeneration) { toReturn.add(vm); } } } } return toReturn; }
Source:
public static HazelcastInstance newHazelcastClient(AddressProvider addressProvider, ClientConfig clientConfig) { return newHazelcastClientInternal(addressProvider, MultipleClientConfigSupport.resolveClientConfigs(clientConfig)); }

Target:
public static HazelcastInstance newHazelcastClient(AddressProvider addressProvider, ClientConfig clientConfig) { return newHazelcastClientInternal(addressProvider, FailoverClientConfigSupport.resolveClientConfig(clientConfig)); }
Source:
private TTransport createNewTransport(ThriftTransportKey cacheKey) throws TTransportException { TTransport transport = ThriftUtil.createClientTransport(cacheKey.getServer(), (int) cacheKey.getTimeout(), cacheKey.getSslParams(), cacheKey.getSaslParams()); log.trace("Creating new connection to connection to {}", cacheKey.getServer()); CachedTTransport tsc = new CachedTTransport(transport, cacheKey); CachedConnection cc = new CachedConnection(tsc); cc.reserve(); try { Lock lock = getLock(cacheKey); lock.lock(); try { CachedConnections cachedConns = getCache().computeIfAbsent(cacheKey, ck -> new CachedConnections()); cachedConns.reserved.put(cc.transport, cc); } finally { lock.unlock(); } } catch (TransportPoolShutdownException e) { cc.transport.close(); throw e; } return cc.transport; }

Target:
private TTransport createNewTransport(ThriftTransportKey cacheKey) throws TTransportException { TTransport transport = ThriftUtil.createClientTransport(cacheKey.getServer(), (int) cacheKey.getTimeout(), cacheKey.getSslParams(), cacheKey.getSaslParams()); log.trace("Creating new connection to connection to {}", cacheKey.getServer()); CachedTTransport tsc = new CachedTTransport(transport, cacheKey); CachedConnection connection = new CachedConnection(tsc); connection.reserve(); try { ConnectionPool pool = getConnectionPool(); pool.putReserved(cacheKey, connection); } catch (TransportPoolShutdownException e) { connection.transport.close(); throw e; } return connection.transport; }