auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void sortImageList(List<DiskImage> images) { List<DiskImage> hold = new ArrayList<>(); DiskImage curr = null; for (int i = 0; i < images.size(); i++) { int pos = getFirstImage(images, images.get(i)); if (pos == -1) { curr = images.get(i); hold.add(images.get(i)); images.remove(images.get(i)); break; } } while (images.size() > 0) { int pos = getNextImage(images, curr); if (pos == -1) { log.error("Image list error in SortImageList"); break; } curr = images.get(pos); hold.add(images.get(pos)); images.remove(images.get(pos)); } images.addAll(hold); }

Target:
public static void sortImageList(List<DiskImage> images) { List<DiskImage> hold = new ArrayList<>(); DiskImage curr = null; for (int i = 0; i < images.size(); i++) { int pos = getFirstImage(images, images.get(i)); if (pos == -1) { curr = images.get(i); hold.add(images.get(i)); images.remove(images.get(i)); break; } } while (images.size() > 0) { int pos = getNextImage(images, curr); if (pos == -1) { log.error("Image list error in SortImageList"); break; } curr = images.get(pos); hold.add(images.get(pos)); images.remove(images.get(pos)); } for (DiskImage image : hold) { images.add(image); } }
Source:
public void testToJSONWithListData() throws IOException { long timestampMillis = 1496712943487L; Position position = new Position(new BinlogPosition(1L, "binlog-0001"), 0L); RowMap rowMap = new RowMap("insert", "MyDatabase", "MyTable", timestampMillis, null, position); rowMap.putData("id", "9001"); rowMap.putData("first_name", "foo"); rowMap.putData("middle_name", "buzz"); rowMap.putData("last_name", "bar"); rowMap.putData("salary", "4000"); rowMap.putData("department", "science"); rowMap.putData("interests", Arrays.asList("classical music", "hiking", "biking", "programming")); MaxwellOutputConfig outputConfig = getMaxwellOutputConfig(); Assert.assertEquals("{\"database\":\"MyDatabase\",\"table\":\"MyTable\",\"type\":\"insert\",\"ts\":1496712943,\"position\":\"binlog-0001:1\",\"gtid\":null,\"data\":{\"id\":\"9001\",\"salary\":\"4000\",\"department\":\"science\",\"interests\":[\"classical music\",\"hiking\",\"biking\",\"programming\"]}}", rowMap.toJSON(outputConfig)); }

Target:
public void testToJSONWithListData() throws IOException { RowMap rowMap = new RowMap("insert", "MyDatabase", "MyTable", TIMESTAMP_MILLISECONDS, new ArrayList<String>(), POSITION); rowMap.putData("id", "9001"); rowMap.putData("first_name", "foo"); rowMap.putData("last_name", "bar"); rowMap.putData("interests", Arrays.asList("hiking", "programming")); rowMap.setServerId(7653213L); rowMap.setThreadId(6532312L); MaxwellOutputConfig outputConfig = getMaxwellOutputConfig(Pattern.compile("^.*name.*$")); Assert.assertEquals("{\"database\":\"MyDatabase\",\"table\":\"MyTable\",\"type\":\"insert\",\"ts\":1496712943," + "\"position\":\"binlog-0001:1\",\"gtid\":null,\"server_id\":7653213,\"thread_id\":6532312," + "\"data\":{\"id\":\"9001\",\"interests\":[\"hiking\",\"programming\"]}}", rowMap.toJSON(outputConfig)); }
Source:
protected String evalNamespaceName(String workspaceId, Subject currentUser) { if (isNullOrEmpty(this.namespaceName)) { return workspaceId; } else { String tmpNamespaceName = this.namespaceName; for (String placeholder : NAMESPACE_NAME_PLACEHOLDERS.keySet()) { tmpNamespaceName = tmpNamespaceName.replaceAll( placeholder, NAMESPACE_NAME_PLACEHOLDERS.get(placeholder).apply(currentUser)); } return tmpNamespaceName; } }

Target:
protected String evalNamespaceName(String workspaceId, Subject currentUser) { if (isPredefined) { return this.namespaceName; } else if (isNullOrEmpty(this.namespaceName)) { return workspaceId; } else { String tmpNamespaceName = this.namespaceName; for (String placeholder : NAMESPACE_NAME_PLACEHOLDERS.keySet()) { tmpNamespaceName = tmpNamespaceName.replaceAll( placeholder, NAMESPACE_NAME_PLACEHOLDERS.get(placeholder).apply(currentUser)); } return tmpNamespaceName; } }
Source:
public void glancingTest() { Rectangle bounds = new Rectangle(0, 0, 638, 1119); int x0 = 1115; int y0 = -468; int x1 = 1132; int y1 = 42; Rectangle rect = LineClipper.clip(bounds, x0, y0, x1, y1); assertEquals(null, rect); }

Target:
public void glancingTest() { Rectangle bounds = new Rectangle(0, 0, 638, 1119); int x0 = 1115; int y0 = -468; int x1 = 1132; int y1 = 42; Rectangle rect = LineClipper.clip(bounds, x0, y0, x1, y1); assertNull(rect); }
Source:
public void fireResourcesAdded(List<Resource<L>> resources) { if (!resources.isEmpty()) { try { inventoryListenerRWLock.readLock().lock(); LOG.debugf("Firing inventory event for [%d] added/modified resources", resources.size()); InventoryEvent<L> event = new InventoryEvent<L>(EndpointService.this, resources); for (InventoryListener inventoryListener : inventoryListeners) { inventoryListener.resourcesAdded(event); } } finally { inventoryListenerRWLock.readLock().unlock(); } } }

Target:
public void fireResourcesAdded(List<Resource<L>> resources) { if (!resources.isEmpty()) { inventoryListenerRWLock.readLock().lock(); try { LOG.debugf("Firing inventory event for [%d] added/modified resources", resources.size()); InventoryEvent<L> event = new InventoryEvent<L>(EndpointService.this, resources); for (InventoryListener inventoryListener : inventoryListeners) { inventoryListener.resourcesAdded(event); } } finally { inventoryListenerRWLock.readLock().unlock(); } } }
Source:
private void importJayceFile(@Nonnull InputJackLibrary inputJackLibrary, @Nonnull InputVElement element, @Nonnull JSession session, @Nonnull String currentPath) throws JPackageLookupException, TypeImportConflictException, ResourceImportConflictException, JTypeLookupException { String path = currentPath + element.getName(); if (element.isVDir()) { for (InputVElement subFile : ((InputVDir) element).list()) { importJayceFile(inputJackLibrary, subFile, session, path + VPATH_SEPARATOR); } } else { InputVFile file = (InputVFile) element; if (isJackFileName(file.getName())) { String typeName = path.substring(0, path.length() - JAYCE_FILE_EXTENSION.length()).replace( VPATH_SEPARATOR, '.'); addImportedTypes(session, path, new TypeInInputLibraryLocation(inputJackLibrary.getLocation(), typeName)); } else { addImportedResource(file, session, path); } } }

