auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static File getRemovableStorageAppDir(@NonNull Context context) { int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) { File[] fileList = context.getExternalFilesDirs(null); for (File extFile : fileList){ if (extFile != null && Environment.isExternalStorageRemovable(extFile)){ return extFile; } } } return null; }

Target:
public static File getRemovableStorageAppDir(@NonNull Context context) { final int currentApiVersion = android.os.Build.VERSION.SDK_INT; if (currentApiVersion >= Build.VERSION_CODES.LOLLIPOP) { final File[] fileList = context.getExternalFilesDirs(null); for (File extFile : fileList) { if (extFile != null && Environment.isExternalStorageRemovable(extFile)) { return extFile; } } } return null; }
Source:
private Change createChange(CreateChangeOperation operation, boolean updateStatus, IRunnableContext context){ InvocationTargetException exception= null; try { context.run(true, fIsChangeCreationCancelable, new WorkbenchRunnableAdapter( operation, ResourcesPlugin.getWorkspace().getRoot())); } catch (InterruptedException e) { setConditionCheckingStatus(null); return null; } catch (InvocationTargetException e) { exception= e; } if (updateStatus) { RefactoringStatus status= null; if (exception != null) { status= new RefactoringStatus(); String msg= exception.getMessage(); if (msg != null) { status.addFatalError(Messages.format(RefactoringUIMessages.RefactoringWizard_see_log, msg)); } else { status.addFatalError(RefactoringUIMessages.RefactoringWizard_Internal_error); } RefactoringUIPlugin.log(exception); } else { status= operation.getConditionCheckingStatus(); } setConditionCheckingStatus(status, operation.getConditionCheckingStyle()); } else { if (exception != null) ExceptionHandler.handle(exception, getContainer().getShell(), RefactoringUIMessages.RefactoringWizard_refactoring, RefactoringUIMessages.RefactoringWizard_unexpected_exception); } Change change= operation.getChange(); return change; }

Target:
private Change createChange(CreateChangeOperation operation, boolean updateStatus, IRunnableContext context){ InvocationTargetException exception= null; try { context.run((context == PlatformUI.getWorkbench().getActiveWorkbenchWindow()), fIsChangeCreationCancelable, new WorkbenchRunnableAdapter( operation, ResourcesPlugin.getWorkspace().getRoot())); } catch (InterruptedException e) { setConditionCheckingStatus(null); return null; } catch (InvocationTargetException e) { exception= e; } if (updateStatus) { RefactoringStatus status= null; if (exception != null) { status= new RefactoringStatus(); String msg= exception.getMessage(); if (msg != null) { status.addFatalError(Messages.format(RefactoringUIMessages.RefactoringWizard_see_log, msg)); } else { status.addFatalError(RefactoringUIMessages.RefactoringWizard_Internal_error); } RefactoringUIPlugin.log(exception); } else { status= operation.getConditionCheckingStatus(); } setConditionCheckingStatus(status, operation.getConditionCheckingStyle()); } else { if (exception != null) ExceptionHandler.handle(exception, getContainer().getShell(), RefactoringUIMessages.RefactoringWizard_refactoring, RefactoringUIMessages.RefactoringWizard_unexpected_exception); } Change change= operation.getChange(); return change; }
Source:
public void actionPerformed(ActionEvent e) { eventLogger.log(this); if (this.presenter == null) { this.presenter = this.presenterProvider.get(); } this.presenter.showDialog(); }

Target:
public void actionPerformed(ActionEvent e) { eventLogger.log(this); this.presenterProvider.get().showDialog(); }
Source:
private void createMultiTree(final String pageId) throws DotSecurityException, DotDataException { MultiTree multiTree = new MultiTree(pageId, containerId, contentletsIds.get(0)); APILocator.getMultiTreeAPI().saveMultiTree(multiTree); multiTree = new MultiTree(pageId, containerId, contentletsIds.get(1)); APILocator.getMultiTreeAPI().saveMultiTree(multiTree); multiTree = new MultiTree(pageId, containerId, contentletsIds.get(2)); APILocator.getMultiTreeAPI().saveMultiTree(multiTree); }

Target:
private void createMultiTree(final String pageId) throws DotSecurityException, DotDataException { MultiTree multiTree = new MultiTree(pageId, containerId, contentletsIds.get(0),UUID,0); APILocator.getMultiTreeAPI().saveMultiTree(multiTree); multiTree = new MultiTree(pageId, containerId, contentletsIds.get(1),UUID,0); APILocator.getMultiTreeAPI().saveMultiTree(multiTree); multiTree = new MultiTree(pageId, containerId, contentletsIds.get(2),UUID,0); APILocator.getMultiTreeAPI().saveMultiTree(multiTree); }
Source:
private static void insertToJson(DocumentContext ctx, String path, Object value) { final String preantPath; final String key; Integer dotIndex = path.lastIndexOf("."); Integer leftBracketIndex = path.lastIndexOf("["); if (dotIndex.equals(-1) && leftBracketIndex.equals(-1)) { preantPath = path; key = path; } else if (!dotIndex.equals(-1) && leftBracketIndex.equals(-1)) { preantPath = path.substring(0, dotIndex); key = path.substring(dotIndex + 1); } else if (dotIndex.equals(-1) && !leftBracketIndex.equals(-1)) { preantPath = path.substring(0, leftBracketIndex); key = path.substring(leftBracketIndex + 1); } else { Integer position = dotIndex > leftBracketIndex ? dotIndex : leftBracketIndex; preantPath = path.substring(0, position); key = path.substring(position); } Object obj = ctx.read(preantPath); if (obj instanceof Map) { ctx.put(preantPath, key, value.toString()); } else if (obj instanceof Collection) { ctx.add(preantPath, value); } }

Target:
private static void insertToJson(DocumentContext ctx, String path, Object value) { final String parentPath; final String key; Integer dotIndex = path.lastIndexOf("."); Integer leftBracketIndex = path.lastIndexOf("["); if (dotIndex.equals(-1) && leftBracketIndex.equals(-1)) { parentPath = path; key = path; } else if (!dotIndex.equals(-1) && leftBracketIndex.equals(-1)) { parentPath = path.substring(0, dotIndex); key = path.substring(dotIndex + 1); } else if (dotIndex.equals(-1) && !leftBracketIndex.equals(-1)) { parentPath = path.substring(0, leftBracketIndex); key = path.substring(leftBracketIndex + 1); } else { int position = dotIndex > leftBracketIndex ? dotIndex : leftBracketIndex; parentPath = path.substring(0, position); key = path.substring(position); } Object obj = ctx.read(parentPath); if (obj instanceof Map) { ctx.put(parentPath, key, value.toString()); } else if (obj instanceof Collection) { ctx.add(parentPath, value); } }
Source:
public IdToken getIdToken() { return this.idToken; }

