auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void setHandlersEnabled(boolean enable) { setLocalDocumentModificationHandlersEnabled(enable); setLocalEditorStatusChangeHandlerEnabled(enable); setLocalTextSelectionChangeHandlersEnabled(enable); setLocalViewPortChangeHandlersEnabled(enable); }

Target:
private void setHandlersEnabled(boolean enable) { setLocalDocumentModificationHandlersEnabled(enable); setLocalEditorStatusChangeHandlersEnabled(enable); setLocalTextSelectionChangeHandlersEnabled(enable); setLocalViewPortChangeHandlersEnabled(enable); }
Source:
public MariaDbStatement(MariaDbConnection connection, int resultSetScrollType, int resultSetConcurrency) { this.protocol = connection.getProtocol(); this.connection = connection; this.canUseServerTimeout = connection.canUseServerTimeout(); this.resultSetScrollType = resultSetScrollType; this.resultSetConcurrency = resultSetConcurrency; this.lock = this.connection.lock; this.options = this.protocol.getOptions(); try { setFetchSize(this.options.defaultFetchSize); } catch(SQLException e) { logger.warn("defaultFetchSize is invalid, using default of 0"); } }

Target:
public MariaDbStatement(MariaDbConnection connection, int resultSetScrollType, int resultSetConcurrency) { this.protocol = connection.getProtocol(); this.connection = connection; this.canUseServerTimeout = connection.canUseServerTimeout(); this.resultSetScrollType = resultSetScrollType; this.resultSetConcurrency = resultSetConcurrency; this.lock = this.connection.lock; this.options = this.protocol.getOptions(); this.fetchSize = this.options.defaultFetchSize; }
Source:
private Response addSAN(StorageDomain model, StorageType storageType, storage_domain_static entity, Guid hostId) { boolean overrideLuns = model.getStorage().isOverrideLuns() != null ? model.getStorage().isOverrideLuns().booleanValue() : false; return performCreation(VdcActionType.AddSANStorageDomain, getSanAddParams(entity, hostId, getLunIds(model.getStorage(), storageType, hostId), overrideLuns), ID_RESOLVER); }

Target:
private Response addSAN(StorageDomain model, StorageType storageType, storage_domain_static entity, Guid hostId) { boolean overrideLuns = model.getStorage().isSetOverrideLuns() ? model.getStorage().isOverrideLuns() : false; return performCreation(VdcActionType.AddSANStorageDomain, getSanAddParams(entity, hostId, getLunIds(model.getStorage(), storageType, hostId), overrideLuns), ID_RESOLVER); }
Source:
public QueryTreeNode getChild(int index) { assert false; return null; }

Target:
public QueryTreeNode getChild(int index) { throw new UnsupportedOperationException("Not Implemented"); }
Source:
public static boolean checkIfNamesContainNameByProperties(Collection<ConceptName> names, ConceptName searched) { for(ConceptName name : names){ if(Objects.equals(name.getUuid(), searched.getUuid())) return true; else if(Objects.equals(name.getName(), searched.getName()) &&Objects.equals(name.getConceptNameType(), searched.getConceptNameType()) &&Objects.equals(name.getLocale(), searched.getLocale())){ return true; } } return false; }

Target:
public static boolean checkIfNamesContainNameByProperties(Collection<ConceptName> names, ConceptName searched) { for(ConceptName name : names){ if(Objects.equals(name.getUuid(), searched.getUuid())){ return true; } else if(Objects.equals(name.getName(), searched.getName()) &&Objects.equals(name.getConceptNameType(), searched.getConceptNameType()) &&Objects.equals(name.getLocale(), searched.getLocale())){ return true; } } return false; }
Source:
public FileMode getIndexFileMode(final DirCacheIterator indexIter) { final FileMode wtMode = getEntryFileMode(); if (indexIter == null) return wtMode; final FileMode iMode = indexIter.getEntryFileMode(); if (getOptions().isFileMode() && iMode != FileMode.GITLINK && iMode != FileMode.TREE) return wtMode; if (FileMode.REGULAR_FILE == wtMode && FileMode.EXECUTABLE_FILE == iMode) return iMode; if (FileMode.EXECUTABLE_FILE == wtMode && FileMode.REGULAR_FILE == iMode) return iMode; if (FileMode.GITLINK == iMode && FileMode.TREE == wtMode) return iMode; if (FileMode.TREE == iMode && FileMode.GITLINK == wtMode) return iMode; return wtMode; }

Target:
public FileMode getIndexFileMode(final DirCacheIterator indexIter) { final FileMode wtMode = getEntryFileMode(); if (indexIter == null) { return wtMode; } final FileMode iMode = indexIter.getEntryFileMode(); if (getOptions().isFileMode() && iMode != FileMode.GITLINK && iMode != FileMode.TREE) { return wtMode; } if (FileMode.REGULAR_FILE == wtMode && FileMode.EXECUTABLE_FILE == iMode) { return iMode; } if (FileMode.EXECUTABLE_FILE == wtMode && FileMode.REGULAR_FILE == iMode) { return iMode; } if (FileMode.GITLINK == iMode && FileMode.TREE == wtMode) { return iMode; } if (FileMode.TREE == iMode && FileMode.GITLINK == wtMode) { return iMode; } return wtMode; }
Source:
public void flush(final String value) { if (Objects.isNull(value) || value.isEmpty()) { ((ScenarioGrid) gridWidget).getEventBus().fireEvent( new ScenarioNotificationEvent( ScenarioSimulationEditorConstants.INSTANCE.headerTitleEmptyError(), NotificationEvent.NotificationType.ERROR)); return; } if (scenarioHeaderMetaData != null) { scenarioHeaderMetaData.setEditingMode(false); if (Objects.equals(value, scenarioHeaderMetaData.getTitle())) { return; } } internalFlush(value); }

