auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void run() { synchronized (entitiesToStopOnShutdown) { log.info("Brooklyn stopOnShutdown shutdown-hook invoked: stopping entities: "+entitiesToStopOnShutdown); List<Task> stops = new ArrayList<Task>(); for (Entity entity: entitiesToStopOnShutdown) { try { stops.add(entity.invoke(Startable.STOP, new MutableMap())); } catch (RuntimeException exc) { if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+entity+" returned error (continuing): "+exc, exc); } } try { for (Task t: stops) { try { Object result = t.get(); if (log.isDebugEnabled()) log.debug("stopOnShutdown of completed: {}", t, result); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+t+" returned error (continuing): "+e, e); Exceptions.propagateIfFatal(e); } } } catch (RuntimeInterruptedException e) { Thread.currentThread().interrupt(); if (log.isDebugEnabled()) log.debug("stopOnShutdown interrupted while waiting for entity-stop tasks; continuing: "+e); } } synchronized (managementContextsToTermianteOnShutdown) { log.info("Brooklyn terminateOnShutdown shutdown-hook invoked: terminating management contexts: "+managementContextsToTermianteOnShutdown); for (ManagementContextInternal managementContext: managementContextsToTermianteOnShutdown) { try { managementContext.terminate(); } catch (RuntimeException e) { log.info("terminateOnShutdown of "+managementContext+" returned error (continuing): "+e, e); } } } }

Target:
public void run() { synchronized (mutex) { log.info("Brooklyn stopOnShutdown shutdown-hook invoked: stopping entities: "+entitiesToStopOnShutdown); List<Task> stops = new ArrayList<Task>(); for (Entity entity: entitiesToStopOnShutdown) { try { stops.add(entity.invoke(Startable.STOP, new MutableMap())); } catch (RuntimeException exc) { if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+entity+" returned error (continuing): "+exc, exc); } } long endTime = System.currentTimeMillis() + shutdownTimeout.toMilliseconds(); for (Task t: stops) { Duration remainingTime = Duration.max(Duration.untilUtc(endTime), Duration.ONE_MILLISECOND); try { Object result = t.getUnchecked(remainingTime); if (log.isDebugEnabled()) log.debug("stopOnShutdown of completed: {}", t, result); } catch (RuntimeInterruptedException e) { Thread.currentThread().interrupt(); endTime = System.currentTimeMillis(); if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+t+" interrupted; (continuing with immediate timeout): "+e); } catch (RuntimeException e) { if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+t+" returned error (continuing): "+e, e); Exceptions.propagateIfFatal(e); } } log.info("Brooklyn terminateOnShutdown shutdown-hook invoked: terminating management contexts: "+managementContextsToTerminateOnShutdown); for (ManagementContextInternal managementContext: managementContextsToTerminateOnShutdown) { try { managementContext.terminate(); } catch (RuntimeException e) { log.info("terminateOnShutdown of "+managementContext+" returned error (continuing): "+e, e); } } } }
Source:
public QualifiedName getQualifiedName() { if (qualifiedName != null) { return qualifiedName; } if (isNested()) { ASTClassOrInterfaceDeclaration parent = this.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class); QualifiedName parentQN = parent.getQualifiedName(); return QualifiedName.makeClassOf(parentQN, this.getImage()); } QualifiedName qname = new QualifiedName(); ASTPackageDeclaration pkg = this.getFirstParentOfType(ASTCompilationUnit.class) .getFirstChildOfType(ASTPackageDeclaration.class); if (pkg != null) { qname.setPackages(pkg.getPackageNameImage().split("\\.")); } qname.setClass(this.getImage()); qualifiedName = qname; return qualifiedName; }

Target:
public QualifiedName getQualifiedName() { if (qualifiedName == null) { if (isNested()) { ASTClassOrInterfaceDeclaration parent = this.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class); QualifiedName parentQN = parent.getQualifiedName(); qualifiedName = QualifiedName.makeNestedClassOf(parentQN, this.getImage()); return qualifiedName; } qualifiedName = QualifiedName.makeOuterClassOf(this); } return qualifiedName; }
Source:
private void downloadTemplateFile() { String zipFileUrl = baseUrlForTemplates; zipFileUrl += createLandscapeProject ? templateData.getLandscape() : templateData.getPortrait(); DownloadTemplateTask downloadTemplateTask = new DownloadTemplateTask(getActivity(), templateData, zipFileUrl); downloadTemplateTask.setOnDownloadTemplateCompleteListener(this); downloadTemplateTask.execute(); }

Target:
private void downloadTemplateFile() { String zipFileUrl = baseUrlForTemplates; zipFileUrl += createLandscapeProject ? templateData.getLandscape() : templateData.getPortrait(); DownloadTemplateTask downloadTask = new DownloadTemplateTask(getActivity(), templateData, zipFileUrl, this); downloadTask.execute(); }
Source:
static final List<Operator> getOperatorList(StreamsConnection sc, String operatorsList) { List<Operator> opList; OperatorArray opArray; try { opArray = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(operatorsList, OperatorArray.class); opList = opArray.operators; for (Operator op : opList) { op.setConnection(sc); } } catch (IllegalStateException e) { opList = new ArrayList<Operator>(); } return opList; }

Target:
static final List<Operator> getOperatorList(StreamsConnection sc, String operatorsList) { List<Operator> opList; OperatorArray opArray; try { opArray = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(operatorsList, OperatorArray.class); opList = opArray.operators; for (Operator op : opList) { op.setConnection(sc); } } catch (JsonSyntaxException e) { opList = Collections.<Operator> emptyList(); } return opList; }
Source:
void testLocalInstanceMethod() { compilationHelper .addSourceLines( "Test.java", "import " + Optional.class.getName() + ';', "class Test {", " public Optional<Integer> foo(Optional<String> optional) {", " " return optional.map(v -> bar(v));", " }", " private Integer bar(String value) {", " return value.length();", " }", "}") .doTest(); }