Target:
public IdToken getIdToken() { return (IdToken) getAccessToken(); }
Source:
private Map<String, Object> getConsoleDeviceSpecParams(Guid vmId) { Map<String, Object> specParams = new HashMap<>(); VmBase vmBase = getVmBase(vmId); specParams.put("enableSocket", "true"); specParams.put( "consoleType", osRepository.getOsConsoleTargetType( vmBase.getOsId(), clusterUtils.getCompatibilityVersion(vmBase)).libvirtName); return specParams; }

Target:
private Map<String, Object> getConsoleDeviceSpecParams(Guid vmId) { Map<String, Object> specParams = new HashMap<>(); VmBase vmBase = getVmBase(vmId); ConsoleTargetType targetType = osRepository.getOsConsoleTargetType( vmBase.getOsId(), CompatibilityVersionUtils.getEffective(vmBase, clusterDao.get(vmBase.getClusterId()))); specParams.put("enableSocket", "true"); specParams.put("consoleType", targetType == null ? "serial" : targetType.libvirtName); return specParams; }
Source:
public TranscriptionResponse createTranscription(String callID, String legId, String recordingId, String language) throws UnauthorizedException, GeneralException { if (callID == null) { throw new IllegalArgumentException("Voice call ID must be specified."); } if (legId == null) { throw new IllegalArgumentException("Leg ID must be specified."); } if (recordingId == null) { throw new IllegalArgumentException("Recording ID must be specified."); } if (language == null) { throw new IllegalArgumentException("Language must be specified."); } String[] supportedLanguages = {"de-DE", "en-AU", "en-UK", "en-US", "es-ES", "es-LA", "fr-FR", "it-IT", "nl-NL", "pt-BR"}; if (!Arrays.asList(supportedLanguages).contains(language)) { throw new IllegalArgumentException("Your language is not allowed."); } String url = String.format( "%s%s/%s%s/%s%s/%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH, callID, LEGSPATH, legId, RECORDINGPATH, recordingId, TRANSCRIPTIONPATH); return messageBirdService.sendPayLoad(url, language, TranscriptionResponse.class); }

Target:
public TranscriptionResponse createTranscription(String callID, String legId, String recordingId, String language) throws UnauthorizedException, GeneralException { if (callID == null) { throw new IllegalArgumentException("Voice call ID must be specified."); } if (legId == null) { throw new IllegalArgumentException("Leg ID must be specified."); } if (recordingId == null) { throw new IllegalArgumentException("Recording ID must be specified."); } if (language == null) { throw new IllegalArgumentException("Language must be specified."); } if (!Arrays.asList(supportedLanguages).contains(language)) { throw new IllegalArgumentException("Your language is not allowed."); } String url = String.format( "%s%s/%s%s/%s%s/%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH, callID, LEGSPATH, legId, RECORDINGPATH, recordingId, TRANSCRIPTIONPATH); return messageBirdService.sendPayLoad(url, language, TranscriptionResponse.class); }
Source:
protected void executeCommand() { AuditLog auditLog = getAuditLogDao().get(getParameters().getAuditLogId()); getAuditLogDao().remove(getParameters().getAuditLogId()); setAuditLogDetails(auditLog); evict(AuditLogDirector.composeSystemObjectId(this, auditLog.getLogType())); setSucceeded(true); }

Target:
protected void executeCommand() { AuditLog auditLog = getAuditLogDao().get(getParameters().getAuditLogId()); getAuditLogDao().remove(getParameters().getAuditLogId()); setAuditLogDetails(auditLog); evict(auditLogDirector.composeSystemObjectId(this, auditLog.getLogType())); setSucceeded(true); }
Source:
private Optional<Map<String, VariableDefinition>> getVariableDefinitionMap(String processDefinitionId) { ProcessExtensionModel processExtensionModel = processDefinitionId != null ? processExtensionService.getExtensionsForId(processDefinitionId) : null; return Optional.ofNullable(processExtensionModel) .map(p -> p.getExtensionsByProcessDefinitionId(processDefinitionId)) .map(Extension::getProperties); }

Target:
private Optional<Map<String, VariableDefinition>> getVariableDefinitionMap(String processDefinitionId) { Extension processExtensionModel = processDefinitionId != null ? processExtensionService.getExtensionsForId(processDefinitionId) : null; return Optional.ofNullable(processExtensionModel) .map(Extension::getProperties); }
Source:
public static void setReactorsMap(String vmId, ReactorClient client){ reactorsMap.put(vmId, client); }

Target:
public void setReactorsMap(String vmId, ReactorClient client){ reactorsMap.put(vmId, client); }
Source:
public void fireNormalTrigger(Window window, boolean fireOnlyUpdatedPanes) { if (fireOnlyUpdatedPanes && updatedKeyStorage != null) { for (KeyT key : updatedKeyStorage.get(window)) { OutputValT outputVal = accumulation.getOutput(dataStorage.get(window, key)); if (retractionStorage != null) { OutputValT oldValue = retractionStorage.get(window, key); if (oldValue != null && oldValue.equals(outputVal)) { continue; } } output.emit(new Tuple.WindowedTuple<>(window, new KeyValPair<>(key, outputVal))); if (retractionStorage != null) { retractionStorage.put(window, key, outputVal); } } updatedKeyStorage.removeAll(window); return; } for (Map.Entry<KeyT, AccumT> entry : dataStorage.entries(window)) { OutputValT outputVal = accumulation.getOutput(entry.getValue()); output.emit(new Tuple.WindowedTuple<>(window, new KeyValPair<>(entry.getKey(), outputVal))); if (retractionStorage != null) { retractionStorage.put(window, entry.getKey(), outputVal); } } }

Target:
public void fireNormalTrigger(Window window, boolean fireOnlyUpdatedPanes) { if (useUpdatedKeyStorage()) { for (KeyT key : updatedKeyStorage.get(window)) { OutputValT outputVal = accumulation.getOutput(dataStorage.get(window, key)); if (retractionStorage != null) { OutputValT oldValue = retractionStorage.get(window, key); if (oldValue != null && oldValue.equals(outputVal)) { continue; } } output.emit(new Tuple.WindowedTuple<>(window, new KeyValPair<>(key, outputVal))); if (retractionStorage != null) { retractionStorage.put(window, key, outputVal); } } updatedKeyStorage.removeAll(window); } else { for (Map.Entry<KeyT, AccumT> entry : dataStorage.entries(window)) { OutputValT outputVal = accumulation.getOutput(entry.getValue()); output.emit(new Tuple.WindowedTuple<>(window, new KeyValPair<>(entry.getKey(), outputVal))); if (retractionStorage != null) { retractionStorage.put(window, entry.getKey(), outputVal); } } } }
Source:
private void addVirtualNetworkResource() { String virtualNetworkName = group + "virtualnetwork"; String vnAddresSpacePrefix = "10.0.0.0/16"; String subnetName = group + "subnet"; String subnetAddressPrefix = "10.0.0.0/24"; variables.put("virtualNetworkName", virtualNetworkName); variables.put("virtualNetworkReference", "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]"); variables.put("subnetName", subnetName); variables.put("subnetReference", "[concat(variables('virtualNetworkReference'),'/subnets/',variables('subnetName'))]"); VirtualNetworkProperties properties = VirtualNetworkProperties.builder() .addressSpace( AddressSpace.create(Arrays.asList(vnAddresSpacePrefix)) ) .subnets( Arrays.asList( Subnet.create("[variables('subnetName')]", null, null, SubnetProperties.builder() .addressPrefix(subnetAddressPrefix).build() )) ) .build(); ResourceDefinition virtualNetwork = ResourceDefinition.builder() .name("[variables('virtualNetworkName')]") .type("Microsoft.Network/virtualNetworks") .location(location) .apiVersion("2015-06-15") .properties(properties) .build(); resources.add(virtualNetwork); }

Target:
private void addVirtualNetworkResource() { String virtualNetworkName = group + "virtualnetwork"; String subnetName = group + "subnet"; variables.put("virtualNetworkName", virtualNetworkName); variables.put("virtualNetworkReference", "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]"); variables.put("subnetName", subnetName); variables.put("subnetReference", "[concat(variables('virtualNetworkReference'),'/subnets/',variables('subnetName'))]"); VirtualNetworkProperties properties = VirtualNetworkProperties.builder() .addressSpace( AddressSpace.create(Arrays.asList(DEFAULT_vnAddresSpacePrefix)) ) .subnets( Arrays.asList( Subnet.create("[variables('subnetName')]", null, null, SubnetProperties.builder() .addressPrefix(DEFAULT_subnetAddressPrefix).build() )) ) .build(); ResourceDefinition virtualNetwork = ResourceDefinition.builder() .name("[variables('virtualNetworkName')]") .type("Microsoft.Network/virtualNetworks") .location(location) .apiVersion(STORAGE_API_VERSION) .properties(properties) .build(); resources.add(virtualNetwork); }
Source:
private boolean perform() { getParameters().setStartTime(new Date()); try { if (unplugPassthroughNics() && connectLunDisks(getDestinationVdsId()) && migrateVm()) { ExecutionHandler.setAsyncJob(getExecutionContext(), true); return true; } } catch (EngineException e) { cleanupPassthroughVnics(getDestinationVdsId()); } runningFailed(); return false; }

Target:
private boolean perform() { try { getParameters().setStartTime(new Date()); allVmPassthroughNics = getAllVmPassthroughNics(); log.debug("Performing migration with following passthrough nics: {}", allVmPassthroughNics); if (unplugPassthroughNics(allVmPassthroughNics) && connectLunDisks(getDestinationVdsId()) && migrateVm()) { ExecutionHandler.setAsyncJob(getExecutionContext(), true); return true; } runningFailed(); return false; } catch (Exception e) { cleanupPassthroughVnics(getDestinationVdsId()); runningFailed(); throw e; } }
Source:
public void test_service_info(){ Map<String,String> tags = new HashMap<>(); tags.put("key1", "value1"); tags.put("key2", "value2"); ServiceInfo info = new ServiceInfo("service1", tags); String metadata = info.toMetadata(); System.out.println(metadata); ServiceInfo info2 = ServiceInfo.from(metadata); assertTrue(info2.getServiceName().equals("service1")); assertTrue( info2.getTags().get("key1").equals("value1")); assertTrue( info2.getTags().get("key2").equals("value2")); }

Target:
public void test_service_info() { Map<String, String> tags = new HashMap<>(); tags.put("key1", "value1"); tags.put("key2", "value2"); ServiceInfo info = new ServiceInfo("service1", tags); String metadata = info.toMetadata(); assertEquals(metadata, "service1:tags:key1=value1|tag|key2=value2|tag|"); ServiceInfo info2 = ServiceInfo.from(metadata); assertTrue(info2.getServiceName().equals("service1")); assertTrue(info2.getTags().get("key1").equals("value1")); assertTrue(info2.getTags().get("key2").equals("value2")); }
Source:
protected boolean hasRemainingRenewals(final String tokenId, long renewInterval) { return ((System.currentTimeMillis() + 30000 + renewInterval) < getMaxLifetime(tokenId)); }

Target:
protected boolean hasRemainingRenewals(final String tokenId, long renewInterval) { return ((System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(30) + renewInterval) < getMaxLifetime(tokenId)); }
Source:
public String getStatusReport(String pluginId) { if (!ElasticAgentExtensionConverterV2.VERSION.equals(pluginManager.resolveExtensionVersion(pluginId, SUPPORTED_VERSIONS))) { throw new UnsupportedOperationException(format("Plugin `%s` implements Elastic Agent V1, `StatusReport` endpoint is not supported in this version.", pluginId)); } return pluginRequestHelper.submitRequest(pluginId, REQUEST_STATUS_REPORT, new DefaultPluginInteractionCallback<String>() { @Override public String onSuccess(String responseBody, String resolvedExtensionVersion) { final ElasticAgentExtensionConverterV2 converter = (ElasticAgentExtensionConverterV2) getElasticAgentMessageConverter(resolvedExtensionVersion); return converter.getStatusReportView(responseBody); } }); }

Target:
public String getStatusReport(String pluginId) { return pluginRequestHelper.submitRequest(pluginId, REQUEST_STATUS_REPORT, new DefaultPluginInteractionCallback<String>() { @Override public String onSuccess(String responseBody, String resolvedExtensionVersion) { final ElasticAgentExtensionConverterV2 converter = (ElasticAgentExtensionConverterV2) getElasticAgentMessageConverter(resolvedExtensionVersion); return converter.getStatusReportView(responseBody); } }); }
Source:
private void checkMissingQueuesFatalFromProperty() { if (!isMissingQueuesFatalSet()) { try { ApplicationContext applicationContext = getApplicationContext(); if (applicationContext != null) { Properties properties = applicationContext.getBean("spring.amqp.global.properties", Properties.class); String missingQueuesFatal = properties.getProperty("mlc.missing.queues.fatal"); if (StringUtils.hasText(missingQueuesFatal)) { setMissingQueuesFatal(Boolean.parseBoolean(missingQueuesFatal)); } } } catch (BeansException be) { if (logger.isDebugEnabled()) { logger.debug("No global properties bean"); } } } }

Target:
private void checkMissingQueuesFatalFromProperty() { if (!isMissingQueuesFatalSet()) { try { ApplicationContext applicationContext = getApplicationContext(); if (applicationContext != null) { Properties properties = applicationContext.getBean("spring.amqp.global.properties", Properties.class); String missingQueuesFatal = properties.getProperty("mlc.missing.queues.fatal"); if (!StringUtils.hasText(missingQueuesFatal)) { missingQueuesFatal = properties.getProperty("smlc.missing.queues.fatal"); } if (StringUtils.hasText(missingQueuesFatal)) { setMissingQueuesFatal(Boolean.parseBoolean(missingQueuesFatal)); } } } catch (BeansException be) { logger.debug("No global properties bean"); } } }
Source:
public String getAccessTokenEndpoint() { return "<LINK_1>?grant_type=authorization_code"; }

Target:
public String getAccessTokenEndpoint() { return "<LINK_1>"; }
Source:
public final void writeTextSegment(final TextSegment textSegment, final FileType fileType) throws IOException, NitfFormatException { writeFixedLengthString(TextConstants.TE, TextConstants.TE.length()); if (fileType == FileType.NITF_TWO_ZERO) { writeFixedLengthString(textSegment.getIdentifier(), TextConstants.TEXTID20_LENGTH); } else { writeFixedLengthString(textSegment.getIdentifier(), TextConstants.TEXTID_LENGTH); writeFixedLengthNumber(textSegment.getAttachmentLevel(), TextConstants.TXTALVL_LENGTH); } writeDateTime(textSegment.getTextDateTime()); writeFixedLengthString(textSegment.getTextTitle(), TextConstants.TXTITL_LENGTH); writeSecurityMetadata(textSegment.getSecurityMetadata()); writeENCRYP(); writeFixedLengthString(textSegment.getTextFormat().getTextEquivalent(), TextConstants.TXTFMT_LENGTH); byte[] textExtendedSubheaderData = mTreParser.getTREs(textSegment, TreSource.TextExtendedSubheaderData); int textExtendedSubheaderDataLength = textExtendedSubheaderData.length; if ((textExtendedSubheaderDataLength > 0) || (textSegment.getExtendedHeaderDataOverflow() != 0)) { textExtendedSubheaderDataLength += TextConstants.TXSOFL_LENGTH; } writeFixedLengthNumber(textExtendedSubheaderDataLength, TextConstants.TXSHDL_LENGTH); if (textExtendedSubheaderDataLength > 0) { writeFixedLengthNumber(textSegment.getExtendedHeaderDataOverflow(), TextConstants.TXSOFL_LENGTH); writeBytes(textExtendedSubheaderData, textExtendedSubheaderDataLength - TextConstants.TXSOFL_LENGTH); } mOutput.writeBytes(textSegment.getData()); }

Target:
public final void writeTextSegment(final TextSegment textSegment, final FileType fileType) throws IOException, NitfFormatException { writeFixedLengthString(TE, TE.length()); if (fileType == FileType.NITF_TWO_ZERO) { writeFixedLengthString(textSegment.getIdentifier(), TEXTID20_LENGTH); } else { writeFixedLengthString(textSegment.getIdentifier(), TEXTID_LENGTH); writeFixedLengthNumber(textSegment.getAttachmentLevel(), TXTALVL_LENGTH); } writeDateTime(textSegment.getTextDateTime()); writeFixedLengthString(textSegment.getTextTitle(), TXTITL_LENGTH); writeSecurityMetadata(textSegment.getSecurityMetadata()); writeENCRYP(); writeFixedLengthString(textSegment.getTextFormat().getTextEquivalent(), TXTFMT_LENGTH); byte[] textExtendedSubheaderData = mTreParser.getTREs(textSegment, TreSource.TextExtendedSubheaderData); int textExtendedSubheaderDataLength = textExtendedSubheaderData.length; if ((textExtendedSubheaderDataLength > 0) || (textSegment.getExtendedHeaderDataOverflow() != 0)) { textExtendedSubheaderDataLength += TXSOFL_LENGTH; } writeFixedLengthNumber(textExtendedSubheaderDataLength, TXSHDL_LENGTH); if (textExtendedSubheaderDataLength > 0) { writeFixedLengthNumber(textSegment.getExtendedHeaderDataOverflow(), TXSOFL_LENGTH); writeBytes(textExtendedSubheaderData, textExtendedSubheaderDataLength - TXSOFL_LENGTH); } mOutput.writeBytes(textSegment.getData()); }
Source:
public void onReceive(Context context, Intent intent) { String language = intent.getStringExtra(LANG); String country = intent.getStringExtra(COUNTRY); Locale locale = new Locale(language, country); LocaleSettingHandler localeSettingHandler = new LocaleSettingHandler(context); localeSettingHandler.setLocale(locale); }

Target:
public void onReceive(Context context, Intent intent) { if(!hasExtraLocale(intent)) { Log.e(TAG, "Don't forget to set lang and country like: am broadcast -a io.appium.settings.locale --es lang ja --es country JP"); Log.e(TAG, "Set en-US by default."); intent.putExtra(LANG, "en"); intent.putExtra(COUNTRY, "US"); } String language = intent.getStringExtra(LANG); String country = intent.getStringExtra(COUNTRY); Locale locale = new Locale(language, country); LocaleSettingHandler localeSettingHandler = new LocaleSettingHandler(context); localeSettingHandler.setLocale(locale); }
Source:
private RepositoriesPanel createRepositoriesPanel() { ObservableList<RepositoryLocation<? extends Repository>> repositoryLocations = FXCollections .observableArrayList(settingsManager.loadRepositoryLocations()); final RepositoriesPanel repositoriesPanel = new RepositoriesPanel(repositoryLocationLoader, repositoryLocations); repositoriesPanel.setOnRepositoryRefresh(repositoryManager::triggerRepositoryChange); repositoriesPanel.getRepositoryLocations() .addListener((ListChangeListener.Change<? extends RepositoryLocation<? extends Repository>> change) -> { while (change.next()) { final int from = change.getFrom(); if (change.wasRemoved()) { change.getRemoved().forEach(repositoryManager::removeRepositories); } if (change.wasAdded()) { IntStream.range(0, change.getAddedSize()).forEach(index -> repositoryManager .addRepositories(from + index, change.getAddedSubList().get(index))); } settingsManager.saveRepositories(repositoryLocations); } }); return repositoriesPanel; }

Target:
private RepositoriesPanel createRepositoriesPanel() { ObservableList<RepositoryLocation<? extends Repository>> repositoryLocations = FXCollections .observableArrayList(settingsManager.loadRepositoryLocations()); final RepositoriesPanel repositoriesPanel = new RepositoriesPanel(repositoryLocations); repositoriesPanel.setOnRepositoryRefresh(repositoryManager::triggerRepositoryChange); repositoriesPanel.setRepositoryLocationLoader(repositoryLocationLoader); repositoriesPanel.getRepositoryLocations() .addListener((ListChangeListener.Change<? extends RepositoryLocation<? extends Repository>> change) -> { repositoryManager.updateRepositories(repositoryLocations); settingsManager.saveRepositories(repositoryLocations); }); return repositoriesPanel; }
Source:
private void setupReplyTo(InvocableHandlerMethod handler) { String replyTo = null; Method method = handler.getMethod(); if (method != null) { SendTo ann = AnnotationUtils.getAnnotation(method, SendTo.class); replyTo = extractSendTo(method.toString(), ann); } if (replyTo == null) { SendTo ann = AnnotationUtils.getAnnotation(this.bean.getClass(), SendTo.class); replyTo = extractSendTo(this.getBean().getClass().getSimpleName(), ann); } if (replyTo != null) { this.handlerSendTo.put(handler, replyTo); } }

Target:
private void setupReplyTo(InvocableHandlerMethod handler) { String replyTo = null; Method method = handler.getMethod(); if (method != null) { SendTo ann = AnnotationUtils.getAnnotation(method, SendTo.class); replyTo = extractSendTo(method.toString(), ann); } if (replyTo == null) { SendTo ann = AnnotationUtils.getAnnotation(this.bean.getClass(), SendTo.class); replyTo = extractSendTo(this.getBean().getClass().getSimpleName(), ann); } if (replyTo != null) { this.handlerSendTo.put(handler, PARSER.parseExpression(replyTo, PARSER_CONTEXT)); } }
Source:
@Before public void prepareAgentForPlatform() throws Exception { System.out.println("prepare platform: " + platform); switch (platform) { case NATIVE: s = j.createOnlineSlave(); break; case SLIM: case ALPINE: case CENTOS: case UBUNTU: s = prepareAgentDocker(); j.jenkins.addNode(s); j.waitOnline(s); break; case SIMPLE: case TINI: s = prepareAgentCommandLauncher(); j.jenkins.addNode(s); j.waitOnline(s); break; default: Assert.fail("Unknown enum value: " + platform); break; } ws = s.getWorkspaceRoot().child("ws"); launcher = s.createLauncher(listener); }

Target:
@Before public void prepareAgentForPlatform() throws Exception { switch (platform) { case NATIVE: s = j.createOnlineSlave(); break; case UBUNTU_NO_BINARY: BourneShellScript.FORCE_SHELL_WRAPPER = true; case SLIM: case ALPINE: case CENTOS: case UBUNTU: case SIMPLE: s = prepareAgentDocker(); j.jenkins.addNode(s); j.waitOnline(s); break; default: Assert.fail("Unknown enum value: " + platform); break; } ws = s.getWorkspaceRoot().child("ws"); launcher = s.createLauncher(listener); }
Source:
public void notifyNewMessage(final HttpMessage msg) { HistoryReference hRef = msg.getHistoryRef(); if (hRef == null) { try { hRef = new HistoryReference( Model.getSingleton().getSession(), HistoryReference.TYPE_SCANNER_TEMPORARY, msg); msg.setHistoryRef(null); hRefs.add(Integer.valueOf(hRef.getHistoryId())); } catch (HttpMalformedHeaderException | DatabaseException e) { log.error(e.getMessage(), e); } } else { hRefs.add(Integer.valueOf(hRef.getHistoryId())); } this.rcTotals.incResponseCodeCount(msg.getResponseHeader().getStatusCode()); if (hRef != null) { if (this.rcTotals.getTotal() <= this.maxResultsToList) { addHistoryReference(hRef); } else { HistoryReference remRef = getMessagesTableModel().getEntry(0).getHistoryReference(); removeHistoryReferenceInEdt(remRef); addHistoryReference(hRef); } } }

Target:
public void notifyNewMessage(final HttpMessage msg) { HistoryReference hRef = msg.getHistoryRef(); if (hRef == null) { try { hRef = new HistoryReference( Model.getSingleton().getSession(), HistoryReference.TYPE_SCANNER_TEMPORARY, msg); msg.setHistoryRef(null); hRefs.add(Integer.valueOf(hRef.getHistoryId())); } catch (HttpMalformedHeaderException | DatabaseException e) { log.error(e.getMessage(), e); } } else { hRefs.add(Integer.valueOf(hRef.getHistoryId())); } this.rcTotals.incResponseCodeCount(msg.getResponseHeader().getStatusCode()); if (hRef != null && View.isInitialised()) { if (this.rcTotals.getTotal() > this.maxResultsToList) { removeFirstHistoryReferenceInEdt(); } addHistoryReferenceInEdt(hRef); } }
Source:
public void clickOnDetails() { CommonActions.clickOnaHiddenElement(datails); }

Target:
public void clickOnDetails() { CommonActions.clickOnaHiddenElement(detailsLinkButton); }
Source:
protected synchronized void onDetectedFailure(SensorEvent<Object> event) { final Entity failedEntity = event.getSource(); final Object reason = event.getValue(); if (isSuspended()) { LOG.warn("ServiceReplacer suspended, so not acting on failure detected at "+failedEntity+" ("+reason+", child of "+entity+")"); return; } if (isRepeatedlyFailingTooMuch()) { LOG.error("ServiceReplacer not acting on failure detected at "+failedEntity+" ("+reason+", child of "+entity+"), because too many recent replacement failures"); return; } LOG.warn("ServiceReplacer acting on failure detected at "+failedEntity+" ("+reason+", child of "+entity+")"); ((EntityInternal)entity).getManagementSupport().getExecutionContext().submit(MutableMap.of(), new Runnable() { @Override public void run() { try { Entities.invokeEffectorWithArgs(entity, entity, MemberReplaceable.REPLACE_MEMBER, failedEntity.getId()).get(); consecutiveReplacementFailureTimes.clear(); } catch (Exception e) { if (e.toString().contains("failed to stop and remove old member") && e.toString().contains(failedEntity.getId())) { LOG.info("ServiceReplacer: ignoring error reported from stopping failed node "+failedEntity); return; } onReplacementFailed("Replace failure (error "+e+") at "+entity+": "+reason); } } }); }

Target:
protected synchronized void onDetectedFailure(SensorEvent<Object> event) { final Entity failedEntity = event.getSource(); final Object reason = event.getValue(); if (isSuspended()) { LOG.warn("ServiceReplacer suspended, so not acting on failure detected at "+failedEntity+" ("+reason+", child of "+entity+")"); return; } if (isRepeatedlyFailingTooMuch()) { LOG.error("ServiceReplacer not acting on failure detected at "+failedEntity+" ("+reason+", child of "+entity+"), because too many recent replacement failures"); return; } LOG.warn("ServiceReplacer acting on failure detected at "+failedEntity+" ("+reason+", child of "+entity+")"); ((EntityInternal)entity).getManagementSupport().getExecutionContext().submit(MutableMap.of(), new Runnable() { @Override public void run() { try { Entities.invokeEffectorWithArgs(entity, entity, MemberReplaceable.REPLACE_MEMBER, failedEntity.getId()).get(); consecutiveReplacementFailureTimes.clear(); } catch (Exception e) { if (Exceptions.getFirstThrowableOfType(e, StopFailedRuntimeException.class) != null) { LOG.info("ServiceReplacer: ignoring error reported from stopping failed node "+failedEntity); return; } onReplacementFailed("Replace failure (error "+e+") at "+entity+": "+reason); } } }); }
Source:
private boolean peekId(int index) { TokenType type = peekType(index); return EnumSet.of( TokenType.IDENTIFIER, TokenType.TYPE, TokenType.DECLARE, TokenType.MODULE, TokenType.NAMESPACE) .contains(type) || (peekReservedWordAsId()); }

Target:
private boolean peekId(int index) { TokenType type = peekType(index); return TokenType.IDENTIFIER == type || (config.parseTypeSyntax && Keywords.isTypeScriptSpecificKeyword(type)) || peekReservedWordAsId(); }
Source:
private void callBackupRestore(GatewayConfig primaryGateway, Set<String> target, Set<Node> allNodes, SaltConfig saltConfig, ExitCriteriaModel exitModel, String state) throws CloudbreakOrchestratorFailedException { try (SaltConnector sc = createSaltConnector(primaryGateway)) { for (Entry<String, SaltPillarProperties> propertiesEntry : saltConfig.getServicePillarConfig().entrySet()) { OrchestratorBootstrap pillarSave = new PillarSave(sc, Sets.newHashSet(primaryGateway.getPrivateAddress()), propertiesEntry.getValue()); Callable<Boolean> saltPillarRunner = saltRunner.runner(pillarSave, exitCriteria, exitModel, maxRetry, true); saltPillarRunner.call(); } StateRunner stateRunner = new StateRunner(target, allNodes, state); OrchestratorBootstrap saltJobIdTracker = new SaltJobIdTracker(sc, stateRunner); Callable<Boolean> saltJobRunBootstrapRunner = saltRunner.runner(saltJobIdTracker, exitCriteria, exitModel, maxRetry, true); saltJobRunBootstrapRunner.call(); } catch (Exception e) { LOGGER.info("Error occurred during database backup/restore", e); throw new CloudbreakOrchestratorFailedException(e); } }

Target:
private void callBackupRestore(GatewayConfig primaryGateway, Set<String> target, Set<Node> allNodes, SaltConfig saltConfig, ExitCriteriaModel exitModel, String state) throws CloudbreakOrchestratorFailedException { try (SaltConnector sc = createSaltConnector(primaryGateway)) { for (Entry<String, SaltPillarProperties> propertiesEntry : saltConfig.getServicePillarConfig().entrySet()) { OrchestratorBootstrap pillarSave = new PillarSave(sc, Sets.newHashSet(primaryGateway.getPrivateAddress()), propertiesEntry.getValue()); Callable<Boolean> saltPillarRunner = saltRunner.runner(pillarSave, exitCriteria, exitModel, maxRetry, true); saltPillarRunner.call(); } StateRunner stateRunner = new StateRunner(target, allNodes, state); OrchestratorBootstrap saltJobIdTracker = new SaltJobIdTracker(sc, stateRunner); Callable<Boolean> saltJobRunBootstrapRunner = saltRunner.runner(saltJobIdTracker, exitCriteria, exitModel, maxRetry, true); saltJobRunBootstrapRunner.call(); } catch (Exception e) { LOGGER.error("Error occurred during database backup/restore", e); throw new CloudbreakOrchestratorFailedException(e); } }
Source:
public void setTTL(Long ttl) { this.m_ttl = m_ttl; }

Target:
public void setTTL(Long ttl) { m_ttl = ttl; }
Source:
private String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) { if (event == null) { return EMPTY_STRING_ARRAY; } synchronized (columns) { List<String> itemStrings = new ArrayList<>(columns.size()); int columnIndex = 0; for (TmfEventTableColumn column : columns) { ITmfEvent passedEvent = event; if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) { passedEvent = ((CachedEvent) event).event; } TableColumn viewColumn = fTable.getColumns()[columnIndex]; if (passedEvent == null || (!viewColumn.getResizable() && viewColumn.getWidth() == 0)) { itemStrings.add(EMPTY_STRING); } else { itemStrings.add(column.getItemString(passedEvent)); } columnIndex++; } return itemStrings.toArray(new String[0]); } }

Target:
private String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) { if (event == null) { return EMPTY_STRING_ARRAY; } synchronized (columns) { List<String> itemStrings = new ArrayList<>(columns.size()); int columnIndex = 0; for (TmfEventTableColumn column : columns) { ITmfEvent passedEvent = event; if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) { passedEvent = ((CachedEvent) event).event; } TableColumn viewColumn = fTable.getColumns()[fColumnOrder[columnIndex]]; if (passedEvent == null || (!viewColumn.getResizable() && viewColumn.getWidth() == 0)) { itemStrings.add(EMPTY_STRING); } else { itemStrings.add(column.getItemString(passedEvent)); } columnIndex++; } return itemStrings.toArray(new String[0]); } }
Source:
protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); if (resultCode == DownloadService.DOWNLOAD_COMPLETE) { Word word; try { word = getWordFromFilePath(mTempFilePath); } catch (JSONException | IOException e) { mListener.OnError(e); return; } if (mAutoInsert) { insertWordToLocal(word); } if (mListener != null) { mListener.OnWordReceived(word); } } if (resultCode == DownloadService.HTTP_ERROR && mListener != null) { mListener.OnHttpFailed( resultData.getInt(DownloadService.PARAM_STATUS), resultData.getString(DownloadService.PARAM_MESSAGE)); return; } }

