auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean isValidValue(final Object element) { boolean result = super.isValidValue(element); if (result) { EObject eObject = EMFHelper.getEObject(element); result = (ProtocolUtils.isProtocol(eObject) && !SystemElementsUtils.isSystemProtocol((Collaboration) eObject) && !SystemElementsUtils.isBaseProtocol((Collaboration) eObject)); } return result; }

Target:
public boolean isValidValue(final Object element) { boolean result = super.isValidValue(element); if (result) { EObject eObject = EMFHelper.getEObject(element); result = (ProtocolUtils.isProtocol(eObject) && !SystemElementsUtils.isBaseProtocol((Collaboration) eObject)); } return result; }
Source:
public static Comparator<Graph.Node> getComparator() { Comparator<Graph.Node> comparator = null; String text = System.getProperty("testng.order", Order.INSTANCES.getValue()); Order order = Order.parse(text); switch (order) { case INSTANCES: comparator = new Comparator<Graph.Node>() { @Override public int compare(Graph.Node o1, Graph.Node o2) { return o1.getObject().toString().compareTo(o2.getObject().toString()); } @Override public String toString() { return "Instance_Names"; } }; break; case METHOD_NAMES: comparator = new Comparator<Graph.Node>() { @Override public int compare(Graph.Node o1, Graph.Node o2) { if (o1.getObject() instanceof ITestNGMethod && o2.getObject() instanceof ITestNGMethod) { String n1 = ((ITestNGMethod) o1.getObject()).getMethodName(); String n2 = ((ITestNGMethod) o1.getObject()).getMethodName(); return n1.compareTo(n2); } return o1.getObject().getClass().getName().compareTo(o2.getObject().getClass().getName()); } @Override public String toString() { return "Method_Names"; } }; break; case NONE: default: } return comparator; }

Target:
public static Comparator<ITestNGMethod> getComparator() { Comparator<ITestNGMethod> comparator; String text = System.getProperty("testng.order", Order.INSTANCES.getValue()); Order order = Order.parse(text); switch (order) { case METHOD_NAMES: comparator = new Comparator<ITestNGMethod>() { @Override public int compare(ITestNGMethod o1, ITestNGMethod o2) { String n1 = o1.getMethodName(); String n2 = o1.getMethodName(); return n1.compareTo(n2); } @Override public String toString() { return "Method_Names"; } }; break; case NONE: comparator = new Comparator<ITestNGMethod>() { @Override public int compare(ITestNGMethod o1, ITestNGMethod o2) { return 0; } @Override public String toString() { return "No_Sorting"; } }; break; case INSTANCES: default: comparator = new Comparator<ITestNGMethod>() { @Override public int compare(ITestNGMethod o1, ITestNGMethod o2) { return o1.toString().compareTo(o2.toString()); } @Override public String toString() { return "Instance_Names"; } }; } return comparator; }
Source:
public long getValueReference() { if (getFmiVariable() != null){ return (int)getFmiVariable().getValueReference(); } return super.getValueReference(); }

Target:
public long getValueReference() { if (getFmiVariable() != null){ return (long)getFmiVariable().getValueReference(); } return super.getValueReference(); }
Source:
protected final ISeries addSeries(IYSeries series) { ISeriesSet seriesSet = getSwtChart().getSeriesSet(); int seriesCount = seriesSet.getSeries().length; String seriesName = series.getLabel(); IYSeries ySeries = fModel.getSeries().stream().filter(elem -> elem.getLabel().equals(seriesName)).findAny().orElse(null); if (ySeries == null) { setSeries(seriesName, new double[fModel.getXAxis().length]); ySeries = fModel.getSeries().stream().filter(elem -> elem.getLabel().equals(seriesName)).findAny().get(); } String colorTxt = ySeries.getColor(); Color color = getColor(seriesName, colorTxt); switch (ySeries.getSeriesType()) { case IYSeries.BAR: IBarSeries barSeries = (IBarSeries) seriesSet.createSeries(SeriesType.BAR, seriesName); barSeries.setBarColor(color); barSeries.setVisible(true); return barSeries; default: ILineSeries lineSeries = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, seriesName); lineSeries.enableArea(IYSeries.AREA.equals(ySeries.getSeriesType())); lineSeries.setLineStyle(LINE_STYLES.get(getLineStyle(ySeries.getSeriesType(), seriesCount))); lineSeries.setSymbolType(IYSeries.SCATTER.equals(ySeries.getSeriesType()) ? PlotSymbolType.DIAMOND : PlotSymbolType.NONE); lineSeries.setLineColor(color); lineSeries.setVisible(true); return lineSeries; } }

Target:
protected final ISeries addSeries(IYSeries series) { ISeriesSet seriesSet = getSwtChart().getSeriesSet(); int seriesCount = seriesSet.getSeries().length; String seriesName = series.getLabel(); IYSeries ySeries = fModel.getSeries().stream().filter(elem -> elem.getLabel().equals(seriesName)).findAny().orElse(null); if (ySeries == null) { setSeries(seriesName, new double[fModel.getXAxis().length]); ySeries = fModel.getSeries().stream().filter(elem -> elem.getLabel().equals(seriesName)).findAny().get(); } String colorTxt = ySeries.getColor(); Color color = getColor(seriesName, colorTxt); switch (ySeries.getSeriesType()) { case IYSeries.BAR: IBarSeries barSeries = (IBarSeries) seriesSet.createSeries(SeriesType.BAR, seriesName); barSeries.enableStack(true); barSeries.setBarColor(color); barSeries.setBarPadding(0); barSeries.setVisible(true); return barSeries; default: ILineSeries lineSeries = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, seriesName); lineSeries.enableArea(IYSeries.AREA.equals(ySeries.getSeriesType())); lineSeries.setLineStyle(LINE_STYLES.get(getLineStyle(ySeries.getSeriesType(), seriesCount))); lineSeries.setSymbolType(IYSeries.SCATTER.equals(ySeries.getSeriesType()) ? PlotSymbolType.DIAMOND : PlotSymbolType.NONE); lineSeries.setLineColor(color); lineSeries.setVisible(true); return lineSeries; } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(map); if (ContextCompat.checkSelfPermission(this, reqPermission[0]) == PackageManager.PERMISSION_GRANTED) { applyDictionaRendererToGraphics(); } else { int requestCode = 2; ActivityCompat.requestPermissions(this, reqPermission, requestCode); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(map); mMapView.addSpatialReferenceChangedListener(spatialReferenceChangedEvent -> mMapView .setViewpointGeometryAsync(mMapView.getGraphicsOverlays().get(0).getExtent())); requestReadPermission(); }
Source:
public boolean implies(Permission p) { if (!(p instanceof PortalAccessPermission)) { return false; } PortalAccessPermission pp = (PortalAccessPermission) p; for (String portal : pp.portalsAccess) { if (!this.allPortals && !portalsAccess.contains(portal)) { return false; } } return true; }

