auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static IProject getProject() { CheatSheetView view = ViewUtilities.showCheatSheetView(); if (view != null && view.getContent() != null) { String href = view.getContent().getHref(); if (href != null) { try { URL url = new URL(href); File file = null; if (ProjectExampleUtil.PROTOCOL_FILE.equals(url.getProtocol())) { try { file = new File(new URI(url.toExternalForm())); } catch (Exception e) { file = new File(url.getFile()); } } if (file != null && file.exists()) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IPath location= Path.fromOSString(file.getAbsolutePath()); if (location != null) { IFile iFile= workspace.getRoot().getFileForLocation(location); if (iFile != null) { return iFile.getProject(); } } } } catch (MalformedURLException e) { Activator.log(e); } } } return null; }

Target:
public static IProject getProject() { CheatSheetView view = ViewUtilities.showCheatSheetView(); if (view != null && view.getContent() != null) { String href = view.getContent().getHref(); if (href != null) { try { URL url = new URL(href); File file = null; if (ProjectExampleUtil.PROTOCOL_FILE.equals(url.getProtocol())) { try { file = new File(new URI(url.toExternalForm())); } catch (Exception e) { file = new File(url.getFile()); } } return getProject(file); } catch (MalformedURLException e) { Activator.log(e); } } } IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (page != null) { IEditorPart activeEditor = page.getActiveEditor(); if (activeEditor instanceof SimpleCSEditor || activeEditor instanceof CompCSEditor) { IEditorInput input = activeEditor.getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput)input).getFile(); if (file != null && file.exists()) { return file.getProject(); } } } } return null; }
Source:
public File get(final String bsn, final Version version, Map<String,String> properties, final DownloadListener... listeners) throws Exception { if (!inited) { init(); } final Entry<IMavenProjectFacade,MavenProject> entry = bsnMap.get(bsn); if (entry == null) return null; final MavenProject mavenProject = entry.getValue(); final String projectName = entry.getKey().getProject().getName(); properties.put("sourceProjectName", projectName); final File bundleFile = new File(mavenProject.getBuild().getDirectory(), mavenProject.getBuild().getFinalName() + ".jar"); if (listeners == null || listeners.length == 0) { return bundleFile; } new Job(getName() + " getting " + bsn) { @Override public IStatus run(IProgressMonitor monitor) { String failureReason = null; if (!bundleFile.exists()) { try { MavenUtil.execJarMojo(mavenProject, monitor); } catch (CoreException e) { failureReason = e.getMessage(); } } if (bundleFile.exists() && failureReason == null) { try { Domain domain = Domain.domain(bundleFile); String bundleBsn = domain.getBundleSymbolicName().getKey(); Version bundleVersion = new Version(domain.getBundleVersion()); if (!bsn.equals(bundleBsn)) { failureReason = "Bundle built by maven changed bsn"; } if (version.compareTo(bundleVersion) != 0) { failureReason = "Bundle built by maven changed version"; } } catch (IOException e) { failureReason = e.getMessage(); } } else { failureReason = "Maven build did not create bundle file"; } for (DownloadListener listener : listeners) { try { if (failureReason == null) { listener.success(bundleFile); } else { listener.failure(bundleFile, failureReason); } } catch (Throwable t) { logger.logError("Download listener error", t); } } return Status.OK_STATUS; } }.schedule(); return bundleFile; }

Target:
public File get(final String bsn, final Version version, Map<String,String> properties, final DownloadListener... listeners) throws Exception { if (!inited) { init(); } final Entry<IMavenProjectFacade,MavenProject> entry = bsnMap.get(bsn); if (entry == null) return null; final MavenProject mavenProject = entry.getValue(); final String projectName = entry.getKey().getProject().getName(); properties.put("sourceProjectName", projectName); final File bundleFile = getBundleFile(mavenProject); if (!bundleFile.exists()) { for (DownloadListener listener : listeners) { try { listener.failure(bundleFile, "Could not get bundle file for " + bsn + ":" + version); } catch (Throwable t) { logger.logError("Download listener error", t); } } return null; } for (DownloadListener listener : listeners) { try { listener.success(bundleFile); } catch (Throwable t) { logger.logError("Download listener error", t); } } return bundleFile; }
Source:
public static Function<Resource, Double> toDoubleResourceValue() { return new Function<Resource, Double>() { @Override public Double apply(@Nullable Resource resource) { return resourceValueDouble(Optional.fromNullable(resource)).or(0.0); } }; }

Target:
public static Function<Resource, Double> toDoubleResourceValue() { return ToDoubleResourceValue.INSTANCE; }
Source:
private Mono<PagedResponse<DataPointAnomaly>> listAnomaliesForDetectionConfigSinglePageAsync( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime, ListAnomaliesDetectedOptions options, Context context) { Objects.requireNonNull(detectionConfigurationId, "'detectionConfigurationId' is required."); Objects.requireNonNull(startTime, "'startTime' is required."); Objects.requireNonNull(endTime, "'endTime' is required."); DetectionAnomalyResultQuery query = new DetectionAnomalyResultQuery() .setStartTime(startTime) .setEndTime(endTime); if (options.getFilter() != null) { DetectionAnomalyFilterCondition innerFilter = AnomalyTransforms.toInnerFilter(options.getFilter(), logger); if (innerFilter != null) { query.setFilter(innerFilter); } } final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE); return service.getAnomaliesByAnomalyDetectionConfigurationSinglePageAsync( UUID.fromString(detectionConfigurationId), query, options.getSkip(), options.getTop(), withTracing) .doOnRequest(ignoredValue -> logger.info("Listing anomalies detected")) .doOnSuccess(response -> logger.info("Listed anomalies {}", response)) .doOnError(error -> logger.warning("Failed to list the anomalies detected", error)) .map(response -> AnomalyTransforms.fromInnerPagedResponse(response)); }