Target:
protected void onReceiveResult(int resultCode, Bundle resultData) { super.onReceiveResult(resultCode, resultData); switch (resultCode) { case DownloadService.DOWNLOAD_COMPLETE: Word word = getWordFromFilePath(mTempFilePath); if (mAutoInsert && word != null) { insertWordToLocal(word); } if (mListener != null && word != null) { mListener.onWordReceived(word); } break; case DownloadService.HTTP_ERROR: if (mListener != null) { mListener.onError(DownloadWordListener.HTTP_ERROR, (Exception) resultData .getSerializable(DownloadService.PARAM_EXCEPTION)); } break; case DownloadService.INTERNAL_ERROR: if (mListener != null) { mListener.onError(DownloadWordListener.INTERNAL_ERROR, (Exception) resultData .getSerializable(DownloadService.PARAM_EXCEPTION)); } break; } }
Source:
private static boolean validateName(String value) throws WSSecurityException { Name name; try { name = new LdapName(value); } catch (Exception e) { LOG.info("Validation of X509 Subject Name failed: {}", e.getLocalizedMessage(), e); throw new WSSecurityException(ErrorCode.FAILURE, "Not a valid X509 Subject Name."); } return name != null; }

Target:
private static void validateName(String value) throws WSSecurityException { Name name; try { name = new LdapName(value); } catch (Exception e) { LOG.info("Validation of X509 Subject Name failed: {}", e.getLocalizedMessage(), e); throw new WSSecurityException(ErrorCode.FAILURE, "Not a valid X509 Subject Name."); } }
Source:
private void broadcastClusterEvent(ClusterEvent event, InterpreterSetting intpSetting) { if (!conf.isClusterMode()) { return; } List<Dependency> dependencies = intpSetting.getDependencies(); Map<String, InterpreterProperty> properties = (Map<String, InterpreterProperty>) intpSetting.getProperties(); InterpreterOption intpOption = intpSetting.getOption(); HashMap<String, String> params = new HashMap<>(); String jsonDep = gson.toJson(dependencies, new TypeToken<List<Dependency>>() { }.getType()); String jsonProps = gson.toJson(properties, new TypeToken<Map<String, InterpreterProperty>>() { }.getType()); params.put("id", intpSetting.getId()); params.put("name", intpSetting.getName()); params.put("group", intpSetting.getGroup()); params.put("dependencies", jsonDep); params.put("option", intpOption.toJson()); params.put("properties", jsonProps); ClusterMessage message = new ClusterMessage(event); message.put(params); String msg = ClusterMessage.serializeMessage(message); ClusterManagerServer.getInstance().broadcastClusterEvent( CLUSTER_INTP_SETTING_EVENT_TOPIC, msg); }

