auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public FactoryParametersResolver getFactoryParametersResolver(Map<String, String> parameters) { if (specificFactoryParametersResolvers != null) for (FactoryParametersResolver factoryParametersResolver : specificFactoryParametersResolvers) { if (factoryParametersResolver.accept(parameters)) { return factoryParametersResolver; } } return defaultFactoryResolver.accept(parameters) ? defaultFactoryResolver : null; }

Target:
public FactoryParametersResolver getFactoryParametersResolver(Map<String, String> parameters) throws BadRequestException { if (specificFactoryParametersResolvers != null) { for (FactoryParametersResolver factoryParametersResolver : specificFactoryParametersResolvers) { if (factoryParametersResolver.accept(parameters)) { return factoryParametersResolver; } } } if (defaultFactoryResolver.accept(parameters)) { return defaultFactoryResolver; } else { throw new BadRequestException(FACTORY_NOT_RESOLVABLE); } }
Source:
public static boolean openRenameWizard(String newName, IStructuredSelection structuredSelection) { Map<String, Object> commandParameters = Collections.singletonMap(LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY, newName); return runCommand(LTK_RENAME_ID, structuredSelection, commandParameters); }

Target:
public static boolean openRenameWizard(String newName, IStructuredSelection structuredSelection) { Map<String, Object> commandParameters; if (newName != null) { commandParameters = Collections.singletonMap(LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY, newName); } else { commandParameters = Collections.emptyMap(); } return runCommand(LTK_RENAME_ID, structuredSelection, commandParameters); }
Source:
private String getResponse(String token, String searchPhrase, int itemStartNumber) throws ClientProtocolException, IOException { HttpPost post = new HttpPost("<LINK_0>"); post.setHeader("Content-type", "application/json"); if (searchPhrase.contains(" ")) { searchPhrase = "\"" + searchPhrase + "\""; } VideoRequest videoRequest = new VideoRequest(token, searchPhrase, itemsPerPage, itemStartNumber); JsonElement json = toJson(videoRequest); post.setEntity(new StringEntity(json.toString())); HttpResponse resp = new DefaultHttpClient().execute(post); InputStreamReader reader = new InputStreamReader(resp.getEntity().getContent()); return CharStreams.toString(reader); }

Target:
private String getResponse(String token, String searchPhrase, int itemStartNumber) throws ClientProtocolException, IOException { HttpPost post = new HttpPost("<LINK_0>"); post.setHeader("Content-type", "application/json"); if (searchPhrase.contains(" ")) { searchPhrase = "\"" + searchPhrase.replaceAll("\"", "\\\"") + "\""; } VideoRequest videoRequest = new VideoRequest(token, searchPhrase, itemsPerPage, itemStartNumber); JsonElement json = toJson(videoRequest); post.setEntity(new StringEntity(json.toString())); HttpResponse resp = new DefaultHttpClient().execute(post); InputStreamReader reader = new InputStreamReader(resp.getEntity().getContent()); return CharStreams.toString(reader); }
Source:
private <T> T mockTransformer(Map<String, Object> serviceProperties, Class<T> clazz) { T metacardTransformer = mock(clazz); ServiceReference<T> serviceReference = mock(ServiceReference.class); when(serviceReference.getPropertyKeys()) .thenReturn(serviceProperties.keySet().toArray(new String[0])); when(bundleContext.getService(serviceReference)).thenReturn(metacardTransformer); when(serviceReference.getProperty(eq(TransformerProperties.MIME_TYPE))) .thenReturn( serviceProperties .entrySet() .stream() .filter( stringObjectEntry -> stringObjectEntry.getKey().equals(TransformerProperties.MIME_TYPE)) .map(Map.Entry::getValue) .filter(List.class::isInstance) .map(List.class::cast) .flatMap(Collection::stream) .filter(String.class::isInstance) .map(String.class::cast) .collect(Collectors.toList())); when(serviceReference.getProperty(eq(Constants.SERVICE_ID))) .thenReturn( serviceProperties .entrySet() .stream() .filter( stringObjectEntry -> stringObjectEntry.getKey().equals(Constants.SERVICE_ID)) .map(Map.Entry::getValue) .filter(String.class::isInstance) .map(String.class::cast) .findFirst() .orElse(null)); serviceMap.computeIfAbsent(clazz, aClass -> new ArrayList()).add(serviceReference); return metacardTransformer; }

Target:
private <T> T mockTransformer(Map<String, Object> serviceProperties, Class<T> clazz) { T metacardTransformer = mock(clazz); ServiceReference<T> serviceReference = mock(ServiceReference.class); when(serviceReference.getPropertyKeys()) .thenReturn(serviceProperties.keySet().toArray(new String[0])); when(bundleContext.getService(serviceReference)).thenReturn(metacardTransformer); when(serviceReference.getProperty(eq(TransformerProperties.MIME_TYPE))) .thenReturn( serviceProperties .entrySet() .stream() .filter( stringObjectEntry -> stringObjectEntry.getKey().equals(TransformerProperties.MIME_TYPE)) .map(Map.Entry::getValue) .filter(List.class::isInstance) .map(List.class::cast) .flatMap(Collection::stream) .filter(String.class::isInstance) .map(String.class::cast) .collect(Collectors.toList())); when(serviceReference.getProperty(eq(Constants.SERVICE_ID))) .thenReturn(serviceProperties.get(Constants.SERVICE_ID)); serviceMap.computeIfAbsent(clazz, aClass -> new ArrayList()).add(serviceReference); return metacardTransformer; }
Source:
private void updateMetaDataDescription(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); if (!isDomainExistAndActive()) { auditLogForNoMetadataDescriptionUpdate(AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED_SINCE_STORAGE_DOMAIN_NOT_ACTIVE, storageDomain, diskImage); return; } try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); auditLogForNoMetadataDescriptionUpdate(AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED, storageDomain, diskImage); } }