Target:
private Mono<PagedResponse<DataPointAnomaly>> listAnomaliesForDetectionConfigSinglePageAsync( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime, ListAnomaliesDetectedOptions options, Context context) { Objects.requireNonNull(detectionConfigurationId, "'detectionConfigurationId' is required."); Objects.requireNonNull(startTime, "'startTime' is required."); Objects.requireNonNull(endTime, "'endTime' is required."); DetectionAnomalyResultQuery query = new DetectionAnomalyResultQuery() .setStartTime(startTime) .setEndTime(endTime); if (options == null) { options = new ListAnomaliesDetectedOptions(); } if (options.getFilter() != null) { DetectionAnomalyFilterCondition innerFilter = AnomalyTransforms.toInnerFilter(options.getFilter(), logger); if (innerFilter != null) { query.setFilter(innerFilter); } } final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE); return service.getAnomaliesByAnomalyDetectionConfigurationSinglePageAsync( UUID.fromString(detectionConfigurationId), query, options.getSkip(), options.getTop(), withTracing) .doOnRequest(ignoredValue -> logger.info("Listing anomalies detected")) .doOnSuccess(response -> logger.info("Listed anomalies {}", response)) .doOnError(error -> logger.warning("Failed to list the anomalies detected", error)) .map(response -> AnomalyTransforms.fromInnerPagedResponse(response)); }
Source:
public ImmutableIgniteableData copy() { return new ImmutableSpongeIgniteableData(this.fireTicks, this.fireDelay); }

Target:
public ImmutableIgniteableData copy() { return this; }
Source:
public static TableSchema projectSchema(TableSchema tableSchema, int[][] projectedFields) { checkArgument(containsPhysicalColumnsOnly(tableSchema), "Projection is only supported for physical columns."); TableSchema.Builder schemaBuilder = TableSchema.builder(); List<TableColumn> tableColumns = tableSchema.getTableColumns(); Map<String, String> nameDomain = new HashMap<>(); String exceptionTemplate = "Get name conflicts for origin fields %s and %s with new name `%s`. " + "When pushing projection into scan, we will concatenate top level names with delimiter '_'. " + "Please rename the origin field names when creating table."; String originFullyQualifiedName; String newName; for (int[] fieldPath : projectedFields) { if (fieldPath.length == 1) { TableColumn column = tableColumns.get(fieldPath[0]); newName = column.getName(); originFullyQualifiedName = String.format("`%s`", column.getName()); if (nameDomain.containsKey(column.getName())) { throw new TableException( String.format(exceptionTemplate, nameDomain.get(newName), originFullyQualifiedName, newName)); } schemaBuilder.field(newName, column.getType()); nameDomain.put(newName, originFullyQualifiedName); } else { TableColumn column = tableColumns.get(fieldPath[0]); DataType dataType = column.getType(); StringBuilder nameBuilder = new StringBuilder(column.getName()); StringBuilder originQualifiedNameBuilder = new StringBuilder("`" + column.getName() + "`"); for (int i = 1; i < fieldPath.length; i++) { RowType rowType = (RowType) dataType.getLogicalType(); nameBuilder.append('_').append(rowType.getFieldNames().get(fieldPath[i])); originQualifiedNameBuilder.append(".`") .append(rowType.getFieldNames().get(fieldPath[i])) .append("`"); dataType = dataType.getChildren().get(fieldPath[i]); } originFullyQualifiedName = originQualifiedNameBuilder.toString(); newName = nameBuilder.toString(); if (nameDomain.containsKey(newName)) { throw new TableException( String.format(exceptionTemplate, originFullyQualifiedName, nameDomain.get(newName), newName)); } schemaBuilder.field(newName, dataType); nameDomain.put(newName, originFullyQualifiedName); } } return schemaBuilder.build(); }

Target:
public static TableSchema projectSchema(TableSchema tableSchema, int[][] projectedFields) { checkArgument(containsPhysicalColumnsOnly(tableSchema), "Projection is only supported for physical columns."); TableSchema.Builder builder = TableSchema.builder(); FieldsDataType fields = (FieldsDataType) DataTypeUtils.projectRow(tableSchema.toRowDataType(), projectedFields); RowType topFields = (RowType) fields.getLogicalType(); for (int i = 0; i < topFields.getFieldCount(); i++) { builder.field(topFields.getFieldNames().get(i), fields.getChildren().get(i)); } return builder.build(); }
Source:
public void vuapResolvedStateIsNotMute(Page page, String slot, String videoIframeSelector) { AdsBaseObject ads = new AdsBaseObject(driver, page.getUrl() + "&" + TURN_ON_RESOLVED_STATE); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, videoIframeSelector); scrollToSlot(slot, ads); vuap.replay(); vuap.mute(); VuapAssertions.verifyVideoUnmuteAndMute(vuap); }

Target:
public void vuapResolvedStateIsNotMute(Page page, String slot, String videoIframeSelector) { AdsBaseObject ads = new AdsBaseObject(driver, this.urlBuilder.getUrlForPage(page, TURN_ON_RESOLVED_STATE)); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, videoIframeSelector); scrollToSlot(slot, ads); vuap.replay(); vuap.mute(); VuapAssertions.verifyVideoUnmuteAndMute(vuap); }
Source:
public void testGetters() { org.apache.bookkeeper.client.api.LedgerMetadata metadata = new LedgerMetadata( 3, 2, 1, DigestType.CRC32, passwd, Collections.emptyMap(), false); assertEquals(3, metadata.getEnsembleSize()); assertEquals(2, metadata.getWriteQuorumSize()); assertEquals(1, metadata.getAckQuorumSize()); assertEquals(org.apache.bookkeeper.client.api.DigestType.CRC32, metadata.getDigestType()); assertEquals(Collections.emptyMap(), metadata.getCustomMetadata()); assertEquals(-1L, metadata.getCtime()); assertEquals(-1L, metadata.getLastEntryId()); assertEquals(0, metadata.getLength()); assertFalse(metadata.isSealed()); assertTrue(metadata.getAllEnsembles().isEmpty()); try { metadata.getEnsembleAt(99L); fail("Should fail to retrieve ensemble if ensembles is empty"); } catch (NoSuchElementException e) { } }