Target:
private void importJayceFile(@Nonnull InputJackLibrary inputJackLibrary, @Nonnull InputVElement element, @Nonnull JSession session, @Nonnull String currentPath) throws JPackageLookupException, TypeImportConflictException, ResourceImportConflictException, JTypeLookupException { String path = currentPath + element.getName(); if (element.isVDir()) { for (InputVElement subFile : ((InputVDir) element).list()) { importJayceFile(inputJackLibrary, subFile, session, path + VPATH_SEPARATOR); } } else { InputVFile file = (InputVFile) element; if (isJackFileName(file.getName())) { addImportedTypes(session, path, inputJackLibrary); } else { addImportedResource(file, session, path); } } }
Source:
public static String getCellValue(Workbook wb, Cell cell) { if (cell == null) { return null; } final String result; switch (cell.getCellType()) { case BLANK: case _NONE: result = null; break; case BOOLEAN: result = Boolean.toString(cell.getBooleanCellValue()); break; case ERROR: String errorResult; try { byte errorCode = cell.getErrorCellValue(); FormulaError formulaError = FormulaError.forInt(errorCode); errorResult = formulaError.getString(); } catch (RuntimeException e) { logger .debug("Getting error code for ({},{}) failed!: {}", cell.getRowIndex(), cell.getColumnIndex(), e.getMessage()); if (cell instanceof XSSFCell) { String value = ((XSSFCell) cell).getErrorCellString(); errorResult = value; } else { logger .error("Couldn't handle unexpected error scenario in cell: (" + cell.getRowIndex() + "," + cell.getColumnIndex() + ")", e); throw e; } } result = errorResult; break; case FORMULA: result = getFormulaCellValue(wb, cell); break; case NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { Date date = cell.getDateCellValue(); if (date == null) { result = null; } else { result = DateUtils.createDateFormat().format(date); } } else { result = getNumericCellValueAsString(cell.getCellStyle(), cell.getNumericCellValue()); } break; case STRING: result = cell.getRichStringCellValue().getString(); break; default: throw new IllegalStateException("Unknown cell type: " + cell.getCellType()); } logger.debug("cell ({},{}) resolved to value: {}", cell.getRowIndex(), cell.getColumnIndex(), result); return result; }

Target:
public static String getCellValue(Workbook wb, Cell cell) { if (cell == null) { return null; } final String result; switch (cell.getCellType()) { case BLANK: case _NONE: result = null; break; case BOOLEAN: result = Boolean.toString(cell.getBooleanCellValue()); break; case ERROR: result = getErrorResult(cell); break; case FORMULA: result = getFormulaCellValue(wb, cell); break; case NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { Date date = cell.getDateCellValue(); if (date == null) { result = null; } else { result = DateUtils.createDateFormat().format(date); } } else { result = getNumericCellValueAsString(cell.getCellStyle(), cell.getNumericCellValue()); } break; case STRING: result = cell.getRichStringCellValue().getString(); break; default: throw new IllegalStateException("Unknown cell type: " + cell.getCellType()); } logger.debug("cell ({},{}) resolved to value: {}", cell.getRowIndex(), cell.getColumnIndex(), result); return result; }
Source:
public void setContext(CommandContext context) { if (context == null) { return; } CompensationContext compensationContext = context.getCompensationContext(); if (compensationContext != null) { setCompensationContext(compensationContext); } ExecutionContext executionContext = context.getExecutionContext(); if (executionContext != null) { setExecutionContext(executionContext); if (executionContext.getJob() != null) { if (executionContext.getJob().getOwnerId() != null) { DbUser user = DbFacade.getInstance().getDbUserDao().get(executionContext.getJob().getOwnerId().getValue()); if (user != null) { setUserName(user.getusername()); } } setJobId(executionContext.getJob().getId()); } else if (executionContext.getStep() != null) { setJobId(executionContext.getStep().getJobId()); } } if (commandLock == null) { commandLock = context.getLock(); } }

Target:
public void setContext(CommandContext context) { if (context == null) { return; } CompensationContext compensationContext = context.getCompensationContext(); if (compensationContext != null) { setCompensationContext(compensationContext); } ExecutionContext executionContext = context.getExecutionContext(); if (executionContext != null) { setExecutionContext(executionContext); if (executionContext.getJob() != null) { setJobId(executionContext.getJob().getId()); } else if (executionContext.getStep() != null) { setJobId(executionContext.getStep().getJobId()); } } if (commandLock == null) { commandLock = context.getLock(); } }
Source:
protected void onLoad() { super.onLoad(); CallbackGroup cbs = new CallbackGroup(); Util.DETAIL_SVC.patchSetPublishDetail(patchSetId, cbs.add( (com.google.gwtjsonrpc.common.AsyncCallback<PatchSetPublishDetail>) new ScreenLoadCallback<PatchSetPublishDetail>(this) { @Override protected void preDisplay(final PatchSetPublishDetail result) { send.setEnabled(true); display(result); } @Override protected void postDisplay() { message.setFocus(true); } })); }

Target:
protected void onLoad() { super.onLoad(); CallbackGroup cbs = new CallbackGroup(); Util.DETAIL_SVC.patchSetPublishDetail(patchSetId, cbs.addGwtjsonrpc( new ScreenLoadCallback<PatchSetPublishDetail>(this) { @Override protected void preDisplay(final PatchSetPublishDetail result) { send.setEnabled(true); display(result); } @Override protected void postDisplay() { message.setFocus(true); } })); }
Source:
public static void EwsAssert(boolean condition, String caller, String message) { assert condition : String.format("[%s] %s", caller, message); }