Target:
void testLocalInstanceMethod() { compile() .addSourceLines( "Test.java", "import " + Optional.class.getName() + ';', "class Test {", " public Optional<Integer> foo(Optional<String> optional) {", " " return optional.map(v -> bar(v));", " }", " private Integer bar(String value) {", " return value.length();", " }", "}") .doTest(); }
Source:
public void sourceRestartedWithDynamicConfig() throws Exception { Long gatheredMoney = HeisenbergSource.gatheredMoney; startFlow("source"); Thread.sleep(TIME_WAIT_MILLIS); assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoney)); stopFlow("source"); gatheredMoney = HeisenbergSource.gatheredMoney; Thread.sleep(TIME_WAIT_MILLIS); assertThat(gatheredMoney, is(HeisenbergSource.gatheredMoney)); startFlow("source"); Thread.sleep(TIME_WAIT_MILLIS); assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoney)); }

Target:
public void sourceRestartedWithDynamicConfig() throws Exception { final Long gatheredMoney = HeisenbergSource.gatheredMoney; startFlow("source"); check(TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> { assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoney)); return true; }); stopFlow("source"); final Long gatheredMoneyAfterStop = HeisenbergSource.gatheredMoney; checkNot(TIME_WAIT_MILLIS, POLL_DELAY_MILLIS, () -> { assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoneyAfterStop)); return true; }); startFlow("source"); check(TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> { assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoneyAfterStop)); return true; }); }
Source:
public void update(final Sensor sensor, final List<Sample> values) { switch (sensor) { case LIGHT: this.light.clear(); this.light.addAll(values); break; case SOUND: this.light.clear(); this.sound.addAll(values); break; case HUMIDITY: this.light.clear(); this.humidity.addAll(values); break; case TEMPERATURE: this.light.clear(); this.temperature.addAll(values); break; case PARTICULATES: this.light.clear(); this.particulates.addAll(values); break; case WAVE_COUNT: this.light.clear(); this.waveCounts.addAll(values); break; case HOLD_COUNT: this.light.clear(); this.holdCounts.addAll(values); break; case SOUND_NUM_DISTURBANCES: this.light.clear(); this.soundNumDisturbances.addAll(values); break; case SOUND_PEAK_DISTURBANCE: this.light.clear(); this.soundPeakDisturbance.addAll(values); break; default: break; } }

Target:
public void update(final Sensor sensor, final List<Sample> values) { switch (sensor) { case LIGHT: this.light.clear(); this.light.addAll(values); break; case SOUND: this.sound.clear(); this.sound.addAll(values); break; case HUMIDITY: this.humidity.clear(); this.humidity.addAll(values); break; case TEMPERATURE: this.temperature.clear(); this.temperature.addAll(values); break; case PARTICULATES: this.particulates.clear(); this.particulates.addAll(values); break; case WAVE_COUNT: this.waveCounts.clear(); this.waveCounts.addAll(values); break; case HOLD_COUNT: this.holdCounts.clear(); this.holdCounts.addAll(values); break; case SOUND_NUM_DISTURBANCES: this.soundNumDisturbances.clear(); this.soundNumDisturbances.addAll(values); break; case SOUND_PEAK_DISTURBANCE: this.soundPeakDisturbance.clear(); this.soundPeakDisturbance.addAll(values); break; default: break; } }
Source:
protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock()) { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = getNetworkDao().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } return null; } }); if (vds.getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { haMaintenanceFailed = true; } } } } logMonitorLockReleased("Activate"); if (vds.getVdsGroupSupportsGlusterService()) { runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); } }

Target:
protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock()) { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = getNetworkDao().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } return null; } }); if (vds.getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { haMaintenanceFailed = true; } } } } logMonitorLockReleased("Activate"); }
Source:
protected void loadServerTemplates() { serverTemplateMap.clear(); widgetView.removeAllServerTemplates(); view.removeAllServerTemplates(); specManagementService.call((ServerTemplateList serverTemplates) -> { FluentIterable.from(serverTemplates.getServerTemplates()) .filter(s -> s.getServerInstanceKeys() != null && !s.getServerInstanceKeys().isEmpty()) .forEach(s -> serverTemplateMap.put(s.getId(), s)); final List<String> ids = serverTemplateMap.keySet().stream().sorted(String.CASE_INSENSITIVE_ORDER).collect(Collectors.toList()); for (String id : ids) { widgetView.addServerTemplate(id); view.addServerTemplate(id); } if (ids.size() == 1) { widgetView.selectServerTemplate(ids.iterator().next()); view.selectServerTemplate(ids.iterator().next()); } else { final ServerTemplate selectedServerTemplate = getSelectedServerTemplate(); if (selectedServerTemplate != null && ids.contains(selectedServerTemplate.getId())) { widgetView.selectServerTemplate(selectedServerTemplate.getId()); view.selectServerTemplate(selectedServerTemplate.getId()); } else { widgetView.clearSelectedServerTemplate(); view.clearSelectedServerTemplate(); if(ids.size() > 1) { String defaultServerTemple = ids.get(0); widgetView.selectServerTemplate(defaultServerTemple); view.selectServerTemplate(defaultServerTemple); } } } widgetView.setVisible(ids.size() > 1); view.setVisible(ids.size() > 1); }).listServerTemplates(); }

Target:
protected void loadServerTemplates() { serverTemplateMap.clear(); widgetView.removeAllServerTemplates(); view.removeAllServerTemplates(); specManagementService.call((ServerTemplateList serverTemplates) -> { FluentIterable.from(serverTemplates.getServerTemplates()) .filter(s -> s.getServerInstanceKeys() != null && !s.getServerInstanceKeys().isEmpty()) .forEach(s -> serverTemplateMap.put(s.getId(), s)); final List<String> ids = serverTemplateMap.keySet().stream().sorted(String.CASE_INSENSITIVE_ORDER).collect(Collectors.toList()); for (String id : ids) { widgetView.addServerTemplate(id); view.addServerTemplate(id); } if (ids.size() == 1) { widgetView.selectServerTemplate(ids.iterator().next()); view.selectServerTemplate(ids.iterator().next()); } else { final ServerTemplate selectedServerTemplate = getSelectedServerTemplate(); if (selectedServerTemplate != null && ids.contains(selectedServerTemplate.getId())) { widgetView.selectServerTemplate(selectedServerTemplate.getId()); view.selectServerTemplate(selectedServerTemplate.getId()); } else { widgetView.clearSelectedServerTemplate(); view.clearSelectedServerTemplate(); if (ids.size() > 1) { String defaultServerTemplate = ids.get(0); widgetView.selectServerTemplate(defaultServerTemplate); view.selectServerTemplate(defaultServerTemplate); } } } widgetView.setVisible(ids.size() > 1); view.setVisible(ids.size() > 1); }).listServerTemplates(); }
Source:
protected void verifyResults(Response response, Map<String, Boolean> results) { for (Map.Entry entry : response.getStringHeaders().entrySet()) { LOG.info("<K, V> ->" + entry); try { String item = entry .getValue() .toString() .split("\\[")[1].split(" ")[1]; if (results.keySet() .contains(item)) { results.put(item.replaceAll(" ", ""), true); } } catch (ArrayIndexOutOfBoundsException e) { LOG.info("[BYPASSED] -> " + entry); } } }