Target:
public boolean implies(Permission p) { if (!(p instanceof PortalAccessPermission)) { return false; } PortalAccessPermission clientRequest = (PortalAccessPermission) p; if (this.allPortals) { return true; } return portalsAccess.containsAll(clientRequest.portalsAccess); }
Source:
public int[] findJoinPositions(int probePosition, Page probe, int probeGeometryChannel) { Block probeGeometryBlock = probe.getBlock(probeGeometryChannel); if (probeGeometryBlock.isNull(probePosition)) { return EMPTY_ADDRESSES; } Slice slice = probeGeometryBlock.getSlice(probePosition, 0, probeGeometryBlock.getSliceLength(probePosition)); OGCGeometry probeGeometry = deserialize(slice); verify(probeGeometry != null); if (probeGeometry.isEmpty()) { return EMPTY_ADDRESSES; } IntArrayList matchingPositions = new IntArrayList(); Envelope envelope = getEnvelope(probeGeometry); rtree.query(envelope, item -> { GeometryWithPosition geometryWithPosition = (GeometryWithPosition) item; Optional<Double> radius = radiusChannel.map(channel -> getRadius(geometryWithPosition.position)); if (spatialRelationshipTest.apply(geometryWithPosition.ogcGeometry, probeGeometry, radius)) { matchingPositions.add(geometryWithPosition.position); } }); return matchingPositions.toIntArray(null); }

Target:
public int[] findJoinPositions(int probePosition, Page probe, int probeGeometryChannel) { Block probeGeometryBlock = probe.getBlock(probeGeometryChannel); if (probeGeometryBlock.isNull(probePosition)) { return EMPTY_ADDRESSES; } Slice slice = probeGeometryBlock.getSlice(probePosition, 0, probeGeometryBlock.getSliceLength(probePosition)); OGCGeometry probeGeometry = deserialize(slice); verify(probeGeometry != null); if (probeGeometry.isEmpty()) { return EMPTY_ADDRESSES; } IntArrayList matchingPositions = new IntArrayList(); Envelope envelope = getEnvelope(probeGeometry); if (radiusChannel == -1) { rtree.query(envelope, item -> { GeometryWithPosition geometryWithPosition = (GeometryWithPosition) item; if (spatialRelationshipTest.apply(geometryWithPosition.ogcGeometry, probeGeometry, OptionalDouble.empty())) { matchingPositions.add(geometryWithPosition.position); } }); } else { rtree.query(envelope, item -> { GeometryWithPosition geometryWithPosition = (GeometryWithPosition) item; if (spatialRelationshipTest.apply(geometryWithPosition.ogcGeometry, probeGeometry, OptionalDouble.of(getRadius(geometryWithPosition.position)))) { matchingPositions.add(geometryWithPosition.position); } }); } return matchingPositions.toIntArray(null); }
Source:
void poll(RequestRegistrationCallback<GetOperation> requestRegistrationCallback) { if (!maybeProcessDecryptCallbackAndComplete()) { cleanupExpiredInFlightRequests(); checkAndMaybeComplete(true); if (!isOperationComplete()) { fetchRequests(requestRegistrationCallback); } } }

Target:
void poll(RequestRegistrationCallback<GetOperation> requestRegistrationCallback) { cleanupExpiredInFlightRequests(); checkAndMaybeComplete(); if (!isOperationComplete()) { fetchRequests(requestRegistrationCallback); } }
Source:
public ClusterFeatures list() { ClusterFeatures features = new ClusterFeatures(); Set<SupportedAdditionalClusterFeature> addlFeatures = getOptionalEntity(Set.class, QueryType.GetClusterFeaturesByClusterId, new IdQueryParameters(asGuid(clusterId)), clusterId, false); if (addlFeatures != null && !addlFeatures.isEmpty()) { for (SupportedAdditionalClusterFeature entity : addlFeatures) { if (entity.isEnabled()) { features.getClusterFeatures().add(ClusterFeaturesMapper.map(entity.getFeature(), null)); } } } return features; }

Target:
public ClusterFeatures list() { ClusterFeatures features = new ClusterFeatures(); Set<SupportedAdditionalClusterFeature> addlFeatures = getOptionalEntity(Set.class, QueryType.GetClusterFeaturesByClusterId, new IdQueryParameters(asGuid(clusterId)), clusterId, false); if (addlFeatures != null) { for (SupportedAdditionalClusterFeature entity : addlFeatures) { if (entity.isEnabled()) { features.getClusterFeatures().add(ClusterFeaturesMapper.map(entity.getFeature(), null)); } } } return features; }
Source:
public int execute(AtlasDbServices services) { PrintWriter output = new PrintWriter(System.out, true); if (truncateOldQueue) { services.getKeyValueService().truncateTable(AtlasDbConstants.OLD_SCRUB_TABLE); output.println("Truncated the old scrub queue."); } else { run(services.getKeyValueService(), output, MoreObjects.firstNonNull(batchSize, 1000)); } return 0; }

Target:
public int execute(AtlasDbServices services) { Preconditions.checkArgument(!truncateOldQueue || batchSize == null, "Truncating the old scrub queue and specifying a batch size are mutually exclusive options."); PrintWriter output = new PrintWriter(System.out, true); if (truncateOldQueue) { services.getKeyValueService().truncateTable(AtlasDbConstants.OLD_SCRUB_TABLE); output.println("Truncated the old scrub queue."); } else { run(services.getKeyValueService(), output, MoreObjects.firstNonNull(batchSize, 1000)); } return 0; }
Source:
public void readOnlyIsSupportedByDiskInterface() { disk.setReadOnly(true); disk.setDiskInterface(DiskInterface.VirtIO); assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid()); disk.setReadOnly(true); disk.setDiskInterface(DiskInterface.VirtIO_SCSI); assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid()); disk.setReadOnly(false); disk.setDiskInterface(DiskInterface.IDE); assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid()); }