Target:
public static void EwsAssert(boolean condition, String caller, String message) { if (!condition) { throw new RuntimeException(String.format("[%s] %s", caller, message)); } }
Source:
protected int hash(InputRow inputRow) { final Map<String, Set<String>> dims = Maps.newTreeMap(); for (final String dim : inputRow.getDimensions()) { final Set<String> dimValues = ImmutableSortedSet.copyOf(inputRow.getDimension(dim)); if (dimValues.size() > 0) { dims.put(dim, dimValues); } } final List<Object> groupKey = ImmutableList.of( inputRow.getTimestampFromEpoch(), dims ); try { return hashFunction.hashBytes(jsonMapper.writeValueAsBytes(groupKey)).asInt(); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } }

Target:
private int hash(InputRow inputRow) { final List<Object> groupKey = Rows.toGroupKey(inputRow.getTimestampFromEpoch(), inputRow); try { return hashFunction.hashBytes(jsonMapper.writeValueAsBytes(groupKey)).asInt(); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } }
Source:
public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) { IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSet targetWorkingSet = (IWorkingSet) ((IAdaptable)aTarget).getAdapter(IWorkingSet.class); ISelection sel = LocalSelectionTransfer.getTransfer().getSelection(); if (sel instanceof TreeSelection) { for (TreePath path : ((ITreeSelection)sel).getPaths()) { if (path.getFirstSegment() instanceof IAdaptable) { IProject project = (IProject) ((IAdaptable)path.getLastSegment()).getAdapter(IProject.class); IWorkingSet sourceWorkingSet = (IWorkingSet) ((IAdaptable)path.getFirstSegment()).getAdapter(IWorkingSet.class); if (! targetWorkingSet.equals(sourceWorkingSet)) { if (! workingSetContains(targetWorkingSet, project)) { workingSetManager.addToWorkingSets(project, new IWorkingSet[] { targetWorkingSet }); } if (sourceWorkingSet != null) { removeFromWorkingSet(project, sourceWorkingSet); } } } } } else if (sel instanceof IStructuredSelection) { for (Object item : ((IStructuredSelection)sel).toArray()) { IProject project = (IProject) ((IAdaptable)item).getAdapter(IProject.class); if (! workingSetContains(targetWorkingSet, project)) { workingSetManager.addToWorkingSets(project, new IWorkingSet[] { targetWorkingSet }); } } } return Status.OK_STATUS; }

Target:
public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) { IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSet targetWorkingSet = (IWorkingSet) ((IAdaptable)aTarget).getAdapter(IWorkingSet.class); ISelection sel = LocalSelectionTransfer.getTransfer().getSelection(); if (sel instanceof ITreeSelection) { for (TreePath path : ((ITreeSelection)sel).getPaths()) { if (path.getFirstSegment() instanceof IAdaptable) { IProject project = (IProject) ((IAdaptable)path.getLastSegment()).getAdapter(IProject.class); IWorkingSet sourceWorkingSet = (IWorkingSet) ((IAdaptable)path.getFirstSegment()).getAdapter(IWorkingSet.class); if (! targetWorkingSet.equals(sourceWorkingSet)) { if (! workingSetContains(targetWorkingSet, project)) { workingSetManager.addToWorkingSets(project, new IWorkingSet[] { targetWorkingSet }); } if (sourceWorkingSet != null) { removeFromWorkingSet(project, sourceWorkingSet); } } } } } else if (sel instanceof IStructuredSelection) { for (Object item : ((IStructuredSelection)sel).toArray()) { IProject project = (IProject) ((IAdaptable)item).getAdapter(IProject.class); if (! workingSetContains(targetWorkingSet, project)) { workingSetManager.addToWorkingSets(project, new IWorkingSet[] { targetWorkingSet }); } } } return Status.OK_STATUS; }
Source:
public WiFiDirectBroadcastReceiver(WifiP2pManager manager, WiFiDirectManagementFragment activity) { super(); this.manager = manager; this.activity = activity; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1) { connectivityManager = (ConnectivityManager)activity.getContext().getSystemService(Context.CONNECTIVITY_SERVICE); } }

Target:
public WiFiDirectBroadcastReceiver(WifiP2pManager manager, WiFiDirectManagementFragment activity) { super(); this.manager = manager; this.activity = activity; }
Source:
public SignatureAndHashAlgorithm getSignatureAndHashAlgorithm(List<X509Certificate> chain) { X509Certificate certificate = chain.get(0); PublicKey publicKey = certificate.getPublicKey(); if (isSupportedKeyType(certificate)) { SignatureAndHashAlgorithm signatureAndHashAlgorithm = SignatureAndHashAlgorithm .getSupportedSignatureAlgorithm(supportedSignatureAlgorithms, publicKey); if (signatureAndHashAlgorithm != null && SignatureAndHashAlgorithm.isSignedWithSupportedAlgorithms(supportedSignatureAlgorithms, chain)) { return signatureAndHashAlgorithm; } } return null; }

Target:
public SignatureAndHashAlgorithm getSignatureAndHashAlgorithm(List<X509Certificate> chain) { X509Certificate certificate = chain.get(0); if (isSupportedKeyType(certificate)) { SignatureAndHashAlgorithm signatureAndHashAlgorithm = SignatureAndHashAlgorithm .getSupportedSignatureAlgorithm(supportedSignatureAlgorithms, certificate.getPublicKey()); if (signatureAndHashAlgorithm != null && SignatureAndHashAlgorithm.isSignedWithSupportedAlgorithms(supportedSignatureAlgorithms, chain)) { return signatureAndHashAlgorithm; } } return null; }
Source:
void checkRamResourcesAvailability( String accountId, String namespace, Workspace workspace, @Nullable String envName) throws NotFoundException, ServerException, ConflictException { if (workspace.getConfig() != null) { checkRamResourcesAvailability( accountId, namespace, workspace.getId(), workspace.getConfig(), envName); } else { LOG.warn( "Can not estimate memory needed for devfile based workspace {}. Set memory resources limits may work incorrectly", workspace.getId()); } }

