auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected int doWork() { IOUtil.assertFileIsReadable(INPUT); MetricsFile<CrosscheckMetric, ?> metricsFile = getMetricsFile(); try { metricsFile.read(new FileReader(INPUT)); } catch (FileNotFoundException e) { e.printStackTrace(); return 1; } clusterMetrics(metricsFile.getMetrics()).write(OUTPUT); return 0; }

Target:
protected int doWork() { IOUtil.assertFileIsReadable(INPUT); if(OUTPUT != null) IOUtil.assertFileIsWritable(OUTPUT); final MetricsFile<CrosscheckMetric, ?> metricsFile = getMetricsFile(); try { metricsFile.read(new FileReader(INPUT)); } catch (FileNotFoundException e) { e.printStackTrace(); return 1; } clusterMetrics(metricsFile.getMetrics()).write(OUTPUT); return 0; }
Source:
public void testIssue799() throws Exception { Swagger swagger = converter.read("src/test/resources/specs/v1_2/issue799.json"); Assert.assertEquals( swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/bindings").getPost().getResponses().get("200").getResponseSchema().getReference(), "#/definitions/v1beta3.Binding"); Json.prettyPrint(swagger); }

Target:
public void testIssue799() throws Exception { Swagger swagger = converter.read("src/test/resources/specs/v1_2/issue799.json"); Assert.assertEquals( swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/bindings").getPost().getResponses().get("200").getResponseSchema().getReference(), "#/definitions/v1beta3.Binding"); Parameter bodyParameter = swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/bindings").getPost().getParameters().get(1); Assert.assertEquals( bodyParameter.getName(), "body"); Assert.assertTrue( bodyParameter instanceof BodyParameter); Assert.assertEquals( ((BodyParameter)bodyParameter).getSchema().getReference(), "#/definitions/v1beta3.Binding"); Assert.assertEquals( swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/componentstatuses/{name}").getGet().getResponses().get("200").getResponseSchema().getReference(), "#/definitions/v1beta3.ComponentStatus"); Assert.assertEquals( swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/componentstatuses").getGet().getResponses().get("200").getResponseSchema().getReference(), "#/definitions/v1beta3.ComponentStatusList"); Property conditionsProperty = swagger.getDefinitions().get("v1beta3.ComponentStatus").getProperties().get("conditions"); Assert.assertTrue( conditionsProperty instanceof ArrayProperty); Property items = ((ArrayProperty)conditionsProperty).getItems(); Assert.assertTrue( items instanceof RefProperty); Assert.assertEquals( ((RefProperty)items).get$ref(), "#/definitions/v1beta3.ObjectReference"); Property metadataProperty = swagger.getDefinitions().get("v1beta3.ComponentStatus").getProperties().get("metadata"); Assert.assertTrue( metadataProperty instanceof RefProperty); Assert.assertEquals( ((RefProperty)metadataProperty).get$ref(), "#/definitions/v1beta3.ObjectMeta"); }
Source:
private void attachAccessibilityDelegateOnBind(ViewHolder holder) { if (isAccessibilityEnabled()) { final View itemView = holder.itemView; if (ViewCompat.getImportantForAccessibility(itemView) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(itemView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } RecyclerViewAccessibilityDelegate.ItemDelegate itemDelegate = (RecyclerViewAccessibilityDelegate.ItemDelegate) mAccessibilityDelegate.getItemDelegate(); AccessibilityDelegateCompat appDelegate = itemDelegate.getAppAccessibilityDelegate(); if (appDelegate != null) { ViewCompat.setAccessibilityDelegate(holder.itemView, appDelegate); } else { ViewCompat.setAccessibilityDelegate(holder.itemView, itemDelegate); } } }

Target:
private void attachAccessibilityDelegateOnBind(ViewHolder holder) { if (isAccessibilityEnabled()) { final View itemView = holder.itemView; if (ViewCompat.getImportantForAccessibility(itemView) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(itemView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } RecyclerViewAccessibilityDelegate.ItemDelegate itemDelegate = (RecyclerViewAccessibilityDelegate.ItemDelegate) mAccessibilityDelegate.getItemDelegate(); AccessibilityDelegateCompat appDelegate = itemDelegate.getAppAccessibilityDelegate(holder.itemView); ViewCompat.setAccessibilityDelegate(holder.itemView, appDelegate); } }
Source:
public void handleSelections() { for (View view : getViews()) { if (view != null) { handleSelection(view); } } }

Target:
public void handleSelections() { for (View view : getViews()) { handleSelection(view); } }
Source:
public void updateNewAttachmentAttribute(TaskAttribute attachmentAttribute) { BugzillaRestConfiguration repositoryConfiguration; try { repositoryConfiguration = connector.getRepositoryConfiguration(this.getTaskRepository()); repositoryConfiguration.updateAttachmentFlags(attachmentAttribute); } catch (CoreException e) { e.printStackTrace(); } }

Target:
public void updateNewAttachmentAttribute(TaskAttribute attachmentAttribute) { BugzillaRestConfiguration repositoryConfiguration; try { repositoryConfiguration = connector.getRepositoryConfiguration(this.getTaskRepository()); repositoryConfiguration.updateAttachmentFlags(attachmentAttribute); } catch (CoreException e) { StatusHandler.log( new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, "Eerror in updateNewAttachmentAttribute", e)); } }
Source:
public NewAgileFeatureGroup getFeatureGroup(@PathParam("featureUuid") long featureUuid) { IAgileFeatureGroup feature = atsServer.getAgileService().getAgileFeatureGroups(Arrays.asList(featureUuid)).iterator().next(); NewAgileFeatureGroup created = new NewAgileFeatureGroup(); created.setGuid(feature.getGuid()); created.setName(feature.getName()); created.setUuid(feature.getId()); created.setTeamUuid(feature.getTeamUuid()); created.setActive(feature.isActive()); return created; }

Target:
public JaxAgileFeatureGroup getFeatureGroup(@PathParam("featureUuid") long featureUuid) { IAgileFeatureGroup feature = atsServer.getAgileService().getAgileFeatureGroups(Arrays.asList(featureUuid)).iterator().next(); JaxAgileFeatureGroup created = new JaxAgileFeatureGroup(); created.setGuid(feature.getGuid()); created.setName(feature.getName()); created.setUuid(feature.getId()); created.setTeamUuid(feature.getTeamUuid()); created.setActive(feature.isActive()); return created; }
Source:
protected IStatus run(IProgressMonitor monitor) { while (!monitor.isCanceled()) { try { Thread.sleep(INDEXING_THREAD_SLEEP_VALUE); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } monitor.done(); return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { while (!monitor.isCanceled()) { try { Thread.sleep(INDEXING_THREAD_SLEEP_VALUE); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return Status.OK_STATUS; } } monitor.done(); return Status.OK_STATUS; }
Source:
public void publishUserTune(UserTuneElement userTuneElement) throws NotLoggedInException, NotALeafNodeException, NoResponseException, NotConnectedException, XMPPErrorException, InterruptedException { if (pubSubManager == null) { pubSubManager = PubSubManager.getInstanceFor(getAuthenticatedConnectionOrThrow(), connection().getUser().asBareJid()); } LeafNode node = pubSubManager.getOrCreateLeafNode(USERTUNE_NODE); userTuneElementStack.push(userTuneElement); Thread.sleep(5000); if (!userTuneElementStack.isEmpty()) { node.publish(new PayloadItem<>(userTuneElementStack.pop())); userTuneElementStack.clear(); } }

Target:
public void publishUserTune(UserTuneElement userTuneElement) throws NotLoggedInException, NotALeafNodeException, NoResponseException, NotConnectedException, XMPPErrorException, InterruptedException { pepManager.publish(USERTUNE_NODE, new PayloadItem<>(userTuneElement)); }
Source:
public boolean canHandle(HttpServletRequest request) { String token = CharacterEncoder.getSafeText(request.getParameter("token")); String action = CharacterEncoder.getSafeText(request.getParameter("sendToken")); if (token != null || action != null) { return true; } return false; }

Target:
public boolean canHandle(HttpServletRequest request) { String token = CharacterEncoder.getSafeText(request.getParameter("token")); String action = CharacterEncoder.getSafeText(request.getParameter("sendToken")); return (token != null || action != null); }
Source:
private void verifyParentItemsMatch(ParentListItem<Object> expectedParentListItem, boolean expectedExpansion, int actualParentIndex) { assertEquals(expectedParentListItem, mExpandableRecyclerAdapter.getListItem(actualParentIndex)); assertEquals(expectedExpansion, mExpandableRecyclerAdapter.mItemList.get(actualParentIndex).isExpanded()); if (expectedExpansion) { List<Object> expectedChildList = expectedParentListItem.getChildItemList(); int actualChildIndex = actualParentIndex + 1; for (int i = 0; i < expectedChildList.size(); i++) { assertEquals(expectedChildList.get(i), mExpandableRecyclerAdapter.getListItem(actualChildIndex)); actualChildIndex++; } } }

Target:
private void verifyParentItemsMatch(ParentListItem<Object> expectedParentListItem, boolean expectedExpansion, int actualParentIndex) { assertEquals(expectedParentListItem, getListItem(actualParentIndex)); assertEquals(expectedExpansion, mExpandableRecyclerAdapter.mItemList.get(actualParentIndex).isExpanded()); if (expectedExpansion) { List<Object> expectedChildList = expectedParentListItem.getChildItemList(); int actualChildIndex = actualParentIndex + 1; for (int i = 0; i < expectedChildList.size(); i++) { assertEquals(expectedChildList.get(i), getListItem(actualChildIndex)); actualChildIndex++; } } }
Source:
private Set<StoreKey> getMissingStoreKeys(ReplicaMetadataResponseInfo replicaMetadataResponseInfo, DataNodeId remoteNode, RemoteReplicaInfo remoteReplicaInfo) throws StoreException { long startTime = SystemTime.getInstance().milliseconds(); List<MessageInfo> messageInfoList = replicaMetadataResponseInfo.getMessageInfoList(); List<StoreKey> storeKeysToCheck = new ArrayList<StoreKey>(messageInfoList.size()); for (MessageInfo messageInfo : messageInfoList) { storeKeysToCheck.add(messageInfo.getStoreKey()); logger.trace("Remote node: Thread name: Remote replica: Key from remote: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } Set<StoreKey> missingStoreKeys = remoteReplicaInfo.getLocalStore().findMissingKeys(storeKeysToCheck); for (StoreKey storeKey : missingStoreKeys) { logger.trace("Remote node: Thread name: Remote replica: Key missing id: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), storeKey); } if (isRemoteColo) { replicationMetrics.interColoCheckMissingKeysTime.get(remoteDatacenterName) .update(SystemTime.getInstance().milliseconds() - startTime); } else { replicationMetrics.intraColoCheckMissingKeysTime.update(SystemTime.getInstance().milliseconds() - startTime); } return missingStoreKeys; }

Target:
private Set<StoreKey> getMissingStoreKeys(ReplicaMetadataResponseInfo replicaMetadataResponseInfo, DataNodeId remoteNode, RemoteReplicaInfo remoteReplicaInfo) throws StoreException { long startTime = SystemTime.getInstance().milliseconds(); List<MessageInfo> messageInfoList = replicaMetadataResponseInfo.getMessageInfoList(); List<StoreKey> storeKeysToCheck = new ArrayList<StoreKey>(messageInfoList.size()); for (MessageInfo messageInfo : messageInfoList) { storeKeysToCheck.add(messageInfo.getStoreKey()); logger.trace("Remote node: Thread name: Remote replica: Key from remote: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } Set<StoreKey> missingStoreKeys = remoteReplicaInfo.getLocalStore().findMissingKeys(storeKeysToCheck); for (StoreKey storeKey : missingStoreKeys) { logger.trace("Remote node: Thread name: Remote replica: Key missing id: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), storeKey); } replicationMetrics .updateCheckMissingKeysTime(SystemTime.getInstance().milliseconds() - startTime, replicatingFromRemoteColo, datacenterName); return missingStoreKeys; }
Source:
public void folderScopedCredentialsTest() { final Folder folder = jenkins.jobs.create(Folder.class, F01); final FreeStyleJob job1 = folder.getJobs().create(FreeStyleJob.class, JOB1); this.checkItemExists(folder, true); this.checkItemExists(job1, true); final WorkflowJob job2 = createWorkflowJob(folder); this.checkItemExists(job2, true); final String console = job2.startBuild().shouldSucceed().getConsole(); assertThat(console, containsRegexp(CRED_INJECTED_MESSAGE)); job1.delete(); elasticSleep(1000); this.checkItemExists(job1, false); job2.delete(); elasticSleep(1000); this.checkItemExists(job2, false); folder.delete(); this.checkItemExists(folder, false); }

Target:
public void folderScopedCredentialsTest() { final Folder folder = jenkins.jobs.create(Folder.class, F01); final FreeStyleJob job1 = folder.getJobs().create(FreeStyleJob.class, JOB1); this.checkItemExists(folder, true); this.checkItemExists(job1, true); final WorkflowJob job2 = createWorkflowJob(folder); this.checkItemExists(job2, true); final String console = job2.startBuild().shouldSucceed().getConsole(); assertThat(console, containsRegexp(CRED_INJECTED_MESSAGE)); job1.delete(); waitFor(job1, Matchers.pageObjectDoesNotExist(), 1000); job2.delete(); waitFor(job2, Matchers.pageObjectDoesNotExist(), 1000); folder.delete(); waitFor(folder, Matchers.pageObjectDoesNotExist(), 1000); }
Source:
public List<EnrichedHost> getEnrichedHosts(PerunSession sess, Facility facility, List<String> attrNames) throws AttributeNotExistsException, FacilityNotExistsException { Utils.checkPerunSession(sess); getFacilitiesManagerBl().checkFacilityExists(sess, facility); List<Host> hosts = getFacilitiesManagerBl().getHosts(sess, facility); Host host1 = hosts.get(0); List<String> allowedAttributes = new ArrayList<>(); for (String attrName : attrNames) { if (AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, attrName), host1)) { allowedAttributes.add(attrName); } } List<EnrichedHost> enrichedHosts = new ArrayList<>(); for (Host host : hosts) { List<Attribute> hostAttributes = getPerunBl().getAttributesManagerBl().getAttributes(sess, host, allowedAttributes); enrichedHosts.add(new EnrichedHost(host, hostAttributes)); } return enrichedHosts; }

Target:
public List<EnrichedHost> getEnrichedHosts(PerunSession sess, Facility facility, List<String> attrNames) throws AttributeNotExistsException, FacilityNotExistsException, PrivilegeException { List<Host> hosts = getHosts(sess, facility); List<EnrichedHost> enrichedHosts = new ArrayList<>(); if (hosts.isEmpty()) return enrichedHosts; Host host1 = hosts.get(0); List<String> allowedAttributes = new ArrayList<>(); for (String attrName : attrNames) { if (AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, attrName), host1)) { allowedAttributes.add(attrName); } } for (Host host : hosts) { List<Attribute> hostAttributes = getPerunBl().getAttributesManagerBl().getAttributes(sess, host, allowedAttributes); enrichedHosts.add(new EnrichedHost(host, hostAttributes)); } return enrichedHosts; }
Source:
public Boolean load(EntryKey key) throws NoSuchProjectException, MergeException, IOException { boolean open = key.repo == null; Repository repo = open ? repoManager.openRepository(key.dest.getParentKey()) : key.repo; try { return isMergeable(key, repo); } finally { key.dest = null; key.repo = null; if (open) { repo.close(); } } }

Target:
public Boolean load(EntryKey key) throws NoSuchProjectException, MergeException, IOException { checkArgument(key.dest != null && key.repo != null && key.db != null, "Key cannot be loaded without destination, repo, and db: %s", key); if (key.into.equals(ObjectId.zeroId())) { return true; } try { Map<String, Ref> refs = key.repo.getAllRefs(); RevWalk rw = CodeReviewCommit.newRevWalk(key.repo); try { RevFlag canMerge = rw.newFlag("CAN_MERGE"); CodeReviewCommit rev = parse(rw, key.commit); rev.add(canMerge); CodeReviewCommit tip = parse(rw, key.into); Set<RevCommit> accepted = alreadyAccepted(rw, refs.values()); accepted.add(tip); accepted.addAll(Arrays.asList(rev.getParents())); return submitStrategyFactory.create( key.submitType, key.db, key.repo, rw, null , canMerge, accepted, key.dest).dryRun(tip, rev); } finally { rw.release(); } } finally { key.dest = null; key.repo = null; } }
Source:
public Object[] transform(String sourceData) throws FormatException { if (sourceData == null) { return null; } Tokenizer tokenizer = new Tokenizer(new BufferedReader(new StringReader(sourceData)), m_csvPreference, m_strictquotes, m_escape, DEFAULT_COLUMN_LIMIT_SIZE, 0); CsvListReader csvReader = new CsvListReader(tokenizer, m_csvPreference); List<String> dataList; try { dataList = csvReader.read(); } catch (Exception e) { throw new FormatException(e.getMessage()); } finally { try { if (csvReader != null) csvReader.close(); } catch (Exception e) { throw new FormatException(e.getMessage()); } } String[] data = dataList.toArray(new String[0]); normalize(data); return data; }

Target:
public Object[] transform(String sourceData) throws FormatException { if (sourceData == null) { return null; } Tokenizer tokenizer = new Tokenizer(new StringReader(sourceData), m_csvPreference, m_strictquotes, m_escape, DEFAULT_COLUMN_LIMIT_SIZE, 0); CsvListReader csvReader = new CsvListReader(tokenizer, m_csvPreference); List<String> dataList; try { dataList = csvReader.read(); } catch (IOException | SuperCsvException e) { throw new FormatException("Fail to parse csv data", e); } finally { try { if (csvReader != null) csvReader.close(); } catch (IOException e) { throw new FormatException(e); } } String[] data = dataList.toArray(new String[0]); normalize(data); return data; }
Source:
public void testGetSlaDueDate() { GenericServiceTaskExecutionSet a = new GenericServiceTaskExecutionSet( new GenericServiceTaskInfo(), new SLADueDate(SLA_DUE_DATE_1)); Assert.assertTrue(a.getSlaDueDate().getValue().equals(SLA_DUE_DATE_1)); }

Target:
public void testGetSlaDueDate() { GenericServiceTaskExecutionSet a = new GenericServiceTaskExecutionSet( new GenericServiceTaskInfo(), new SLADueDate(SLA_DUE_DATE_1)); assertEquals(SLA_DUE_DATE_1, a.getSlaDueDate().getValue()); }
Source:
public Class<?>[] getAdapterList() { return new Class<?>[] { ITranslationUnit.class }; }

Target:
public Class<?>[] getAdapterList() { return ADAPTER_LIST; }
Source:
private ConcurrentNavigableMap<Cell, byte[]> getReadsForTable(TableReference table) { return readsByTable.computeIfAbsent(table, $ -> new ConcurrentSkipListMap<>()); }

Target:
private ConcurrentNavigableMap<Cell, byte[]> getReadsForTable(TableReference table) { return readsByTable.computeIfAbsent(table, unused -> new ConcurrentSkipListMap<>()); }
Source:
public Map<byte[], Iterator<Map.Entry<Cell, byte[]>>> getRowsColumnRangeIterator(TableReference tableRef, Iterable<byte[]> rows, BatchColumnRangeSelection columnRangeSelection) { checkGetPreconditions(tableRef); if (Iterables.isEmpty(rows)) { return ImmutableMap.of(); } hasReads = true; Map<byte[], RowColumnRangeIterator> rawResults = keyValueService.getRowsColumnRange(tableRef, rows, columnRangeSelection, getStartTimestamp()); ImmutableSortedMap.Builder<byte[], Iterator<Map.Entry<Cell, byte[]>>> postFilteredResults = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); for (Map.Entry<byte[], RowColumnRangeIterator> e : rawResults.entrySet()) { byte[] row = e.getKey(); RowColumnRangeIterator rawIterator = e.getValue(); Iterator<Map.Entry<Cell, byte[]>> postFilteredIterator = getPostFilteredColumns(tableRef, columnRangeSelection, row, rawIterator); postFilteredResults.put(row, postFilteredIterator); } return postFilteredResults.build(); }