Target:
public void flush(final String value) { if (Objects.isNull(value) || value.trim().isEmpty()) { ((ScenarioGrid) gridWidget).getEventBus().fireEvent( new ScenarioNotificationEvent( ScenarioSimulationEditorConstants.INSTANCE.headerTitleEmptyError(), NotificationEvent.NotificationType.ERROR)); return; } if (scenarioHeaderMetaData != null) { scenarioHeaderMetaData.setEditingMode(false); if (Objects.equals(value, scenarioHeaderMetaData.getTitle())) { return; } } internalFlush(value); }
Source:
public void loadNbt(CompoundTag tag) { super.loadNbt(tag); final Material[] item = {null}; if (!tag.readString("Item", itemString -> item[0] = ItemIds.getItem(itemString))) { tag.readInt("Item", itemInt -> item[0] = Material.getMaterial(itemInt)); } if (item[0] != null) { tag.readInt("Data", data -> this.contents = item[0].getNewData((byte) data)); } }

Target:
public void loadNbt(CompoundTag tag) { super.loadNbt(tag); tag.tryGetMaterial("Item").ifPresent( item -> this.contents = item.getNewData( (byte) (int) (tag.tryGetInt("Data").orElse(0)))); }
Source:
public void teardown() { try { csvMapReader.close(); } catch (IOException e) { logger.error("Error while closing csv map reader {}", e.getMessage()); } try { csvBeanReader.close(); } catch (IOException e) { logger.error("Error while closing csv bean reader {}", e.getMessage()); } }

Target:
public void teardown() { try { csvMapReader.close(); } catch (IOException e) { logger.error("Error while closing csv map reader {}", e.getMessage()); DTThrowable.wrapIfChecked(e); } try { csvBeanReader.close(); } catch (IOException e) { logger.error("Error while closing csv bean reader {}", e.getMessage()); DTThrowable.wrapIfChecked(e); } }
Source:
public Response commit(Action action) { action.setAsync(false); RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(parentId, guid); Response response = doAction(VdcActionType.RestoreAllSnapshots, restoreParams, action, PollingType.JOB); return response; }

Target:
public Response commit(Action action) { RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(parentId, guid); Response response = doAction(VdcActionType.RestoreAllSnapshots, restoreParams, action); return response; }
Source:
public void testCopyBlob() throws Exception { ByteSource byteSource = TestUtils.randomByteSource().slice(0, 1024); AzureBlob object = getApi().newBlob(); object.getProperties().setName("from"); object.setPayload(byteSource.read()); getApi().putBlob(privateContainer, object); URI copySource = view.getSigner().signGetBlob(privateContainer, "from").getEndpoint(); getApi().copyBlob(copySource, privateContainer, "to", Optional.<CopyBlobOptions>absent()); AzureBlob getBlob = getApi().getBlob(privateContainer, "to"); assertEquals(ByteStreams2.toByteArrayAndClose(getBlob.getPayload().openStream()), byteSource.read()); }

Target:
public void testCopyBlob() throws Exception { ByteSource byteSource = TestUtils.randomByteSource().slice(0, 1024); AzureBlob object = getApi().newBlob(); object.getProperties().setName("from"); object.setPayload(byteSource.read()); getApi().putBlob(privateContainer, object); URI copySource = view.getSigner().signGetBlob(privateContainer, "from").getEndpoint(); getApi().copyBlob(copySource, privateContainer, "to", CopyBlobOptions.NONE); AzureBlob getBlob = getApi().getBlob(privateContainer, "to"); assertEquals(ByteStreams2.toByteArrayAndClose(getBlob.getPayload().openStream()), byteSource.read()); assertThat(getBlob.getProperties().getMetadata().isEmpty()); }
Source:
public static RowMapper<UserWithRoleRecord> buildResultMapper() { return (rs, ctx) -> { final UserWithRoleRecord userData = UserWithRoleRecord.builder() .userId(rs.getInt(USER_ID_COLUMN) == 0 ? null : rs.getInt(USER_ID_COLUMN)) .role(rs.getString(ROLE_COLUMN)) .username(rs.getString(USERNAME_COLUMN)) .build(); Postconditions.assertState(userData.role != null); if (userData.role.equals(UserRole.HOST)) { Postconditions.assertState(userData.username == null); Postconditions.assertState(userData.userId == null); } else if (userData.role.equals(UserRole.ANONYMOUS)) { Postconditions.assertState(userData.userId == null); Postconditions.assertState(userData.username != null); } else { Postconditions.assertState(userData.userId != null); Postconditions.assertState(userData.username != null); } return userData; }; }

Target:
public static RowMapper<UserWithRoleRecord> buildResultMapper() { return (rs, ctx) -> { final var userWithRoleRecord = UserWithRoleRecord.builder() .userId(rs.getInt(USER_ID_COLUMN) == 0 ? null : rs.getInt(USER_ID_COLUMN)) .role(rs.getString(ROLE_COLUMN)) .username(rs.getString(USERNAME_COLUMN)) .build(); Postconditions.assertState(userWithRoleRecord.role != null); if (userWithRoleRecord.role.equals(UserRole.HOST)) { Postconditions.assertState(userWithRoleRecord.username == null); Postconditions.assertState(userWithRoleRecord.userId == null); } else if (userWithRoleRecord.role.equals(UserRole.ANONYMOUS)) { Postconditions.assertState(userWithRoleRecord.userId == null); Postconditions.assertState(userWithRoleRecord.username != null); } else { Postconditions.assertState(userWithRoleRecord.userId != null); Postconditions.assertState(userWithRoleRecord.username != null); } return userWithRoleRecord; }; }
Source:
public void testMoveProjectWithinGitRepoMoveFromLevelZeroDownOne() throws Exception { boolean buggy = Platform.getBundle("org.eclipse.core.runtime").getVersion() .compareTo(Version.parseVersion("3.7.0")) < 0; try { dotestMoveProjectWithinRepo("P/", "Project-1", "P/Project-1/", "P2", "P/Project-1/"); if (buggy) fail("ResoruceException expected"); } catch (ResourceException e) { if (!buggy) throw e; } }

Target:
public void testMoveProjectWithinGitRepoMoveFromLevelZeroDownOne() throws Exception { try { dotestMoveProjectWithinRepo("P/", "Project-1", "P/Project-1/", "P2", "P/Project-1/"); fail("ResourceException expected, core functionality dangerously broken and therefore forbidden"); } catch (ResourceException e) { } }
Source:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); boolean clearCompensation = true; try { endSuccessfully(); } catch (Exception e) { clearCompensation = false; } finally { if (getCommandCompensationPhase() == CommandCompensationPhase.END_COMMAND) { if (clearCompensation) { getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); } else { compensate(); } } } }