Target:
void checkRamResourcesAvailability( String accountId, String namespace, Workspace workspace, @Nullable String envName) throws NotFoundException, ServerException, ConflictException { if (workspace.getConfig() != null) { checkRamResourcesAvailability( accountId, namespace, workspace.getId(), workspace.getConfig(), envName); } else { LOG.warn( "Cannot estimate the memory requirements of a devfile-based workspace `{}`." + " The memory limits may not be applied correctly.", workspace.getId()); } }
Source:
public void cherryPick() throws Exception { repo.updateRef("HEAD").link("refs/heads/master"); RevCommit head = tr.branch("master").commit() .add("foo", "foo contents\n") .create(); RevCommit toPick = tr.commit() .parent(tr.commit().create()) .message("message to cherry-pick") .add("bar", "bar contents\n") .create(); RevCommit result = tr.cherryPick(toPick); rw.parseBody(result); Ref headRef = tr.getRepository().getRef("HEAD"); assertEquals(result, headRef.getObjectId()); assertTrue(headRef.isSymbolic()); assertEquals("refs/heads/master", headRef.getLeaf().getName()); assertEquals(result, headRef.getObjectId()); assertEquals(1, result.getParentCount()); assertEquals(head, result.getParent(0)); assertEquals(toPick.getAuthorIdent(), result.getAuthorIdent()); assertEquals(new PersonIdent(toPick.getCommitterIdent(), new Date(0)), new PersonIdent(result.getCommitterIdent(), new Date(0))); assertTrue(toPick.getCommitTime() < result.getCommitTime()); assertEquals("message to cherry-pick", result.getFullMessage()); assertEquals("foo contents\n", blobAsString(result, "foo")); assertEquals("bar contents\n", blobAsString(result, "bar")); }

Target:
public void cherryPick() throws Exception { repo.updateRef("HEAD").link("refs/heads/master"); RevCommit head = tr.branch("master").commit() .add("foo", "foo contents\n") .create(); rw.parseBody(head); RevCommit toPick = tr.commit() .parent(tr.commit().create()) .author(new PersonIdent("Cherrypick Author", "cpa@example.com", tr.getClock(), tr.getTimeZone())) .author(new PersonIdent("Cherrypick Committer", "cpc@example.com", tr.getClock(), tr.getTimeZone())) .message("message to cherry-pick") .add("bar", "bar contents\n") .create(); RevCommit result = tr.cherryPick(toPick); rw.parseBody(result); Ref headRef = tr.getRepository().getRef("HEAD"); assertEquals(result, headRef.getObjectId()); assertTrue(headRef.isSymbolic()); assertEquals("refs/heads/master", headRef.getLeaf().getName()); assertEquals(1, result.getParentCount()); assertEquals(head, result.getParent(0)); assertEquals(toPick.getAuthorIdent(), result.getAuthorIdent()); assertEquals(new PersonIdent(head.getCommitterIdent(), new Date(0)), new PersonIdent(result.getCommitterIdent(), new Date(0))); assertTrue(toPick.getCommitTime() < result.getCommitTime()); assertEquals("message to cherry-pick", result.getFullMessage()); assertEquals("foo contents\n", blobAsString(result, "foo")); assertEquals("bar contents\n", blobAsString(result, "bar")); }
Source:
public void getStorageConnectionsByStorageTypeWithRecords(EnumSet<StorageDomainStatus> statuses, Collection<Guid> expectedDomains) { List<StorageServerConnections> result = dao.getStorageConnectionsByStorageTypeAndStatus(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS, statuses); assertNotNull(result); assertFalse(result.isEmpty()); for (StorageServerConnections storageServerConnection : result) { assertEquals(StorageType.NFS, storageServerConnection.getstorage_type()); } List<StoragePoolIsoMap> poolIsoMap = dbFacade.getStoragePoolIsoMapDao().getAllForStoragePool(FixturesTool.STORAGE_POOL_MIXED_TYPES); List<Guid> storageDomainIds = new LinkedList<>(); for (StoragePoolIsoMap isoMap : poolIsoMap) { if (statuses.contains(isoMap.getStatus())) { storageDomainIds.add(isoMap.getstorage_id()); } } assertTrue(CollectionUtils.isEqualCollection(expectedDomains, storageDomainIds)); List<StorageServerConnections> domainConnections = new LinkedList<>(); for (Guid domainId : storageDomainIds) { domainConnections.addAll(dao.getAllForDomain(domainId)); } assertTrue(CollectionUtils.isEqualCollection(domainConnections, result)); }

Target:
public void getStorageConnectionsByStorageTypeWithRecords(EnumSet<StorageDomainStatus> statuses, Collection<Guid> expectedDomains) { List<StoragePoolIsoMap> poolIsoMap = dbFacade.getStoragePoolIsoMapDao().getAllForStoragePool(FixturesTool.STORAGE_POOL_MIXED_TYPES); List<Guid> storageDomainIds = new LinkedList<>(); for (StoragePoolIsoMap isoMap : poolIsoMap) { if (statuses.contains(isoMap.getStatus())) { storageDomainIds.add(isoMap.getstorage_id()); } } assertTrue("the list of the pool domains expected to be in the given statuses doesn't match the queried data", CollectionUtils.isEqualCollection(expectedDomains, storageDomainIds)); List<StorageServerConnections> result = dao.getStorageConnectionsByStorageTypeAndStatus(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS, statuses); assertFalse("there should be connections for the tested domains to verify the correctness", result.isEmpty()); for (StorageServerConnections storageServerConnection : result) { assertEquals("connections were loaded with incorrect storage type", StorageType.NFS, storageServerConnection.getstorage_type()); } List<StorageServerConnections> domainConnections = new LinkedList<>(); for (Guid domainId : storageDomainIds) { domainConnections.addAll(dao.getAllForDomain(domainId)); } assertTrue("the connections loaded by the given dao function should match the connections loaded separately", CollectionUtils.isEqualCollection(domainConnections, result)); }
Source:
private String getOSGiMetadataFileName() { String packaging = project.getPackaging(); if (PackagingType.TYPE_ECLIPSE_PLUGIN.equals(packaging) || PackagingType.TYPE_ECLIPSE_TEST_PLUGIN.equals(packaging)) { return "META-INF/MANIFEST.MF"; } else if (PackagingType.TYPE_ECLIPSE_FEATURE.equals(packaging)) { return "feature.xml"; } else if (PackagingType.TYPE_ECLIPSE_APPLICATION.equals(packaging)) { return project.getArtifactId() + ".product"; } else if (PackagingType.TYPE_ECLIPSE_REPOSITORY.equals(packaging)) { return project.getArtifactId(); } else if (PackagingType.TYPE_P2_IU.equals(packaging)) { return IU.P2_IU; } return "<unknown packaging=" + packaging + ">"; }