Target:
protected void verifyResults(Response response, Map<String, Boolean> results) { for (Map.Entry entry : response.getStringHeaders().entrySet()) { LOG.info("<K, V> ->" + entry); try { String item = entry .getValue() .toString() .split("\\[")[1].split(" ")[1]; if (results.keySet() .contains(item)) { results.put(item.replaceAll(" ", ""), true); } } catch (ArrayIndexOutOfBoundsException e) { } } }
Source:
public void revoke(Content content) { if (!(content instanceof Item)) { throw new RuntimeException("content " + content.getCanonicalUri() + " not an item, cannot revoke"); } Item item = (Item) content; Set<String> onDemandIds = onDemandHierarchyExpander.expandHierarchy(item).keySet(); for (String onDemandId : onDemandIds) { Task task = createTaskFor(content, Action.DELETE, TVAElementType.ONDEMAND, onDemandId); YouViewResult deleteResult = client.sendDeleteFor(onDemandId); processDeletionResult(task, item, deleteResult); } revocationStore.revoke(content.getCanonicalUri()); }

Target:
public void revoke(Content content) { checkArgument(content instanceof Item, "content " + content.getCanonicalUri() + " not an item, cannot revoke"); Item item = (Item) content; Set<String> onDemandIds = onDemandHierarchyExpander.expandHierarchy(item).keySet(); for (String onDemandId : onDemandIds) { Task task = createTaskFor(content, Action.DELETE, TVAElementType.ONDEMAND, onDemandId); YouViewResult deleteResult = client.sendDeleteFor(onDemandId); processDeletionResult(task, item, deleteResult); } revocationStore.revoke(content.getCanonicalUri()); }
Source:
public <T> InstanceAndVersion<T> createProxy(Optional<TrustContext> trustContext, String uri, Class<T> type, AuxiliaryRemotingParameters parameters) { ClientConfiguration clientConfiguration = ClientOptions.DEFAULT_RETRYING.create( ImmutableList.of(uri), Optional.empty(), trustContext.orElseThrow(() -> new IllegalStateException("CJR requires a trust context"))); return wrapWithVersion(JaxRsClient.create( type, addAtlasDbRemotingAgent(parameters.userAgent()), HOST_METRICS_REGISTRY, clientConfiguration)); }

Target:
public <T> InstanceAndVersion<T> createProxy( Optional<TrustContext> trustContext, String uri, Class<T> type, AuxiliaryRemotingParameters parameters) { ClientOptions relevantOptions = parameters.shouldRetry() ? ClientOptions.DEFAULT_RETRYING : ClientOptions.DEFAULT_NO_RETRYING; ClientConfiguration clientConfiguration = relevantOptions.create( ImmutableList.of(uri), Optional.empty(), trustContext.orElseThrow(() -> new IllegalStateException("CJR requires a trust context"))); return wrapWithVersion(JaxRsClient.create( type, addAtlasDbRemotingAgent(parameters.userAgent()), HOST_METRICS_REGISTRY, clientConfiguration)); }
Source:
public String getDescription() { return "Dropping an Association to generate a ReadLinkAction"; }

Target:
public String getDescription() { return Messages.AssociationToReadLinkActionDropStrategy_Description; }
Source:
private void addAndWatchForChanges(Scene scene, URL cssFile, int index) { scene.getStylesheets().add(index, cssFile.toExternalForm()); try { URI cssUri = cssFile.toURI(); if (!cssUri.toString().contains("jrt")) { LOGGER.debug("CSS URI {}", cssUri); Path cssPath = Paths.get(cssUri).toAbsolutePath(); LOGGER.info("Enabling live reloading of {}", cssPath); fileUpdateMonitor.addListenerForFile(cssPath, () -> { LOGGER.info("Reload css file " + cssFile); DefaultTaskExecutor.runInJavaFXThread(() -> { scene.getStylesheets().remove(cssFile.toExternalForm()); scene.getStylesheets().add(index, cssFile.toExternalForm()); }); }); } } catch (IOException | URISyntaxException | UnsupportedOperationException e) { LOGGER.error("Could not watch css file for changes " + cssFile, e); } }

Target:
private void addAndWatchForChanges(Scene scene, URL cssFile, int index) { scene.getStylesheets().add(index, cssFile.toExternalForm()); try { URI cssUri = cssFile.toURI(); if (!cssUri.toString().contains("jrt")) { LOGGER.debug("CSS URI {}", cssUri); Path cssPath = Paths.get(cssUri).toAbsolutePath(); LOGGER.info("Enabling live reloading of {}", cssPath); fileUpdateMonitor.addListenerForFile(cssPath, () -> { LOGGER.info("Reload css file {}", cssFile); DefaultTaskExecutor.runInJavaFXThread(() -> { scene.getStylesheets().remove(cssFile.toExternalForm()); scene.getStylesheets().add(index, cssFile.toExternalForm()); }); }); } } catch (IOException | URISyntaxException | UnsupportedOperationException e) { LOGGER.error("Could not watch css file for changes " + cssFile, e); } }
Source:
public String getMappedAttributeOfGroupClaimURL(String ClaimURL, RealmConfiguration realmConfiguration) { switch (ClaimURL) { case UserCoreClaimConstants.GROUP_ID_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupIDAttribute); case UserCoreClaimConstants.GROUP_CREATED_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupCreatedDateAttribute); case UserCoreClaimConstants.GROUP_MODIFIED_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupModifiedDateAttribute); default: return null; } }