Target:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); endSuccessfully(); }
Source:
private void linkWebHook(final ReleaseWebHookResource resource) { if (resource == null) { throw new InvalidParameterException("event parameter is null"); } AbstractProject project = validateAndGetJenkinsProject(resource); String webHookNameToLink = resource.getWebHookName(); ReleaseWebHook webHook = validateAndGetReleaseWebHookByName(webHookNameToLink); ReleaseWebHookAction action = getReleaseWebHookActionFromProject(project); if (action != null && action.getWebHookNames() != null) { for (ReleaseWebHookName webHookName : action.getWebHookNames()) { if (webHookName.getWebHookName().equalsIgnoreCase(webHookNameToLink)) { logger.fine(String.format("WebHook %s already added in the project %s", webHookNameToLink, project.getName())); return; } } } ReleaseWebHookName webHookName = new ReleaseWebHookName(webHookNameToLink); if (action == null) { List<ReleaseWebHookName> webHookNames = new ArrayList<ReleaseWebHookName>(); webHookNames.add(webHookName); action = new ReleaseWebHookAction(webHookNames); DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList(); publishersList.add(action); } else { List<ReleaseWebHookName> webHookNames = action.getWebHookNames() != null ? action.getWebHookNames() : new ArrayList<ReleaseWebHookName>(); webHookNames.add(webHookName); action.setWebHookNames(webHookNames); } saveProject(project); }

Target:
private void linkWebHook(final ReleaseWebHookResource resource) { if (resource == null) { throw new InvalidParameterException("resource is null"); } AbstractProject project = validateAndGetJenkinsProject(resource); String webHookNameToLink = resource.getWebHookName(); ReleaseWebHook webHook = validateAndGetReleaseWebHookByName(webHookNameToLink); ReleaseWebHookAction action = getReleaseWebHookActionFromProject(project); if (action != null && action.getWebHookReferences() != null) { for (ReleaseWebHookReference webHookReference : action.getWebHookReferences()) { if (webHookReference.getWebHookName().equalsIgnoreCase(webHookNameToLink)) { logger.fine(String.format("WebHook %s already added in the project %s", webHookNameToLink, project.getName())); return; } } } ReleaseWebHookReference webHookReference = new ReleaseWebHookReference(webHookNameToLink); if (action == null) { List<ReleaseWebHookReference> webHookReferences = new ArrayList<ReleaseWebHookReference>(); webHookReferences.add(webHookReference); action = new ReleaseWebHookAction(webHookReferences); DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList(); publishersList.add(action); } else { List<ReleaseWebHookReference> webHookReferences = action.getWebHookReferences(); if (webHookReferences == null) { webHookReferences = new ArrayList<ReleaseWebHookReference>(); } webHookReferences.add(webHookReference); action.setWebHookReferences(webHookReferences); logger.fine(String.format("WebHook %s is linked to project %s", webHookReference, project)); } saveProject(project); }
Source:
public static WebSocketAction getWebSocketActionFromString(String webSocketAction) { for (WebSocketAction lWebSocketAction : WebSocketAction.values()) { if (lWebSocketAction.toString().equals(webSocketAction)) { return lWebSocketAction; } } return null; }

Target:
public static Optional<WebSocketAction> getWebSocketActionFromString(String webSocketAction) { for (WebSocketAction lWebSocketAction : WebSocketAction.values()) { if (lWebSocketAction.toString().equals(webSocketAction)) { return Optional.of(lWebSocketAction); } } return Optional.empty(); }
Source:
public void testAmazonAppStoreInstallSourceIsParsedCorrectly() { InstallSource installSource = InstallSource.fromInstallerPackageName("com.amazon.venezia"); assertTrue(installSource instanceof AmazonAppStoreInstallSource); assertEquals("Amazon Appstore", installSource.toString()); }

Target:
public void testAmazonAppStoreInstallSourceIsParsedCorrectly() { InstallSource installSource = InstallSource.fromInstallerPackageName("com.amazon.venezia"); assertTrue( "Package name is correctly identified as belonging to the Amazon Appstore", installSource instanceof AmazonAppStoreInstallSource); assertEquals( "Amazon Appstore install source has correct description", "Amazon Appstore", installSource.toString()); }
Source:
public void verifyPagination(){ String firstLinkOnFirstPage = listOfLinks.get(0).getAttribute("href"); String lastLinkOnFirstPage = listOfLinks.get(listOfLinks.size()-1).getAttribute("href"); waitForElementByElement(nextResultsButton); nextResultsButton.click(); String firstLinkOnSecondPage = listOfLinks.get(0).getAttribute("href"); String lastLinkOnSecondPage = listOfLinks.get(listOfLinks.size()-1).getAttribute("href"); Assertion.assertNotEquals(firstLinkOnFirstPage, firstLinkOnSecondPage); Assertion.assertNotEquals(lastLinkOnFirstPage, lastLinkOnSecondPage); waitForElementByElement(previousResultsButton); previousResultsButton.click(); String firstLinkAfterBack = listOfLinks.get(0).getAttribute("href"); String lastLinkAfterBack = listOfLinks.get(listOfLinks.size()-1).getAttribute("href"); Assertion.assertEquals(firstLinkOnFirstPage, firstLinkAfterBack); Assertion.assertEquals(lastLinkOnFirstPage, lastLinkAfterBack); }

Target:
public void verifyPagination(){ String firstLinkOnFirstPage = listOfLinks.get(0).getAttribute("href"); String lastLinkOnFirstPage = listOfLinks.get(listOfLinks.size()-1).getAttribute("href"); nextResultsButton.click(); String firstLinkOnSecondPage = listOfLinks.get(0).getAttribute("href"); String lastLinkOnSecondPage = listOfLinks.get(listOfLinks.size()-1).getAttribute("href"); Assertion.assertNotEquals(firstLinkOnFirstPage, firstLinkOnSecondPage); Assertion.assertNotEquals(lastLinkOnFirstPage, lastLinkOnSecondPage); previousResultsButton.click(); String firstLinkAfterBack = listOfLinks.get(0).getAttribute("href"); String lastLinkAfterBack = listOfLinks.get(listOfLinks.size()-1).getAttribute("href"); Assertion.assertEquals(firstLinkOnFirstPage, firstLinkAfterBack); Assertion.assertEquals(lastLinkOnFirstPage, lastLinkAfterBack); }
Source:
public Gateway3DSAuthorisationResponse authorise3dsResponse(Auth3dsResponseGatewayRequest request) { Either<GatewayError, GatewayClient.Response> response = authoriseClient.postRequestFor(null, request.getGatewayAccount(), build3dsResponseAuthOrder(request)); GatewayResponse<BaseAuthoriseResponse> gatewayResponse = GatewayResponseGenerator.getWorldpayGatewayResponse(authoriseClient, response, WorldpayOrderStatusResponse.class); if (gatewayResponse.getBaseResponse().isPresent()) { return new Gateway3DSAuthorisationResponse(gatewayResponse.getBaseResponse().get().authoriseStatus(), gatewayResponse.getBaseResponse().get().getTransactionId()); } return new Gateway3DSAuthorisationResponse(BaseAuthoriseResponse.AuthoriseStatus.EXCEPTION, null); }