Target:
public Map<byte[], Iterator<Map.Entry<Cell, byte[]>>> getRowsColumnRangeIterator(TableReference tableRef, Iterable<byte[]> rows, BatchColumnRangeSelection columnRangeSelection) { checkGetPreconditions(tableRef); if (Iterables.isEmpty(rows)) { return ImmutableMap.of(); } hasReads = true; Map<byte[], RowColumnRangeIterator> rawResults = keyValueService.getRowsColumnRange(tableRef, rows, columnRangeSelection, getStartTimestamp()); ImmutableSortedMap.Builder<byte[], Iterator<Map.Entry<Cell, byte[]>>> postFilteredResults = ImmutableSortedMap.orderedBy(PtBytes.BYTES_COMPARATOR); for (Map.Entry<byte[], RowColumnRangeIterator> e : rawResults.entrySet()) { byte[] row = e.getKey(); RowColumnRangeIterator rawIterator = e.getValue(); Iterator<Map.Entry<Cell, byte[]>> postFilteredIterator = getPostFilteredColumns(tableRef, columnRangeSelection, row, rawIterator); postFilteredResults.put(row, postFilteredIterator); } return postFilteredResults.build(); }
Source:
public synchronized void setFunctionModels(List<FunctionModel> newFunctionModels) { List<FunctionModel> oldFunctionModels = functionModels; this.functionModels = ObservableCollections.observableList(newFunctionModels); pcs.firePropertyChange(PROP_FUNCTION_MODELS, oldFunctionModels, functionModels); }