Target:
public static String getMappedAttributeOfGroupClaimURL(String ClaimURL, RealmConfiguration realmConfiguration) { switch (ClaimURL) { case UserCoreClaimConstants.GROUP_ID_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_ID_ATTRIBUTE); case UserCoreClaimConstants.GROUP_CREATED_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_CREATED_DATE_ATTRIBUTE); case UserCoreClaimConstants.GROUP_MODIFIED_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_MODIFIED_DATE_ATTRIBUTE); default: return null; } }
Source:
public NodeProperty getNodeProperty(String className) { for (NodeProperty p: getNodeProperties()) { if (p.getClass().getName().equals(className)) return p; } return null; }

Target:
public NodeProperty getNodeProperty(String className) { for (NodeProperty p: getNodeProperties()) { if (p.getClass().getName().equals(className)) { return p; } } return null; }
Source:
public void testRouterBasic() throws Exception { Properties props = getNonBlockingRouterProperties(); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); MockClusterMap mockClusterMap = new MockClusterMap(); MockTime mockTime = new MockTime(); router = new NonBlockingRouter(new RouterConfig(verifiableProperties), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(verifiableProperties, null, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, new MockServerLayout(mockClusterMap), mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); assertExpectedThreadCounts(1); setOperationParams(); router.putBlob(putBlobProperties, putUserMetadata, putChannel).get(); router.close(); assertExpectedThreadCounts(0); Future<String> future = router.putBlob(putBlobProperties, putUserMetadata, putChannel); Assert.assertTrue(future.isDone()); RouterException e = (RouterException) ((FutureResult<String>) future).error(); Assert.assertEquals(e.getErrorCode(), RouterErrorCode.RouterClosed); }

Target:
public void testRouterBasic() throws Exception { Properties props = getNonBlockingRouterProperties(); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); MockClusterMap mockClusterMap = new MockClusterMap(); MockTime mockTime = new MockTime(); router = new NonBlockingRouter(new RouterConfig(verifiableProperties), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(verifiableProperties, null, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, new MockServerLayout(mockClusterMap), mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); assertExpectedThreadCounts(1); setOperationParams(); router.putBlob(putBlobProperties, putUserMetadata, putChannel).get(); router.close(); assertExpectedThreadCounts(0); assertClosed(); }
Source:
protected synchronized void processGetBlockBodies(GetBlockBodiesMessage msg) { Iterator<byte[]> bodiesIterator = blockchain.getIteratorOfBodiesByHashes(msg.getBlockHashes()); List<byte[]> bodies = new ArrayList<>(); int sizeSum = 80; while (bodiesIterator.hasNext()) { byte[] body = bodiesIterator.next(); sizeSum += ByteArrayEstimator.estimateSize(body); bodies.add(body); if (sizeSum >= MAX_MESSAGE_SIZE) break; } BlockBodiesMessage response = new BlockBodiesMessage(bodies); sendMessage(response); }

Target:
protected synchronized void processGetBlockBodies(GetBlockBodiesMessage msg) { Iterator<byte[]> bodiesIterator = blockchain.getIteratorOfBodiesByHashes(msg.getBlockHashes()); List<byte[]> bodies = new ArrayList<>(); int sizeSum = 0; while (bodiesIterator.hasNext()) { byte[] body = bodiesIterator.next(); sizeSum += ByteArrayEstimator.estimateSize(body); bodies.add(body); if (sizeSum >= MAX_MESSAGE_SIZE) break; } BlockBodiesMessage response = new BlockBodiesMessage(bodies); sendMessage(response); }
Source:
public RowsToKeepResult getRowsToKeep(int batchSize, long filePosition) { Optional<BitSet> rowsDeleted = getRowsDeleted(); if (rowsDeleted.isPresent() && rowsDeleted.get().cardinality() > 0) { IntArrayList rowsToKeep = new IntArrayList(batchSize); for (int position = 0; position < batchSize; position++) { if (!rowsDeleted.get().get(toIntExact(filePosition) + position)) { rowsToKeep.add(position); } } if (rowsToKeep.size() == batchSize) { return new RowsToKeepResult(true, new IntArrayList(0)); } return new RowsToKeepResult(false, rowsToKeep); } return new RowsToKeepResult(true, new IntArrayList(0)); }

Target:
public RowsToKeepResult getRowsToKeep(int batchSize, long filePosition) { Optional<BitSet> rowsDeleted = getRowsDeleted(); if (rowsDeleted.isPresent() && rowsDeleted.get().cardinality() > 0) { IntArrayList rowsToKeep = new IntArrayList(batchSize); for (int position = 0; position < batchSize; position++) { if (!rowsDeleted.get().get(toIntExact(filePosition) + position)) { rowsToKeep.add(position); } } if (rowsToKeep.size() == batchSize) { return KEEP_ALL; } return new RowsToKeepResult(false, rowsToKeep); } return KEEP_ALL; }
Source:
public void insertDiscovery(List<Token> tokens) throws IOException { batchHistogram.update(tokens.size()); if (tokens.size() == 0) return; Timer.Context ctx = writeTimer.time(); try { BulkRequestBuilder bulk = client.prepareBulk(); for (Token token : tokens) { bulk.add(createSingleRequest(token)); } bulk.execute().actionGet(); } catch (EsRejectedExecutionException esEx) { log.error(("Error during bulk insert to ES with status: [" + esEx.status() + "] " + "with message: [" + esEx.getDetailedMessage() + "]")); } finally { ctx.stop(); } }

Target:
public void insertDiscovery(List<Token> tokens) throws IOException { batchHistogram.update(tokens.size()); if (tokens.size() == 0) return; Timer.Context ctx = writeTimer.time(); try { BulkRequestBuilder bulk = client.prepareBulk(); for (Token token : tokens) { bulk.add(createSingleRequest(token)); } bulk.execute().actionGet(); } catch (EsRejectedExecutionException esEx) { log.error(("Error during bulk insert to ES with status: [" + esEx.status() + "] " + "with message: [" + esEx.getDetailedMessage() + "]")); throw esEx; } finally { ctx.stop(); } }
Source:
public void setChangeAmount(TemporalAmount changeAmount) { assert changeAmount != null : "changeAmount may not be null"; this.changeAmount = changeAmount; }