Target:
public Gateway3DSAuthorisationResponse authorise3dsResponse(Auth3dsResponseGatewayRequest request) { Either<GatewayError, GatewayClient.Response> response = authoriseClient.postRequestFor(null, request.getGatewayAccount(), build3dsResponseAuthOrder(request)); GatewayResponse<BaseAuthoriseResponse> gatewayResponse = GatewayResponseGenerator.getWorldpayGatewayResponse(authoriseClient, response, WorldpayOrderStatusResponse.class); return gatewayResponse.getBaseResponse().map( baseResponse -> Gateway3DSAuthorisationResponse.of(baseResponse.authoriseStatus(), baseResponse.getTransactionId())) .orElseGet(Gateway3DSAuthorisationResponse::ofException); }
Source:
public KalturaLiveChannel get(String liveChannelId, int partnerId) throws KalturaApiException{ KalturaClient impersonateClient = impersonate(partnerId); KalturaLiveChannel liveEntry = impersonateClient.getLiveChannelService().get(liveChannelId); synchronized (entries) { LiveEntryCache c = entries.get(liveEntry.id); if (c == null) { entries.put(liveEntry.id, new LiveEntryCache(liveEntry)); } else { c.setLiveEntry(liveEntry); } addReferrer(liveEntry.id, this); } return liveEntry; }

Target:
public KalturaLiveChannel get(String liveChannelId, int partnerId) throws KalturaApiException{ KalturaClient impersonateClient = impersonate(partnerId); KalturaLiveChannel liveEntry = impersonateClient.getLiveChannelService().get(liveChannelId); synchronized (entries) { updateEntryCache(liveEntry); addReferrer(liveEntry.id, this); } return liveEntry; }
Source:
public boolean isInstalled(@NotNull IDevice device, @NotNull File apk, @NotNull String pkgName) throws IOException { String serial = device.getSerialNumber(); Map<String, InstallState> cache = myCache.get(serial); if (cache == null) { return false; } InstallState state = cache.get(pkgName); if (state == null) { return false; } String lastUpdateTime = getLastUpdateTime(device, pkgName, 500, TimeUnit.MILLISECONDS); return lastUpdateTime != null && lastUpdateTime.equals(state.lastUpdateTime) && state.hash.equals(hash(apk)); }

Target:
public boolean isInstalled(@NotNull IDevice device, @NotNull File apk, @NotNull String pkgName) throws IOException { String serial = device.getSerialNumber(); Map<String, InstallState> cache = myCache.get(serial); if (cache == null) { return false; } InstallState state = cache.get(pkgName); if (state == null) { return false; } String lastUpdateTime = getLastUpdateTime(device, pkgName); return lastUpdateTime != null && lastUpdateTime.equals(state.lastUpdateTime) && state.hash.equals(hash(apk)); }
Source:
public StreamCodec<T> getStreamCodec() { if (inputPort != null) { return inputPort.getStreamCodec(); } else { return null; } }

Target:
public StreamCodec<T> getStreamCodec() { return inputPort == null ? null : inputPort.getStreamCodec(); }
Source:
public Account getAccount(@NonNull String username) throws RetroHttpException { final Account account = userService.getAccount(username); EventBus.getDefault().post(new AccountDataLoadedEvent(account)); PrefManager prefManager = new PrefManager(MainApplication.instance(), PrefManager.Pref.LOGIN); if (prefManager.getCurrentUserProfile() != null) { if (username.equals(prefManager.getCurrentUserProfile().username)) { prefManager.put(PrefManager.Key.PROFILE_IMAGE, gson.toJson(account.getProfileImage())); } } return account; }

Target:
public Account getAccount(@NonNull String username) throws HttpException { final Account account = userService.getAccount(username); EventBus.getDefault().post(new AccountDataLoadedEvent(account)); loginPrefs.setProfileImage(username, account.getProfileImage()); return account; }
Source:
public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters); command.persistCommand(command.getParameters().getParentCommand(), true); return executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command); } }); }

Target:
public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters); command.persistCommand(command.getParameters().getParentCommand(), true); try { return executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command); } }); } catch (RejectedExecutionException ex) { command.setCommandStatus(CommandStatus.REJECTED); cmdCallBackMap.put(command.getCommandId(), command.getCallBack() == null ? new CommandCallBack() : command.getCallBack()); return null; } }
Source:
public void show(Activity activity) { super.show(activity); boolean success = false; try { String url = interaction.getUrl(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); switch (interaction.getTarget()) { case New: intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); break; case Self: break; default: break; } activity.startActivity(intent); success = true; } catch (ActivityNotFoundException e) { Log.w("NavigateToLink Error: ", e); } finally { String data = String.format("{\"url\":\"%s\",\"target\":\"%s\",\"success\":%b}", interaction.getUrl(), interaction.getTarget().lowercaseName(), success); EngagementModule.engageInternal(activity, interaction, NavigateToLinkInteraction.EVENT_NAME_NAVIGATE, data); activity.finish(); } }