Target:
private String getOSGiMetadataFileName() { String packaging = project.getPackaging(); if (PackagingType.TYPE_ECLIPSE_PLUGIN.equals(packaging) || PackagingType.TYPE_ECLIPSE_TEST_PLUGIN.equals(packaging)) { return "META-INF/MANIFEST.MF"; } else if (PackagingType.TYPE_ECLIPSE_FEATURE.equals(packaging)) { return "feature.xml"; } else if (PackagingType.TYPE_ECLIPSE_APPLICATION.equals(packaging)) { return project.getArtifactId() + ".product"; } else if (PackagingType.TYPE_ECLIPSE_REPOSITORY.equals(packaging)) { return project.getArtifactId(); } else if (PackagingType.TYPE_P2_IU.equals(packaging)) { return IU.SOURCE_FILE_NAME; } return "<unknown packaging=" + packaging + ">"; }
Source:
private void setUpMetricData(List<MetricData> metricDataList) { List<PointValue> chartPoints = new ArrayList<>(); List<AxisValue> chartAxisPoints = new ArrayList<>(); for (int metricDataPosition = 0; metricDataPosition < metricDataList.size(); metricDataPosition++) { MetricData metricData = metricDataList.get(metricDataPosition); chartPoints.add(new PointValue(metricDataPosition, metricData.getValue())); chartAxisPoints.add(new AxisValue(metricDataPosition) .setLabel(DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date(metricData.getTimestamp())))); } Line chartLine = new Line(chartPoints) .setColor(getResources().getColor(R.color.background_primary_dark)) .setCubic(true) .setHasPoints(false); LineChartData chartData = new LineChartData() .setLines(Collections.singletonList(chartLine)); chartData.setAxisXBottom(new Axis() .setValues(chartAxisPoints)); chartData.setAxisYLeft(new Axis() .setHasLines(true)); chart.setLineChartData(chartData); Viewport chartViewport = new Viewport(chart.getMaximumViewport()); chartViewport.bottom = chart.getMaximumViewport().bottom - 50; chartViewport.top = chart.getMaximumViewport().top + 50; chart.setMaximumViewport(chartViewport); chart.setCurrentViewport(chartViewport); hideProgress(); }

Target:
private void setUpMetricData(List<MetricData> metricDataList) { sortMetricData(metricDataList); List<PointValue> chartPoints = new ArrayList<>(); List<AxisValue> chartAxisPoints = new ArrayList<>(); for (int metricDataPosition = 0; metricDataPosition < metricDataList.size(); metricDataPosition++) { MetricData metricData = metricDataList.get(metricDataPosition); chartPoints.add(new PointValue(metricDataPosition, metricData.getValue())); chartAxisPoints.add(new AxisValue(metricDataPosition) .setLabel(DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date(metricData.getTimestamp())))); } Line chartLine = new Line(chartPoints) .setColor(getResources().getColor(R.color.background_primary_dark)) .setCubic(true) .setHasPoints(false); LineChartData chartData = new LineChartData() .setLines(Collections.singletonList(chartLine)); chartData.setAxisXBottom(new Axis() .setValues(chartAxisPoints)); chartData.setAxisYLeft(new Axis() .setHasLines(true)); chart.setLineChartData(chartData); Viewport chartViewport = new Viewport(chart.getMaximumViewport()); chartViewport.bottom = chart.getMaximumViewport().bottom - 50; chartViewport.top = chart.getMaximumViewport().top + 50; chart.setMaximumViewport(chartViewport); chart.setCurrentViewport(chartViewport); hideProgress(); }
Source:
protected Command createChangeBoundsCommand(final IGraphicalEditPart editPart, final Point newPosition) { Command result = null; final Object existingRequest = this.findRequest(editPart, org.eclipse.gef.RequestConstants.REQ_MOVE); ChangeBoundsRequest request = null; double scale = 1.0; if (editPart.getRoot() instanceof DiagramRootEditPart) { final ZoomManager zoomManager = ((DiagramRootEditPart) editPart.getRoot()).getZoomManager(); scale = zoomManager.getZoom(); } if (existingRequest instanceof ChangeBoundsRequest) { request = (ChangeBoundsRequest) existingRequest; } else if (existingRequest == null) { request = new ChangeBoundsRequest(); request.setEditParts(editPart); result = this.buildCommandWrapper(request, editPart); } if (newPosition != null) { final Dimension delta = newPosition.getDifference(editPart.getFigure().getBounds().getLocation()); delta.width *= scale; delta.height *= scale; if (request != null) { request.setMoveDelta(new Point(delta.width, delta.height)); request.setLocation(newPosition); request.setType(org.eclipse.gef.RequestConstants.REQ_MOVE); request.getExtendedData().put(RegionResizableEditPolicy.IS_AUTHORIZED_MOVE, Boolean.TRUE); } else { return null; } } return result; }