Target:
public void setChangeAmount(TemporalAmount changeAmount) { this.changeAmount = Objects.requireNonNull(changeAmount, "changeAmount may not be null"); }
Source:
public void setOperatingRate(float operatingRate) { onOperatingRateChanged(operatingRate); }

Target:
public final void setOperatingRate(float operatingRate) { onOperatingRateChanged(operatingRate); }
Source:
public void getPermissions_updatedWithNewRealms_stressTest() { final PermissionManager pm = user.getPermissionManager(); looperThread.closeAfterTest(pm); pm.getPermissions(new PermissionManager.PermissionsCallback() { @Override public void onSuccess(RealmResults<Permission> permissions) { assertTrue(permissions.isLoaded()); assertInitialPermissions(permissions); for (int i = 0; i < 10; i++) { SyncConfiguration configNew = new SyncConfiguration.Builder(user, "realm://127.0.0.1:9080/~/test" + i).build(); Realm newRealm = Realm.getInstance(configNew); looperThread.closeAfterTest(newRealm); } looperThread.keepStrongReference(permissions); permissions.addChangeListener(new RealmChangeListener<RealmResults<Permission>>() { @Override public void onChange(RealmResults<Permission> permissions) { Permission p = permissions.where().endsWith("path", "test9").findFirst(); if (p != null) { assertTrue(p.mayRead()); assertTrue(p.mayWrite()); assertTrue(p.mayManage()); looperThread.testComplete(); } } }); } @Override public void onError(ObjectServerError error) { fail("Could not open Realm: " + error.toString()); } }); }