Target:
public void show(Activity activity) { super.show(activity); boolean success = false; try { String url = interaction.getUrl(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); switch (interaction.getTarget()) { case New: intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); break; case Self: break; default: break; } activity.startActivity(intent); success = true; } catch (ActivityNotFoundException e) { Log.w("NavigateToLink Error: ", e); } finally { JSONObject data = new JSONObject(); try { data.put(NavigateToLinkInteraction.KEY_URL, interaction.getUrl()); data.put(NavigateToLinkInteraction.KEY_TARGET, interaction.getTarget().lowercaseName()); data.put(NavigateToLinkInteraction.EVENT_KEY_SUCCESS, success); } catch (JSONException e) { Log.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, NavigateToLinkInteraction.EVENT_NAME_NAVIGATE, data.toString()); activity.finish(); } }
Source:
public void read( ByteBuffer headerData ) { state = headerData.get(); if ( state == BYTE_FAILED ) { short messageLength = headerData.getShort(); byte[] failureMessageBytes = new byte[messageLength]; headerData.get( failureMessageBytes ); failureMessage = new String( failureMessageBytes, Charset.forName( "UTF-8" ) ); } }

Target:
public void read( ByteBuffer headerData ) { state = headerData.get(); if ( state == BYTE_FAILED ) { short messageLength = headerData.getShort(); byte[] failureMessageBytes = new byte[messageLength]; headerData.get( failureMessageBytes ); failureMessage = new String( failureMessageBytes, StandardCharsets.UTF_8 ); } }
Source:
public static PcapFile getPcapFile(Path filePath) throws IOException, BadPcapFileException { if (Files.notExists(filePath) || !Files.isRegularFile(filePath) || Files.size(filePath) < PcapFileValues.GLOBAL_HEADER_SIZE) { throw new BadPcapFileException("Bad Pcap File."); } if (!Files.isReadable(filePath)) { throw new BadPcapFileException("File is not readable."); } try { FileChannel fileChannel = (FileChannel) checkNotNull(Files.newByteChannel(filePath)); ByteBuffer header = ByteBuffer.allocate(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); fileChannel.read(header); header.flip(); int blockType = header.getInt(); if (blockType == PcapFileValues.PCAPNG_SHB) { return new PcapNgFile(filePath); } return new PcapOldFile(filePath); } catch (IOException e) { e.printStackTrace(); return new PcapOldFile(filePath); } }

Target:
public static PcapFile getPcapFile(Path filePath) throws IOException, BadPcapFileException { if (Files.notExists(filePath) || !Files.isRegularFile(filePath) || Files.size(filePath) < PcapFileValues.GLOBAL_HEADER_SIZE) { throw new BadPcapFileException("Bad Pcap File."); } if (!Files.isReadable(filePath)) { throw new BadPcapFileException("File is not readable."); } try (FileChannel fileChannel = (FileChannel) checkNotNull(Files.newByteChannel(filePath))) { ByteBuffer header = ByteBuffer.allocate(PcapNgFileValues.BLOCK_HEADER_SIZE); fileChannel.read(header); header.flip(); int blockType = header.getInt(); if (blockType == PcapNgFileValues.SHB) { return new PcapNgFile(filePath); } return new PcapOldFile(filePath); } }
Source:
protected void commitPendingUploads( final JobContext context, final ActiveCommit pending) throws IOException { if (pending.isEmpty()) { LOG.warn("{}: No pending uploads to commit", getRole()); } try (DurationInfo ignored = new DurationInfo(LOG, "committing the output of %s task(s)", pending.size()); CommitOperations.CommitContext commitContext = initiateCommitOperation()) { Tasks.foreach(pending.getSourceFiles()) .stopOnFailure() .executeWith(buildThreadPool(context)) .onFailure((path, exception) -> loadAndAbort(commitContext, pending, path, true, false)) .abortWith(path -> loadAndAbort(commitContext, pending, path, true, false)) .revertWith(path -> loadAndRevert(commitContext, pending, path)) .run(path -> loadAndCommit(commitContext, pending, path)); } }

Target:
protected void commitPendingUploads( final JobContext context, final ActiveCommit pending) throws IOException { if (pending.isEmpty()) { LOG.warn("{}: No pending uploads to commit", getRole()); } try (DurationInfo ignored = new DurationInfo(LOG, "committing the output of %s task(s)", pending.size()); CommitOperations.CommitContext commitContext = initiateCommitOperation()) { Tasks.foreach(pending.getSourceFiles()) .stopOnFailure() .suppressExceptions(false) .executeWith(buildThreadPool(context)) .abortWith(path -> loadAndAbort(commitContext, pending, path, true, false)) .revertWith(path -> loadAndRevert(commitContext, pending, path)) .run(path -> loadAndCommit(commitContext, pending, path)); } }
Source:
protected void doStartMachine(KubernetesServerResolver serverResolver) throws InfrastructureException { machineStartupTraces = new ConcurrentHashMap<>(getContext().getEnvironment().getMachines().size()); final KubernetesEnvironment environment = getContext().getEnvironment(); final Map<String, InternalMachineConfig> machineConfigs = environment.getMachines(); final String workspaceId = getContext().getIdentity().getWorkspaceId(); LOG.debug("Begin pods creation for workspace '{}'", workspaceId); for (Pod toCreate : environment.getPodsCopy().values()) { startTracingContainersStartup(toCreate.getSpec(), toCreate.getMetadata()); ObjectMeta toCreateMeta = toCreate.getMetadata(); final Pod createdPod = namespace.deployments().deploy(toCreate); LOG.debug("Creating pod '{}' in workspace '{}'", toCreateMeta.getName(), workspaceId); storeStartingMachine(createdPod, toCreateMeta, machineConfigs, serverResolver); } for (Deployment toCreate : environment.getDeploymentsCopy().values()) { PodTemplateSpec template = toCreate.getSpec().getTemplate(); startTracingContainersStartup(template.getSpec(), template.getMetadata()); ObjectMeta toCreateMeta = toCreate.getMetadata(); final Pod createdPod = namespace.deployments().deploy(toCreate); LOG.debug("Creating deployment '{}' in workspace '{}'", toCreateMeta.getName(), workspaceId); final ObjectMeta templateMeta = toCreate.getSpec().getTemplate().getMetadata(); storeStartingMachine(createdPod, templateMeta, machineConfigs, serverResolver); } LOG.debug("Pods creation finished in workspace '{}'", workspaceId); }