Target:
private void broadcastClusterEvent(ClusterEvent event, InterpreterSetting intpSetting) { if (!conf.isClusterMode()) { return; } String jsonIntpSetting = InterpreterSetting.toJson(intpSetting); ClusterMessage message = new ClusterMessage(event); message.put("intpSetting", jsonIntpSetting); String msg = ClusterMessage.serializeMessage(message); ClusterManagerServer.getInstance().broadcastClusterEvent( CLUSTER_INTP_SETTING_EVENT_TOPIC, msg); }
Source:
public Object[][] fofnData() throws IOException { Path fofnPath1 = inMemoryfileSystem.getPath("Level1.fofn"); Files.copy(TEST_DATA_DIR.resolve("Level1.fofn"), fofnPath1); Path fofnPath2 = inMemoryfileSystem.getPath("Level2.fofn"); Files.copy(TEST_DATA_DIR.resolve("Level2.fofn"), fofnPath2); return new Object[][]{ {TEST_DATA_DIR + "/Level1.fofn", new String[]{".vcf", ".vcf.gz"}, 2}, {TEST_DATA_DIR + "/Level2.fofn", new String[]{".vcf", ".vcf.gz"}, 4}, {fofnPath1.toUri().toString(), new String[]{".vcf", ".vcf.gz"}, 2}, {fofnPath2.toUri().toString(), new String[]{".vcf", ".vcf.gz"}, 4} }; }