Target:
public void getPermissions_updatedWithNewRealms_stressTest() { final PermissionManager pm = user.getPermissionManager(); looperThread.closeAfterTest(pm); pm.getPermissions(new PermissionManager.PermissionsCallback() { @Override public void onSuccess(RealmResults<Permission> permissions) { assertTrue(permissions.isLoaded()); assertInitialPermissions(permissions); for (int i = 0; i < 10; i++) { SyncConfiguration configNew = new SyncConfiguration.Builder(user, "realm://127.0.0.1:9080/~/test" + i).build(); Realm newRealm = Realm.getInstance(configNew); looperThread.closeAfterTest(newRealm); } looperThread.keepStrongReference(permissions); permissions.addChangeListener(new RealmChangeListener<RealmResults<Permission>>() { @Override public void onChange(RealmResults<Permission> permissions) { Permission p = permissions.where().endsWith("path", "test9").findFirst(); if (p != null) { assertTrue(p.mayRead()); assertTrue(p.mayWrite()); assertTrue(p.mayManage()); looperThread.testComplete(); } } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); }
Source:
public static void save(Fingerprint fp, File file) throws IOException { if (fp.getPersistedFacets().isEmpty()) { file.getParentFile().mkdirs(); AtomicFileWriter afw = new AtomicFileWriter(file); try { PrintWriter w = new PrintWriter(afw); w.println("<?xml version='1.1' encoding='UTF-8'?>"); w.println("<fingerprint>"); w.print(" <timestamp>"); w.print(DATE_CONVERTER.toString(fp.getTimestamp())); w.println("</timestamp>"); if (fp.getOriginal() != null) { w.println(" <original>"); w.print(" <name>"); w.print(Util.xmlEscape(fp.getOriginal().getName())); w.println("</name>"); w.print(" <number>"); w.print(fp.getOriginal().getNumber()); w.println("</number>"); w.println(" </original>"); } w.print(" <md5sum>"); w.print(fp.getHashString()); w.println("</md5sum>"); w.print(" <fileName>"); w.print(Util.xmlEscape(fp.getFileName())); w.println("</fileName>"); w.println(" <usages>"); for (Map.Entry<String, Fingerprint.RangeSet> e : fp.getUsages().entrySet()) { w.println(" <entry>"); w.print(" <string>"); w.print(Util.xmlEscape(e.getKey())); w.println("</string>"); w.print(" <ranges>"); w.print(Fingerprint.RangeSet.ConverterImpl.serialize(e.getValue())); w.println("</ranges>"); w.println(" </entry>"); } w.println(" </usages>"); w.println(" <facets/>"); w.print("</fingerprint>"); w.flush(); afw.commit(); } finally { afw.abort(); } } else { getConfigFile(file).write(fp); } }

Target:
public static void save(Fingerprint fp, File file) throws IOException { if (fp.getPersistedFacets().isEmpty()) { file.getParentFile().mkdirs(); AtomicFileWriter afw = new AtomicFileWriter(file); try { PrintWriter w = new PrintWriter(afw); w.println("<?xml version='1.1' encoding='UTF-8'?>"); w.println("<fingerprint>"); w.print(" <timestamp>"); w.print(DATE_CONVERTER.toString(fp.getTimestamp())); w.println("</timestamp>"); if (fp.getOriginal() != null) { w.println(" <original>"); w.print(" <name>"); w.print(Util.xmlEscape(fp.getOriginal().getName())); w.println("</name>"); w.print(" <number>"); w.print(fp.getOriginal().getNumber()); w.println("</number>"); w.println(" </original>"); } w.print(" <md5sum>"); w.print(fp.getHashString()); w.println("</md5sum>"); w.print(" <fileName>"); w.print(Util.xmlEscape(fp.getFileName())); w.println("</fileName>"); w.println(" <usages>"); for (Map.Entry<String, Fingerprint.RangeSet> e : fp.getUsages().entrySet()) { w.println(" <entry>"); w.print(" <string>"); w.print(Util.xmlEscape(e.getKey())); w.println("</string>"); w.print(" <ranges>"); w.print(serialize(e.getValue())); w.println("</ranges>"); w.println(" </entry>"); } w.println(" </usages>"); w.println(" <facets/>"); w.print("</fingerprint>"); w.flush(); afw.commit(); } finally { afw.abort(); } } else { getConfigFile(file).write(fp); } }
Source:
public void start(MetricRegistry registry, MetricFilter filter, Set<MetricAttribute> deniedExpansions) { log.warn("Creating Jaeger reporter"); String url = options.get(URL); Duration timeout = Duration.create(Long.valueOf(options.getOrDefault(TIMEOUT_SECOND, DEFAULT_TIMEOUT_SECOND)), 0); JaegerExporterConfiguration configuration = JaegerExporterConfiguration.builder() .setServiceName("nuxeo") .setThriftEndpoint(url) .setDeadline(timeout) .build(); JaegerTraceExporter.createAndRegister(configuration); activated = true; enableTracing(options); }

Target:
public void start(MetricRegistry registry, MetricFilter filter, Set<MetricAttribute> deniedExpansions) { log.warn("Creating Jaeger reporter"); String url = options.get(URL); Duration timeout = Duration.create( DurationUtils.parsePositive(options.get(TIMEOUT), DEFAULT_TIMEOUT).getSeconds(), 0); JaegerExporterConfiguration configuration = JaegerExporterConfiguration.builder() .setServiceName("nuxeo") .setThriftEndpoint(url) .setDeadline(timeout) .build(); JaegerTraceExporter.createAndRegister(configuration); activated = true; enableTracing(options); }
Source:
private AdColonyAppOptions buildAppOptions(MediationRewardedAdConfiguration adConfiguration) { Bundle networkExtras = adConfiguration.getMediationExtras(); AdColonyAppOptions options; if (appOptions != null) { options = appOptions; } else { options = new AdColonyAppOptions(); } if (networkExtras != null) { String userId = networkExtras.getString("user_id"); if (userId != null) { options.setUserID(userId); } } if (adConfiguration.isTestRequest()) { options.setTestModeEnabled(true); } AdColonyUserMetadata userMetadata = new AdColonyUserMetadata(); Location location = adConfiguration.getLocation(); if (location != null) { userMetadata.setUserLocation(location); } options.setUserMetadata(userMetadata); return options; }

Target:
private AdColonyAppOptions buildAppOptions(MediationRewardedAdConfiguration adConfiguration) { Bundle networkExtras = adConfiguration.getMediationExtras(); AdColonyAppOptions options = AdColonyMediationAdapter.getAppOptions(); if (networkExtras != null) { String userId = networkExtras.getString("user_id"); if (userId != null) { options.setUserID(userId); } } if (adConfiguration.isTestRequest()) { options.setTestModeEnabled(true); } AdColonyUserMetadata userMetadata = new AdColonyUserMetadata(); Location location = adConfiguration.getLocation(); if (location != null) { userMetadata.setUserLocation(location); } options.setUserMetadata(userMetadata); return options; }
Source:
private static PatentOrFault parse(DocumentText patent, ImportedPatent importedPatent, PatentMetadataParser parser) { Patent.Builder resultBuilder = fillDataFromImport(Patent.newBuilder(), importedPatent); try { return new PatentOrFault(parser.parse(patent.getText(), resultBuilder).build()); } catch (PatentMetadataParserException e) { log.error("error while parsing xml contents of patent id " + patent.getId() + ", text content: " + patent.getText(), e); return new PatentOrFault(resultBuilder.build(), e); } }

Target:
private static Tuple2<Patent, Fault> parse(DocumentText patent, ImportedPatent importedPatent, PatentMetadataParser parser) { try { Patent.Builder resultBuilder = fillDataFromImport(Patent.newBuilder(), importedPatent); return new Tuple2<>(parser.parse(patent.getText(), resultBuilder).build(), null); } catch (PatentMetadataParserException e) { log.error("error while parsing xml contents of patent id " + patent.getId() + ", text content: " + patent.getText(), e); return new Tuple2<>(null, FaultUtils.exceptionToFault(importedPatent.getApplnNr(), e, null)); } }
Source:
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, final LeafBucketCollector sub) throws IOException { final SortedBinaryDocValues values = valuesSource.bytesValues(ctx); return new LeafBucketCollectorBase(sub, values) { final BytesRefBuilder previous = new BytesRefBuilder(); @Override public void collect(int docId, long owningBucketOrd) throws IOException { if (false == values.advanceExact(docId)) { return; } int valuesCount = values.docValueCount(); previous.clear(); for (int i = 0; i < valuesCount; ++i) { BytesRef bytes = values.nextValue(); if (filter != null && !filter.accept(bytes)) { continue; } if (i > 0 && previous.get().equals(bytes)) { continue; } previous.copyBytes(bytes); long bucketOrdinal = bucketOrds.add(owningBucketOrd, bytes); if (bucketOrdinal < 0) { bucketOrdinal = -1 - bucketOrdinal; collectExistingBucket(sub, docId, bucketOrdinal); } else { collectBucket(sub, docId, bucketOrdinal); } } } }; }

Target:
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, final LeafBucketCollector sub) throws IOException { final SortedBinaryDocValues values = valuesSource.bytesValues(ctx); return new LeafBucketCollectorBase(sub, values) { final BytesRefBuilder previous = new BytesRefBuilder(); @Override public void collect(int docId, long owningBucketOrd) throws IOException { if (false == values.advanceExact(docId)) { return; } int valuesCount = values.docValueCount(); previous.clear(); for (int i = 0; i < valuesCount; ++i) { BytesRef bytes = values.nextValue(); if (filter != null && false == filter.accept(bytes)) { continue; } if (i > 0 && previous.get().equals(bytes)) { continue; } previous.copyBytes(bytes); long bucketOrdinal = bucketOrds.add(owningBucketOrd, bytes); if (bucketOrdinal < 0) { bucketOrdinal = -1 - bucketOrdinal; collectExistingBucket(sub, docId, bucketOrdinal); } else { collectBucket(sub, docId, bucketOrdinal); } } } }; }
Source:
private TmfXYChartViewer getChartViewer() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { SWTBotView viewBot = fBot.viewById(VIEW_ID); final IViewReference viewReference = viewBot.getViewReference(); IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() { @Override public IViewPart run() { return viewReference.getView(true); } }); assertNotNull(viewPart); if (!(viewPart instanceof PatternScatterGraphView)) { fail("Could not instanciate view"); } TmfChartView chartView = (TmfChartView) viewPart; Method viewer = TmfChartView.class.getDeclaredMethod("getChartViewer"); viewer.setAccessible(true); TmfXYChartViewer chartViewer = (TmfXYChartViewer) viewer.invoke(chartView); fScatterChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class)); assertNotNull(fScatterChart); return chartViewer; }