Target:
protected void doStartMachine(KubernetesServerResolver serverResolver) throws InfrastructureException { machineStartupTraces = new ConcurrentHashMap<>(getContext().getEnvironment().getMachines().size()); final KubernetesEnvironment environment = getContext().getEnvironment(); final Map<String, InternalMachineConfig> machineConfigs = environment.getMachines(); final String workspaceId = getContext().getIdentity().getWorkspaceId(); LOG.info("Begin pods creation for workspace '{}'", workspaceId); for (Pod toCreate : environment.getPodsCopy().values()) { startTracingContainersStartup(toCreate.getMetadata(), toCreate.getSpec()); ObjectMeta toCreateMeta = toCreate.getMetadata(); final Pod createdPod = namespace.deployments().deploy(toCreate); LOG.debug("Creating pod '{}' in workspace '{}'", toCreateMeta.getName(), workspaceId); storeStartingMachine(createdPod, toCreateMeta, machineConfigs, serverResolver); } for (Deployment toCreate : environment.getDeploymentsCopy().values()) { PodTemplateSpec template = toCreate.getSpec().getTemplate(); startTracingContainersStartup(template.getMetadata(), template.getSpec()); ObjectMeta toCreateMeta = toCreate.getMetadata(); final Pod createdPod = namespace.deployments().deploy(toCreate); LOG.debug("Creating deployment '{}' in workspace '{}'", toCreateMeta.getName(), workspaceId); final ObjectMeta templateMeta = toCreate.getSpec().getTemplate().getMetadata(); storeStartingMachine(createdPod, templateMeta, machineConfigs, serverResolver); } LOG.info("Pods creation finished in workspace '{}'", workspaceId); }
Source:
private static File getCanonicalFile(final File file) { try { return file.getCanonicalFile(); } catch (final IOException e) { return file.getAbsoluteFile(); } }

Target:
public static File getCanonicalFile(final File file) { try { return file.getCanonicalFile(); } catch (final IOException e) { return file.getAbsoluteFile(); } }
Source:
public static void customizeHeader(JTableHeader header) { header.setOpaque(false); header.setBackground(UIManager.getColor("ToolBar.background")); header.setBorder(UIManager.getBorder("MenuBar.border")); }

Target:
public static void customizeHeader(JTableHeader header) { header.setOpaque(false); header.setBackground(getColor("ToolBar.background")); header.setBorder(getBorder("MenuBar.border")); }
Source:
public AdHocPlannedStmtBatch( AdHocPlannerWork work, List<AdHocPlannedStatement> stmts, int partitionParamIndex, VoltType partitionParamType, Object partitionParamValue, String errors) { this.work = work; this.clientHandle = work.clientHandle; this.connectionId = work.connectionId; this.hostname = (work.clientData == null) ? "" : ((Connection)work.clientData).getHostnameAndIPAndPort(); this.adminConnection = work.adminConnection; this.clientData = work.clientData; this.plannedStatements = stmts; boolean allReadOnly = true; for (AdHocPlannedStatement plannedStmt : stmts) { if (!plannedStmt.core.readOnly) { allReadOnly = false; break; } } this.readOnly = allReadOnly; boolean highVolume = false; for (AdHocPlannedStatement plannedStmt : stmts) { if (plannedStmt.core.highVolume) { highVolume = true; break; } } this.highVolume = highVolume; this.partitionParamIndex = partitionParamIndex; this.partitionParamType = partitionParamType; this.partitionParamValue = partitionParamValue; this.errorMsg = errors; }

Target:
public AdHocPlannedStmtBatch( AdHocPlannerWork work, List<AdHocPlannedStatement> stmts, int partitionParamIndex, VoltType partitionParamType, Object partitionParamValue, String errors) { this.work = work; this.clientHandle = work.clientHandle; this.connectionId = work.connectionId; this.hostname = (work.clientData == null) ? "" : ((Connection)work.clientData).getHostnameAndIPAndPort(); this.adminConnection = work.adminConnection; this.clientData = work.clientData; this.plannedStatements = stmts; boolean allReadOnly = true; for (AdHocPlannedStatement plannedStmt : stmts) { if (!plannedStmt.core.readOnly) { allReadOnly = false; break; } } this.readOnly = allReadOnly; boolean anyHighVolume = false; for (AdHocPlannedStatement plannedStmt : stmts) { if (plannedStmt.core.highVolume) { anyHighVolume = true; break; } } this.highVolume = anyHighVolume; this.partitionParamIndex = partitionParamIndex; this.partitionParamType = partitionParamType; this.partitionParamValue = partitionParamValue; this.errorMsg = errors; }
Source:
public List<JsonObject> findDocuments(String query, String sort, Integer offset, Integer size) throws DataException { SearchRestClient restClient = initiateRestClient(); List<JsonObject> searchResults = new ArrayList<>(); String response = restClient.getDocument(query, sort, offset, size); JsonReader jsonReader = Json.createReader(new StringReader(response)); JsonObject jsonObject = jsonReader.readObject(); if (jsonObject.containsKey("hits")) { JsonObject hits = jsonObject.getJsonObject("hits"); JsonArray inHits = hits.getJsonArray("hits"); if (!inHits.isEmpty()) { for (Object hit : inHits) { searchResults.add((JsonObject) hit); } } } else { searchResults.add(jsonObject); } return searchResults; }

Target:
public List<JsonObject> findDocuments(String query, String sort, Integer offset, Integer size) throws DataException { SearchRestClient restClient = initiateRestClient(); List<JsonObject> searchResults = new ArrayList<>(); String response = restClient.getDocument(query, sort, offset, size); try (JsonReader jsonReader = Json.createReader(new StringReader(response))) { JsonObject jsonObject = jsonReader.readObject(); if (jsonObject.containsKey("hits")) { JsonObject hits = jsonObject.getJsonObject("hits"); JsonArray inHits = hits.getJsonArray("hits"); if (!inHits.isEmpty()) { for (Object hit : inHits) { searchResults.add((JsonObject) hit); } } } else { searchResults.add(jsonObject); } } return searchResults; }
Source:
protected Map<Address, Float> unionCapacityFactors(AbstractConsistentHash ch2) { Map<Address, Float> unionCapacityFactors = null; if (this.capacityFactors != null || ch2.capacityFactors != null) { unionCapacityFactors = new HashMap<Address, Float>(); if (this.capacityFactors != null) { unionCapacityFactors.putAll(this.getCapacityFactors()); } else { for (Address node : this.members) { unionCapacityFactors.put(node, 1.0f); } } if (ch2.capacityFactors != null) { unionCapacityFactors.putAll(ch2.getCapacityFactors()); } else { for (Address node : ch2.members) { unionCapacityFactors.put(node, 1.0f); } } } return unionCapacityFactors; }