Target:
public Object[][] fofnData() throws IOException { Path fofnPath1 = inMemoryfileSystem.getPath(level1); Files.copy(TEST_DATA_DIR.resolve(level1), fofnPath1); Path fofnPath2 = inMemoryfileSystem.getPath(level2); Files.copy(TEST_DATA_DIR.resolve(level2), fofnPath2); return new Object[][]{ {TEST_DATA_DIR + "/" + level1, new String[]{".vcf", ".vcf.gz"}, 2}, {TEST_DATA_DIR + "/" + level2, new String[]{".vcf", ".vcf.gz"}, 4}, {fofnPath1.toUri().toString(), new String[]{".vcf", ".vcf.gz"}, 2}, {fofnPath2.toUri().toString(), new String[]{".vcf", ".vcf.gz"}, 4} }; }
Source:
public void eval( @Nonnull final ReadableTable tb, final int rowIdx, @Nullable final WritableColumn count, @Nonnull final WritableColumn result, @Nullable final ReadableTable state) throws InvocationTargetException, DbException, IOException { Preconditions.checkArgument( evaluator != null, "Call compile first or copy the data if it is the same in the input."); Preconditions.checkArgument( getExpression().isMultivalued() != (count == null), "count must be null for a single-valued expression and non-null for a multivalued expression."); try { evaluator.evaluate(tb, rowIdx, count, result, state); } catch (Exception e) { LOGGER.error(getJavaExpressionWithAppend(), e); throw e; } }