Target:
public void testGetters() { org.apache.bookkeeper.client.api.LedgerMetadata metadata = new LedgerMetadata( 3, 2, 1, DigestType.CRC32, passwd, Collections.emptyMap(), false); assertEquals(3, metadata.getEnsembleSize()); assertEquals(2, metadata.getWriteQuorumSize()); assertEquals(1, metadata.getAckQuorumSize()); assertEquals(org.apache.bookkeeper.client.api.DigestType.CRC32, metadata.getDigestType()); assertEquals(Collections.emptyMap(), metadata.getCustomMetadata()); assertEquals(-1L, metadata.getCtime()); assertEquals(-1L, metadata.getLastEntryId()); assertEquals(0, metadata.getLength()); assertFalse(metadata.isClosed()); assertTrue(metadata.getAllEnsembles().isEmpty()); try { metadata.getEnsembleAt(99L); fail("Should fail to retrieve ensemble if ensembles is empty"); } catch (NoSuchElementException e) { } }
Source:
private static void printCustomerDetails(List<CustomerDto> allCustomers) { allCustomers.forEach(customer -> System.out.println(customer.getFirstName())); }

Target:
private static void printCustomerDetails(List<CustomerDto> allCustomers) { allCustomers.forEach(customer -> LOGGER.info(customer.getFirstName())); }
Source:
public boolean deleteDomain(DomainVO domain, Boolean cleanup) { GlobalLock lock = getGlobalLock("AccountCleanup"); if (lock == null) { s_logger.debug("Couldn't get the global lock"); return false; } if (!lock.lock(30)) { s_logger.debug("Couldn't lock the db"); return false; } try { s_logger.debug("Marking domain id=" + domain.getId() + " as " + Domain.State.Inactive + " before actually deleting it"); domain.setState(Domain.State.Inactive); _domainDao.update(domain.getId(), domain); try { long ownerId = domain.getAccountId(); if (BooleanUtils.toBoolean(cleanup)) { if (!cleanupDomain(domain.getId(), ownerId)) { rollBackState = true; CloudRuntimeException e = new CloudRuntimeException("Failed to clean up domain resources and sub domains, delete failed on domain " + domain.getName() + " (id: " + domain.getId() + ")."); e.addProxyObject(domain.getUuid(), "domainId"); throw e; } } else { checkDomainAccountsNetworksAndResourcesBeforeRemoving(domain); } cleanupDomainOfferings(domain.getId()); CallContext.current().putContextParameter(Domain.class, domain.getUuid()); return true; } catch (Exception ex) { s_logger.error("Exception deleting domain with id " + domain.getId(), ex); if (ex instanceof CloudRuntimeException) throw (CloudRuntimeException)ex; else return false; } finally { if (rollBackState) { s_logger.debug("Changing domain id=" + domain.getId() + " state back to " + Domain.State.Active + " because it can't be removed due to resources referencing to it"); domain.setState(Domain.State.Active); _domainDao.update(domain.getId(), domain); } } } finally { lock.unlock(); rollBackState = false; } }

Target:
public boolean deleteDomain(DomainVO domain, Boolean cleanup) { GlobalLock lock = getGlobalLock("AccountCleanup"); if (lock == null) { s_logger.debug("Couldn't get the global lock"); return false; } if (!lock.lock(30)) { s_logger.debug("Couldn't lock the db"); return false; } try { s_logger.debug("Marking domain id=" + domain.getId() + " as " + Domain.State.Inactive + " before actually deleting it"); domain.setState(Domain.State.Inactive); _domainDao.update(domain.getId(), domain); try { long ownerId = domain.getAccountId(); if (BooleanUtils.toBoolean(cleanup)) { tryCleanupDomain(domain, ownerId); } else { removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain); } cleanupDomainOfferings(domain.getId()); CallContext.current().putContextParameter(Domain.class, domain.getUuid()); return true; } catch (Exception ex) { s_logger.error("Exception deleting domain with id " + domain.getId(), ex); if (ex instanceof CloudRuntimeException) { rollbackDomainState(domain); throw (CloudRuntimeException)ex; } else return false; } } finally { lock.unlock(); } }
Source:
public static ScalarFunction getRoundExpression(List<Expression> children) throws SQLException { final Expression firstChild = children.get(0); final PDataType firstChildDataType = firstChild.getDataType(); final Object obj = children.get(1); TimeUnit tu = null; if(obj instanceof LiteralExpression) { tu = TimeUnit.getTimeUnitIfValid((LiteralExpression)obj); } if(firstChildDataType.isCoercibleTo(PDataType.DATE)) { return new RoundDateExpression(children); } else if(firstChildDataType == PDataType.TIMESTAMP) { if(tu == TimeUnit.MILLISECOND) { return new RoundTimestampExpression(children); } return new RoundDateExpression(children); } else if(firstChildDataType.isCoercibleTo(PDataType.DECIMAL)) { return new RoundDecimalExpression(children); } else { throw new TypeMismatchException(firstChildDataType, "1"); } }

Target:
public static ScalarFunction getRoundExpression(List<Expression> children) throws SQLException { final Expression firstChild = children.get(0); final PDataType firstChildDataType = firstChild.getDataType(); if(firstChildDataType.isCoercibleTo(PDataType.DATE)) { return new RoundDateExpression(children); } else if (firstChildDataType == PDataType.TIMESTAMP || firstChildDataType == PDataType.UNSIGNED_TIMESTAMP) { Object secondChild = ((LiteralExpression)children.get(1)).getValue(); String timeUnit = secondChild == null ? null : secondChild.toString(); TimeUnit tu = TimeUnit.getTimeUnit(timeUnit); LiteralExpression multiplierExpr = (LiteralExpression)children.get(2); if(tu == TimeUnit.MILLISECOND && ((Number)multiplierExpr.getValue()).intValue() == 1) { return RoundTimestampExpression.create(firstChild, multiplierExpr); } return new RoundDateExpression(children); } else if(firstChildDataType.isCoercibleTo(PDataType.DECIMAL)) { return new RoundDecimalExpression(children); } else { throw new TypeMismatchException(firstChildDataType, "1"); } }
Source:
private void processInstrumented(VCastDataStore dataStore, VCastInstrumentedFile instrumentedFile) throws Exception { VCastSourceFileJoin sourceFile = null; try { sourceFile = dataStore.getSourceFileJoin(instrumentedFile); } catch (OseeCoreException ex) { throw new OseeCoreException(ex, "SQL error while reading source_files for instrumented_file id:%s", instrumentedFile.getId()); } if (sourceFile != null) { int fileNum = sourceFile.getUnitIndex(); String lisFileName_badPath = instrumentedFile.getLISFile(); if (!Strings.isValid(lisFileName_badPath)) { } String normalizedPath = lisFileName_badPath.replaceAll("\\\\", "/"); File f = new File(normalizedPath); String lisFileName = f.getName(); VCastLisFileParser lisFileParser = new VCastLisFileParser(lisFileName, vCastDir); Collection<VCastFunction> functions = Collections.emptyList(); try { functions = dataStore.getFunctions(instrumentedFile); } catch (OseeCoreException ex) { throw new OseeCoreException(ex, "SQL error while reading functions for instrumented_file id:", instrumentedFile.getId()); } for (VCastFunction function : functions) { processFunction(lisFileName, lisFileParser, fileNum, dataStore, instrumentedFile, function); } } }