Target:
private synchronized void setFunctionModels(List<FunctionModel> newFunctionModels) { List<FunctionModel> oldFunctionModels = functionModels; this.functionModels = ObservableCollections.observableList(newFunctionModels); pcs.firePropertyChange(PROP_FUNCTION_MODELS, oldFunctionModels, functionModels); }
Source:
protected void setValueChecked(String fieldName, Object newValue) { Object existingValue = getValueUnchecked(fieldName); ChangeSpec spec = new ChangeSpec(this, fieldName, existingValue, newValue); boolean isNewlyCreated = requestScope.getNewPersistentResources().contains(this); if (!isNewlyCreated) { runTriggers(OnUpdatePreSecurity.class, CLASS_NO_FIELD); runTriggers(OnUpdatePreSecurity.class, fieldName, Optional.of(spec)); checkFieldAwareDeferPermissions(UpdatePermission.class, fieldName, newValue, existingValue); } setValue(fieldName, newValue); }

Target:
protected void setValueChecked(String fieldName, Object newValue) { Object existingValue = getValueUnchecked(fieldName); ChangeSpec spec = new ChangeSpec(this, fieldName, existingValue, newValue); boolean isNewlyCreated = requestScope.getNewPersistentResources().contains(this); if (!isNewlyCreated) { runTriggers(OnUpdatePreSecurity.class, CLASS_NO_FIELD); runTriggers(OnUpdatePreSecurity.class, fieldName, Optional.of(spec)); } checkFieldAwareDeferPermissions(UpdatePermission.class, fieldName, newValue, existingValue); setValue(fieldName, newValue); }
Source:
private Notification updateNotifications() { String contentTitle = getString(R.string.download_notification_title); int numDownloads = requester.getNumberOfDownloads(); String downloadsLeft; if (numDownloads > 0) { int downloads = requester.getNumberOfDownloads(); downloadsLeft = getResources() .getQuantityString(R.plurals.downloads_left, downloads, downloads); } else { downloadsLeft = getString(R.string.downloads_processing); } if (notificationCompatBuilder != null) { StringBuilder bigText = new StringBuilder(""); for (int i = 0; i < downloads.size(); i++) { Downloader downloader = downloads.get(i); final DownloadRequest request = downloader .getDownloadRequest(); if (request.getFeedfileType() == Feed.FEEDFILETYPE_FEED) { if (request.getTitle() != null) { if (i > 0) { bigText.append("\n"); } bigText.append("\u2022 " + request.getTitle()); } } else if (request.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) { if (request.getTitle() != null) { if (i > 0) { bigText.append("\n"); } bigText.append("\u2022 " + request.getTitle() + " (" + request.getProgressPercent() + "%)"); } } } notificationCompatBuilder.setContentTitle(contentTitle); notificationCompatBuilder.setContentText(downloadsLeft); if (bigText != null) { notificationCompatBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(bigText.toString())); } return notificationCompatBuilder.build(); } return null; }