Target:
private void updateMetaDataDescription(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); if (getStorageDomainValidator((DiskImage) getNewDisk()).isDomainExistAndActive().isValid()) { auditLogForNoMetadataDescriptionUpdate(AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_SKIPPED_SINCE_STORAGE_DOMAIN_NOT_ACTIVE, storageDomain, diskImage); return; } try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); auditLogForNoMetadataDescriptionUpdate(AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED, storageDomain, diskImage); } }
Source:
protected boolean processChanges(IWorkbenchPreferenceContainer container) { IScopeContext currContext= fLookupOrder[0]; List<Key> changedOptions= new ArrayList<>(); boolean needsBuild= getChanges(currContext, changedOptions); if (changedOptions.isEmpty()) { return true; } if (needsBuild) { int count= getRebuildCount(); if (count > fRebuildCount) { needsBuild= false; fRebuildCount= count; } } boolean doBuild= false; if (needsBuild) { String[] strings= getFullBuildDialogStrings(fProject == null); if (strings != null) { if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length == 0) { doBuild= true; } else { MessageDialog dialog= new MessageDialog(getShell(), strings[0], null, strings[1], MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 1); int res= dialog.open(); if (res == 0) { doBuild= true; } else { return false; } } } } if (container != null) { if (doBuild) { incrementRebuildCount(); container.registerUpdateJob(CoreUtility.getBuildJob(fProject)); } } else { try { fManager.applyChanges(); } catch (BackingStoreException e) { JavaPlugin.log(e); return false; } if (doBuild) { CoreUtility.getBuildJob(fProject).schedule(); } } return true; }

Target:
protected boolean processChanges(IWorkbenchPreferenceContainer container) { IScopeContext currContext= fLookupOrder[0]; List<Key> changedOptions= new ArrayList<>(); boolean needsBuild= getChanges(currContext, changedOptions); if (changedOptions.isEmpty()) { return true; } if (needsBuild) { int count= getRebuildCount(); if (count > fRebuildCount) { needsBuild= false; fRebuildCount= count; } } boolean doBuild= false; if (needsBuild) { boolean hasJdtCoreSettings= hasJdtCoreSettings(changedOptions); boolean isAutoBuildOn= isAutoBuilding(); boolean willAutoBuild= isAutoBuildOn && hasJdtCoreSettings; String[] strings= getFullBuildDialogStrings(fProject == null); if (strings != null) { if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length == 0) { doBuild= true; } else { String[] dialogButtonLabels= new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; if (willAutoBuild) { dialogButtonLabels= new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }; } int yesResult= 0; int cancelResult= dialogButtonLabels.length - 1; MessageDialog dialog= new MessageDialog(getShell(), strings[0], null, strings[1], MessageDialog.QUESTION, dialogButtonLabels, 1); int dialogDesult= dialog.open(); if (dialogDesult == yesResult) { if (!willAutoBuild) { doBuild= true; } } else if (dialogDesult == cancelResult) { return false; } } } } if (container != null) { if (doBuild) { incrementRebuildCount(); container.registerUpdateJob(CoreUtility.getBuildJob(fProject)); } } else { try { fManager.applyChanges(); } catch (BackingStoreException e) { JavaPlugin.log(e); return false; } if (doBuild) { CoreUtility.getBuildJob(fProject).schedule(); } } return true; }
Source:
private DaoState(int chainHeight, LinkedList<Block> blocks, LinkedList<Cycle> cycles, TreeMap<TxOutputKey, TxOutput> unspentTxOutputMap, TreeMap<TxOutputKey, SpentInfo> spentInfoMap, List<String> confiscatedLockupTxList, TreeMap<String, Issuance> issuanceMap, List<ParamChange> paramChangeList, List<EvaluatedProposal> evaluatedProposalList, List<DecryptedBallotsWithMerits> decryptedBallotsWithMeritsList) { this.chainHeight = chainHeight; this.blocks = blocks; this.cycles = cycles; this.unspentTxOutputMap = unspentTxOutputMap; this.spentInfoMap = spentInfoMap; this.confiscatedLockupTxList = confiscatedLockupTxList; this.issuanceMap = issuanceMap; this.paramChangeList = paramChangeList; this.evaluatedProposalList = evaluatedProposalList; this.decryptedBallotsWithMeritsList = decryptedBallotsWithMeritsList; txMap = blocks.stream() .flatMap(block -> block.getTxs().stream()) .collect(Collectors.toMap(Tx::getId, Function.identity(), (x, y) -> y, HashMap::new)); }

Target:
private DaoState(int chainHeight, LinkedList<Block> blocks, LinkedList<Cycle> cycles, TreeMap<TxOutputKey, TxOutput> unspentTxOutputMap, TreeMap<TxOutputKey, SpentInfo> spentInfoMap, List<String> confiscatedLockupTxList, TreeMap<String, Issuance> issuanceMap, List<ParamChange> paramChangeList, List<EvaluatedProposal> evaluatedProposalList, List<DecryptedBallotsWithMerits> decryptedBallotsWithMeritsList) { this.chainHeight = chainHeight; this.blocks = blocks; this.cycles = cycles; this.unspentTxOutputMap = unspentTxOutputMap; this.spentInfoMap = spentInfoMap; this.confiscatedLockupTxList = confiscatedLockupTxList; this.issuanceMap = issuanceMap; this.paramChangeList = paramChangeList; this.evaluatedProposalList = evaluatedProposalList; this.decryptedBallotsWithMeritsList = decryptedBallotsWithMeritsList; txCache = blocks.stream() .flatMap(block -> block.getTxs().stream()) .collect(Collectors.toMap(Tx::getId, Function.identity(), (x, y) -> x, HashMap::new)); }
Source:
public BatchDTO convertJSONObjectToDTO(JSONObject jsonObject, boolean related) throws DataException { BatchDTO batchDTO = new BatchDTO(); batchDTO.setId(getIdFromJSONObject(jsonObject)); JSONObject batchObject = getSource(jsonObject); batchDTO.setTitle(getStringPropertyForDTO(batchObject, "title")); batchDTO.setType(getStringPropertyForDTO(batchObject, "type")); if (!related) { batchDTO = convertRelatedJSONObjects(batchObject, batchDTO); } return batchDTO; }