Target:
private TmfXYChartViewer getChartViewer() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { SWTBotView viewBot = fBot.viewById(VIEW_ID); final IViewReference viewReference = viewBot.getViewReference(); IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() { @Override public IViewPart run() { return viewReference.getView(true); } }); assertNotNull(viewPart); assertTrue("Could not instanciate view", viewPart instanceof PatternScatterGraphView); TmfChartView chartView = (TmfChartView) viewPart; Method viewer = TmfChartView.class.getDeclaredMethod("getChartViewer"); viewer.setAccessible(true); TmfXYChartViewer chartViewer = (TmfXYChartViewer) viewer.invoke(chartView); fScatterChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class)); assertNotNull(fScatterChart); return chartViewer; }
Source:
public void testDebugContextRsAllocationCopy2D_Short_Normal() { setupAllocationCopyTests AC = new setupAllocationCopyTests(this, 2, 128, (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs))); int xOff = AC.RN.nextInt(AC.Width); int yOff = AC.RN.nextInt(AC.Height); int xCount = AC.RN.nextInt(AC.Width - xOff); int yCount = AC.RN.nextInt(AC.Height - yOff); Soob.set_dstXOff(xOff); Soob.set_srcXOff(xOff); Soob.set_yOff(yOff); Soob.set_xCount(xCount); Soob.set_yCount(yCount); Soob.set_srcMip(0); Soob.set_dstMip(0); Soob.invoke_test2D(); AC.finishAllocationCopyTests(); boolean result = true; short[] inArray = new short[AC.ArrLen]; short[] outArray = new short[AC.ArrLen]; AC.aIn.copyTo(inArray); AC.aOut.copyTo(outArray); for (int i = 0; i < AC.Height; i++) { for (int j = 0; j < AC.Width; j++) { int pos = i * AC.Width + j; if (yOff <= i && i < yOff + yCount && xOff <= j && j < xOff + xCount) { if (inArray[pos] != outArray[pos]) { result = false; break; } } else { if (outArray[pos] != 0) { result = false; break; } } } } assertTrue(result); RenderScript.releaseAllContexts(); }

Target:
public void testDebugContextRsAllocationCopy2D_Short_Normal() { SetupAllocationCopyTests AC = new SetupAllocationCopyTests(2, 128, (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs)), 0x172d8aba); int xOff = AC.RN.nextInt(AC.Width-AC.Height) + AC.Height; int yOff = AC.RN.nextInt(AC.Height); int xCount = AC.RN.nextInt(AC.Width - xOff); int yCount = AC.RN.nextInt(AC.Height - yOff); Soob.set_dstXOff(xOff); Soob.set_srcXOff(xOff); Soob.set_yOff(yOff); Soob.set_xCount(xCount); Soob.set_yCount(yCount); Soob.set_srcMip(0); Soob.set_dstMip(0); Soob.invoke_test2D(); AC.finishAllocationCopyTests(); boolean result = true; short[] inArray = new short[AC.ArrLen]; short[] outArray = new short[AC.ArrLen]; AC.aIn.copyTo(inArray); AC.aOut.copyTo(outArray); for (int i = 0; i < AC.Height; i++) { for (int j = 0; j < AC.Width; j++) { int pos = i * AC.Width + j; if (yOff <= i && i < yOff + yCount && xOff <= j && j < xOff + xCount) { if (inArray[pos] != outArray[pos]) { result = false; break; } } else { if (outArray[pos] != 0) { result = false; break; } } } } assertTrue(result); RenderScript.releaseAllContexts(); }
Source:
public void close() { try { Thread.sleep(1000); } catch (InterruptedException e) { } isOpened = false; }

Target:
public void close() { try { Thread.sleep(1000); } catch (InterruptedException e) { } isOpened = false; closeLatch.countDown(); }
Source:
private void deflaterSetInputJdk11(ByteBuf uncompressed, ByteBuf out, int len) { if (uncompressed.isDirect()) { if (writeHeader) { writeHeader = false; if (wrapper == ZlibWrapper.GZIP) { out.writeBytes(gzipHeader); } } try { if (wrapper == ZlibWrapper.GZIP) { CRC32_UPDATE_BYTEBUFFER.invoke(crc, uncompressed.nioBuffer()); } DEFLATER_SET_INPUT_BYTEBUFFER.invoke(deflater, uncompressed.nioBuffer()); } catch (IllegalAccessException e) { throw new Error(e); } catch (InvocationTargetException e) { throw new Error(e); } } else { deflaterSetInputJdk6(uncompressed, out, len); } }

Target:
private void deflaterSetInputJdk11(ByteBuf uncompressed, ByteBuf out, int len) { if (uncompressed.isDirect()) { if (writeHeader) { writeHeader = false; if (wrapper == ZlibWrapper.GZIP) { out.writeBytes(gzipHeader); } } try { ByteBuffer nioBuffer = uncompressed.nioBuffer(); if (wrapper == ZlibWrapper.GZIP) { int position = nioBuffer.position(); int limit = nioBuffer.limit(); CRC32_UPDATE_BYTEBUFFER.invoke(crc, nioBuffer); nioBuffer.position(position).limit(limit); } DEFLATER_SET_INPUT_BYTEBUFFER.invoke(deflater, nioBuffer); } catch (IllegalAccessException e) { throw new Error(e); } catch (InvocationTargetException e) { throw new Error(e); } } else { deflaterSetInputJdk6(uncompressed, out, len); } }
Source:
public void handlePostEntitlement(PoolManager manager, Consumer consumer, Map<String, Entitlement> entitlements) { Set<String> stackIds = new HashSet<String>(); for (Entitlement entitlement : entitlements.values()) { if (entitlement.getPool().isStacked()) { stackIds.add(entitlement.getPool().getStackId()); } } List<Pool> subPoolsForStackIds = null; if (!stackIds.isEmpty() && !consumer.isShare() && !consumer.getType().isManifest()) { subPoolsForStackIds = poolCurator.getSubPoolForStackIds(consumer, stackIds); if (CollectionUtils.isNotEmpty(subPoolsForStackIds)) { poolRules.updatePoolsFromStack(consumer, subPoolsForStackIds, false); poolCurator.mergeAll(subPoolsForStackIds, false); } } else { subPoolsForStackIds = new ArrayList<Pool>(); } enforcer.postEntitlement(manager, consumer, entitlements, subPoolsForStackIds); }