Target:
private Notification updateNotifications() { String contentTitle = getString(R.string.download_notification_title); int numDownloads = requester.getNumberOfDownloads(); String downloadsLeft; if (numDownloads > 0) { downloadsLeft = getResources() .getQuantityString(R.plurals.downloads_left, numDownloads, numDownloads); } else { downloadsLeft = getString(R.string.downloads_processing); } if (notificationCompatBuilder != null) { StringBuilder bigText = new StringBuilder(""); for (int i = 0; i < downloads.size(); i++) { Downloader downloader = downloads.get(i); final DownloadRequest request = downloader .getDownloadRequest(); if (request.getFeedfileType() == Feed.FEEDFILETYPE_FEED) { if (request.getTitle() != null) { if (i > 0) { bigText.append("\n"); } bigText.append("\u2022 " + request.getTitle()); } } else if (request.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) { if (request.getTitle() != null) { if (i > 0) { bigText.append("\n"); } bigText.append("\u2022 " + request.getTitle() + " (" + request.getProgressPercent() + "%)"); } } } notificationCompatBuilder.setContentTitle(contentTitle); notificationCompatBuilder.setContentText(downloadsLeft); if (bigText != null) { notificationCompatBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(bigText.toString())); } return notificationCompatBuilder.build(); } return null; }
Source:
public IAtsUser getTransitionAsUser() throws OseeCoreException { IAtsUser user = helper.getTransitionUser(); if (user == null) { System.err.println("Unexpected: AtsCore.getUserService().getCurrentUser();"); user = AtsCore.getUserService().getCurrentUser(); } return user; }