Target:
private void processInstrumented(VCastDataStore dataStore, VCastInstrumentedFile instrumentedFile) throws Exception { VCastSourceFileJoin sourceFile = null; try { sourceFile = dataStore.getSourceFileJoin(instrumentedFile); } catch (OseeCoreException ex) { throw new OseeCoreException(ex, "SQL error while reading source_files for instrumented_file id:%s", instrumentedFile.getId()); } if (sourceFile != null) { int fileNum = sourceFile.getUnitIndex(); String lisFileName_badPath = instrumentedFile.getLISFile(); if (!Strings.isValid(lisFileName_badPath)) { } String normalizedPath = lisFileName_badPath.replaceAll("\\\\", "/"); File f = new File(normalizedPath); String lisFileName = f.getName(); VCastLisFileParser lisFileParser = new VCastLisFileParser(lisFileName, vCastDir); Collection<VCastFunction> functions = Collections.emptyList(); try { functions = dataStore.getFunctions(instrumentedFile); } catch (OseeCoreException ex) { throw new OseeCoreException(ex, "SQL error while reading functions for instrumented_file id: %d", instrumentedFile.getId()); } for (VCastFunction function : functions) { processFunction(lisFileName, lisFileParser, fileNum, dataStore, instrumentedFile, function); } } }
Source:
public void clearStatistics(Collection<String> cacheNames) throws IgniteCheckedException { Collection<IgniteInternalCache> caches = manageStatisticsCaches(cacheNames); Collection<String> globalCaches = new HashSet<>(caches.size()); for (IgniteInternalCache cache : caches) { if(!cache.context().isLocal() && cache.clusterMxBean().isStatisticsEnabled()) globalCaches.add(cache.name()); } if (globalCaches.isEmpty()) return; CacheStatisticsClearMessage msg = new CacheStatisticsClearMessage(UUID.randomUUID(), globalCaches); EnableStatisticsFuture fut = new EnableStatisticsFuture(msg.requestId()); manageStatisticsFuts.put(msg.requestId(), fut); ctx.grid().context().discovery().sendCustomEvent(msg); fut.get(); }

Target:
public void clearStatistics(Collection<String> cacheNames) throws IgniteCheckedException { Collection<IgniteInternalCache> caches = manageStatisticsCaches(cacheNames); Collection<String> globalCaches = new HashSet<>(U.capacity(caches.size())); for (IgniteInternalCache cache : caches) { if (!cache.context().isLocal()) globalCaches.add(cache.name()); } if (globalCaches.isEmpty()) return; CacheStatisticsClearMessage msg = new CacheStatisticsClearMessage(UUID.randomUUID(), globalCaches); EnableStatisticsFuture fut = new EnableStatisticsFuture(msg.requestId()); manageStatisticsFuts.put(msg.requestId(), fut); ctx.grid().context().discovery().sendCustomEvent(msg); fut.get(); }
Source:
synchronized void start(Context context, long googleApiConnectTimeout, boolean force) { if (isStarted && !force) { return; } isStarted = true; if (PlayServicesHelpers.isAvailable(context)) { Log.d(TAG, "Configuring location provider for Google Play Services"); stopLocationUpdatesWithPlayServices(); mGoogleApiClient = new GoogleApiClient.Builder(context) .addApi(LocationServices.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); googleApiStartupLatch = new CountDownLatch(1); mGoogleApiClient.connect(); if (googleApiConnectTimeout > 0) { try { googleApiStartupLatch.await(googleApiConnectTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } } } else { Log.d(TAG, "Configuring the default Android location provider"); stopLocationUpdatesWithoutPlayServices(); mLocationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE); if (mLocationManager == null) { Log.e(TAG, "Cannot retrieve the location manager"); return; } startLocationUpdatesWithoutPlayServices(); } }

Target:
synchronized void start(Context context, long googleApiConnectTimeout, boolean force) { if (isStarted && !force) { return; } isStarted = true; boolean isPlayServicesAvailable = PlayServicesHelpers.isAvailable(context); if (isPlayServicesAvailable) { Log.d(TAG, "Configuring location provider for Google Play Services"); stopLocationUpdatesWithPlayServices(); mGoogleApiClient = new GoogleApiClient.Builder(context) .addApi(LocationServices.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); googleApiStartupLatch = new CountDownLatch(1); mGoogleApiClient.connect(); if (googleApiConnectTimeout > 0) { try { googleApiStartupLatch.await(googleApiConnectTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Log.w(TAG, e); } } } if (!isPlayServicesAvailable || mGoogleApiClient == null) { Log.d(TAG, "Configuring the default Android location provider"); stopLocationUpdatesWithoutPlayServices(); mLocationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE); if (mLocationManager == null) { Log.e(TAG, "Cannot retrieve the location manager"); return; } startLocationUpdatesWithoutPlayServices(); } }
Source:
public void basicTest() { DiagnosticsStreamMessage diagnosticsStreamMessage = getDiagnosticsStreamMessage(); Collection<DiagnosticsExceptionEvent> exceptionEventList = getExceptionList(); diagnosticsStreamMessage.addDiagnosticsExceptionEvents(exceptionEventList); diagnosticsStreamMessage.addProcessorStopEvents(getProcessorStopEventList()); diagnosticsStreamMessage.addContainerModels(getSampleContainerModels()); Assert.assertTrue(diagnosticsStreamMessage.getContainerMb().equals(1024)); Assert.assertTrue(diagnosticsStreamMessage.getContainerNumCores().equals(2)); Assert.assertTrue(diagnosticsStreamMessage.getNumStoresWithChangelog().equals(3)); Assert.assertTrue(exceptionEventList.equals(diagnosticsStreamMessage.getExceptionEvents())); Assert.assertEquals(getSampleContainerModels(), diagnosticsStreamMessage.getContainerModels()); Assert.assertEquals(diagnosticsStreamMessage.getProcessorStopEvents(), getProcessorStopEventList()); }