Target:
public BatchDTO convertJSONObjectToDTO(JSONObject jsonObject, boolean related) throws DataException { BatchDTO batchDTO = new BatchDTO(); batchDTO.setId(getIdFromJSONObject(jsonObject)); JSONObject batchJSONObject = getSource(jsonObject); batchDTO.setTitle(getStringPropertyForDTO(batchJSONObject, "title")); batchDTO.setType(getStringPropertyForDTO(batchJSONObject, "type")); if (!related) { batchDTO = convertRelatedJSONObjects(batchJSONObject, batchDTO); } return batchDTO; }
Source:
public List<String> getList(String k, List<String> defaultValue) { if (!containsKey(k)) return defaultValue; String value = get(k); if (value.isEmpty()) { return Collections.emptyList(); } String[] pieces = value.split("\\s*,\\s*"); return Arrays.asList(pieces); }

Target:
public List<String> getList(String k, List<String> defaultValue) { if (!containsKey(k)) return defaultValue; String value = get(k); if (value.trim().isEmpty()) { return defaultValue; } String[] pieces = value.split("\\s*,\\s*"); return Arrays.asList(pieces); }
Source:
protected void unmapNode(ModelNode node) { unmapElement(node); ModelNode[] childrenNodes = node.getChildrenNodes(); if (childrenNodes != null) { for (ModelNode childrenNode : childrenNodes) { unmapNode(childrenNode); } } }

Target:
protected void unmapNode(ModelNode node) { unmapElement(node); ModelNode[] childrenNodes = node.getChildrenNodes(); if (childrenNodes != null) { for (ModelNode childNode : childrenNodes) { unmapNode(childNode); } } }
Source:
public WriteContext(MessageType schema, Map<String, String> extraMetaData) { super(); this.schema = Objects.requireNonNull(schema, "schema cannot be null"); this.extraMetaData = Collections.unmodifiableMap(Objects.requireNonNull(extraMetaData, "extraMetaData")); }

Target:
public WriteContext(MessageType schema, Map<String, String> extraMetaData) { super(); this.schema = Objects.requireNonNull(schema, "schema cannot be null"); this.extraMetaData = Collections.unmodifiableMap(Objects .requireNonNull(extraMetaData, "extraMetaData cannot be null")); }
Source:
public Map<Long, Double> mappingScanner(MetricScanner scanner) { Map<Long, Double> absDatapoints = new HashMap<>(); synchronized (scanner) { while (scanner.hasNextDP()) { Map.Entry<Long, Double> nextDP = scanner.getNextDP(); absDatapoints.put(nextDP.getKey(), nextDP.getValue()); } } return absDatapoints; }

Target:
public Map<Long, Double> mappingScanner(MetricScanner scanner) { Map<Long, Double> absDatapoints = new HashMap<>(); while (scanner.hasNextDP()) { Map.Entry<Long, Double> nextDP = scanner.getNextDP(); absDatapoints.put(nextDP.getKey(), Math.abs(nextDP.getValue())); } return absDatapoints; }
Source:
private long interval(Config rc, String section) { long interval = -1; try { interval = ConfigUtil.getTimeUnit(rc, section, null, KEY_INTERVAL, -1, TimeUnit.MILLISECONDS); if (interval == -1) { log.info(MessageFormat.format("{0} schedule parameter \"{0}.{1}\" is not configured", section, KEY_INTERVAL)); } } catch (IllegalArgumentException e) { log.error(MessageFormat.format("Invalid {0} schedule parameter \"{0}.{1}\"", section, KEY_INTERVAL), e); } return interval; }

Target:
private static long interval(Config rc, String section) { long interval = -1; try { interval = ConfigUtil.getTimeUnit(rc, section, null, KEY_INTERVAL, -1, TimeUnit.MILLISECONDS); if (interval == -1) { log.info(MessageFormat.format("{0} schedule parameter \"{0}.{1}\" is not configured", section, KEY_INTERVAL)); } } catch (IllegalArgumentException e) { log.error(MessageFormat.format("Invalid {0} schedule parameter \"{0}.{1}\"", section, KEY_INTERVAL), e); } return interval; }
Source:
public RGB open () { byte buffer = Converter.wcsToMbcs (null, title, true); long handle = 0; Display display = parent != null ? parent.getDisplay (): Display.getCurrent (); if (OS.GTK_VERSION >= OS.VERSION (3, 4, 0)) { handle = OS.gtk_color_chooser_dialog_new (buffer, parent.topHandle ()); GdkRGBA rgba = new GdkRGBA (); generateGdkRGBAFromRGB(rgba, handle); parseRGBSGtk3(handle, rgba); Dialog oldModal = setModal(handle, display); int signalId = setSignalId(); long hookId = setHookId(handle, display, signalId); display.sendPreExternalEventDispatchEvent (); int response = OS.gtk_dialog_run (handle); boolean success = buttonClicked(handle, display, oldModal, signalId, hookId, response); if (success) { rgb = generateRGBFromGdkRGBA(handle, rgba); } destroy(handle, display); if (!success) { return null; } } else { handle = OS.gtk_color_selection_dialog_new (buffer); GdkColor color = new GdkColor (); setUpWindowGtk2(handle); long colorsel = generateGdkColorFromRGB(color, handle); parseRGBSGtk2(color); Dialog oldModal = setModal(handle, display); int signalId = setSignalId(); long hookId = setHookId(handle, display, signalId); display.sendPreExternalEventDispatchEvent (); int response = OS.gtk_dialog_run (handle); boolean success = buttonClicked(handle, display, oldModal, signalId, hookId, response); if (success) { rgb = generateRGBFromGdkColor(color, colorsel); } recreateRGBS(color); destroy(handle, display); if (!success) { return null; } } return rgb; }