Target:
public IAtsUser getTransitionAsUser() throws OseeCoreException { IAtsUser user = helper.getTransitionUser(); if (user == null) { user = AtsCore.getUserService().getCurrentUser(); } return user; }
Source:
public @ResponseBody String ping( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) final String accessToken, @RequestHeader(value = "User-Agent", defaultValue = "unknown") String userAgent, HttpServletRequest request) { String ipAddress = request.getHeader(com.google.common.net.HttpHeaders.X_FORWARDED_FOR); if (ipAddress == null) { ipAddress = request.getRemoteAddr(); } log.info("Requesting download of sentinel object id with access token (MD5) from and client version {}", identifier(accessToken), ipAddress, userAgent); return downloadService.getSentinelObject(); }

Target:
public @ResponseBody String ping( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) final String accessToken, @RequestHeader(value = "User-Agent", defaultValue = "unknown") String userAgent, HttpServletRequest request) { val ipAddress = RequestHeaderUtils.getIpAddress(request); log.info("Requesting download of sentinel object id with access token (MD5) from and client version {}", identifier(accessToken), ipAddress, userAgent); return downloadService.getSentinelObject(); }
Source:
public void testGetNonExistingImage() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setResponseCode(500).setBody(payloadFromResource("/image/image-not-found.xml"))); ProfitBricksApi pbApi = api(server.getUrl(rootUrl)); ImageApi api = pbApi.imageApi(); String id = "random-non-existing-id"; try { Image image = api.getImage(id); assertRequestHasCommonProperties(server.takeRequest()); assertNull(image); } finally { pbApi.close(); server.shutdown(); } }

Target:
public void testGetNonExistingImage() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setResponseCode(404)); ProfitBricksApi pbApi = api(server.getUrl(rootUrl)); ImageApi api = pbApi.imageApi(); String id = "random-non-existing-id"; try { Image image = api.getImage(id); assertRequestHasCommonProperties(server.takeRequest()); assertNull(image); } finally { pbApi.close(); server.shutdown(); } }
Source:
public ConfigBuilder withSchema(Schema readerSchema) { conf.set(KITE_READER_SCHEMA, readerSchema.toString()); return this; }

Target:
public ConfigBuilder withSchema(Schema readerSchema) { Class<?> type = conf.getClass(KITE_TYPE, null); Preconditions.checkArgument(type == null, "Can't configure a reader schema when a type is already set: {}", type); conf.set(KITE_READER_SCHEMA, readerSchema.toString()); return this; }
Source:
public void testRandomDigit() { for (int i = 0; i < 1000; ++i) { int value = faker.number().randomDigit(); assertTrue(value <= 9 && value >= 0); } }

Target:
public void testRandomDigit() { for (int i = 0; i < 1000; ++i) { int value = faker.number().randomDigit(); assertThat(value, is(lessThanOrEqualTo(9))); assertThat(value, is(greaterThanOrEqualTo(0))); } }
Source:
public void testWithValidIgw() { DescribeRouteTablesResult describeRouteTablesResult = new DescribeRouteTablesResult(); RouteTable routeTable = new RouteTable().withVpcId(VPC_ID).withVpcId(VPC_ID); Route route = new Route(); route.setGatewayId(GATEWAY_ID); route.setDestinationCidrBlock(OPEN_CIDR_BLOCK); routeTable.setRoutes(List.of(route)); RouteTableAssociation routeTableAssociation = new RouteTableAssociation(); routeTableAssociation.setSubnetId(SUBNET_ID); routeTable.setAssociations(List.of(routeTableAssociation)); describeRouteTablesResult.setRouteTables(List.of(routeTable)); boolean hasInternetGateway = awsSubnetIgwExplorer.hasInternetGatewayOfSubnet(describeRouteTablesResult, SUBNET_ID, VPC_ID); assertTrue(hasInternetGateway); }

Target:
public void testWithValidIgw() { DescribeRouteTablesResult describeRouteTablesResult = new DescribeRouteTablesResult(); RouteTable routeTable = new RouteTable().withVpcId(VPC_ID); Route route = new Route(); route.setGatewayId(GATEWAY_ID); route.setDestinationCidrBlock(OPEN_CIDR_BLOCK); routeTable.setRoutes(List.of(route)); RouteTableAssociation routeTableAssociation = new RouteTableAssociation(); routeTableAssociation.setSubnetId(SUBNET_ID); routeTable.setAssociations(List.of(routeTableAssociation)); describeRouteTablesResult.setRouteTables(List.of(routeTable)); boolean hasInternetGateway = awsSubnetIgwExplorer.hasInternetGatewayOfSubnet(describeRouteTablesResult, SUBNET_ID, VPC_ID); assertTrue(hasInternetGateway); }
Source:
public Response remove(@PathParam("id") long id) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); if (baseClass.equals(Device.class)) { Context.getPermissionsManager().checkDeviceReadonly(getUserId()); } Context.getPermissionsManager().checkPermission(baseClass, getUserId(), id); BaseObjectManager<T> manager = Context.getManager(baseClass); manager.removeItem(id); if (manager instanceof SimpleObjectManager) { ((SimpleObjectManager<T>) manager).refreshUserItems(); } if (manager instanceof ExtendedObjectManager) { ((ExtendedObjectManager<T>) manager).refreshExtendedPermissions(); } if (baseClass.equals(Group.class) || baseClass.equals(Device.class) || baseClass.equals(User.class)) { Context.getPermissionsManager().refreshDeviceAndGroupPermissions(); if (baseClass.equals(User.class)) { Context.getPermissionsManager().refreshAllUsersPermissions(); } else { Context.getPermissionsManager().refreshAllExtendedPermissions(); } } if (baseClass.equals(Device.class)) { Context.getAliasesManager().removeDevice(id); } return Response.noContent().build(); }