Target:
public void readOnlyIsSupportedByDiskInterface() { disk.setReadOnly(true); disk.setDiskInterface(DiskInterface.VirtIO); assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid()); disk.setReadOnly(false); disk.setDiskInterface(DiskInterface.IDE); assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid()); }
Source:
private void deleteOrphans() { File[] files = new File(repo.getObjectsDirectory(), "pack").listFiles(); if (files == null) { return; } for (File file : files) { if (file.isFile() && isOrphan(file)) { file.delete(); } } }

Target:
private void deleteOrphans() { Path packDir = Paths.get(repo.getObjectsDirectory().getAbsolutePath(), "pack"); DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() { public boolean accept(Path file) throws IOException { String name = file.toFile().getName(); return name != null && name.startsWith("pack") && (name.endsWith("." + PackExt.PACK.getExtension()) || name.endsWith("." + PackExt.BITMAP_INDEX.getExtension()) || name.endsWith( "." + PackExt.INDEX.getExtension())); } }; try { Stream<Path> pathStream = StreamSupport.stream( Files.newDirectoryStream(packDir, filter).spliterator(), false); List<String> names = pathStream .map(path -> path.toFile().getName()) .collect(Collectors.toList()); names.stream().filter(name -> isOrphan(name, names)) .forEach(name -> deleteQuietly(packDir.resolve(name))); } catch (IOException e) { LOG.error(e.getMessage(), e); } }
Source:
public void shouldAttemptMethodAndRetry_withExceptionThrownAndRetryEnabledAndDelayAdjusted() throws Throwable { final RetryableAspect retryableAspect = new RetryableAspect(); final ProceedingJoinPoint mockProceedingJoinPoint = setupSimpleProceedingJoinPointMock(); final int retryDelayInMillis = 3000; final int maxRetries = randomIntInRange(2, 6); final int expectedRuntime = retryDelayInMillis * (maxRetries - 1); final Retryable mockRetryable = setupMockRetryable(maxRetries, retryDelayInMillis); RetryableConfiguration.setRetryableEnabled(true); when(mockProceedingJoinPoint.proceed()).thenThrow(new RetryAspectTestException()); DateTime startDateTime = null; DateTime endDateTime = null; RetryAspectTestException actualException = null; try { startDateTime = DateTime.now(); retryableAspect.attemptMethodAndRetryIfNeeded(mockProceedingJoinPoint, mockRetryable); } catch (final RetryAspectTestException e) { endDateTime = DateTime.now(); actualException = e; } verify(mockProceedingJoinPoint, times(maxRetries)).proceed(); assertNotNull(actualException); assertTrue(startDateTime.plusMillis(expectedRuntime).getMillis() <= endDateTime.getMillis()); }

Target:
public void shouldAttemptMethodAndRetry_withExceptionThrownAndRetryEnabledAndDelayAdjusted() throws Throwable { final RetryableAspect retryableAspect = new RetryableAspect(); final ProceedingJoinPoint mockProceedingJoinPoint = setupSimpleProceedingJoinPointMock(); final long EPSILON_MS = 300; final int retryDelayInMillis = 400; final int maxAttempts = randomIntInRange(2, 6); final int expectedRuntime = retryDelayInMillis * (maxAttempts - 1); final Retryable mockRetryable = setupMockRetryable(maxAttempts, retryDelayInMillis); RetryableConfiguration.setRetryableEnabled(true); when(mockProceedingJoinPoint.proceed()).thenThrow(new RetryAspectTestException()); DateTime startDateTime = null; RetryAspectTestException actualException = null; try { startDateTime = DateTime.now(); retryableAspect.attemptMethodAndRetryIfNeeded(mockProceedingJoinPoint, mockRetryable); } catch (final RetryAspectTestException e) { actualException = e; } verify(mockProceedingJoinPoint, times(maxAttempts)).proceed(); assertNotNull(actualException); final long elapsedMillis = DateTime.now().getMillis() - startDateTime.getMillis(); assertTrue(Math.abs(elapsedMillis - expectedRuntime) < EPSILON_MS); }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } if (tree.is(Tree.Kind.CLASS)) { Symbol.TypeSymbol clazz = ((ClassTree) tree).symbol(); clazz.memberSymbols().stream() .filter(Symbol::isVariableSymbol) .filter(s -> s.type().is(THREAD_LOCAL)) .filter(ThreadLocalCleanupCheck::isNotSuper) .forEach(this::checkThreadLocalField); } else { MethodInvocationTree mit = (MethodInvocationTree) tree; if (THREADLOCAL_SET.matches(mit) && mit.arguments().get(0).is(Tree.Kind.NULL_LITERAL)) { reportIssue(mit, "Use \"remove()\" instead of \"set(null)\"."); } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } if (tree.is(Tree.Kind.CLASS)) { Symbol.TypeSymbol clazz = ((ClassTree) tree).symbol(); if (clazz.type().isSubtypeOf(THREAD_LOCAL)) { return; } clazz.memberSymbols().stream() .filter(Symbol::isVariableSymbol) .filter(s -> s.isPrivate() && s.type().is(THREAD_LOCAL)) .forEach(this::checkThreadLocalField); } else { MethodInvocationTree mit = (MethodInvocationTree) tree; if (THREADLOCAL_SET.matches(mit) && mit.arguments().get(0).is(Tree.Kind.NULL_LITERAL)) { reportIssue(mit, "Use \"remove()\" instead of \"set(null)\"."); } } }
Source:
private NdefMessage decodeNfcBarcodeUri(NfcBarcode nfcBarcode) { final byte URI_PREFIX_HTTP_WWW = (byte) 0x01; final byte URI_PREFIX_HTTPS_WWW = (byte) 0x02; final byte URI_PREFIX_HTTP = (byte) 0x03; final byte URI_PREFIX_HTTPS = (byte) 0x04; NdefMessage message = null; byte[] tagId = nfcBarcode.getTag().getId(); if (tagId[1] == URI_PREFIX_HTTP_WWW || tagId[1] == URI_PREFIX_HTTPS_WWW || tagId[1] == URI_PREFIX_HTTP || tagId[1] == URI_PREFIX_HTTPS) { int end = 2; for (; end < tagId.length - 2; end++) { if (tagId[end] == (byte) 0xfe) { break; } } byte[] payload = new byte[end - 1]; System.arraycopy(tagId, 1, payload, 0, payload.length); NdefRecord uriRecord = new NdefRecord( NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_URI, tagId, payload); message = new NdefMessage(uriRecord); } return message; }