Target:
public void basicTest() { DiagnosticsStreamMessage diagnosticsStreamMessage = getDiagnosticsStreamMessage(); Collection<DiagnosticsExceptionEvent> exceptionEventList = getExceptionList(); diagnosticsStreamMessage.addDiagnosticsExceptionEvents(exceptionEventList); diagnosticsStreamMessage.addProcessorStopEvents(getProcessorStopEventList()); diagnosticsStreamMessage.addContainerModels(getSampleContainerModels()); Assert.assertEquals(1024, (int) diagnosticsStreamMessage.getContainerMb()); Assert.assertEquals(2, (int) diagnosticsStreamMessage.getContainerNumCores()); Assert.assertEquals(3, (int) diagnosticsStreamMessage.getNumStoresWithChangelog()); Assert.assertEquals(exceptionEventList, diagnosticsStreamMessage.getExceptionEvents()); Assert.assertEquals(getSampleContainerModels(), diagnosticsStreamMessage.getContainerModels()); Assert.assertEquals(diagnosticsStreamMessage.getProcessorStopEvents(), getProcessorStopEventList()); }
Source:
public void saveValidityBackup() throws IOException { final String backupValidityKey = _sessionIdFormat.createBackupKey( _validityKey ); final int maxInactiveInterval = _session.getMaxInactiveInterval(); final int expiration = maxInactiveInterval <= 0 ? 0 : maxInactiveInterval; _memcached.set( backupValidityKey, toMemcachedExpiration(expiration), _validityData ); }

Target:
public void saveValidityBackup() { final String backupValidityKey = _sessionIdFormat.createBackupKey( _validityKey ); final int maxInactiveInterval = _session.getMaxInactiveInterval(); final int expiration = maxInactiveInterval <= 0 ? 0 : maxInactiveInterval; _memcached.set( backupValidityKey, toMemcachedExpiration(expiration), _validityData ); }
Source:
private static TemporalType find( int temporalType ) { if ( temporalType < TYPES.length ) { return TYPES[temporalType]; } else { return TEMPORAL_INVALID; } }

Target:
private static TemporalType find( int temporalType ) { if ( temporalType < TYPES.length && temporalType >= 0 ) { return TYPES[temporalType]; } else { return TEMPORAL_INVALID; } }
Source:
public static <T> Class<T> classForName(ResourceLoader resourceLoader, String className) { try { return cast(resourceLoader.classForName(className)); } catch (Exception e) { CommonLogger.LOG.cannotLoadClassUsingResourceLoader(className); CommonLogger.LOG.catchingTrace(e); } try { return cast(Class.forName(className)); } catch (Exception e) { throw CommonLogger.LOG.cannotLoadClass(className, e); } catch (LinkageError e) { throw new ResourceLoadingException("Error loading class " + className, e); } }