Target:
protected Command createChangeBoundsCommand(final IGraphicalEditPart editPart, final Point newPosition) { Command result = null; final Object existingRequest = this.findRequest(editPart, org.eclipse.gef.RequestConstants.REQ_MOVE); ChangeBoundsRequest request = null; double scale = 1.0; if (editPart.getRoot() instanceof DiagramRootEditPart) { final ZoomManager zoomManager = ((DiagramRootEditPart) editPart.getRoot()).getZoomManager(); scale = zoomManager.getZoom(); } if (existingRequest instanceof ChangeBoundsRequest) { request = (ChangeBoundsRequest) existingRequest; } else if (existingRequest == null) { request = new ChangeBoundsRequest(); request.setEditParts(editPart); result = this.buildCommandWrapper(request, editPart); } if (newPosition != null) { final Dimension delta = newPosition.getDifference(editPart.getFigure().getBounds().getLocation()); delta.width *= scale; delta.height *= scale; if (request != null) { request.setMoveDelta(new Point(delta.width, delta.height)); request.setLocation(newPosition); request.setType(org.eclipse.gef.RequestConstants.REQ_MOVE); request.getExtendedData().put(PinnedElementsLayoutProvider.PINNED_ELEMENTS_MOVE, Boolean.TRUE); } else { return null; } } return result; }
Source:
public void testListAttribute() { DummyNodeWithListAndEnum dummy = new DummyNodeWithListAndEnum(1); SaxonXPathRuleQuery query = createQuery(" List<Node> result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(0, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(0, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); query = createQuery(" result = query.evaluate(dummy, new RuleContext()); Assert.assertEquals(1, result.size()); }

Target:
public void testListAttribute() { DummyNodeWithListAndEnum dummy = new DummyNodeWithListAndEnum(1); assertQuery(1, " assertQuery(1, " assertQuery(0, " assertQuery(1, " assertQuery(0, " assertQuery(1, " assertQuery(1, " assertQuery(1, " assertQuery(0, " }
Source:
public boolean doMonitor(ServiceEmitter emitter) { final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder(); Map<String, Long> diff = keyedDiff.to( "queryCountStats", ImmutableMap.of("query/total/count", statsProvider.getSuccessfulQueryCount() + statsProvider.getFailedQueryCount(), "query/success/count", statsProvider.getSuccessfulQueryCount(), "query/failed/count", statsProvider.getFailedQueryCount(), "query/interrupted/count", statsProvider.getInterruptedQueryCount() ) ); if (diff != null) { for (Map.Entry<String, Long> diffEntry : diff.entrySet()) { emitter.emit(builder.build(diffEntry.getKey(), diffEntry.getValue())); } } return true; }

Target:
public boolean doMonitor(ServiceEmitter emitter) { final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder(); final long successfulQueryCount = statsProvider.getSuccessfulQueryCount(); final long failedQueryCount = statsProvider.getFailedQueryCount(); final long interruptedQueryCount = statsProvider.getInterruptedQueryCount(); Map<String, Long> diff = keyedDiff.to( "queryCountStats", ImmutableMap.of( "query/count", successfulQueryCount + failedQueryCount + interruptedQueryCount, "query/success/count", successfulQueryCount, "query/failed/count", failedQueryCount, "query/interrupted/count", interruptedQueryCount ) ); if (diff != null) { for (Map.Entry<String, Long> diffEntry : diff.entrySet()) { emitter.emit(builder.build(diffEntry.getKey(), diffEntry.getValue())); } } return true; }
Source:
public void test() throws Exception { tester.assertThat(new RemoveDistinctFromSemiJoin()) .on(p -> { Symbol sourceKey = p.symbol("custkey", BigintType.BIGINT); Symbol filteringSourceKey = p.symbol("custkey_1", BigintType.BIGINT); Symbol outputKey = p.symbol("orderkey", BigintType.BIGINT); return p.semiJoin( p.tableScan("orders", ImmutableMap.of("custkey", "custkey")), p.project(Assignments.of(filteringSourceKey, expression("x")), p.aggregation(ab -> ab.step(AggregationNode.Step.SINGLE) .groupingSets(ImmutableList.of(ImmutableList.of(filteringSourceKey))) .source(p.tableScan("customer", ImmutableMap.of("custkey_1", "custkey"))) .build()) ), sourceKey, filteringSourceKey, outputKey ); }) .matches( semiJoin("Source", "Filter", "Output", tableScan("orders", ImmutableMap.of("Source", "custkey")), project(tableScan("customer", ImmutableMap.of("Filter", "custkey"))) ) ); }

Target:
public void test() throws Exception { tester.assertThat(new RemoveDistinctFromSemiJoin()) .on(p -> { Symbol sourceKey = p.symbol("custkey", BigintType.BIGINT); Symbol filteringSourceKey = p.symbol("custkey_1", BigintType.BIGINT); Symbol outputKey = p.symbol("orderkey", BigintType.BIGINT); return p.semiJoin( p.tableScan( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "orders", TINY_SCALE_FACTOR)), ImmutableList.of(sourceKey), ImmutableMap.of(sourceKey, new TpchColumnHandle("custkey", BIGINT))), p.project(Assignments.of(filteringSourceKey, expression("x")), p.aggregation(ab -> ab.step(AggregationNode.Step.SINGLE) .groupingSets(ImmutableList.of(ImmutableList.of(filteringSourceKey))) .source( p.tableScan( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "customer", TINY_SCALE_FACTOR)), ImmutableList.of(filteringSourceKey), ImmutableMap.of(filteringSourceKey, new TpchColumnHandle("custkey", BIGINT))) ) .build()) ), sourceKey, filteringSourceKey, outputKey ); }) .matches( semiJoin("Source", "Filter", "Output", tableScan("orders", ImmutableMap.of("Source", "custkey")), project(tableScan("customer", ImmutableMap.of("Filter", "custkey"))) ) ); }
Source:
public void onConnected(Bundle bundle) { if(SmartLocationOptions.getDebugging()) Log.i(getClass().getSimpleName(), "connected"); continueRemoveUpdates(); }

Target:
public void onConnected(Bundle bundle) { if(smartLocationOptions.getDebugging()) { Log.i(getClass().getSimpleName(), "connected"); } continueRemoveUpdates(); }
Source:
private DefaultGroupCheckpointStore(@Parameter(SharedStorePath.class) final String tmpFolderpath) { this.tmpFolderPath = tmpFolderpath; this.avroDagDatumWriter = new SpecificDatumWriter<>(AvroDag.class); this.avroDagDatumReader = new SpecificDatumReader<>(AvroDag.class); this.groupCheckpointDatumWriter = new SpecificDatumWriter<>(GroupCheckpoint.class); this.groupCheckpointDatumReader = new SpecificDatumReader<>(GroupCheckpoint.class); final File folder = new File(tmpFolderPath); if (!folder.exists()) { folder.mkdir(); } }

Target:
private DefaultGroupCheckpointStore(@Parameter(SharedStorePath.class) final String tmpFolderpath) { this.tmpFolderPath = tmpFolderpath; this.avroDagDatumWriter = new SpecificDatumWriter<>(AvroDag.class); this.avroDagDatumReader = new SpecificDatumReader<>(AvroDag.class); this.groupCheckpointDatumWriter = new SpecificDatumWriter<>(GroupCheckpoint.class); this.groupCheckpointDatumReader = new SpecificDatumReader<>(GroupCheckpoint.class); }
Source:
public void testGetByNameAndDataCenter() { Network result = dao.getByNameAndDataCenter("engine", datacenter); assertNotNull(result); assertEquals("engine", result.getname()); }

Target:
public void testGetByNameAndDataCenter() { Network result = dao.getByNameAndDataCenter(EXISTING_NETWORK_NAME, datacenter); assertNotNull(result); assertEquals(EXISTING_NETWORK_NAME, result.getname()); }
Source:
private void updateButtonState(boolean isBlocked) { android.util.Log.w("tjs", "updateButtonState " + isBlocked); mBlockButton.setEnabled(!isBlocked); mBlockTransientButton.setEnabled(!isBlocked); mUnblockButton.setEnabled(isBlocked); }

Target:
private void updateButtonState(boolean isBlocked) { mBlockButton.setEnabled(!isBlocked); mBlockTransientButton.setEnabled(!isBlocked); mUnblockButton.setEnabled(isBlocked); mTerminateButton.setEnabled(WebViewFeature.isFeatureSupported( WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE)); }
Source:
public void execute(final String activeContextId, final EventHandler<AvroElasticMemoryMessage> callback) { final ActiveContext activeContext = activeContexts.remove(activeContextId); final boolean isSuccess; if (activeContext == null) { LOG.log(Level.WARNING, "Trying to remove running task on active context {0}. Cannot find running task on it", activeContextId); isSuccess = false; } else { workerContextsToClose.remove(activeContext); activeContext.close(); final int remainingNumWorkers = runningWorkerContextCount.decrementAndGet(); LOG.log(Level.FINE, "Worker has been deleted successfully. Remaining workers: {0}", remainingNumWorkers); isSuccess = true; } sendCallback(activeContextId, callback, isSuccess); }

Target:
public boolean execute(final String activeContextId, final EventHandler<AvroElasticMemoryMessage> callback) { final ActiveContext activeContext = activeContexts.remove(activeContextId); final boolean isSuccess; if (activeContext == null) { LOG.log(Level.WARNING, "Trying to remove active context {0}, which is not found", activeContextId); isSuccess = false; } else { deletedWorkerSet.add(activeContextId); final RunningTask runningTask = contextIdToRunningTasks.remove(activeContextId); runningTask.close(); activeContext.close(); final int remainingNumWorkers = runningWorkerContextCount.decrementAndGet(); LOG.log(Level.FINE, "Worker has been deleted successfully. Remaining workers: {0}", remainingNumWorkers); isSuccess = true; } sendCallback(activeContextId, callback, isSuccess); return isSuccess; }
Source:
public String toString() { return getClass().getName() + " [policyDirectives=" + this.policy + "]"; }

Target:
public String toString() { return getClass().getName() + " [policy=" + this.policy + "]"; }
Source:
public static void createDecisionReviews(boolean DEBUG, SkynetTransaction transaction) throws Exception { Date createdDate = new Date(); IAtsUser createdBy = AtsClientService.get().getAtsUserAdmin().getCurrentUser(); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "Create Decision reviews"); } TeamWorkFlowArtifact firstTestArt = getSampleReviewTestWorkflows().get(0); TeamWorkFlowArtifact secondTestArt = getSampleReviewTestWorkflows().get(1); DecisionReviewArtifact reviewArt = ValidateReviewManager.createValidateReview(firstTestArt, true, createdDate, createdBy, transaction); Result result = DecisionReviewManager.transitionTo(reviewArt, DecisionReviewState.Followup, AtsClientService.get().getAtsUserAdmin().getCurrentUser(), false, transaction); if (result.isFalse()) { throw new IllegalStateException("Failed transitioning review to Followup: " + result.getText()); } reviewArt.persist(transaction); reviewArt = ValidateReviewManager.createValidateReview(secondTestArt, true, createdDate, createdBy, transaction); DecisionReviewManager.transitionTo(reviewArt, DecisionReviewState.Completed, AtsClientService.get().getAtsUserAdmin().getCurrentUser(), false, transaction); if (result.isFalse()) { throw new IllegalStateException("Failed transitioning review to Completed: " + result.getText()); } reviewArt.persist(transaction); }

Target:
public static void createDecisionReviews(boolean DEBUG, SkynetTransaction transaction) throws Exception { Date createdDate = new Date(); IAtsUser createdBy = AtsClientService.get().getAtsUserAdmin().getCurrentUser(); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "Create Decision reviews"); } TeamWorkFlowArtifact firstTestArt = getSampleReviewTestWorkflows().get(0); TeamWorkFlowArtifact secondTestArt = getSampleReviewTestWorkflows().get(1); DecisionReviewArtifact reviewArt = ValidateReviewManager.createValidateReview(firstTestArt, true, createdDate, createdBy, transaction); Result result = DecisionReviewManager.transitionTo(reviewArt, DecisionReviewState.Followup, createdBy, false, transaction); if (result.isFalse()) { throw new IllegalStateException("Failed transitioning review to Followup: " + result.getText()); } reviewArt.persist(transaction); reviewArt = ValidateReviewManager.createValidateReview(secondTestArt, true, createdDate, createdBy, transaction); DecisionReviewManager.transitionTo(reviewArt, DecisionReviewState.Completed, createdBy, false, transaction); if (result.isFalse()) { throw new IllegalStateException("Failed transitioning review to Completed: " + result.getText()); } reviewArt.persist(transaction); }
Source:
protected com.woorea.openstack.quantum.model.Network createNewNetworkEntity(Network network) { com.woorea.openstack.quantum.model.Network networkForCreate = super.createNewNetworkEntity(network); networkForCreate.setTenantId(DEVICE_OWNER); return networkForCreate; }