Target:
public void handlePostEntitlement(PoolManager manager, Consumer consumer, Map<String, Entitlement> entitlements) { Set<String> stackIds = new HashSet<String>(); for (Entitlement entitlement : entitlements.values()) { if (entitlement.getPool().isStacked()) { stackIds.add(entitlement.getPool().getStackId()); } } List<Pool> subPoolsForStackIds = null; if (!stackIds.isEmpty() && !consumer.isShare() && !consumer.isManifestDistributor()) { subPoolsForStackIds = poolCurator.getSubPoolForStackIds(consumer, stackIds); if (CollectionUtils.isNotEmpty(subPoolsForStackIds)) { poolRules.updatePoolsFromStack(consumer, subPoolsForStackIds, false); poolCurator.mergeAll(subPoolsForStackIds, false); } } else { subPoolsForStackIds = new ArrayList<Pool>(); } enforcer.postEntitlement(manager, consumer, entitlements, subPoolsForStackIds); }
Source:
public void getAllRecipesIfRecipeNamesAreNullTest() { DistroXV1Request distroXV1Request = new DistroXV1Request(); InstanceGroupV1Request instanceGroupV1Request = new InstanceGroupV1Request(); instanceGroupV1Request.setRecipeNames(null); distroXV1Request.setInstanceGroups(Collections.singleton(instanceGroupV1Request)); distroXV1Request.getAllRecipes(); }

Target:
public void getAllRecipesIfRecipeNamesAreNullTest() { DistroXV1Request distroXV1Request = new DistroXV1Request(); InstanceGroupV1Request instanceGroupV1Request = new InstanceGroupV1Request(); instanceGroupV1Request.setRecipeNames(null); distroXV1Request.setInstanceGroups(Collections.singleton(instanceGroupV1Request)); Set<String> allRecipes = distroXV1Request.getAllRecipes(); assertEquals(0, allRecipes.size()); }
Source:
private String getNotificationMessage(LCNotification schedulerBean) { String[] pathParams = schedulerBean.getRegPath().split("/"); String resourceName = pathParams[pathParams.length - 1]; StringBuilder stringBuilder = new StringBuilder("Resource '").append(resourceName).append ("'s lifecycle '").append(schedulerBean.getLcName()).append("' is reaching ").append("lifecycle " + "checkpoint '").append(schedulerBean.getLcCheckpointId()).append("' on ") .append(schedulerBean.getNotificationDate()).append("."); return stringBuilder.toString(); }

Target:
private String getNotificationMessage(LCNotification schedulerBean) { String[] pathParams = schedulerBean.getRegPath().split("/"); String resourceName = pathParams[pathParams.length - 1]; StringBuilder stringBuilder = new StringBuilder("Resource '").append(resourceName).append("'s lifecycle '") .append(schedulerBean.getLcName()).append("' is reaching lifecycle checkpoint '") .append(schedulerBean.getLcCheckpointId()).append("' on ").append(schedulerBean.getNotificationDate()) .append("."); return stringBuilder.toString(); }
Source:
public Builder() { super(ChromeScreenshotReportSource::new); _ignoreCertificateErrors = false; }

Target:
public Builder() { super(ChromeScreenshotReportSource::new); }
Source:
public void savingTemplate() { InfoboxBuilder builder = new InfoboxBuilder(); TemplatePage templatePage = builder.open("savingTemplate") .switchToIFrame() .addRowComponent() .addImageComponent() .save(); builder.verifyCreatedTemplateName("savingTemplate", templatePage); }

Target:
public void savingTemplate() { TemplatePage templatePage = new InfoboxBuilderPage() .open("savingTemplate") .switchToIFrame() .addRowComponent() .addImageComponent() .save(); Assertion.assertEquals("savingtemplate", templatePage.getHeaderText().toLowerCase()); }
Source:
public void testBasicClass() { compiler.getOptions().setLanguageIn(CompilerOptions.LanguageMode.ECMASCRIPT_2015); PolymerClassDefinition def = parseAndExtractClassDefFromClass( LINE_JOINER.join( "class A extends Polymer.Element {", " static get is() { return 'x-element'; }", " static get config() {", " return {", " properties: {", " pets: {", " type: Array,", " notify: true,", " },", " name: String,", " },", " };", " }", "}")); assertNotNull(def); assertEquals(2, def.version); assertTrue(def.target.isName()); assertEquals("A", def.target.getString()); assertNotNull(def.descriptor); assertTrue(def.descriptor.isObjectLit()); assertNull(def.nativeBaseElement); assertNull(def.behaviors); assertThat(def.props).hasSize(2); }

Target:
public void testBasicClass() { compiler.getOptions().setLanguageIn(CompilerOptions.LanguageMode.ECMASCRIPT_2015); PolymerClassDefinition def = parseAndExtractClassDefFromClass( LINE_JOINER.join( "class A extends Polymer.Element {", " static get is() { return 'x-element'; }", " static get properties() {", " return {", " pets: {", " type: Array,", " notify: true,", " },", " name: String", " };", " }", "}")); assertNotNull(def); assertEquals(PolymerClassDefinition.DefinitionType.ES6Class, def.defType); NodeSubject.assertNode(def.target).hasType(Token.NAME); assertEquals("A", def.target.getString()); assertNotNull(def.descriptor); NodeSubject.assertNode(def.descriptor).hasType(Token.OBJECTLIT); assertNull(def.nativeBaseElement); assertNull(def.behaviors); assertThat(def.props).hasSize(2); }