Target:
public Response remove(@PathParam("id") long id) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); if (baseClass.equals(Device.class)) { Context.getPermissionsManager().checkDeviceReadonly(getUserId()); } Context.getPermissionsManager().checkPermission(baseClass, getUserId(), id); BaseObjectManager<T> manager = Context.getManager(baseClass); manager.removeItem(id); if (manager instanceof SimpleObjectManager) { ((SimpleObjectManager<T>) manager).refreshUserItems(); if (manager instanceof ExtendedObjectManager) { ((ExtendedObjectManager<T>) manager).refreshExtendedPermissions(); } } if (baseClass.equals(Group.class) || baseClass.equals(Device.class) || baseClass.equals(User.class)) { Context.getPermissionsManager().refreshDeviceAndGroupPermissions(); if (baseClass.equals(User.class)) { Context.getPermissionsManager().refreshAllUsersPermissions(); } else { Context.getPermissionsManager().refreshAllExtendedPermissions(); } } if (baseClass.equals(Device.class)) { Context.getAliasesManager().removeDevice(id); } return Response.noContent().build(); }
Source:
private List<EmailLogEntry> filterLogsForEmailLogPage(List<AppLogLine> appLogLines, AdminEmailLogPageData data) { List<EmailLogEntry> emailLogs = new LinkedList<EmailLogEntry>(); for (AppLogLine appLog : appLogLines) { String logMsg = appLog.getLogMessage(); boolean isNotEmailLog = !logMsg.contains("TEAMMATESEMAILLOG"); if (isNotEmailLog) { continue; } EmailLogEntry emailLogEntry = new EmailLogEntry(appLog); if (emailLogEntry.isTestData() && !data.isShouldShowAll()) { continue; } if (data.shouldShowLog(emailLogEntry)) { emailLogs.add(emailLogEntry); } } return emailLogs; }

Target:
private List<EmailLogEntry> filterLogsForEmailLogPage(List<AppLogLine> appLogLines, AdminEmailLogPageData data) { List<EmailLogEntry> emailLogs = new LinkedList<EmailLogEntry>(); for (AppLogLine appLog : appLogLines) { String logMsg = appLog.getLogMessage(); boolean isNotEmailLog = !logMsg.contains("TEAMMATESEMAILLOG"); if (isNotEmailLog) { continue; } EmailLogEntry emailLogEntry = new EmailLogEntry(appLog); if (data.shouldShowLog(emailLogEntry)) { emailLogs.add(emailLogEntry); } } return emailLogs; }
Source:
private boolean isJandexSetFlagsAvailable() { try { Method setFlags = GetDeclaredMethodAction.of(ClassFileInfo.class, "setFlags").run(); return setFlags != null; } catch (Exception e) { return false; } }

Target:
private boolean isJandexSetFlagsAvailable() { try { Method setFlags = AccessController.doPrivileged(GetDeclaredMethodAction.of(ClassFileInfo.class, "setFlags", short.class)); return setFlags != null; } catch (Exception e) { return false; } }
Source:
public int compareTo(final Scale scale) { if (!scale.unit.equals(scale.unit)) { throw new RuntimeException("Unable to compare scales in different units"); } return new Double(this.resolution).compareTo(new Double(scale.resolution)); }

Target:
public int compareTo(final Scale scale) { if (!this.unit.equals(scale.unit)) { throw new RuntimeException("Unable to compare scales in different units"); } return Double.compare(this.resolution, scale.resolution); }
Source:
public void configure(final MapperFactory mapperFactory) { mapperFactory.getConverterFactory().registerConverter(new CosemDateTimeConverter(this)); mapperFactory.getConverterFactory().registerConverter(new AdministrativeStatusResponseConverter()); mapperFactory.getConverterFactory().registerConverter(new FirmwareVersionConverter()); mapperFactory.getConverterFactory().registerConverter(new GetAttributeValuesResponseConverter()); mapperFactory.getConverterFactory().registerConverter(new GetConfigurationObjectResponseConverter()); }

Target:
public void configure(final MapperFactory mapperFactory) { mapperFactory.getConverterFactory().registerConverter(new CosemDateTimeConverter(this)); mapperFactory.getConverterFactory().registerConverter(new AdministrativeStatusResponseConverter()); mapperFactory.getConverterFactory().registerConverter(new FirmwareVersionConverter()); mapperFactory.getConverterFactory().registerConverter(new GetAttributeValuesResponseConverter()); }
Source:
public boolean sendMessage(ChatMessage message) { return ChatManager.getInstance(context).enqueueOutGoingMessageQueue(message.convertMessageToJson()) && this.pushMessage(message); }

Target:
public boolean sendMessage(ChatMessage message) { return ChatManager .getInstance() .enqueueOutGoingMessageQueue(message.convertMessageToJson()) && this.pushMessage(message); }
Source:
protected static boolean isFieldValueNotSet(final Object field) { return field == null || ObjectHelper.isEmpty(field); }

Target:
protected static boolean isFieldValueNotSet(final Object field) { return ObjectHelper.isEmpty(field); }
Source:
public String getJdbcUrl() { if (getUriInfo().getUriString().startsWith(JDBC_PREFIX)) { return getUriInfo().getUriString(); } return String.format("jdbc:%s://%s:%d/%s", jdbcUrlDatabaseType, getHost(), getPort(), getPath()); }

Target:
public String getJdbcUrl() { if (getUriInfo().getUriString().startsWith(JDBC_PREFIX)) { return getUriInfo().getUriString(); } return String.format("jdbc:%s://%s:%d/%s:user=%s;password=%s;", jdbcUrlDatabaseType, getHost(), getPort(), getPath(), getUserName(), getPassword()); }
Source:
public void deleteNodeTestEntityNotFound_chef() throws EntityNotFoundException, ClientProtocolException, IOException, NodeExecutionException { HttpResponse httpResponse= mock(HttpResponse.class); StatusLine statusLine= mock(StatusLine.class); when(httpResponse.getStatusLine()).thenReturn(statusLine); when(httpResponse.getStatusLine().getStatusCode()).thenReturn(200); when(client.execute((HttpUriRequest) anyObject())).thenReturn(httpResponse); when(propertiesProvider.getProperty(anyString())).thenReturn("URL"); List<ProductInstance> productInstances = new ArrayList<ProductInstance>(); productInstances.add(new ProductInstance()); when(productInstanceDao.findByHostname(anyString())).thenThrow(EntityNotFoundException.class); nodeManager.nodeDelete("test", "testError"); }