Target:
protected com.woorea.openstack.quantum.model.Network createNewNetworkEntity(Network network) { com.woorea.openstack.quantum.model.Network networkForCreate = super.createNewNetworkEntity(network); if (!provider.isRequiringAuthentication()) { networkForCreate.setTenantId(DEVICE_OWNER); } return networkForCreate; }
Source:
public <K, V> OnHeapStore<K, V> createStore(final Configuration<K, V> storeConfig, final ServiceConfiguration<?>... serviceConfigs) { TimeSource timeSource = serviceProvider.getService(TimeSourceService.class).getTimeSource(); CopyProvider copyProvider = serviceProvider.getService(CopyProvider.class); Copier<K> keyCopier = copyProvider.createKeyCopier(storeConfig.getKeyType(), storeConfig.getKeySerializer(), serviceConfigs); Copier<V> valueCopier = copyProvider.createValueCopier(storeConfig.getValueType(), storeConfig.getValueSerializer(), serviceConfigs); SizeOfEngineProvider sizeOfEngineProvider = serviceProvider.getService(SizeOfEngineProvider.class); boolean isByteSized = storeConfig.getResourcePools().getPoolForResource(ResourceType.Core.HEAP).getUnit() instanceof MemoryUnit; SizeOfEngine sizeOfEngine = sizeOfEngineProvider.createSizeOfEngine(isByteSized, serviceConfigs); OnHeapStore<K, V> onHeapStore = new OnHeapStore<K, V>(storeConfig, timeSource, keyCopier, valueCopier, sizeOfEngine); createdStores.add(onHeapStore); return onHeapStore; }