Target:
private NdefMessage decodeNfcBarcodeUri(NfcBarcode nfcBarcode) { final byte URI_PREFIX_HTTP_WWW = (byte) 0x01; final byte URI_PREFIX_HTTPS_WWW = (byte) 0x02; final byte URI_PREFIX_HTTP = (byte) 0x03; final byte URI_PREFIX_HTTPS = (byte) 0x04; NdefMessage message = null; byte[] tagId = nfcBarcode.getTag().getId(); if (tagId.length >= 16 && tagId.length % 16 == 0 && (tagId[1] == URI_PREFIX_HTTP_WWW || tagId[1] == URI_PREFIX_HTTPS_WWW || tagId[1] == URI_PREFIX_HTTP || tagId[1] == URI_PREFIX_HTTPS)) { int end = 2; for (; end < tagId.length - 2; end++) { if (tagId[end] == (byte) 0xfe) { break; } } byte[] payload = new byte[end - 1]; System.arraycopy(tagId, 1, payload, 0, payload.length); NdefRecord uriRecord = new NdefRecord( NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_URI, tagId, payload); message = new NdefMessage(uriRecord); } return message; }
Source:
public static StatefulKnowledgeSession newStatefulKnowledgeSession(KieBase kbase) { RuntimeEnvironmentBuilder builder = null; if ( usePersistence ) { Properties properties = new Properties(); properties.put("driverClassName", "org.h2.Driver"); properties.put("className", "org.h2.jdbcx.JdbcDataSource"); properties.put("user", "sa"); properties.put("password", ""); properties.put("url", "jdbc:h2:tcp://localhost/~/jbpm-db"); properties.put("datasourceName", "jdbc/jbpm-ds"); PersistenceUtil.setupPoolingDataSource(properties); Map<String, String> map = new HashMap<String, String>(); map.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); EntityManagerFactory emf = Persistence.createEntityManagerFactory(properties.getProperty("persistence.persistenceunit.name", "org.jbpm.persistence.jpa"), map); builder = RuntimeEnvironmentBuilder.Factory.get() .newDefaultBuilder() .entityManagerFactory(emf) .addEnvironmentEntry(EnvironmentName.TRANSACTION_MANAGER, com.arjuna.ats.jta.TransactionManager.transactionManager()); } else { builder = RuntimeEnvironmentBuilder.Factory.get() .newDefaultInMemoryBuilder(); } builder.knowledgeBase(kbase); RuntimeManager manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(builder.get()); return (StatefulKnowledgeSession) manager.getRuntimeEngine(EmptyContext.get()).getKieSession(); }

Target:
public static StatefulKnowledgeSession newStatefulKnowledgeSession(KieBase kbase) { RuntimeEnvironmentBuilder builder = null; if ( usePersistence ) { Properties properties = new Properties(); properties.put("driverClassName", "org.h2.Driver"); properties.put("className", "org.h2.jdbcx.JdbcDataSource"); properties.put("user", "sa"); properties.put("password", ""); properties.put("url", "jdbc:h2:tcp://localhost/~/jbpm-db"); properties.put("datasourceName", "jdbc/jbpm-ds"); PersistenceUtil.setupPoolingDataSource(properties); Map<String, String> map = new HashMap<String, String>(); map.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); EntityManagerFactory emf = Persistence.createEntityManagerFactory(properties.getProperty("persistence.persistenceunit.name", "org.jbpm.persistence.jpa"), map); builder = RuntimeEnvironmentBuilder.Factory.get() .newDefaultBuilder() .entityManagerFactory(emf); } else { builder = RuntimeEnvironmentBuilder.Factory.get() .newDefaultInMemoryBuilder(); DeploymentDescriptor descriptor = new DeploymentDescriptorManager().getDefaultDescriptor().getBuilder().auditMode(AuditMode.NONE).get(); builder.addEnvironmentEntry("KieDeploymentDescriptor", descriptor); } builder.knowledgeBase(kbase); RuntimeManager manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(builder.get()); return (StatefulKnowledgeSession) manager.getRuntimeEngine(EmptyContext.get()).getKieSession(); }
Source:
public static Insert addWriteOptions(Insert insert, WriteOptions writeOptions) { Assert.notNull(insert, "Insert must not be null"); addQueryOptions(insert, writeOptions); if (!writeOptions.getTtl().isNegative()) { insert.using(QueryBuilder.ttl(Math.toIntExact(writeOptions.getTtl().getSeconds()))); } if (!(writeOptions.getTimestamp() < 0)) { insert.using(QueryBuilder.timestamp(writeOptions.getTimestamp())); } return insert; }

Target:
public static Insert addWriteOptions(Insert insert, WriteOptions writeOptions) { Assert.notNull(insert, "Insert must not be null"); addQueryOptions(insert, writeOptions); if (!writeOptions.getTtl().isNegative()) { insert.using(QueryBuilder.ttl(Math.toIntExact(writeOptions.getTtl().getSeconds()))); } if (writeOptions.getTimestamp() != null) { insert.using(QueryBuilder.timestamp(writeOptions.getTimestamp())); } return insert; }
Source:
private Set<String> convertGroups(String groups) { if (groups == null) { return Collections.emptySet(); } String[] groupArray = groups.split(","); Set<String> groupsSet = new HashSet<>(groupArray.length); for (String current : groupArray) { String value = current.trim(); if (value.length() > 0) { groupsSet.add(value); } } return Collections.unmodifiableSet(groupsSet); }