Target:
public static <T> Class<T> classForName(ResourceLoader resourceLoader, String className) { try { return cast(resourceLoader.classForName(className)); } catch (Exception e) { CommonLogger.LOG.cannotLoadClassUsingResourceLoader(className); CommonLogger.LOG.catchingTrace(e); } try { return cast(Class.forName(className)); } catch (Exception | LinkageError e) { throw CommonLogger.LOG.cannotLoadClass(className, e); } }
Source:
Mono<Response<ConfigurationSetting>> setReadOnly(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.lockKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, context) .doOnRequest(ignoredValue -> logger.info("Setting read only ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Set read only ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.info("Failed to set read only ConfigurationSetting - {}", setting, error)); }

Target:
Mono<Response<ConfigurationSetting>> setReadOnly(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.lockKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, context) .doOnSubscribe(ignoredValue -> logger.verbose("Setting read only ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Set read only ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to set read only ConfigurationSetting - {}", setting, error)); }
Source:
protected void executeVmCommand() { ImagesHandler.setDiskAlias(getParameters().getDiskInfo(), getVm()); if (resizeDiskImageRequested()) { extendDiskImageSize(); } else { try { performDiskUpdate(false); List<Pair<VM, VmDevice>> vmsForDisk = getVmDAO().getVmsWithPlugInfo(getParameters().getDiskId()); for (Pair<VM, VmDevice> pair : vmsForDisk) { getVmStaticDAO().incrementDbGeneration(pair.getFirst().getId()); } } finally { freeLock(); } } }

Target:
protected void executeVmCommand() { ImagesHandler.setDiskAlias(getParameters().getDiskInfo(), getVm()); if (resizeDiskImageRequested()) { extendDiskImageSize(); } else { try { performDiskUpdate(false); } finally { freeLock(); } } }
Source:
public boolean canHandleType(Class<?> payloadType) { return inspector.getHandlers(listenerType) .filter(messageHandler -> !messageHandler.hasAnnotation(ResetHandler.class)) .anyMatch(handler -> handler.canHandleType(payloadType)); }

Target:
public boolean canHandleType(Class<?> payloadType) { return inspector.getHandlers(listenerType) .filter(this::handlesEventMessage) .anyMatch(handler -> handler.canHandleType(payloadType)); }
Source:
private void setSessionToken(ResourceId resourceId, String collectionName, String token) { String partitionKeyRangeId; ISessionToken parsedSessionToken; String[] tokenParts = StringUtils.split(token, ':'); partitionKeyRangeId = tokenParts[0]; parsedSessionToken = SessionTokenHelper.parse(tokenParts[1]); if (logger.isTraceEnabled()) { logger.trace("UPDATE SESSION token {}", resourceId.getUniqueDocumentCollectionId(), collectionName, parsedSessionToken); } boolean isKnownCollection; this.readLock.lock(); try { isKnownCollection = this.collectionNameToCollectionResourceId.containsKey(collectionName) && this.collectionResourceIdToCollectionName.containsKey(resourceId.getUniqueDocumentCollectionId()) && this.collectionNameToCollectionResourceId.get(collectionName) == resourceId.getUniqueDocumentCollectionId() && this.collectionResourceIdToCollectionName.get(resourceId.getUniqueDocumentCollectionId()).equals(collectionName); if (isKnownCollection) { this.addSessionToken(resourceId, partitionKeyRangeId, parsedSessionToken); } } finally { this.readLock.unlock(); } if (!isKnownCollection) { this.writeLock.lock(); try { if (resourceId.getUniqueDocumentCollectionId() != 0) { this.collectionNameToCollectionResourceId.compute(collectionName, (k, v) -> resourceId.getUniqueDocumentCollectionId()); this.collectionResourceIdToCollectionName.compute(resourceId.getUniqueDocumentCollectionId(), (k, v) -> collectionName); } addSessionToken(resourceId, partitionKeyRangeId, parsedSessionToken); } finally { this.writeLock.unlock(); } } }

Target:
private void setSessionToken(ResourceId resourceId, String collectionName, String token) { String partitionKeyRangeId; ISessionToken parsedSessionToken; String[] tokenParts = StringUtils.split(token, ':'); partitionKeyRangeId = tokenParts[0]; parsedSessionToken = SessionTokenHelper.parse(tokenParts[1]); if (logger.isTraceEnabled()) { logger.trace("UPDATE SESSION token {}", resourceId.getUniqueDocumentCollectionId(), collectionName, parsedSessionToken); } boolean isKnownCollection; this.readLock.lock(); try { isKnownCollection = this.collectionNameToCollectionResourceId.containsKey(collectionName) && this.collectionResourceIdToCollectionName.containsKey(resourceId.getUniqueDocumentCollectionId()) && this.collectionNameToCollectionResourceId.get(collectionName) == resourceId.getUniqueDocumentCollectionId() && this.collectionResourceIdToCollectionName.get(resourceId.getUniqueDocumentCollectionId()).equals(collectionName); if (isKnownCollection) { this.addSessionToken(resourceId, partitionKeyRangeId, parsedSessionToken); } } finally { this.readLock.unlock(); } if (!isKnownCollection) { this.writeLock.lock(); try { if (collectionName != null && resourceId.getUniqueDocumentCollectionId() != 0) { this.collectionNameToCollectionResourceId.compute(collectionName, (k, v) -> resourceId.getUniqueDocumentCollectionId()); this.collectionResourceIdToCollectionName.compute(resourceId.getUniqueDocumentCollectionId(), (k, v) -> collectionName); } addSessionToken(resourceId, partitionKeyRangeId, parsedSessionToken); } finally { this.writeLock.unlock(); } } }
Source:
public void cleanup() { buildConfigs.forEach(bc -> cleanUpResource(client, bc)); cleanUpResource(client, project); }

Target:
public static void cleanup() { cleanUpResource(client, project); }
Source:
public Long getLimit(String capability) { Long val = capabilityLimitMap.get(capability); if (capability.equals(CAPABILITY_OFFHEAP) && isSubscriptionBasedLicense()) { if (val != null) { return val; } return UNLIMITED_STORAGE_AMT_IN_MB; } return val; }

Target:
public Long getLimit(String capability) { return capabilityLimitMap.get(capability); }
Source:
public void close() { enabled.set(false); if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } }

Target:
public void close() { if (enabled.compareAndSet(true, false)) { if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } } }
Source:
public void testMarkerColor() { RGBAColor rgbaColor; RGBA rgbaColorToCompare; String[] testColors = X11TestColors.getColors(); for (int i = 0; i < testColors.length; i++) { TraceMarker traceMarker = new TraceMarker("Marker" + String.valueOf(i), null, fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), testColors[i]); String hexColor = X11ColorUtils.toHexColor(testColors[i]); if (hexColor != null) { rgbaColor = new RGBAColor(Integer.parseInt(hexColor.substring(1), 16)); rgbaColorToCompare = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); } else { fail(X11_COLOR_ERROR_MESSAGE); } } TraceMarker traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), ""); String hexColor = X11ColorUtils.toHexColor(DEFAULT_COLOR); if (hexColor != null) { rgbaColor = new RGBAColor(Integer.parseInt(hexColor.substring(1), 16)); rgbaColorToCompare = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), "invalid"); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), null); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); } else { fail(X11_COLOR_ERROR_MESSAGE); } }

Target:
public void testMarkerColor() { RGBAColor rgbaColor; RGBA rgbaColorToCompare; for (int i = 0; i < TEST_COLORS.length; i++) { TraceMarker traceMarker = new TraceMarker("Marker" + String.valueOf(i), null, fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), TEST_COLORS[i]); String hexColor = X11ColorUtils.toHexColor(TEST_COLORS[i]); assertNotNull(hexColor); rgbaColor = new RGBAColor(Integer.parseInt(hexColor.substring(1), 16)); rgbaColorToCompare = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); } TraceMarker traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), ""); String hexColor = X11ColorUtils.toHexColor(DEFAULT_COLOR); assertNotNull(hexColor); rgbaColor = new RGBAColor(Integer.parseInt(hexColor.substring(1), 16)); rgbaColorToCompare = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), "invalid"); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), null); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); }
Source:
public Deregistration removeRegistration(String registrationId) { try (Jedis j = pool.getResource()) { byte[] regKey = toRegIdKey(registrationId); byte[] ep = j.get(regKey); if (ep == null) { return null; } byte[] data = j.get(toEndpointKey(ep)); if (data == null) { return null; } Registration r = deserializeReg(data); deleteClient(j, r); Collection<Observation> obsRemoved = unsafeRemoveAllObservations(j, r.getId()); return new Deregistration(r, obsRemoved); } }