Target:
public <K, V> OnHeapStore<K, V> createStore(final Configuration<K, V> storeConfig, final ServiceConfiguration<?>... serviceConfigs) { TimeSource timeSource = serviceProvider.getService(TimeSourceService.class).getTimeSource(); CopyProvider copyProvider = serviceProvider.getService(CopyProvider.class); Copier<K> keyCopier = copyProvider.createKeyCopier(storeConfig.getKeyType(), storeConfig.getKeySerializer(), serviceConfigs); Copier<V> valueCopier = copyProvider.createValueCopier(storeConfig.getValueType(), storeConfig.getValueSerializer(), serviceConfigs); SizeOfEngineProvider sizeOfEngineProvider = serviceProvider.getService(SizeOfEngineProvider.class); SizeOfEngine sizeOfEngine = sizeOfEngineProvider.createSizeOfEngine(storeConfig.getResourcePools().getPoolForResource(ResourceType.Core.HEAP).getUnit(), serviceConfigs); OnHeapStore<K, V> onHeapStore = new OnHeapStore<K, V>(storeConfig, timeSource, keyCopier, valueCopier, sizeOfEngine); createdStores.add(onHeapStore); return onHeapStore; }
Source:
protected void addUserInputPages() { RenameResourceProcessor processor= getRefactoring().getAdapter(RenameResourceProcessor.class); RenameResourceRefactoringConfigurationPage page= new RenameResourceRefactoringConfigurationPage(processor); addPage(page); }

Target:
protected void addUserInputPages() { RenameResourceProcessor processor= getRefactoring().getAdapter(RenameResourceProcessor.class); addPage(new RenameResourceRefactoringConfigurationPage(processor)); }
Source:
protected void executeCommand() { EngineLock monitoringLock = aquireMonitorLock(); try { ResourceManager.getInstance().GetVdsManager(getVdsId()).refreshHost(getVds()); setSucceeded(true); } finally { releaseMonitorLock(monitoringLock, "Get Capabilities"); } }

Target:
protected void executeCommand() { EngineLock monitoringLock = acquireMonitorLock(); try { ResourceManager.getInstance().GetVdsManager(getVdsId()).refreshHost(getVds()); setSucceeded(true); } finally { releaseMonitorLock(monitoringLock, "Refresh host capabilities"); } }
Source:
public Iterable<RevCommit> call() throws IllegalStateException, MissingObjectException, IncorrectObjectTypeException, IOException { processOptions(); walk = new RevWalk(repo); walk.markStart(walk.parseCommit(start)); return walk; }

Target:
public Iterable<RevCommit> call() throws NoHeadException, JGitInternalException { if (!startSpecified) { try { ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) throw new NoHeadException( "No HEAD exists and no explicit starting revision was specified"); add(headId); } catch (IOException e) { throw new JGitInternalException( "An exception occured while trying to add the Id of HEAD", e); } } return walk; }
Source:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); Map<String, ModuleService> moduleServices = load(ModuleService.class); if(argMap.containsKey(ARG_HELP)) { System.out.println(getUsage(moduleServices.keySet())); return; } Deque<String> others = (Deque<String>)argMap.get("__other__"); String module = others.removeFirst(); ModuleService moduleService = moduleServices.get(module); if(moduleService != null) { moduleService.parseArguments(others); ExtensionsManager extensionsManager = new ExtensionsManager(); File config = new File((String)argMap.get(ARG_EXT_CONFIG)); if (!config.exists()) { throw new Exception("Could not find extension configuration at the specified path"); } extensionsManager.initialize(extensionsManager.load(config)); moduleService.run(extensionsManager); } else { System.out.println("No such " + module + " module exists. To list existing modules use --help argument."); } } catch (Throwable t) { t.printStackTrace(); System.exit(1); } }

Target:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); Map<String, ModuleService> moduleServices = load(ModuleService.class); if (argMap.containsKey(ARG_HELP)) { System.out.println("core help"); System.out.println("Modules: " + StringUtils.join(moduleServices.keySet(), ", ")); return; } List<String> others = (List<String>) argMap.get("__other__"); String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists. To list existing modules use --help argument.", module) ); } Map<String, Object> moduleArgMap = moduleService.parseArguments(others); if(moduleArgMap.containsKey(ARG_HELP)) { System.out.println(module + " help"); return; } others = (List<String>)moduleArgMap.get("__other__"); if(others.size() > 1) { throw new IllegalArgumentException( String.format( "You've provided illegal arguments '%1$s' for module '%2$s' ", StringUtils.join(others, ", "), module ) ); } ExtensionsManager extensionsManager = new ExtensionsManager(); for(File f : CoreUtil.listFiles((String)argMap.get("extensions-dir"))) { extensionsManager.load(f); } for(ExtensionProxy proxy : extensionsManager.getLoadedExtensions()) { extensionsManager.initialize(proxy.getContext().<String>get(Base.ContextKeys.INSTANCE_NAME)); } ExtMap context = new ExtMap().mput(Base.GlobalContextKeys.EXTENSIONS, extensionsManager.getLoadedExtensions()); moduleService.setContext(context); moduleService.run(); } catch (IllegalArgumentException ex) { System.out.println(ex.getMessage()); } catch (Throwable t) { t.printStackTrace(); } }
Source:
protected Map<String, Pair<String, String>> getExclusiveLocks() { return Collections.singletonMap(getParameters().getStorageServerConnection().getid(), LockMessagesMatchUtil.STORAGE); }

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Map<String, Pair<String, String>> locks = new HashMap<String, Pair<String, String>>(); locks.put(getStorageDomain().getId().toString(), LockMessagesMatchUtil.STORAGE); locks.put(getParameters().getStorageServerConnection().getconnection(), LockMessagesMatchUtil.STORAGE_CONNECTION); return locks; }