Target:
private Set<String> convertGroups(String groups) { if (groups == null) { return Collections.emptySet(); } return Arrays.stream(groups.split(",")) .map(String::trim) .filter(s -> !s.isEmpty()) .collect(Collectors.collectingAndThen(Collectors.toSet(), Collections::unmodifiableSet)); }
Source:
private Date getDateFromDiskDescription(Map<String, Object> map) { try { if (getLastUpdate(map) != null) { return new SimpleDateFormat(OvfParser.formatStrFromDiskDescription).parse(getLastUpdate(map).toString()); } else { log.info("LastUpdate Date is not initialized in the OVF_STORE disk."); } } catch (java.text.ParseException e) { log.errorFormat("LastUpdate Date could not be parsed from disk desscription. Exception: {0}", e); } return null; }

Target:
private Date getDateFromDiskDescription(Map<String, Object> map) { try { Object lastUpdate = map.get(OvfInfoFileConstants.LastUpdated); if (lastUpdate != null) { return new SimpleDateFormat(OvfParser.formatStrFromDiskDescription).parse(lastUpdate.toString()); } else { log.info("LastUpdate Date is not initialized in the OVF_STORE disk."); } } catch (java.text.ParseException e) { log.errorFormat("LastUpdate Date could not be parsed from disk desscription. Exception: {0}", e); } return null; }
Source:
public void renameAndAddField() { RealmMigration migration = new RealmMigration() { @Override public void migrate(DynamicRealm realm, long oldVersion, long newVersion) { realm.schema.get("MigrationFieldRenameAndAdd") .renameField("string1", "string2") .addField("string1", String.class); } }; RealmConfiguration config = configFactory.createConfigurationBuilder() .schema(MigrationFieldRenameAndAdd.class) .schemaVersion(2) .migration(migration) .assetFile("rename-and-add.realm") .build(); Realm realm = Realm.getInstance(config); assertTrue(realm.getSchema().get("MigrationFieldRenameAndAdd").hasField("string1")); assertTrue(realm.getSchema().get("MigrationFieldRenameAndAdd").hasField("string2")); realm.close(); }

Target:
public void renameAndAddField() { final Class<MigrationFieldRenameAndAdd> schemaClass = MigrationFieldRenameAndAdd.class; RealmMigration migration = new RealmMigration() { @Override public void migrate(DynamicRealm realm, long oldVersion, long newVersion) { realm.getSchema().get(schemaClass.getSimpleName()) .renameField("string1", "string2") .addField("string1", String.class); } }; RealmConfiguration config = configFactory.createConfigurationBuilder() .schema(schemaClass) .schemaVersion(2) .migration(migration) .assetFile("rename-and-add.realm") .build(); Realm realm = Realm.getInstance(config); RealmObjectSchema schema = realm.getSchema().get(schemaClass.getSimpleName()); assertTrue(schema.hasField("string1")); assertTrue(schema.hasField("string2")); realm.close(); }
Source:
Set<BeanDefinition> findCandidateBeanDefinitions(String className, Iterable<String> basePackages, Iterable<TypeFilter> excludeFilters) { Pattern pattern = Pattern.compile(".*\\." + className); ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); provider.setEnvironment(environment); provider.setResourceLoader(resourceLoader); provider.setResourcePattern(String.format(CUSTOM_IMPLEMENTATION_RESOURCE_PATTERN, className)); provider.setMetadataReaderFactory(metadataReaderFactory); provider.addIncludeFilter(new RegexPatternTypeFilter(pattern)); for (TypeFilter excludeFilter : excludeFilters) { provider.addExcludeFilter(excludeFilter); } Set<BeanDefinition> definitions = new HashSet<BeanDefinition>(); for (String basePackage : basePackages) { definitions.addAll(provider.findCandidateComponents(basePackage)); } return definitions; }

Target:
Set<BeanDefinition> findCandidateBeanDefinitions(String className, Iterable<String> basePackages, Iterable<TypeFilter> excludeFilters) { Pattern pattern = Pattern.compile(".*\\." + className); ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); provider.setEnvironment(environment); provider.setResourceLoader(resourceLoader); provider.setResourcePattern(String.format(CUSTOM_IMPLEMENTATION_RESOURCE_PATTERN, className)); provider.setMetadataReaderFactory(metadataReaderFactory); provider.addIncludeFilter(new RegexPatternTypeFilter(pattern)); for (TypeFilter excludeFilter : excludeFilters) { provider.addExcludeFilter(excludeFilter); } Set<BeanDefinition> definitions = new HashSet<>(); for (String basePackage : basePackages) { definitions.addAll(provider.findCandidateComponents(basePackage)); } return definitions; }
Source:
public MotorInfoStdView(Composite parent, int style, MinimalMotorViewModel minimalMotorViewModel) { super(parent, style, minimalMotorViewModel); GridLayout glMotorComposite = new GridLayout(1, false); glMotorComposite.verticalSpacing = MOTOR_COMPOSITE_VERTIAL_SPACING; glMotorComposite.marginWidth = MOTOR_COMPOSITE_MARGIN_WIDTH; glMotorComposite.marginHeight = MOTOR_COMPOSITE_MARGIN_HEIGHT; setLayout(glMotorComposite); setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); motorName = new Label(this, SWT.NONE); motorName.setAlignment(SWT.CENTER); GridData gdMotorName = new GridData(SWT.FILL, SWT.TOP, true, false); gdMotorName.minimumWidth = MOTOR_NAME_MINIMUM_WIDTH; gdMotorName.widthHint = MOTOR_NAME_WIDTHHINT; motorName.setLayoutData(gdMotorName); motorName.setText("Motor name"); value = new Label(this, SWT.NONE); value.setAlignment(SWT.CENTER); value.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); value.setText(""); setpoint = new Label(this, SWT.NONE); setpoint.setAlignment(SWT.CENTER); setpoint.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); setpoint.setText(""); minimalMotionIndicator = new MinimalMotionIndicator(this, SWT.NONE); minimalMotionIndicator.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false)); minimalMotionIndicator.setMotor(this.getViewModel().getMotor()); setMouseListeners(); bind(); }