Target:
public void deleteNodeTestEntityNotFound_chef() throws EntityNotFoundException, ClientProtocolException, IOException, NodeExecutionException { HttpResponse httpResponse= mock(HttpResponse.class); StatusLine statusLine= mock(StatusLine.class); when(httpResponse.getStatusLine()).thenReturn(statusLine); when(httpResponse.getStatusLine().getStatusCode()).thenReturn(200); when(client.execute((HttpUriRequest) anyObject())).thenReturn(httpResponse); when(propertiesProvider.getProperty(anyString())).thenReturn("URL"); List<ProductInstance> productInstances = new ArrayList<ProductInstance>(); productInstances.add(new ProductInstance()); when(productInstanceDao.findByHostname(anyString())).thenThrow(EntityNotFoundException.class); nodeManager.nodeDelete("test", "testError"); verify(httpResponse,times(2)).getStatusLine(); verify(client, times(1)).execute((HttpUriRequest) anyObject()); }
Source:
CircuitBreaker(long timeout, int failureThreshold, long retryTimePeriod) { this.state = State.CLOSED; this.failureThreshold = failureThreshold; this.timeout = timeout; this.retryTimePeriod = retryTimePeriod; this.lastFailureTime = System.nanoTime() + 1000 * 1000 * 1000 * 1000; this.failureCount = 0; }

Target:
CircuitBreaker(long timeout, int failureThreshold, long retryTimePeriod) { this.state = State.CLOSED; this.failureThreshold = failureThreshold; this.timeout = timeout; this.retryTimePeriod = retryTimePeriod; this.lastFailureTime = System.nanoTime() + futureTime; this.failureCount = 0; }
Source:
private void validateTypeValue(Map<String, Object> rootObject) throws CatalogTransformerException { Object typeValue = rootObject.get(CompositeGeometry.TYPE_KEY); if (typeValue == null || !typeValue.equals("Feature")) { throw new CatalogTransformerException( new UnsupportedOperationException( "Only supported type is Feature, not [" + typeValue + "]")); } }

Target:
private void validateTypeValue(Map<String, Object> rootObject) throws CatalogTransformerException { Object typeValue = rootObject.get(CompositeGeometry.TYPE_KEY); if (!"Feature".equals(typeValue)) { throw new CatalogTransformerException( new UnsupportedOperationException( "Only supported type is Feature, not [" + typeValue + "]")); } }
Source:
protected void innerMap( InputRow inputRow, Object value, Context context ) throws IOException, InterruptedException { final Optional<Bucket> bucket = getConfig().getBucket(inputRow); if (!bucket.isPresent()) { throw new ISE("WTF?! No bucket found for row: %s", inputRow); } final long truncatedTimestamp = granularitySpec.getQueryGranularity().truncate(inputRow.getTimestampFromEpoch()); final byte[] hashedDimensions = hashFunction.hashBytes( HadoopDruidIndexerConfig.jsonMapper.writeValueAsBytes( Rows.toGroupKey( truncatedTimestamp, inputRow ) ) ).asBytes(); context.write( new SortableBytes( bucket.get().toGroupKey(), ByteBuffer.allocate(Longs.BYTES + hashedDimensions.length) .putLong(truncatedTimestamp) .put(hashedDimensions) .array() ).toBytesWritable(), new BytesWritable(InputRowHelper.toBytes(inputRow, config.getSchema().getDataSchema().getAggregators())) ); }

Target:
protected void innerMap( InputRow inputRow, Object value, Context context ) throws IOException, InterruptedException { final Optional<Bucket> bucket = getConfig().getBucket(inputRow); if (!bucket.isPresent()) { throw new ISE("WTF?! No bucket found for row: %s", inputRow); } final long truncatedTimestamp = granularitySpec.getQueryGranularity().truncate(inputRow.getTimestampFromEpoch()); final byte[] hashedDimensions = hashFunction.hashBytes( HadoopDruidIndexerConfig.jsonMapper.writeValueAsBytes( Rows.toGroupKey( truncatedTimestamp, inputRow ) ) ).asBytes(); context.write( new SortableBytes( bucket.get().toGroupKey(), ByteBuffer.allocate(Longs.BYTES + hashedDimensions.length) .putLong(truncatedTimestamp) .put(hashedDimensions) .array() ).toBytesWritable(), new BytesWritable(InputRowSerde.toBytes(inputRow, aggregators)) ); }
Source:
public void write(NullWritable key, Text value) throws IOException, InterruptedException { PutRecordRequest putRecordRequest = new PutRecordRequest(); putRecordRequest.setStreamName(context.getConfiguration().get(Properties.KinesisRealtimeSink.NAME)); String dist = distribute ? String.valueOf(Math.random()) : String.valueOf(distribute); putRecordRequest.setPartitionKey(dist); ByteBuffer buffer = ByteBuffer.wrap(value.toString().getBytes()); sendKinesisRecord(buffer, putRecordRequest); }

Target:
public void write(NullWritable key, Text value) throws IOException, InterruptedException { PutRecordRequest putRecordRequest = new PutRecordRequest(); putRecordRequest.setStreamName(streamName); String dist = distribute ? String.valueOf(Math.random()) : String.valueOf(distribute); putRecordRequest.setPartitionKey(dist); ByteBuffer buffer = ByteBuffer.wrap(value.toString().getBytes()); sendKinesisRecord(buffer, putRecordRequest); }
Source:
private void updateAttributes(final String typeDamage) { mSelectedArcGISFeature.loadAsync(); mSelectedArcGISFeature.addDoneLoadingListener(new Runnable() { @Override public void run() { if (mSelectedArcGISFeature.getLoadStatus() == LoadStatus.FAILED_TO_LOAD) { Log.d(getResources().getString(R.string.app_name), "Error while loading feature"); } mSelectedArcGISFeature.getAttributes().put("typdamage", typeDamage); try { ListenableFuture<Boolean> mapViewResult = mServiceFeatureTable.updateFeatureAsync(mSelectedArcGISFeature); if (mapViewResult.get().booleanValue()) { final ListenableFuture<List<FeatureEditResult>> serverResult = mServiceFeatureTable.applyEditsAsync(); serverResult.addDoneListener(new Runnable() { @Override public void run() { try { List<FeatureEditResult> edits = serverResult.get(); if (edits.size() > 0) { if (!edits.get(0).hasCompletedWithErrors()) { Log.e(getResources().getString(R.string.app_name), "Feature successfully updated"); } } else { Log.e(getResources().getString(R.string.app_name), "The attribute type was not changed"); } showCallout((String) mSelectedArcGISFeature.getAttributes().get("typdamage")); } catch (Exception e) { Log.e(getResources().getString(R.string.app_name), "applying changes to the server failed: " + e.getMessage()); } } }); } } catch (Exception e) { Log.e(getResources().getString(R.string.app_name), "updating feature in the feature table failed: " + e.getMessage()); } } }); }