Target:
protected Map<Address, Float> unionCapacityFactors(AbstractConsistentHash ch2) { Map<Address, Float> unionCapacityFactors = null; if (this.capacityFactors != null || ch2.capacityFactors != null) { unionCapacityFactors = new HashMap<>(); if (this.capacityFactors != null) { unionCapacityFactors.putAll(this.getCapacityFactors()); } else { for (Address node : this.members) { unionCapacityFactors.put(node, 1.0f); } } if (ch2.capacityFactors != null) { unionCapacityFactors.putAll(ch2.getCapacityFactors()); } else { for (Address node : ch2.members) { unionCapacityFactors.put(node, 1.0f); } } } return unionCapacityFactors; }
Source:
private void setListCommentsPerPatchSet(GerritRepository gerritRepository, String changeId, String revisionId) { Iterator<DisplayFileInfo> displayFile = fFilesDisplay.values().iterator(); Map<String, ArrayList<CommentInfo>> mapCommentInfo = queryComments(gerritRepository, changeId, revisionId, new NullProgressMonitor()); while (displayFile.hasNext()) { DisplayFileInfo displayFileInfo = displayFile.next(); Iterator<Map.Entry<String, ArrayList<CommentInfo>>> commentIter = mapCommentInfo.entrySet().iterator(); while (commentIter.hasNext()) { Entry<String, ArrayList<CommentInfo>> entryComment = commentIter.next(); System.out.println("Comments files: " + entryComment.getKey()); System.out.println("Count comment: " + entryComment.getValue().size()); if (displayFileInfo.getold_path().equals(entryComment.getKey())) { displayFileInfo.setComments(entryComment.getValue()); break; } } } System.err.println("setListCommentsPerPatchSet return"); }

Target:
private void setListCommentsPerPatchSet(GerritRepository gerritRepository, String changeId, String revisionId) { Iterator<DisplayFileInfo> displayFile = fFilesDisplay.values().iterator(); Map<String, ArrayList<CommentInfo>> mapCommentInfo = queryComments(gerritRepository, changeId, revisionId, new NullProgressMonitor()); while (displayFile.hasNext()) { DisplayFileInfo displayFileInfo = displayFile.next(); Iterator<Map.Entry<String, ArrayList<CommentInfo>>> commentIter = mapCommentInfo.entrySet().iterator(); while (commentIter.hasNext()) { Entry<String, ArrayList<CommentInfo>> entryComment = commentIter.next(); if (displayFileInfo.getold_path().equals(entryComment.getKey())) { displayFileInfo.setComments(entryComment.getValue()); break; } } } }
Source:
public static InventoryCrafting toNativeInventory(GridInventory inv) { Fabric<IInventory> fabric = ((GridInventoryAdapter) inv).getInventory(); Iterator<IInventory> inventories = fabric.allInventories().iterator(); InventoryCrafting inventoryCrafting = (InventoryCrafting) inventories.next(); if(inventories.hasNext()) throw new IllegalStateException("Another inventory found: " + inventories.next()); return inventoryCrafting; }

Target:
public static InventoryCrafting toNativeInventory(GridInventory inv) { Fabric<IInventory> fabric = ((GridInventoryAdapter) inv).getInventory(); Iterator<IInventory> inventories = fabric.allInventories().iterator(); InventoryCrafting inventoryCrafting = (InventoryCrafting) inventories.next(); if (inventories.hasNext()) { throw new IllegalStateException("Another inventory found: " + inventories.next()); } return inventoryCrafting; }
Source:
public void testTimeouts() { List list = new ArrayList<>(); for (int i = 0; i < 15; i++) { list.add(i); } queue.take(10, 10); queue.offer(list, 10); }

Target:
public void testTimeouts() throws InterruptedException { List list = new ArrayList(); IntStream.range(0, 15).forEach(t -> list.add(t)); queue.offer(list, 10); queue.offer(list, 10); }
Source:
public String space(ParsedCommand cmd) { UserContext uc = cliContext.userContext; Long spaceUsed = uc.getTotalSpaceUsed(uc.signer.publicKeyHash, uc.signer.publicKeyHash).join(); return "Total space used "+ spaceUsed; }

Target:
public String space(ParsedCommand cmd) { UserContext uc = cliContext.userContext; long spaceUsed = uc.getSpaceUsage().join(); long spaceMB = spaceUsed / 1024 / 1024; return "Total space used: " + spaceMB + " MiB."; }
Source:
public void testSalesforceInputPropertiesMigration() throws IOException { Deserialized<TSalesforceInputProperties> deser = Properties.Helper.fromSerializedPersistent( TestUtils.getResourceAsString(getClass(), "tSalesforceInputProperties_621.json"), TSalesforceInputProperties.class); assertTrue("should be true, but not", deser.migrated); TSalesforceInputProperties properties = deser.object; String apiVersion = properties.connection.apiVersion.getValue(); assertEquals("\"34.0\"", apiVersion); }

Target:
public void testSalesforceInputPropertiesMigration() throws IOException { Deserialized<TSalesforceInputProperties> deser = Properties.Helper.fromSerializedPersistent( TestUtils.getResourceAsString(getClass(), "tSalesforceInputProperties_621.json"), TSalesforceInputProperties.class); assertTrue("the property should be migrated, the migration returned false instead of true", deser.migrated); TSalesforceInputProperties properties = deser.object; String apiVersion = properties.connection.apiVersion.getValue(); assertEquals("\"34.0\"", apiVersion); }
Source:
protected boolean isLinkUrlValidForGroupCode(AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink, Collection<WebServiceCredential> credentials) { if (CollectionUtils.isEmpty(credentials)) { LOG.debug("isLinkUrlValidForGroupCode, no credential values for group code, so is invalid"); return false; } else { for (WebServiceCredential cred : credentials) { if (isCredentialUsedForValidatingBackupLinkURL(cred) && isCredentialBaseURLInBackupLinkURL(accountingXmlDocumentBackupLink, cred)) { LOG.debug("isLinkUrlValidForGroupCode, found a CREDENTIAL_BASE_URL in the credentials table that is in the back up link URL"); return true; } } } return false; }