Target:
public MotorInfoStdView(Composite parent, int style, MinimalMotorViewModel minimalMotorViewModel) { super(parent, style, minimalMotorViewModel); GridLayout glMotorComposite = new GridLayout(1, false); glMotorComposite.verticalSpacing = MOTOR_COMPOSITE_VERTIAL_SPACING; glMotorComposite.marginWidth = MOTOR_COMPOSITE_MARGIN_WIDTH; glMotorComposite.marginHeight = MOTOR_COMPOSITE_MARGIN_HEIGHT; setLayout(glMotorComposite); setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); motorName = new Label(this, SWT.NONE); motorName.setAlignment(SWT.CENTER); GridData gdMotorName = new GridData(SWT.FILL, SWT.TOP, true, false); gdMotorName.minimumWidth = MOTOR_NAME_MINIMUM_WIDTH; gdMotorName.widthHint = MOTOR_NAME_WIDTHHINT; motorName.setLayoutData(gdMotorName); motorName.setText("Motor name"); value = new Label(this, SWT.NONE); value.setAlignment(SWT.CENTER); value.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); value.setText(""); value.setToolTipText("The actual position of this motor"); setpoint = new Label(this, SWT.NONE); setpoint.setAlignment(SWT.CENTER); setpoint.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); setpoint.setText(""); setpoint.setToolTipText("The requested position of this motor"); minimalMotionIndicator = new MinimalMotionIndicator(this, SWT.NONE); minimalMotionIndicator.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false)); minimalMotionIndicator.setMotor(this.getViewModel().getMotor()); setMouseListeners(); bind(); }
Source:
private String getTargetWithDialog() { AbstractBranchSelectionDialog dialog; switch (mode) { case MODE_CHECKOUT: dialog = new CheckoutDialog(getShell(), repository); break; case MODE_CREATE: CreateBranchWizard wiz = new CreateBranchWizard(repository); new WizardDialog(getShell(), wiz).open(); return null; case MODE_DELETE: new DeleteBranchDialog(getShell(), repository).open(); return null; case MODE_RENAME: new RenameBranchDialog(getShell(), repository).open(); return null; default: return null; } if (dialog.open() != Window.OK) { return null; } return dialog.getRefName(); }

Target:
private String getTargetWithDialog() { AbstractBranchSelectionDialog dialog; switch (mode) { case MODE_CHECKOUT: dialog = new CheckoutDialog(getShell(), repository); break; case MODE_CREATE: CreateBranchWizard wiz; try { wiz = new CreateBranchWizard(repository, repository.getFullBranch()); } catch (IOException e) { wiz = new CreateBranchWizard(repository); } new WizardDialog(getShell(), wiz).open(); return null; case MODE_DELETE: new DeleteBranchDialog(getShell(), repository).open(); return null; case MODE_RENAME: new RenameBranchDialog(getShell(), repository).open(); return null; default: return null; } if (dialog.open() != Window.OK) { return null; } return dialog.getRefName(); }
Source:
private void setLayoutRestrictions(boolean allowScrollThumb, boolean allowAlphaJump, boolean bias) { ImageView upButton = mPagedListView.findViewById(androidx.car.test.R.id.page_up); ImageView downButton = mPagedListView.findViewById(androidx.car.test.R.id.page_down); Button alphaJump = mPagedListView.findViewById(androidx.car.test.R.id.alpha_jump); View scrollThumb = mPagedListView.findViewById(androidx.car.test.R.id.scrollbar_thumb); View scrollBarView = mPagedListView.findViewById(androidx.car.test.R.id.paged_scroll_view); ViewGroup.LayoutParams params = scrollBarView.getLayoutParams(); int seperateMargin = mPagedListView.getContext().getResources() .getDimensionPixelSize(androidx.car.R.dimen.car_padding_4); int restrictedHeight = mPagedListView.getPaddingTop() + upButton.getHeight() + downButton.getHeight() + mPagedListView.getPaddingBottom() + seperateMargin; if (allowScrollThumb) { restrictedHeight += scrollThumb.getHeight() + seperateMargin; } if (allowAlphaJump) { restrictedHeight += alphaJump.getHeight() + seperateMargin; } if (bias) { restrictedHeight += -1; } params.height = restrictedHeight; try { mActivityRule.runOnUiThread(() -> { scrollBarView.requestLayout(); }); } catch (Throwable throwable) { throwable.printStackTrace(); throw new RuntimeException(throwable); } }

Target:
private void setLayoutRestrictions(boolean allowScrollThumb, boolean allowAlphaJump, boolean bias) { ImageView upButton = mPagedListView.findViewById(R.id.page_up); ImageView downButton = mPagedListView.findViewById(R.id.page_down); Button alphaJump = mPagedListView.findViewById(R.id.alpha_jump); View scrollThumb = mPagedListView.findViewById(R.id.scrollbar_thumb); View scrollBarView = mPagedListView.findViewById(R.id.paged_scroll_view); ViewGroup.LayoutParams params = scrollBarView.getLayoutParams(); int seperateMargin = mPagedListView.getContext().getResources() .getDimensionPixelSize(androidx.car.R.dimen.car_padding_4); int restrictedHeight = mPagedListView.getPaddingTop() + upButton.getHeight() + downButton.getHeight() + mPagedListView.getPaddingBottom() + seperateMargin; if (allowScrollThumb) { restrictedHeight += scrollThumb.getHeight() + seperateMargin; } if (allowAlphaJump) { restrictedHeight += alphaJump.getHeight() + seperateMargin; } if (bias) { restrictedHeight += -1; } params.height = restrictedHeight; try { mActivityRule.runOnUiThread(() -> scrollBarView.requestLayout()); } catch (Throwable throwable) { throwable.printStackTrace(); throw new RuntimeException(throwable); } }
Source:
public void incrementCommentCount() { ++this.commentCount; ++this.unreadCommentCount; setRead(false); }

Target:
public void incrementCommentCount() { ++commentCount; ++unreadCommentCount; read = false; }
Source:
private static Config expand(Config config, int previousTokensCount) { Config.Builder cb = Config.newBuilder(); int tokensCount = 0; for (String key : config.getKeySet()) { Object value = config.get(key); if (value instanceof String) { String expandedValue = Misc.substitute(config, (String) value); if (expandedValue.contains("${")) { tokensCount++; } cb.put(key, expandedValue); } else { cb.put(key, value); } } if (previousTokensCount != tokensCount) { LOG.info(String.format( "Config expansion found %s values with tokens, will recurse", tokensCount)); return expand(config, tokensCount); } else { return cb.build(); } }