Target:
public Deregistration removeRegistration(String registrationId) { try (Jedis j = pool.getResource()) { byte[] regKey = toRegIdKey(registrationId); byte[] ep = j.get(regKey); if (ep == null) { return null; } byte[] data = j.get(toEndpointKey(ep)); if (data == null) { return null; } Registration r = deserializeReg(data); deleteRegistration(j, r); Collection<Observation> obsRemoved = unsafeRemoveAllObservations(j, r.getId()); return new Deregistration(r, obsRemoved); } }
Source:
public void visitIfStatement(IfStatementTree tree) { super.visitIfStatement(tree); boolean elseClauseReturnsBoolean = tree.elseClause() != null && returnsBoolean(getStatement(tree.elseClause().statements())); boolean mainClauseReturnsBoolean = returnsBoolean(getStatement(tree.statements())); if (tree.elseifClauses().isEmpty() && mainClauseReturnsBoolean && elseClauseReturnsBoolean) { context().newIssue(KEY, MESSAGE).tree(tree); } }

Target:
public void visitIfStatement(IfStatementTree tree) { super.visitIfStatement(tree); if (!tree.elseifClauses().isEmpty() || tree.elseClause() == null) { return; } if (returnsBoolean(getSingleStatement(tree.statements())) && returnsBoolean(getSingleStatement(tree.elseClause().statements()))) { context().newIssue(KEY, MESSAGE).tree(tree); } }
Source:
public void uploadAttachment(UploadedFile file) throws IOException { Attachment attachment = new Attachment(file, loggedUser.getCurrent(), clientIp.get()); attachments.save(attachment); fileStorage.save(attachment); result.use(json()).withoutRoot().from(attachment).serialize(); }

Target:
public void uploadAttachment(UploadedFile file) throws IOException { Attachment attachment = new Attachment(file, loggedUser.getCurrent(), clientIp.get()); attachments.save(attachment); result.use(json()).withoutRoot().from(attachment).serialize(); }
Source:
public ConjurerFirehoseFactory( @JsonProperty("startTime") Long startTime, @JsonProperty("stopTime") Long stopTime, @JsonProperty("linesPerSec") Integer linesPerSec, @JsonProperty("maxLines") Long maxLines, @JsonProperty("filePath") String filePath ) { this(Conjurer.getBuilder().withStartTime(startTime).withStopTime(stopTime).withMaxLines(maxLines).withFilePath(filePath).withLinesPerSec(linesPerSec).withCustomSchema(true)); }

Target:
public ConjurerFirehoseFactory( @JsonProperty("startTime") Long startTime, @JsonProperty("stopTime") Long stopTime, @JsonProperty("linesPerSec") Integer linesPerSec, @JsonProperty("maxLines") Long maxLines, @JsonProperty("filePath") String filePath ) { this( Conjurer.getBuilder() .withStartTime(startTime) .withStopTime(stopTime) .withMaxLines(maxLines) .withFilePath(filePath) .withLinesPerSec(linesPerSec) ); }
Source:
public static List<Event> getLightEvents(final List<Sample> lightData) { final LinkedList<AmplitudeData> lightAmplitudeData = new LinkedList<>(); for (final Sample sample : lightData) { lightAmplitudeData.add(new AmplitudeData(sample.dateTime, (double) sample.value, sample.offsetMillis)); } final double darknessThreshold = 0.0001; final int approxSunsetHour = 17; final int approxSunriseHour = 6; final int smoothingDegree = 30; final LightEventsDetector detector = new LightEventsDetector(approxSunriseHour, approxSunsetHour, darknessThreshold, smoothingDegree); final LinkedList<Segment> lightSegments = detector.process(lightAmplitudeData); final List<Event> events = new ArrayList<>(); for (final Segment segment : lightSegments) { final String label = segment.getLabel(); if (label.equals(LightLabel.Type.NONE.toString())) continue; final long startTimestamp = segment.getStartTimestamp() + smoothingDegree * 60000; if (label.equals(LightLabel.Type.LIGHTS_OUT.toString()) ) { final LightEvent event = new LightEvent(startTimestamp, startTimestamp + 60000, segment.getOffsetMillis(), label); event.setDescription("Lights on"); events.add(event); final long endTimestamp = segment.getEndTimestamp() - smoothingDegree * 60000; events.add(new LightsOutEvent(endTimestamp, endTimestamp + 60000, segment.getOffsetMillis())); } else if (label.equals(LightLabel.Type.LIGHT_SPIKE.toString())) { events.add(new LightEvent(startTimestamp, startTimestamp + 60000, segment.getOffsetMillis(), label)); } } return events; }

Target:
public static List<Event> getLightEvents(final List<Sample> lightData) { final LinkedList<AmplitudeData> lightAmplitudeData = new LinkedList<>(); for (final Sample sample : lightData) { lightAmplitudeData.add(new AmplitudeData(sample.dateTime, (double) sample.value, sample.offsetMillis)); } final double darknessThreshold = 0.0001; final int approxSunsetHour = 17; final int approxSunriseHour = 6; final int smoothingDegree = 20; final LightEventsDetector detector = new LightEventsDetector(approxSunriseHour, approxSunsetHour, darknessThreshold, smoothingDegree); final LinkedList<LightSegment> lightSegments = detector.process(lightAmplitudeData); final List<Event> events = new ArrayList<>(); for (final LightSegment segment : lightSegments) { final LightSegment.Type segmentType = segment.segmentType; if (segmentType == LightSegment.Type.NONE) { continue; } final long startTimestamp = segment.startTimestamp + smoothingDegree * MINUTE_IN_MILLIS; final int offsetMillis = segment.offsetMillis; if (segmentType == LightSegment.Type.LIGHTS_OUT) { final LightEvent event = new LightEvent(startTimestamp, startTimestamp + MINUTE_IN_MILLIS, offsetMillis, segmentType.toString()); event.setDescription("Lights on"); events.add(event); final long endTimestamp = segment.endTimestamp - smoothingDegree * MINUTE_IN_MILLIS; events.add(new LightsOutEvent(endTimestamp, endTimestamp + MINUTE_IN_MILLIS, offsetMillis)); } else if (segmentType == LightSegment.Type.LIGHT_SPIKE) { events.add(new LightEvent(startTimestamp, startTimestamp + MINUTE_IN_MILLIS, offsetMillis, segmentType.toString())); } } return events; }
Source:
public void onNext(M message, MessageCollector collector, TaskCoordinator coordinator) { K key = thisPartialJoinFn.getKey(message); thisPartialJoinFn.getState().put(key, new PartialJoinMessage<>(message, System.currentTimeMillis())); PartialJoinMessage<JM> otherMessage = otherPartialJoinFn.getState().get(key); if (otherMessage != null) { RM joinResult = thisPartialJoinFn.apply(message, otherMessage.getMessage()); this.propagateResult(joinResult, collector, coordinator); } }