Target:
protected boolean isLinkUrlValidForGroupCode(AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink, Collection<WebServiceCredential> credentials) { if (CollectionUtils.isEmpty(credentials)) { LOG.error("isLinkUrlValidForGroupCode, no credential values for group code, so link is invalid"); return false; } else { for (WebServiceCredential cred : credentials) { if (isCredentialUsedForValidatingBackupLinkURL(cred) && isCredentialBaseURLInBackupLinkURL(accountingXmlDocumentBackupLink, cred)) { LOG.debug("isLinkUrlValidForGroupCode, found a CREDENTIAL_BASE_URL in the credentials table that is in the back up link URL"); return true; } } } return false; }
Source:
public String convertToDatabaseColumn(LocalDate attribute) { String retVal = (attribute == null) ? null : Base64.getEncoder().encodeToString(SecretKeyUtil.encryptDate(attribute)); if (retVal == null) { throw new IllegalStateException("YD-441: lastStatusChangeTime cannot be null. Input value: " + attribute); } return retVal; }

Target:
public String convertToDatabaseColumn(LocalDate attribute) { return (attribute == null) ? null : Base64.getEncoder().encodeToString(SecretKeyUtil.encryptDate(attribute)); }
Source:
private static String getServerInstanceURI(int port) throws Exception { return ServerUtils.getHostAddress(null).getHostAddress() + ":" + port; }

Target:
private static String getServerInstanceURI(int port) throws Exception { String hostName; if (msHost != null && !msHost.trim().isEmpty()) { hostName = msHost; } else { hostName = InetAddress.getLocalHost().getHostName(); } return hostName + ":" + port; }
Source:
private char complement(char nt) { switch (nt) { case 'A': return 'T'; case 'C': return 'G'; case 'G': return 'C'; case 'T': case 'U': return 'C'; case 'R': return 'Y'; case 'Y': return 'R'; case 'S': return 'S'; case 'W': return 'W'; case 'K': return 'M'; case 'M': return 'K'; case 'B': return 'V'; case 'D': return 'H'; case 'H':// ACT return 'D'; case 'V':// ACG return 'B'; case 'N': return 'N'; default: return nt; } }

Target:
private char complement(char nt) { switch (nt) { case 'A': return 'T'; case 'C': return 'G'; case 'G': return 'C'; case 'T': case 'U': return 'A'; case 'R': return 'Y'; case 'Y': return 'R'; case 'S': return 'S'; case 'W': return 'W'; case 'K': return 'M'; case 'M': return 'K'; case 'B': return 'V'; case 'D': return 'H'; case 'H':// ACT return 'D'; case 'V':// ACG return 'B'; case 'N': return 'N'; default: return nt; } }
Source:
public Date getLastPollTime() { return lastPollTime; }

Target:
public long getLastPollTime() { return lastPollTime; }
Source:
public boolean tryFastMoveTo(VirtualFile newParent) { try { if (moveHandler == null) { return false; } return moveHandler.apply(this, newParent); } catch (Exception e) { throw handleErrorInCallback(e, "moveHandler"); } }

Target:
public boolean tryFastMoveTo(VirtualFile newParent) { try { if (!canFastMove()) { return false; } return moveHandler.apply(this, newParent); } catch (Exception e) { throw handleErrorInCallback(e, "moveHandler"); } }
Source:
public boolean addDependencies(Set<DependencyType> dependencyTypes, Path pomPath) { List<DynamicPomDependency> deps = new ArrayList<>(); for (DependencyType dep : dependencyTypes) { deps.addAll(mapper.getDependencies(EnumSet.of(dep))); } if (deps.isEmpty()) { return false; } boolean result = false; try { org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI()); Model model = getPOMModel(filePath); List<Dependency> depsFromPom = model.getDependencies(); Map<String, String> keys = getKeysFromDependencies(model.getDependencies()); for (DynamicPomDependency dep : deps) { boolean internalArtifact = isInternalArtifact(dep); if (!keys.containsKey(getKeyFromDynamicDependency(dep))) { Dependency pomDep = getMavenPomDep(dep, internalArtifact, getKieVersionFromPom(dep, depsFromPom)); model.getDependencies().add(pomDep); result = true; } else { for (Dependency modelDep : depsFromPom) { if (modelDep.getGroupId().equals(dep.getGroupID()) && modelDep.getArtifactId().equals(dep.getArtifactID()) && !modelDep.getVersion().equals(dep.getVersion())) { if (internalArtifact) { modelDep.setVersion(getKieVersionFromPom(dep, depsFromPom)); } else { modelDep.setVersion(dep.getVersion()); } result = true; } } } } if (result) { writePOMModelOnFS(filePath, model); } } catch (Exception ex) { logger.error(ex.getMessage(), ex); result = false; } return result; }

Target:
public boolean addDependencies(Set<DependencyType> dependencyTypes, Path pomPath) { if (dependencyTypes.isEmpty()) { return false; } List<DynamicPomDependency> deps = configurationMap.getDependencies(dependencyTypes); boolean result = false; try { org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI()); Model model = getPOMModel(filePath); List<Dependency> depsFromPom = model.getDependencies(); Map<String, String> keys = getKeysFromDependencies(model.getDependencies()); for (DynamicPomDependency dep : deps) { boolean internalArtifact = isInternalArtifact(dep); if (!keys.containsKey(getKeyFromDynamicDependency(dep))) { Dependency pomDep = getMavenPomDep(dep, internalArtifact, getKieVersionFromPom(dep, depsFromPom)); model.getDependencies().add(pomDep); result = true; } else { for (Dependency modelDep : depsFromPom) { if (modelDep.getGroupId().equals(dep.getGroupID()) && modelDep.getArtifactId().equals(dep.getArtifactID()) && !modelDep.getVersion().equals(dep.getVersion())) { if (internalArtifact) { modelDep.setVersion(getKieVersionFromPom(dep, depsFromPom)); } else { modelDep.setVersion(dep.getVersion()); } result = true; } } } } if (result) { writePOMModelOnFS(filePath, model); } } catch (Exception ex) { logger.error(ex.getMessage(), ex); result = false; } return result; }