Target:
private static Config expand(Config config, int previousTokensCount) { Config.Builder cb = Config.newBuilder().putAll(config); int tokensCount = 0; for (String key : config.getKeySet()) { Object value = config.get(key); if (value instanceof String) { String expandedValue = Misc.substitute(config, (String) value); if (expandedValue.contains("${")) { tokensCount++; } cb.put(key, expandedValue); } else { cb.put(key, value); } } if (previousTokensCount != tokensCount) { return expand(cb.build(), tokensCount); } else { return cb.build(); } }
Source:
public boolean equals(Object obj) { if (obj instanceof GitModelCommit) { GitModelCommit objCommit = (GitModelCommit) obj; return objCommit.getBaseCommit().equals(baseCommit) && objCommit.getRemoteCommit().equals(remoteCommit) && objCommit.getLocation().equals(getLocation()); } return false; }

Target:
public boolean equals(Object obj) { if (obj instanceof GitModelCommit) { GitModelCommit objCommit = (GitModelCommit) obj; RevCommit objBaseCommit = objCommit.getBaseCommit(); return objBaseCommit == null ? baseCommit == null : objBaseCommit .equals(baseCommit) && objCommit.getRemoteCommit().equals(remoteCommit) && objCommit.getLocation().equals(getLocation()); } return false; }
Source:
public Date getDate() { return getDate(); }

Target:
public Date getDate() { return getPickerDate(); }
Source:
protected String[] customCommandLineValidation() { if (PROGRAM.isEmpty()) { return new String[]{"No programs specified with PROGRAM"}; } if ( (PROGRAM.contains(Program.CollectSequencingArtifactMetrics)) ) { List<String> errs = new ArrayList<String>(); if (DB_SNP == null) { errs.add("DB_SNP must be specified for CollectSequencingArtifactMetrics."); } if (INTERVALS == null) { errs.add("INTERVALS must be specified for CollectSequencingArtifactMetrics."); } if (!errs.isEmpty()) { return errs.toArray(new String[errs.size()]); } } programsToRun = new ArrayList<ProgramInterface>(PROGRAM); return super.customCommandLineValidation(); }

Target:
protected String[] customCommandLineValidation() { if (PROGRAM.isEmpty()) { return new String[]{"No programs specified with PROGRAM"}; } programsToRun = new ArrayList<ProgramInterface>(PROGRAM); return super.customCommandLineValidation(); }
Source:
private boolean useCamera(Instrumentation instrumentation, String mode) throws Exception { final UiDevice device = UiDevice.getInstance(instrumentation); AppLauncher.launchPath(instrumentation, new String[]{"Camera"}); new CameraAccessPermissionsWatcher(device).checkForCondition(); device.pressBack(); device.pressHome(); AppLauncher.launchPath(instrumentation, new String[]{"Camera"}); UiObject cameraFrame = device.findObject(new UiSelector().resourceId(Res.CAMERA_FRAME_RES)); if (cameraFrame.waitForExists(3L)) { cameraFrame.click(); cameraFrame.swipeRight(3); } try { UiObject2 cameraModeButton = UiAutomatorPlus.findObjectByRelative( instrumentation, By.res("com.android.camera2:id/selector_icon"), By.text(mode), By.res("com.android.camera2:id/mode_list")); cameraModeButton.click(); } catch(UiObjectNotFoundException e) { Log.d(TAG, "Selected camera mode button not found"); } createTestFile(device); deleteTestFile(device); String originalFileList = listGalleryFiles(instrumentation); AppLauncher.launchPath(instrumentation, new String[]{"Camera"}); new CameraAccessPermissionsWatcher(device).checkForCondition(); createTestFile(device); String fileExt = mode.equals("Camera") ? ".jpg" : ".mp4"; String newFileList = listGalleryFiles(instrumentation); Assert.assertTrue("New file was not added to the gallery", !originalFileList.equals(newFileList) && newFileList.contains(fileExt)); deleteTestFile(device); String lastFileList = listGalleryFiles(instrumentation); return originalFileList.equals(lastFileList); }

Target:
private boolean useCamera(Instrumentation instrumentation, String mode) throws Exception { final UiDevice device = UiDevice.getInstance(instrumentation); AppLauncher.launchPath(instrumentation, new String[]{"Camera"}); new CameraAccessPermissionsWatcher(device).checkForCondition(); device.pressBack(); device.pressHome(); AppLauncher.launchPath(instrumentation, new String[]{"Camera"}); UiObject cameraFrame = device.findObject(new UiSelector().resourceId(Res.CAMERA_FRAME_RES)); if (cameraFrame.waitForExists(3L)) { cameraFrame.click(); cameraFrame.swipeRight(3); } try { UiObject2 cameraModeButton = UiAutomatorPlus.findObjectByRelative( instrumentation, By.res("com.android.camera2:id/selector_icon"), By.text(mode), By.res("com.android.camera2:id/mode_list")); cameraModeButton.click(); } catch(UiObjectNotFoundException e) { Assert.assertTrue("Button to select " + mode + " mode not found", false); } createTestFile(device); deleteTestFile(device); String originalFileList = listGalleryFiles(instrumentation); AppLauncher.launchPath(instrumentation, new String[]{"Camera"}); new CameraAccessPermissionsWatcher(device).checkForCondition(); createTestFile(device); String fileExt = mode.equals("Camera") ? ".jpg" : ".mp4"; String newFileList = listGalleryFiles(instrumentation); Assert.assertTrue("New file was not added to the gallery", !originalFileList.equals(newFileList) && newFileList.contains(fileExt)); deleteTestFile(device); String lastFileList = listGalleryFiles(instrumentation); return originalFileList.equals(lastFileList); }
Source:
private int binarySearch(Tuple[] arr, Tuple key, int startPos, int endPos) { int offset = -1; int start = startPos; int end = endPos; int prevCenter = -1; int centerPos = (start + end) >>> 1; if (arr.length == 0) { LOG.error("arr.length: 0, loadNum: " + loadNum + ", inited: " + inited.get()); return -1; } correctable = false; if (arr.length == 1) { int comp = comparator.compare(arr[0], key); if (comp < 0) { return 0; } else if (comp > 0) { return -1; } correctable = true; return 0; } while (true) { if (end - start == 1) { int comp; if (end == prevCenter) { comp = comparator.compare(arr[start], key); if (comp == 0) { correctable = true; offset = start; } else if (comp < 0) { offset = start; } break; } else { if (end == arr.length) { if (comparator.compare(arr[start], key) == 0) { correctable = true; } offset = start; break; } comp = comparator.compare(arr[end], key); if (comp == 0) { correctable = true; offset = end; } else if (comp > 0) { offset = start; } break; } } int compareResult = comparator.compare(arr[centerPos], key); if (compareResult == 0) { correctable = true; offset = centerPos; break; } else { prevCenter = centerPos; if (compareResult > 0) { end = centerPos; } else { start = centerPos; } centerPos = (start + end) / 2; } } return offset; }