Target:
private boolean updateAttributes(final String typeDamage) { mSelectedArcGISFeature.loadAsync(); mSelectedArcGISFeature.addDoneLoadingListener(new Runnable() { @Override public void run() { if (mSelectedArcGISFeature.getLoadStatus() == LoadStatus.FAILED_TO_LOAD) { Log.d(getResources().getString(R.string.app_name), "Error while loading feature"); } mSelectedArcGISFeature.getAttributes().put("typdamage", typeDamage); try { ListenableFuture<Boolean> mapViewResult = mServiceFeatureTable.updateFeatureAsync(mSelectedArcGISFeature); if (mapViewResult.get()) { final ListenableFuture<List<FeatureEditResult>> serverResult = mServiceFeatureTable.applyEditsAsync(); serverResult.addDoneListener(new Runnable() { @Override public void run() { try { List<FeatureEditResult> edits = serverResult.get(); if (edits.size() > 0) { if (!edits.get(0).hasCompletedWithErrors()) { Log.e(getResources().getString(R.string.app_name), "Feature successfully updated"); mFeatureUpdated = true; } } else { Log.e(getResources().getString(R.string.app_name), "The attribute type was not changed"); mFeatureUpdated = false; } showCallout((String) mSelectedArcGISFeature.getAttributes().get("typdamage")); } catch (Exception e) { Log.e(getResources().getString(R.string.app_name), "applying changes to the server failed: " + e.getMessage()); } } }); } } catch (Exception e) { Log.e(getResources().getString(R.string.app_name), "updating feature in the feature table failed: " + e.getMessage()); } } }); return mFeatureUpdated; }
Source:
public DefaultCommandMatcher(Class<? extends ReplicableCommand> commandClass) { this(commandClass, null, null, null, MATCH_ANY_COUNT); }

Target:
public DefaultCommandMatcher(Class<? extends ReplicableCommand> commandClass) { this(commandClass, null, null, null); }
Source:
public void startUp() { for (Pipe pipe : pipeList) { pipe.startUp(); } }

Target:
public void startUp() { serviceManager.startAsync().awaitHealthy(); }
Source:
public void onFailed() { if (!completedMerge()) { TransactionSupport.executeInNewTransaction(() -> { syncDbRecordsMergeFailure(); return null; }); log.error("Merging of snapshot '{}' images '{}'..'{}' failed. Images have been" + " marked illegal and can no longer be previewed or reverted to." + " Please retry Live Merge on the snapshot to complete the operation.", getDiskImage().getImage().getSnapshotId(), getDiskImage().getImageId(), getDestinationDiskImage() != null ? getDestinationDiskImage().getImageId() : "(n/a)" ); } else { VmBlockJobType blockJobType = getParameters().getMergeStatusReturnValue().getBlockJobType(); DiskImage targetImage = blockJobType == VmBlockJobType.PULL ? getDestinationDiskImage() : getDiskImage(); DiskImage imageFromIRS = getImageInfoFromIRS(targetImage); TransactionSupport.executeInNewTransaction(() -> { syncDbRecords(imageFromIRS, false); return null; }); log.error("Snapshot '{}' images '{}'..'{}' merged, but volume removal failed." + " Some or all of the following volumes may be orphaned: {}." + " Please retry Live Merge on the snapshot to complete the operation.", getDiskImage().getImage().getSnapshotId(), getDiskImage().getImageId(), getDestinationDiskImage() != null ? getDestinationDiskImage().getImageId() : "(n/a)", getParameters().getMergeStatusReturnValue().getImagesToRemove()); } }

Target:
public void onFailed() { if (!completedMerge()) { TransactionSupport.executeInNewTransaction(() -> { syncDbRecordsMergeFailure(); return null; }); log.error("Merging of snapshot '{}' images '{}'..'{}' failed. Images have been" + " marked illegal and can no longer be previewed or reverted to." + " Please retry Live Merge on the snapshot to complete the operation.", getDiskImage().getImage().getSnapshotId(), getDiskImage().getImageId(), getDestinationDiskImage() != null ? getDestinationDiskImage().getImageId() : "(n/a)" ); } else { DiskImage imageFromIRS = getImageInfoFromIRS(getTargetImage()); TransactionSupport.executeInNewTransaction(() -> { syncDbRecords(imageFromIRS, false); return null; }); log.error("Snapshot '{}' images '{}'..'{}' merged, but volume removal failed." + " Some or all of the following volumes may be orphaned: {}." + " Please retry Live Merge on the snapshot to complete the operation.", getDiskImage().getImage().getSnapshotId(), getDiskImage().getImageId(), getDestinationDiskImage() != null ? getDestinationDiskImage().getImageId() : "(n/a)", getParameters().getMergeStatusReturnValue().getImagesToRemove()); } }
Source:
public void testCallProcIsProc() throws Exception { when(fakePlayer.isOp()).thenReturn(true); String config = "/for = >>>\n" + " msg(is_proc('_proc'))\n" + " proc('_proc'," + " msg('hello world')" + " )" + "@name_proc = '_proc'" + " msg(is_proc(@name_proc))" + " call_proc(@name_proc)" + "<<<\n"; RunCommand(config, fakePlayer, "/for"); verify(fakePlayer).sendMessage("false"); verify(fakePlayer).sendMessage("true"); verify(fakePlayer).sendMessage("hello world"); }

Target:
public void testCallProcIsProc() throws Exception { when(fakePlayer.isOp()).thenReturn(true); String config = "/for = >>>\n" + " msg(is_proc('_proc'))\n" + " proc('_proc'," + " msg('hello world')" + " )" + " msg(is_proc('_proc'))" + " call_proc(dyn('_proc'))" + "<<<\n"; RunCommand(config, fakePlayer, "/for"); verify(fakePlayer).sendMessage("false"); verify(fakePlayer).sendMessage("true"); verify(fakePlayer).sendMessage("hello world"); }