Target:
public void eval( @Nonnull final ReadableTable tb, final int rowIdx, @Nullable final WritableColumn count, @Nonnull final WritableColumn result, @Nullable final ReadableTable state) throws InvocationTargetException, DbException { Preconditions.checkArgument( evaluator != null, "Call compile first or copy the data if it is the same in the input."); Preconditions.checkArgument( getExpression().isMultiValued() != (count == null), "count must be null for a single-valued expression and non-null for a multivalued expression."); try { evaluator.evaluate(tb, rowIdx, count, result, state); } catch (Exception e) { LOGGER.error(getJavaExpressionWithAppend(), e); throw e; } }
Source:
public void testCollectionsWithoutValue() { SettableConfig config = new DefaultSettableConfig(); PropertyFactory factory = DefaultPropertyFactory.from(config); ConfigProxyFactory proxy = new ConfigProxyFactory(config, config.getDecoder(), factory); ConfigWithCollections withCollections = proxy.newProxy(ConfigWithCollections.class); Assert.assertNull(withCollections.getLinkedList()); Assert.assertNull(withCollections.getList()); Assert.assertNull(withCollections.getSet()); Assert.assertNull(withCollections.getSortedSet()); }

Target:
public void testCollectionsWithoutValue() { SettableConfig config = new DefaultSettableConfig(); PropertyFactory factory = DefaultPropertyFactory.from(config); ConfigProxyFactory proxy = new ConfigProxyFactory(config, config.getDecoder(), factory); ConfigWithCollections withCollections = proxy.newProxy(ConfigWithCollections.class); Assert.assertTrue(withCollections.getLinkedList().isEmpty()); Assert.assertTrue(withCollections.getList().isEmpty()); Assert.assertTrue(withCollections.getSet().isEmpty()); Assert.assertTrue(withCollections.getSortedSet().isEmpty()); }
Source:
public void initializeHandlers() { super.initializeHandlers(); registerHandler(getView().getTotalSecurity().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalSecurity().getCommand().execute(); } })); registerHandler(getView().getTotalBugFix().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalBugFix().getCommand().execute(); } })); registerHandler(getView().getTotalEnhancement().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalEnhancement().getCommand().execute(); } })); logger.info("subscribing to HostErrataCountModel changes"); currentErrataModel.addErrataCountsChangeListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { logger.info("bus published message that the counts changed. update view."); ErrataCounts counts = currentErrataModel.getErrataCounts(); getView().showCounts(counts); } }); currentErrataModel.addErrorMessageChangeListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if (currentErrataModel.getMessage() != null && !currentErrataModel.getMessage().isEmpty()) { logger.info("bus published message that there was a query error. update view."); getView().showErrorMessage(SafeHtmlUtils.fromString(currentErrataModel.getMessage())); } } }); }