Target:
private int binarySearch(Tuple[] arr, Tuple key, int startPos, int endPos) { int offset = -1; int start = startPos; int end = endPos; int prevCenter = -1; int centerPos = (start + end) >>> 1; if (arr.length == 0) { LOG.error("arr.length: 0, loadNum: " + loadNum + ", inited: " + inited.get()); return -1; } correctable = false; if (arr.length == 1) { int comp = comparator.compare(arr[0], key); if (comp < 0) { return 0; } else if (comp > 0) { return -1; } correctable = true; return 0; } while (true) { if (end - start == 1) { int comp; if (end == prevCenter) { comp = comparator.compare(arr[start], key); if (comp == 0) { correctable = true; offset = start; } else if (comp < 0) { offset = start; } break; } else { if (end == arr.length) { if (comparator.compare(arr[start], key) == 0) { correctable = true; } offset = start; break; } comp = comparator.compare(arr[end], key); if (comp == 0) { correctable = true; offset = end; } else if (comp > 0) { offset = start; } break; } } int compareResult = comparator.compare(arr[centerPos], key); if (compareResult == 0) { correctable = true; offset = centerPos; break; } else { prevCenter = centerPos; if (compareResult > 0) { end = centerPos; } else { start = centerPos; } centerPos = (start + end) >>> 1; } } return offset; }
Source:
private static long getSize(final String propertyKey, final long defaultValue) { final String propertyValue = getProperty(propertyKey); if (propertyValue != null) { return parseSize(propertyKey, propertyValue); } else { return defaultValue; } }

Target:
private static long getSize(final String propertyKey, final long defaultValue) { final String propertyValue = getProperty(propertyKey); if (propertyValue != null) { final long size = parseSize(propertyKey, propertyValue); if (0 <= size && size <= Integer.MAX_VALUE) { return size; } else { throw new ConfigurationException("Value " + size + " for property " + propertyKey + " is too large, must be " + 0 + " <= " + propertyKey + " <= " + Long.MAX_VALUE); } } else { return defaultValue; } }
Source:
public String toString() { return String.format("spUUID = %s, poolVersion = %s", getStoragePoolId().toString(), getCompatibilityVersion()); }

Target:
public String toString() { return String.format("storagePoolId = %s, poolVersion = %s", getStoragePoolId().toString(), getCompatibilityVersion()); }
Source:
private String getMessagesFromMap(final Map<String, String> keyValues) { boolean first = true; StringBuilder builder = new StringBuilder(); builder.append('{'); for (Map.Entry<String, String> entry : keyValues.entrySet()) { if (!first) { builder.append(','); } first = false; builder.append('\''); builder.append(entry.getKey()); builder.append("':'"); builder.append(entry.getValue()); builder.append('\''); } builder.append('}'); return builder.toString(); }

Target:
private String getMessagesFromMap(final Map<String, String> keyValues) { ObjectNode node = new ObjectMapper().createObjectNode(); for (Map.Entry<String, String> entry : keyValues.entrySet()) { node.put(entry.getKey(), entry.getValue()); } return node.toString(); }
Source:
public synchronized String getActivePackageId(String name) throws PackageException { for (Entry<String, PackageState> entry : states.entrySet()) { if (entry.getKey().startsWith(name) && entry.getValue().isInstalled() && getPackage(entry.getKey()).getName().equals(name)) { return entry.getKey(); } } return null; }

Target:
public synchronized String getActivePackageId(String name) throws PackageException { for (Entry<String, PackageState> entry : states.entrySet()) { String pkgId = entry.getKey(); if (pkgId.startsWith(name) && entry.getValue().isInstalled() && getPackage(pkgId).getName().equals(name)) { return pkgId; } } return null; }
Source:
public Boolean getEmailVerified() { if (emailVerified == null && email != null && phone == null && status == AccountStatus.ENABLED) { return Boolean.TRUE; } return emailVerified; }

Target:
public Boolean getEmailVerified() { return emailVerified; }
Source:
public void disposeVMInstall(String id) { IVMInstall vm = null; synchronized (this) { for (int i= 0; i < fVMs.size(); i++) { vm = fVMs.get(i); if (vm.getId().equals(id)) { fVMs.remove(i); break; } } } if (vm != null) { JavaRuntime.fireVMRemoved(vm); } }

Target:
public void disposeVMInstall(String id) { IVMInstall removedVM = null; synchronized (this) { for (int i= 0; i < fVMs.size(); i++) { if (fVMs.get(i).getId().equals(id)) { removedVM = fVMs.remove(i); break; } } } if (removedVM != null) { JavaRuntime.fireVMRemoved(removedVM); } }
Source:
public void trianglesWithNoSizeAreIllegal() throws Exception { thrown.expect(TriangleException.class); new Triangle(0, 0, 0); }

Target:
public void trianglesWithNoSizeAreIllegal() throws TriangleException { thrown.expect(TriangleException.class); new Triangle(0, 0, 0); }
Source:
<T> T getConnection(ConfigurationInstance config) throws ConnectionException { lock.lock(); try { ConnectionHandler<Object> connectionHandler = connectionManager.getConnection(config.getValue()); Object connection = connectionHandler.getConnection(); Reference<Object> connReference = new Reference<>(connection); int count = getConnectionRefCount(connReference) + 1; connections.put(connReference, new Pair(count, connectionHandler)); return (T) connection; } finally { lock.unlock(); } }

Target:
<T> T getConnection(ConfigurationInstance config) throws ConnectionException { ConnectionHandler<Object> connectionHandler = connectionManager.getConnection(config.getValue()); Object connection = connectionHandler.getConnection(); Reference<Object> connReference = new Reference<>(connection); withLock(lock, () -> { ((AtomicInteger) connections.get(connReference, k -> new Pair(new AtomicInteger(0), connectionHandler)) .getFirst()).incrementAndGet(); }); return (T) connection; }