Target:
public RGB open () { byte buffer = Converter.wcsToMbcs (null, title, true); long handle = 0; Display display = parent != null ? parent.getDisplay (): Display.getCurrent (); boolean success; if (OS.GTK_VERSION >= OS.VERSION (3, 4, 0)) { handle = OS.gtk_color_chooser_dialog_new (buffer, parent.topHandle ()); GdkRGBA rgba = new GdkRGBA (); setCurrentColorGtk3(rgba, handle); parseRGBSGtk3(handle, rgba); Dialog oldModal = setModal(handle, display); int signalId = lookupSignalId(); long hookId = addEmissionHook(handle, display, signalId); display.sendPreExternalEventDispatchEvent (); int response = OS.gtk_dialog_run (handle); success = buttonClicked(handle, display, oldModal, signalId, hookId, response); if (success) { rgb = acquireCurrentColorSelectionGtk3(handle, rgba); } } else { handle = OS.gtk_color_selection_dialog_new (buffer); GdkColor color = new GdkColor (); setUpWindowGtk2(handle); long colorsel = setCurrentColorGtk2(color, handle); parseRGBSGtk2(color); Dialog oldModal = setModal(handle, display); int signalId = lookupSignalId(); long hookId = addEmissionHook(handle, display, signalId); display.sendPreExternalEventDispatchEvent (); int response = OS.gtk_dialog_run (handle); success = buttonClicked(handle, display, oldModal, signalId, hookId, response); if (success) { rgb = acquireCurrentColorSelectionGtk2(color, colorsel); } recreateRGBS(color); } destroy(handle, display); if (!success) { return null; } return rgb; }
Source:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll( Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { if (!proxy.isRunning()) { LOG.info("KafkaSystemConsumer: proxy is not running. Stopping the consumer."); stop(); String message = String.format("%s: KafkaConsumerProxy has stopped.", this); throw new SamzaException(message, proxy.getFailureCause()); } return super.poll(systemStreamPartitions, timeout); }

Target:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll( Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { if (!proxy.isRunning()) { LOG.info("{}: KafkaConsumerProxy is not running. Stopping the consumer.", this); stop(); String message = String.format("%s: KafkaConsumerProxy has stopped.", this); throw new SamzaException(message, proxy.getFailureCause()); } return super.poll(systemStreamPartitions, timeout); }
Source:
protected boolean compareAndRemove(Ref oldRef) throws IOException { boolean ret = compareAndRemoveImpl(oldRef); if (ret) { objdb.markDirty(); } return ret; }

Target:
protected boolean compareAndRemove(Ref oldRef) throws IOException { try { lock.writeLock().lock(); String name = oldRef.getName(); Ref cur = refs.get(name); if (cur != null && eq(cur, oldRef)) return refs.remove(name, cur); else return false; } finally { lock.writeLock().unlock(); } }
Source:
public void saveParameters(List<ScriptGeneratorAction> scriptGenContent, String scriptDefPath, String absoluteFilePath) throws InterruptedException, ExecutionException { try { String content = new String(Files.readAllBytes(Paths.get(scriptDefPath))); Gson gson = new GsonBuilder().setPrettyPrinting().create(); String jsonContent = gson.toJson(new ParametersConverter(CURRENT_VERSION, convertScriptGenContent(scriptGenContent), content, "", getCurrentDate(), getCurrentTime(), scriptDefPath, "", getCurrentGenieVersionNumber())); writeParametersToJSONFile(jsonContent, absoluteFilePath); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void saveParameters(List<ScriptGeneratorAction> scriptGenContent, String scriptDefPath, String absoluteFilePath) throws InterruptedException, ExecutionException { try { String content = createJsonString(scriptGenContent, readFileContent(scriptDefPath), scriptDefPath); writeParametersToJSONFile(content, absoluteFilePath); } catch (IOException e) { LOG.error(e); } }
Source:
public static boolean isAllowedOrigin(final String requestOrigin, final Set<URI> allowedOrigins) { if (requestOrigin == null) { return false; } URI requestOriginURI; try { requestOriginURI = new URI(requestOrigin.toString()); } catch (Exception e) { return false; } String requestScheme = requestOriginURI.getScheme(); String requestHost = requestOriginURI.getHost(); int requestPort = requestOriginURI.getPort(); if (requestScheme == null || requestHost == null) { return false; } for (URI allowedOrigin : allowedOrigins) { if ((requestHost.equalsIgnoreCase(allowedOrigin.getHost()) || requestHost.toLowerCase().endsWith("." + allowedOrigin.getHost().toLowerCase())) && requestPort == allowedOrigin.getPort() && requestScheme.equalsIgnoreCase(allowedOrigin.getScheme())) { return true; } } return false; }

Target:
public static boolean isAllowedOrigin(final String requestOrigin, final Set<URI> allowedOrigins) { if (requestOrigin == null) { return false; } URI requestOriginURI; try { requestOriginURI = new URI(requestOrigin); } catch (URISyntaxException e) { return false; } String requestScheme = requestOriginURI.getScheme(); String requestHost = requestOriginURI.getHost(); int requestPort = requestOriginURI.getPort(); if (requestScheme == null || requestHost == null) { return false; } for (URI allowedOrigin : allowedOrigins) { if ((requestHost.equalsIgnoreCase(allowedOrigin.getHost()) || requestHost.toLowerCase().endsWith("." + allowedOrigin.getHost().toLowerCase())) && requestPort == allowedOrigin.getPort() && requestScheme.equalsIgnoreCase(allowedOrigin.getScheme())) { return true; } } return false; }
Source:
private StorageDomainSharedStatus getStorageDomainSharedStatus() { StorageDomainSharedStatus status = null; if (getStorageDomain() != null) { status = getStorageDomain().getStorageDomainSharedStatus(); } return status; }

Target:
private StorageDomainSharedStatus getStorageDomainSharedStatus() { return getStorageDomain() == null ? null : getStorageDomain().getStorageDomainSharedStatus(); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_peripherals); mAdvStatus = (TextView) findViewById(R.id.textView_advertisingStatus); mConnectionStatus = (TextView) findViewById(R.id.textView_connectionStatus); mBatteryLevelEditText = (EditText) findViewById(R.id.textView_batteryLevel); mBatteryLevelEditText.setOnEditorActionListener(mOnEditorActionListener); mBatteryLevelSeekBar = (SeekBar) findViewById(R.id.seekBar_batteryLevel); mBatteryLevelSeekBar.setOnSeekBarChangeListener(mOnSeekBarChangeListener); setUpBluetooth(); mAdvSettings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .setConnectable(true) .build(); mAdvData = new AdvertiseData.Builder() .setIncludeDeviceName(true) .setIncludeTxPowerLevel(true) .build(); mBatteryLevelCharacteristic = new BluetoothGattCharacteristic(BATTERY_LEVEL_UUID, BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ); mBatteryService = new BluetoothGattService(BATTERY_SERVICE_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY); mBatteryService.addCharacteristic(mBatteryLevelCharacteristic); setBatteryLevel(INITIAL_BATTERY_LEVEL, null); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_peripherals); mAdvStatus = (TextView) findViewById(R.id.textView_advertisingStatus); mConnectionStatus = (TextView) findViewById(R.id.textView_connectionStatus); mBatteryLevelEditText = (EditText) findViewById(R.id.textView_batteryLevel); mBatteryLevelEditText.setOnEditorActionListener(mOnEditorActionListener); mBatteryLevelSeekBar = (SeekBar) findViewById(R.id.seekBar_batteryLevel); mBatteryLevelSeekBar.setOnSeekBarChangeListener(mOnSeekBarChangeListener); ensureBleFeaturesAvailable(); mAdvSettings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .setConnectable(true) .build(); mAdvData = new AdvertiseData.Builder() .setIncludeDeviceName(true) .setIncludeTxPowerLevel(true) .build(); mBatteryLevelCharacteristic = new BluetoothGattCharacteristic(BATTERY_LEVEL_UUID, BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ); mBatteryService = new BluetoothGattService(BATTERY_SERVICE_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY); mBatteryService.addCharacteristic(mBatteryLevelCharacteristic); setBatteryLevel(INITIAL_BATTERY_LEVEL, null); }
Source:
public StorageQuotaSource.Listener getQuotaSourceListener() { return new StorageQuotaSource.Listener() { @Override public void onNewContainerStorageQuota(Map<String, Map<String, Long>> containerStorageQuota) { Map<String, Map<String, Long>> newQuota = new HashMap<>(); initMap(containerStorageQuota, newQuota, false); storageQuota = newQuota; } }; }

Target:
StorageQuotaSource.Listener getQuotaSourceListener() { return containerStorageQuota -> { Map<String, Map<String, Long>> newQuota = new HashMap<>(); initMap(containerStorageQuota, newQuota, false); storageQuota = newQuota; }; }
Source:
public SyncUser get(String identity) { String userJson = nativeGetUser(identity); if (userJson != null) { return SyncUser.fromJson(userJson); } return null; }

Target:
public SyncUser get(String identity) { String userJson = nativeGetUser(identity); return toSyncUserOrNull(userJson); }
Source:
public InternalFunctions getFunctions(RealmUser user) { return new InternalFunctions(user); }

Target:
public Functions getFunctions(RealmUser user) { return new FunctionsImpl(user); }
Source:
private void handleMessageAndSend(Message<?> message) { Object payload = this.messageConverter.fromMessage(message, this.payloadType.get()); SimpMessageHeaderAccessor headerAccessor = SimpMessageHeaderAccessor.wrap(message); SimpMessageType messageType = headerAccessor.getMessageType(); if ((messageType == null || SimpMessageType.MESSAGE.equals(messageType)) && !checkDestinationPrefix(headerAccessor.getDestination())) { headerAccessor.removeHeader(SimpMessageHeaderAccessor.NATIVE_HEADERS); sendMessage(MessageBuilder.withPayload(payload).copyHeaders(headerAccessor.toMap()).build()); } else { if (this.brokerHandler != null) { this.brokerHandler.handleMessage(message); } else if (logger.isDebugEnabled()) { logger.debug("Messages with non 'SimpMessageType.MESSAGE' type are ignored for sending to the " + "'outputChannel'. They have to be emitted as 'ApplicationEvent's " + "from the 'SubProtocolHandler'. Or using 'AbstractBrokerMessageHandler'(useBroker = true) " + "from server side. Received message: " + message); } } }

Target:
private void handleMessageAndSend(Message<?> message) { Object payload = this.messageConverter.fromMessage(message, this.payloadType.get()); SimpMessageHeaderAccessor headerAccessor = SimpMessageHeaderAccessor.wrap(message); SimpMessageType messageType = headerAccessor.getMessageType(); if ((messageType == null || SimpMessageType.MESSAGE.equals(messageType)) && !checkDestinationPrefix(headerAccessor.getDestination())) { headerAccessor.removeHeader(SimpMessageHeaderAccessor.NATIVE_HEADERS); sendMessage(getMessageBuilderFactory().withPayload(payload).copyHeaders(headerAccessor.toMap()).build()); } else { if (this.brokerHandler != null) { this.brokerHandler.handleMessage(message); } else if (logger.isDebugEnabled()) { logger.debug("Messages with non 'SimpMessageType.MESSAGE' type are ignored for sending to the " + "'outputChannel'. They have to be emitted as 'ApplicationEvent's " + "from the 'SubProtocolHandler'. Or using 'AbstractBrokerMessageHandler'(useBroker = true) " + "from server side. Received message: " + message); } } }
Source:
public GenomicsRequestInitializer<GenomicsRequest<?>> setFieldsInitializer(final String fields) { return new GenomicsRequestInitializer<GenomicsRequest<?>>() { @Override public void initialize(GenomicsRequest<?> search) { if (null != fields) { for (String requiredField : REQUIRED_STRICT_SHARD_FIELDS.keySet()) { Preconditions .checkArgument( shardBoundary != ShardBoundary.STRICT || fields.matches(REQUIRED_STRICT_SHARD_FIELDS.get(requiredField)), "Required field missing: '%s' Add this field to the list of Read fields to be returned in the partial response.", requiredField); } search.setFields(fields); } } }; }

Target:
public GenomicsRequestInitializer<GenomicsRequest<?>> setFieldsInitializer(final String fields) { if(shardBoundary == ShardBoundary.STRICT) { return new GenomicsSearchFieldRequestInitializer(fields, REQUIRED_STRICT_SHARD_FIELDS); } return new GenomicsSearchFieldRequestInitializer(fields, REQUIRED_FIELDS); }
Source:
public void deleteEnvironmentPrerequisites(EnvironmentPrerequisiteDeleteRequest environmentPrerequisiteDeleteRequest) { AzureClient azureClient = azureClientService.getClient(environmentPrerequisiteDeleteRequest.getCloudCredential()); String resourceGroupName = environmentPrerequisiteDeleteRequest.getAzurePrerequisiteDeleteRequest().getResourceGroupName(); try { if (!azureClient.isResourceGroupEmpty(resourceGroupName)) { String message = String.format("Resource group %s is not empty, cannot proceed with deleting the environment. " + "Please check contents on azure portal.", resourceGroupName); LOGGER.warn(message); throw new CloudConnectorException(message); } azureUtils.deleteResourceGroup(azureClient, resourceGroupName, false); } catch (CloudException e) { throw new CloudConnectorException("Could not delete resource group", e); } }

Target:
public void deleteEnvironmentPrerequisites(EnvironmentPrerequisiteDeleteRequest environmentPrerequisiteDeleteRequest) { AzureClient azureClient = azureClientService.getClient(environmentPrerequisiteDeleteRequest.getCloudCredential()); environmentPrerequisiteDeleteRequest.getAzurePrerequisiteDeleteRequest() .map(AzurePrerequisiteDeleteRequest::getResourceGroupName) .ifPresentOrElse( resourceGroupName -> deleteResourceGroup(azureClient, resourceGroupName), () -> LOGGER.debug("No azure resource group was defined, not deleting resource group.") ); }
Source:
public static byte[] compressJSONString(String data) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(data.length()); GZIPOutputStream gzip = new GZIPOutputStream(bos); gzip.write(data.getBytes()); gzip.close(); byte[] compressed = bos.toByteArray(); bos.close(); return compressed; }

Target:
public static byte[] compressJSONString(String data) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(data.length()); try (GZIPOutputStream gzip = new GZIPOutputStream(bos)) { gzip.write(data.getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw e; } return bos.toByteArray(); }
Source:
private void populateAutoComplete() { AccountManager am = AccountManager.get(this); Account[] accounts = am.getAccounts(); List<String> emails = Observable.from(accounts) .map(new MapAccountToName()) .filter(new FilterEmail()) .distinct() .toList() .toBlocking() .single(); ArrayAdapter<String> adapter = new ArrayAdapter<>( LoginActivity.this, android.R.layout.simple_dropdown_item_1line, emails ); mEmailView.setAdapter(adapter); }

Target:
private void populateAutoComplete() { List<String> emails = LoginPackage.getDeviceUserEmails(this); ArrayAdapter<String> adapter = new ArrayAdapter<>( LoginActivity.this, android.R.layout.simple_dropdown_item_1line, emails ); emailView.setAdapter(adapter); }
Source:
public void testIncompleteParameters() { ______TS("Missing course, session name and question number"); InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId); verifyAssumptionFailure(); FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1"); ______TS("Missing question number"); String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), }; InstructorFeedbackTemplateQuestionAddAction action = getAction(params); RedirectResult result = getRedirectResult(action); assertEquals( getPageResultDestination( Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, true), result.getDestinationWithParams()); assertEquals("No template questions are indicated to be added", result.getStatusMessage()); String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackTemplateQuestionAdd|||" + "instructorFeedbackTemplateQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "|||/page/instructorFeedbackTemplateQuestionAdd"; AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage()); }

Target:
public void testIncompleteParameters() { ______TS("Missing course, session name and question number"); InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId); verifyAssumptionFailure(); ______TS("Missing question number"); FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1"); String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), }; InstructorFeedbackTemplateQuestionAddAction action = getAction(params); RedirectResult result = getRedirectResult(action); assertEquals( getPageResultDestination( Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, true), result.getDestinationWithParams()); assertEquals("No template questions are indicated to be added", result.getStatusMessage()); String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackTemplateQuestionAdd|||" + "instructorFeedbackTemplateQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "|||/page/instructorFeedbackTemplateQuestionAdd"; AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage()); }
Source:
public void setDRM(final ReactExoplayerView videoView, @Nullable ReadableMap drm) { Log.d("SetDRM", "Set DRM config"); if (drm != null && drm.hasKey(PROP_DRM_TYPE)) { String drmType = drm.hasKey(PROP_DRM_TYPE) ? drm.getString(PROP_DRM_TYPE) : null; String drmLicenseServer = drm.hasKey(PROP_DRM_LICENSESERVER) ? drm.getString(PROP_DRM_LICENSESERVER) : null; ReadableMap drmHeaders = drm.hasKey(PROP_DRM_HEADERS) ? drm.getMap(PROP_DRM_HEADERS) : null; if (drmType != null && drmLicenseServer != null && Util.getDrmUuid(drmType) != null) { Log.d("setDrmType", drmType); UUID drmUUID = Util.getDrmUuid(drmType); videoView.setDrmType(drmUUID); videoView.setDrmLicenseUrl(drmLicenseServer); if (drmHeaders != null) { ArrayList<String> drmKeyRequestPropertiesList = new ArrayList<>(); ReadableMapKeySetIterator itr = drmHeaders.keySetIterator(); while (itr.hasNextKey()) { String key = itr.nextKey(); drmKeyRequestPropertiesList.add(key); drmKeyRequestPropertiesList.add(drmHeaders.getString(key)); } videoView.setDrmLicenseHeader(drmKeyRequestPropertiesList.toArray(new String[0])); } Log.d("setDrm", "Disabling TextureView (needed for DRM)"); videoView.setUseTextureView(false); } } }

Target:
public void setDRM(final ReactExoplayerView videoView, @Nullable ReadableMap drm) { if (drm != null && drm.hasKey(PROP_DRM_TYPE)) { String drmType = drm.hasKey(PROP_DRM_TYPE) ? drm.getString(PROP_DRM_TYPE) : null; String drmLicenseServer = drm.hasKey(PROP_DRM_LICENSESERVER) ? drm.getString(PROP_DRM_LICENSESERVER) : null; ReadableMap drmHeaders = drm.hasKey(PROP_DRM_HEADERS) ? drm.getMap(PROP_DRM_HEADERS) : null; if (drmType != null && drmLicenseServer != null && Util.getDrmUuid(drmType) != null) { UUID drmUUID = Util.getDrmUuid(drmType); videoView.setDrmType(drmUUID); videoView.setDrmLicenseUrl(drmLicenseServer); if (drmHeaders != null) { ArrayList<String> drmKeyRequestPropertiesList = new ArrayList<>(); ReadableMapKeySetIterator itr = drmHeaders.keySetIterator(); while (itr.hasNextKey()) { String key = itr.nextKey(); drmKeyRequestPropertiesList.add(key); drmKeyRequestPropertiesList.add(drmHeaders.getString(key)); } videoView.setDrmLicenseHeader(drmKeyRequestPropertiesList.toArray(new String[0])); } videoView.setUseTextureView(false); } } }
Source:
public void start(String[] filename) { Log.togglePrinting(); addToLog("[LAUNCHER]\tLoading file: " + filename + "."); try { addToLog("[LAUNCHER]\tLoading file: " + filename + " succeeded."); MapParser mp = new MapParser(); ArrayList<Level> levelList = new ArrayList<>(); for(String levelFileName : filename) { InputStream map = getClass().getResourceAsStream(levelFileName); Level level = mp.parseMap(map); levelList.add(level); } Game game = new Game(levelList, levelList.get(0).getPlayers()); Map<Integer, Action> keyMappings = createSinglePlayerKeyMappings(game); JBubbleBobbleUI ui = new JBubbleBobbleUI(game, keyMappings); InputStream map = getClass().getResourceAsStream("/game_over.txt"); Level go = mp.parseMap(map); game.setGameOver(go); game.setKeyListener(ui.getKeyListener()); ui.start(); startScheduler(game); } catch (IOException e) { addToLog("[ERROR]\tLoading file: " + filename + " failed."); new DumpLog(); throw new RuntimeException(); } }

Target:
public void start(String[] filename) { Log.togglePrinting(); addToLog("[LAUNCHER]\tLoading file: " + filename + "."); try { addToLog("[LAUNCHER]\tLoading file: " + filename + " succeeded."); MapParser mp = new MapParser(); ArrayList<Level> levelList = new ArrayList<>(); for(String levelFileName : filename) { InputStream map = getClass().getResourceAsStream(levelFileName); Level level = mp.parseMap(map); levelList.add(level); } Game game = new Game(levelList, levelList.get(0).getPlayers()); Map<Integer, Action> keyMappings = createSinglePlayerKeyMappings(game); JBubbleBobbleUI ui = new JBubbleBobbleUI(game, keyMappings); InputStream map = getClass().getResourceAsStream("/game_over.txt"); Level gameOverLevel = mp.parseMap(map); game.setGameOver(gameOverLevel); game.setKeyListener(ui.getKeyListener()); ui.start(); startScheduler(game); } catch (IOException e) { addToLog("[ERROR]\tLoading file: " + filename + " failed."); new DumpLog(); throw new RuntimeException(); } }
Source:
public MesosCluster createMesosCluster(String path) { try (InputStream is = new FileInputStream(path)) { return createMesosCluster(is); } catch (IOException e) { throw new MinimesosException("Could not read minimesos config: " + e.getMessage()); } }

Target:
public MesosCluster createMesosCluster(String path) { try (InputStream is = new FileInputStream(path)) { return createMesosCluster(is); } catch (IOException e) { LOGGER.debug("Could not read minimesos config: ", e.getMessage()); throw new MinimesosException("Could not read minimesos config: " + e.getMessage()); } }
Source:
private static boolean differentAnnotations(List<JavaSymbol> methodParamSymbols, List<JavaSymbol> overrideeParamSymbols) { for (int i = 0; i < methodParamSymbols.size(); i++) { SymbolMetadataResolve overrideeParamMetadata = overrideeParamSymbols.get(i).metadata(); SymbolMetadataResolve methodParamMetadata = methodParamSymbols.get(i).metadata(); for (AnnotationInstance annotation : methodParamMetadata.annotations()) { if (!overrideeParamMetadata.isAnnotatedWith(annotation.symbol().type().fullyQualifiedName())) { return true; } } } return false; }

Target:
private static boolean differentAnnotations(List<JavaSymbol> methodParamSymbols, List<JavaSymbol> overrideeParamSymbols) { for (int i = 0; i < methodParamSymbols.size(); i++) { if (differentAnnotations(methodParamSymbols.get(i).metadata(), overrideeParamSymbols.get(i).metadata())) { return true; } } return false; }
Source:
public void shouldFindSwappedNodeInRangeSearch() throws Exception { int label = token.nodeLabel( "Node" ); int prop = token.propertyKey( "prop" ); CapableIndexReference index = schemaRead.index( label, prop ); try ( org.neo4j.internal.kernel.api.Transaction tx = session.beginTransaction(); NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor() ) { tx.dataWrite().nodeRemoveLabel( strOne, label ); tx.dataWrite().nodeAddLabel( strOneNoLabel, label ); tx.dataRead().nodeIndexSeek( index, node, IndexOrder.NONE, IndexQuery.range( prop, "ett", true, "tre", true ) ); assertTrue( node.next() ); assertEquals( strOneNoLabel, node.nodeReference() ); } }

Target:
public void shouldFindSwappedNodeInRangeSearch() throws Exception { int label = token.nodeLabel( "Node" ); int prop = token.propertyKey( "prop" ); CapableIndexReference index = schemaRead.index( label, prop ); try ( org.neo4j.internal.kernel.api.Transaction tx = session.beginTransaction(); NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor() ) { tx.dataWrite().nodeRemoveLabel( strOne, label ); tx.dataWrite().nodeAddLabel( strOneNoLabel, label ); tx.dataRead().nodeIndexSeek( index, node, IndexOrder.NONE, IndexQuery.range( prop, "one", true, "ones", true ) ); assertTrue( node.next() ); assertEquals( strOneNoLabel, node.nodeReference() ); assertFalse( node.next() ); } }
Source:
public boolean replaceWithBaselineTxVersion(String userId, BranchId branchId, TransactionId txId, int artId, String comment) { boolean introduced = false; ArtifactReadable userReadable = queryFactory.fromBranch(CoreBranches.COMMON).andGuid(userId).getResults().getOneOrNull(); ArtifactReadable baselineArtifact = queryFactory.fromBranch(branchId).fromTransaction(txId).andUuid(artId).getResults().getOneOrNull(); if (userReadable != null && baselineArtifact != null) { TransactionBuilder tx = createTransaction(branchId, userReadable, comment); ArtifactReadable destination = queryFactory.fromBranch(branchId).includeDeletedArtifacts().andUuid(artId).getResults().getOneOrNull(); tx.replaceWithVersion(baselineArtifact, destination); tx.commit(); introduced = true; } else { throw new OseeCoreException("%s Error - The user and baseline artifact were not found.", comment); } return introduced; }

Target:
public boolean replaceWithBaselineTxVersion(String userId, BranchId branchId, TransactionId txId, int artId, String comment) { boolean introduced = false; ArtifactReadable userReadable = queryFactory.fromBranch(CoreBranches.COMMON).andGuid(userId).getResults().getOneOrDefault( ArtifactReadable.SENTINEL); ArtifactReadable baselineArtifact = queryFactory.fromBranch(branchId).fromTransaction(txId).andUuid(artId).getResults().getOneOrDefault( ArtifactReadable.SENTINEL); if ((!userReadable.getId().equals(ArtifactReadable.SENTINEL.getId())) && (!baselineArtifact.getId().equals( ArtifactReadable.SENTINEL.getId()))) { TransactionBuilder tx = createTransaction(branchId, userReadable, comment); ArtifactReadable destination = queryFactory.fromBranch(branchId).includeDeletedArtifacts().andUuid(artId).getResults().getOneOrDefault( ArtifactReadable.SENTINEL); tx.replaceWithVersion(baselineArtifact, destination); tx.commit(); introduced = true; } else { throw new OseeCoreException("%s Error - The user and baseline artifact were not found.", comment); } return introduced; }
Source:
public void unregisterDevice( final List<String> channels, final AsyncCallback<Void> callback ) { new AsyncTask<Void, Void, RuntimeException>() { @Override protected RuntimeException doInBackground( Void... params ) { try { Context context = ContextHandler.getAppContext(); if ( BackendlessPushService.isFCM( context ) ) FCMRegistration.unregisterDevice( context, channels ); else { if( !GCMRegistrar.isRegistered( context ) ) return new IllegalArgumentException( ExceptionMessage.DEVICE_NOT_REGISTERED ); GCMRegistrar.unregister( context ); } return null; } catch( RuntimeException t ) { return t; } } @Override protected void onPostExecute( RuntimeException result ) { if( result != null ) { if( callback == null ) throw result; callback.handleFault( new BackendlessFault( result ) ); } else { if( callback != null ) callback.handleResponse( null ); } } }.execute(); }

Target:
public void unregisterDevice( final List<String> channels, final AsyncCallback<Void> callback ) { new AsyncTask<Void, Void, RuntimeException>() { @Override protected RuntimeException doInBackground( Void... params ) { try { Context context = ContextHandler.getAppContext(); if ( BackendlessPushService.isFCM( context ) ) { FCMRegistration.unregisterDevice( context, channels ); } else { if( !GCMRegistrar.isRegistered( context ) ) return new IllegalArgumentException( ExceptionMessage.DEVICE_NOT_REGISTERED ); GCMRegistrar.unregister( context ); } return null; } catch( RuntimeException t ) { return t; } } @Override protected void onPostExecute( RuntimeException result ) { if( result != null ) { if( callback == null ) throw result; callback.handleFault( new BackendlessFault( result ) ); } else { if( callback != null ) callback.handleResponse( null ); } } }.execute(); }
Source:
private void printGroupRecord(ExtMap extMap) { if (extMap != null) { do { logger.info( "GroupRecord: ID '{}', name: '{}', namespace: '{}', display name: '{}'", extMap.get(Authz.GroupRecord.ID, ""), extMap.get(Authz.GroupRecord.NAME, ""), extMap.get(Authz.GroupRecord.NAMESPACE, ""), extMap.get(Authz.GroupRecord.DISPLAY_NAME, "") ); } while((extMap = extMap.get(Authz.GroupRecord.GROUPS)) != null); } }

Target:
private void printGroupRecord(ExtMap extMap) { if (extMap != null) { log.info( "GroupRecord: ID '{}', name: '{}', namespace: '{}', display name: '{}'", extMap.get(Authz.GroupRecord.ID, ""), extMap.get(Authz.GroupRecord.NAME, ""), extMap.get(Authz.GroupRecord.NAMESPACE, ""), extMap.get(Authz.GroupRecord.DISPLAY_NAME, "") ); } }
Source:
public void addResourceHandlers(ResourceHandlerRegistry registry) { String staticPathPatterns[] = new String[] {" *.js" , " *.png" , " *.jpg" , " *.swf" , " *.csv" , " *.css" , " *.html" , " *.gif" , " *.ico" , " *.woff2" , " *.woff" , " *.ttf"}; registry.addResourceHandler(staticPathPatterns).addResourceLocations(this.resourceProperties.getStaticLocations()); }

Target:
public void addResourceHandlers(ResourceHandlerRegistry registry) { String staticPathPatterns[] = new String[] {" *.js" , " *.png" , " *.jpg" , " *.swf" , " *.csv" , " *.css" , " *.html" , " *.gif" , " *.ico" , " *.woff2" , " *.woff" , " *.ttf"}; registry.addResourceHandler(staticPathPatterns).addResourceLocations(this.resourceProperties.getStaticLocations()).setCachePeriod(3600); }