Target:
public void initializeHandlers() { super.initializeHandlers(); registerHandler(getView().getTotalSecurity().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalSecurity().getCommand().execute(); } })); registerHandler(getView().getTotalBugFix().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalBugFix().getCommand().execute(); } })); registerHandler(getView().getTotalEnhancement().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalEnhancement().getCommand().execute(); } })); currentErrataModel.addErrataCountsChangeListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { ErrataCounts counts = currentErrataModel.getErrataCounts(); getView().showCounts(counts); } }); currentErrataModel.addErrorMessageChangeListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if (currentErrataModel.getMessage() != null && !currentErrataModel.getMessage().isEmpty()) { getView().showErrorMessage(SafeHtmlUtils.fromString(currentErrataModel.getMessage())); } } }); }
Source:
public void testLogoDetectGcs() throws Exception { LogoDetectionGcs.detectLogoGcs("gs://cloud-samples-data/video/googlework_tiny.mp4"); String got = bout.toString(); assertThat(got).contains("Description : Google Maps"); assertThat(got).contains("Confidence"); assertThat(got).contains("Start Time Offset"); assertThat(got).contains("End Time Offset"); }

Target:
public void testLogoDetectGcs() throws IOException, ExecutionException, InterruptedException, TimeoutException { LogoDetectionGcs.detectLogoGcs("gs://cloud-samples-data/video/googlework_tiny.mp4"); String got = bout.toString(); assertThat(got).contains("Description"); assertThat(got).contains("Confidence"); assertThat(got).contains("Start Time Offset"); assertThat(got).contains("End Time Offset"); }
Source:
public final CompletableFuture<Void> closeAsync() { if (isHandlerClosed.compareAndSet(false, true)) { return FutureUtils.composeAfterwards(closeHandlerAsync(), inFlightRequestTracker::awaitAsync); } else { log.warn("Handler instance had already been closed, not allowed to close it again.", this); return CompletableFuture.completedFuture(null); } }

Target:
public final CompletableFuture<Void> closeAsync() { synchronized (lock) { if (terminationFuture == null) { this.terminationFuture = FutureUtils.composeAfterwards(closeHandlerAsync(), inFlightRequestTracker::awaitAsync); } else { log.warn("The handler instance for had already been closed, but another attempt at closing it was made.", untypedResponseMessageHeaders.getTargetRestEndpointURL()); } return this.terminationFuture; } }