Target:
public void onNext(M message, MessageCollector collector, TaskCoordinator coordinator) { K key = thisPartialJoinFn.getKey(message); thisPartialJoinFn.getState().put(key, new PartialJoinMessage<>(message, System.currentTimeMillis())); PartialJoinMessage<JM> otherMessage = otherPartialJoinFn.getState().get(key); long now = System.currentTimeMillis(); if (otherMessage != null && otherMessage.getReceivedTimeMs() > now - ttlMs) { RM joinResult = thisPartialJoinFn.apply(message, otherMessage.getMessage()); this.propagateResult(joinResult, collector, coordinator); } }
Source:
public void init() { if (entityViewManager.isUnsatisfied()) { this.entityViewAwareObjectMapper = null; } else { ObjectMapper mapper = null; ContextResolver<ObjectMapper> resolver; if (providers != null && (resolver = providers.getContextResolver(ObjectMapper.class, MediaType.APPLICATION_JSON_TYPE)) != null) { mapper = resolver.getContext(EntityViewMessageBodyReader.class); } if (mapper == null) { if (objectMapper.isUnsatisfied()) { mapper = new ObjectMapper(); } else { mapper = objectMapper.get(); } } this.entityViewAwareObjectMapper = new EntityViewAwareObjectMapper(new LazyEntityViewManager(), new ObjectMapper(), new EntityViewIdValueAccessor() { @Override public <T> T getValue(JsonParser jsonParser, Class<T> idType) { String value = idValueHolder.get(); if (value == null || String.class.equals(idType)) { return (T) value; } else { ParamConverter<T> paramConverter = null; for (ParamConverterProvider paramConverterProvider : paramConverterProviders) { if ((paramConverter = paramConverterProvider.getConverter(idType, idType, null)) != null) { break; } } if (paramConverter == null) { paramConverter = FROM_STRING_PARAM_CONVERTER_PROVIDER.getConverter(idType, idType, null); } if (paramConverter == null) { throw new RuntimeException("No " + ParamConverter.class.getName() + " could be found to convert to type " + idType.getName()); } else { return paramConverter.fromString(value); } } } }); } }

Target:
public void init() { if (entityViewManager.isUnsatisfied()) { this.entityViewAwareObjectMapper = null; } else { ObjectMapper mapper = null; ContextResolver<ObjectMapper> resolver; if (providers != null && (resolver = providers.getContextResolver(ObjectMapper.class, MediaType.APPLICATION_JSON_TYPE)) != null) { mapper = resolver.getContext(EntityViewMessageBodyReader.class); } if (mapper == null) { if (objectMapper.isUnsatisfied()) { mapper = new ObjectMapper(); } else { mapper = objectMapper.get(); } } this.entityViewAwareObjectMapper = new EntityViewAwareObjectMapper(new LazyEntityViewManager(), mapper, new EntityViewIdValueAccessor() { @Override public <T> T getValue(JsonParser jsonParser, Class<T> idType) { String value = idValueHolder.get(); if (value == null || String.class.equals(idType)) { return (T) value; } else { ParamConverter<T> paramConverter = null; for (ParamConverterProvider paramConverterProvider : paramConverterProviders) { if ((paramConverter = paramConverterProvider.getConverter(idType, idType, null)) != null) { break; } } if (paramConverter == null) { paramConverter = FROM_STRING_PARAM_CONVERTER_PROVIDER.getConverter(idType, idType, null); } if (paramConverter == null) { throw new RuntimeException("No " + ParamConverter.class.getName() + " could be found to convert to type " + idType.getName()); } else { return paramConverter.fromString(value); } } } }); } }
Source:
public Prefab getPrefab(String name) { if (!name.isEmpty()) { Preconditions.checkArgument(!Strings.isNullOrEmpty(name)); return assetManager.getAsset(name, Prefab.class).orElse(null); } return null; }

Target:
public Prefab getPrefab(String name) { if (Strings.isNullOrEmpty(name)) { return null; } return assetManager.getAsset(name, Prefab.class).orElse(null); }
Source:
public void testAddPort() throws InterruptedException { List<MonitoringPolicy.Port.AddPort> ports = new ArrayList<MonitoringPolicy.Port.AddPort>(); MonitoringPolicy.Port.AddPort port = MonitoringPolicy.Port.AddPort.create(80, Types.AlertIfType.RESPONDING, true, Types.ProtocolType.TCP); ports.add(port); MonitoringPolicy response = monitoringPolicyApi().addPort(currentPolicy.id(), MonitoringPolicy.Port.CreatePort.create(ports)); currentPort = response.ports().get(0); assertNotNull(response); }

Target:
public void testAddPort() throws InterruptedException { List<MonitoringPolicy.Port.AddPort> ports = new ArrayList<MonitoringPolicy.Port.AddPort>(); MonitoringPolicy.Port.AddPort port = MonitoringPolicy.Port.AddPort.create(80, Types.AlertIfType.RESPONDING, true, Types.ProtocolType.TCP); ports.add(port); MonitoringPolicy response = monitoringPolicyApi().addPort(currentPolicy.id(), MonitoringPolicy.Port.CreatePort.create(ports)); assertNotNull(response); assertNotNull(response.ports().get(0)); currentPort = response.ports().get(0); }