auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void selectAll() { assertMultiSelect(); waitForEnabled(); setFocus(); TreeItem first = syncExec(new Result<TreeItem>() { @Override public TreeItem run() { if (widget.getItemCount() == 0) { return null; } return widget.getItem(0); } }); if (first == null) { return; } notifySelect(first, SWT.NONE); TreeItem last = syncExec(new Result<TreeItem>() { @Override public TreeItem run() { if (widget.getItemCount() == 0) { return null; } TreeItem last = widget.getItem(widget.getItemCount() - 1); while (last.getExpanded() && last.getItemCount() > 0) { last = last.getItem(last.getItemCount() - 1); } return last; } }); if (last != null && last != first) { notifySelect(last, SWT.SHIFT, selectAllRunnable()); } }

Target:
public void selectAll() { assertMultiSelect(); waitForEnabled(); setFocus(); TreeItem first = syncExec(new Result<TreeItem>() { @Override public TreeItem run() { if (widget.getItemCount() == 0) { return null; } return widget.getItem(0); } }); if (first == null) { return; } notifySelect(first, SWT.NONE); TreeItem last = syncExec(new Result<TreeItem>() { @Override public TreeItem run() { if (widget.getItemCount() == 0) { return null; } TreeItem last = widget.getItem(widget.getItemCount() - 1); while (last.getExpanded() && last.getItemCount() > 0) { last = last.getItem(last.getItemCount() - 1); } return last; } }); if (last != null && last != first) { notifySelect(last, SWT.MOD2, selectAllRunnable()); } }
Source:
public TaskReview(String summary, String cr, String v, String incomingChanges) { super(); this.summary = summary; this.cr = cr; this.v = v; this.incomingChanges = incomingChanges; }

Target:
public TaskReview(String summary, String cr, String v, String incomingChanges) { this.summary = summary; this.cr = cr; this.v = v; this.incomingChanges = incomingChanges; }
Source:
public void onAcquireTokenSilentClicked(final AcquireTokenFragment.RequestOptions requestOptions) { prepareRequestParameters(requestOptions); new Thread(new Runnable() { @Override public void run() { String uId = getUserIdBasedOnUPN(requestOptions.getLoginHint(), requestOptions.getAuthority()); if (TextUtils.isEmpty(uId)) { try { final UserInfo[] userInfos = mAuthContext.getBrokerUsers(); for (UserInfo userInfo : userInfos) { if (userInfo.getDisplayableId().equalsIgnoreCase(requestOptions.getLoginHint())) { uId = userInfo.getUserId(); break; } } } catch (OperationCanceledException | AuthenticatorException | IOException e) { Logger.e(TAG, "Unable to getbrokerusers from broker " + e.getMessage()); } } callAcquireTokenSilent(requestOptions.getDataProfile().getText(), uId, requestOptions.getClientId().getText()); } }).start(); }

Target:
public void onAcquireTokenSilentClicked(final AcquireTokenFragment.RequestOptions requestOptions) { prepareRequestParameters(requestOptions); new Thread(new Runnable() { @Override public void run() { String uId = getUserIdBasedOnUPN(requestOptions.getLoginHint(), requestOptions.getAuthority()); if (TextUtils.isEmpty(uId)) { try { final UserInfo[] userInfos = mAuthContext.getBrokerUsers(); for (UserInfo userInfo : userInfos) { if (userInfo.getDisplayableId().equalsIgnoreCase(requestOptions.getLoginHint())) { uId = userInfo.getUserId(); break; } } if (!TextUtils.isEmpty(uId)) { callAcquireTokenSilent(requestOptions.getDataProfile().getText(), uId, requestOptions.getClientId().getText()); } else { showMessage("No uId matching the provided upn, cannot proceed with silent call"); } } catch (final OperationCanceledException | AuthenticatorException | IOException e) { showMessage("getBrokerUsers call to broker failed: " + e.getMessage()); } } } }).start(); }
Source:
protected boolean canDoAction() { VmStatic vm = getVm().getStaticData(); if (vm == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); return false; } if (!canRunActionOnNonManagedVm()) { return false; } if (!updateVnicForBackwardCompatibility()) { return false; } if (!validate(vmStatusLegal(getVmDynamicDao().get(getParameters().getVmId()).getStatus()))) { return false; } List<VmNic> interfaces = getVmNicDao().getAllForVm(getParameters().getVmId()); if (!uniqueInterfaceName(interfaces)) { return false; } if (!validate(vmTemplateEmpty())) { return false; } List<VmNic> allInterfaces = new ArrayList<>(interfaces); allInterfaces.add(getInterface()); if (!pciAndIdeWithinLimit(getVm(), allInterfaces)) { return false; } Version compatibilityVersion = getVm().getVdsGroupCompatibilityVersion(); VmNicValidator nicValidator = new VmNicValidator(getInterface(), compatibilityVersion, getVm().getOs()); if (!validate(nicValidator.linkedCorrectly()) || !validate(nicValidator.isCompatibleWithOs()) || !validate(nicValidator.emptyNetworkValid()) || !validate(nicValidator.profileValid(vm.getVdsGroupId()))) { return false; } if (StringUtils.isNotEmpty(getMacAddress())) { if (!validate(macAvailable(getMacPoolManager()))) { return false; } } else if (getMacPoolManager().getAvailableMacsCount() <= 0){ addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } return true; }

Target:
protected boolean canDoAction() { VmStatic vm = getVm().getStaticData(); if (vm == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); return false; } if (!canRunActionOnNonManagedVm()) { return false; } if (!updateVnicForBackwardCompatibility()) { return false; } if (!validate(vmStatusLegal(getVmDynamicDao().get(getParameters().getVmId()).getStatus()))) { return false; } List<VmNic> interfaces = getVmNicDao().getAllForVm(getParameters().getVmId()); if (!uniqueInterfaceName(interfaces)) { return false; } if (!validate(vmTemplateEmpty())) { return false; } List<VmNic> allInterfaces = new ArrayList<>(interfaces); allInterfaces.add(getInterface()); if (!pciAndIdeWithinLimit(getVm(), allInterfaces)) { return false; } Version compatibilityVersion = getVm().getVdsGroupCompatibilityVersion(); VmNicValidator nicValidator = new VmNicValidator(getInterface(), compatibilityVersion, getVm().getOs()); if (!validate(nicValidator.linkedCorrectly()) || !validate(nicValidator.isCompatibleWithOs()) || !validate(nicValidator.emptyNetworkValid()) || !validate(nicValidator.profileValid(vm.getVdsGroupId()))) { return false; } if (StringUtils.isNotEmpty(getMacAddress())) { if (!validate(macAvailable())) { return false; } } else if (getMacPool().getAvailableMacsCount() <= 0) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } return true; }
Source:
private static void assertSimplifies(String expression, String expected, String rowExpressionExpected) { Expression actualExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expression)); Expression expectedExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expected)); Expression rewritten = rewrite(actualExpression, TEST_SESSION, new PlanVariableAllocator(booleanVariablesFor(actualExpression)), METADATA, LITERAL_ENCODER, SQL_PARSER); assertEquals( normalize(rewritten), normalize(expectedExpression)); TestingRowExpressionTranslator translator = new TestingRowExpressionTranslator(METADATA); RowExpression actualRowExpression = translator.translate(actualExpression, TypeProvider.viewOf(TYPES)); RowExpression simplifiedByRowExpression = SimplifyRowExpressions.rewrite(actualRowExpression, METADATA, TEST_SESSION.toConnectorSession()); Expression expectedByRowExpression = Optional.ofNullable(rowExpressionExpected).map(expr -> rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expr))).orElse(rewritten); RowExpression simplifiedByExpression = translator.translate(expectedByRowExpression, TypeProvider.viewOf(TYPES)); assertEquals(simplifiedByRowExpression, simplifiedByExpression); }

Target:
private static void assertSimplifies(String expression, String expected, String rowExpressionExpected) { Expression actualExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expression)); Expression expectedExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expected)); Expression rewritten = rewrite(actualExpression, TEST_SESSION, new PlanVariableAllocator(booleanVariablesFor(actualExpression)), METADATA, LITERAL_ENCODER, SQL_PARSER); assertEquals( normalize(rewritten), normalize(expectedExpression)); TestingRowExpressionTranslator translator = new TestingRowExpressionTranslator(METADATA); RowExpression actualRowExpression = translator.translate(actualExpression, TypeProvider.viewOf(TYPES)); RowExpression simplifiedRowExpression = SimplifyRowExpressions.rewrite(actualRowExpression, METADATA, TEST_SESSION.toConnectorSession()); Expression expectedByRowExpression = Optional.ofNullable(rowExpressionExpected).map(expr -> rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expr))).orElse(rewritten); RowExpression simplifiedByExpression = translator.translate(expectedByRowExpression, TypeProvider.viewOf(TYPES)); assertEquals(simplifiedRowExpression, simplifiedByExpression); }
Source:
public void handleUnimprovedSecondsSpentInputChange( ChangeEvent event ) { try { Long value = unimprovedSecondsSpentInput.getValue().isEmpty() ? null : Long.parseLong( unimprovedSecondsSpentInput.getValue() ); presenter.onUnimprovedSecondsSpentChange( value ); } catch ( NumberFormatException e ) { } }

Target:
public void handleUnimprovedSecondsSpentInputChange( ChangeEvent event ) { boolean isNumeric = unimprovedSecondsSpentInput.getValue().matches( "\\d+" ); if (isNumeric) { presenter.onUnimprovedSecondsSpentChange( Long.parseLong( unimprovedSecondsSpentInput.getValue() ) ); } else { presenter.onUnimprovedSecondsSpentChange( 0l ); unimprovedSecondsSpentInput.setValue( "0" ); } }
Source:
protected StopMachineDetails<Integer> stopAnyProvisionedMachines() { @SuppressWarnings("unchecked") MachineProvisioningLocation<MachineLocation> provisioner = entity().getAttribute(SoftwareProcess.PROVISIONING_LOCATION); if (Iterables.isEmpty(entity().getLocations())) { log.debug("No machine decommissioning necessary for "+entity()+" - no locations"); return new StopMachineDetails<Integer>("No machine decommissioning necessary for - no locations", 0); } if (provisioner==null) { log.debug("No machine decommissioning necessary for "+entity()+" - did not provision"); return new StopMachineDetails<Integer>("No machine decommissioning necessary for - did not provision", 0); } Location machine = getLocation(null); if (!(machine instanceof MachineLocation)) { log.debug("No decommissioning necessary for "+entity()+" - not a machine location ("+machine+")"); return new StopMachineDetails<Integer>("No machine decommissioning necessary for - not a machine ("+machine+")", 0); } try { entity().removeLocations(ImmutableList.of(machine)); entity().setAttribute(Attributes.HOSTNAME, null); entity().setAttribute(Attributes.ADDRESS, null); entity().setAttribute(Attributes.SUBNET_HOSTNAME, null); entity().setAttribute(Attributes.SUBNET_ADDRESS, null); if (provisioner != null) provisioner.release((MachineLocation)machine); } catch (Throwable t) { throw Exceptions.propagate(t); } return new StopMachineDetails<Integer>("Decommissioned "+machine, 1); }

Target:
protected StopMachineDetails<Integer> stopAnyProvisionedMachines() { @SuppressWarnings("unchecked") MachineProvisioningLocation<MachineLocation> provisioner = entity().getAttribute(SoftwareProcess.PROVISIONING_LOCATION); if (Iterables.isEmpty(entity().getLocations())) { log.debug("No machine decommissioning necessary for "+entity()+" - no locations"); return new StopMachineDetails<Integer>("No machine decommissioning necessary - no locations", 0); } if (provisioner==null) { log.debug("No machine decommissioning necessary for "+entity()+" - did not provision"); return new StopMachineDetails<Integer>("No machine decommissioning necessary - did not provision", 0); } Location machine = getLocation(null); if (!(machine instanceof MachineLocation)) { log.debug("No decommissioning necessary for "+entity()+" - not a machine location ("+machine+")"); return new StopMachineDetails<Integer>("No machine decommissioning necessary - not a machine ("+machine+")", 0); } try { entity().removeLocations(ImmutableList.of(machine)); entity().setAttribute(Attributes.HOSTNAME, null); entity().setAttribute(Attributes.ADDRESS, null); entity().setAttribute(Attributes.SUBNET_HOSTNAME, null); entity().setAttribute(Attributes.SUBNET_ADDRESS, null); if (provisioner != null) provisioner.release((MachineLocation)machine); } catch (Throwable t) { throw Exceptions.propagate(t); } return new StopMachineDetails<Integer>("Decommissioned "+machine, 1); }
Source:
protected void persistCommand(String command) { if (command.isEmpty()) { return; } try { Files.write(pendingFile, Arrays.asList(command), StandardOpenOption.CREATE, StandardOpenOption.APPEND); } catch (IOException e) { throw new IllegalStateException("Cannot write to file " + pendingFile, e); } }

Target:
protected void persistCommand(String command) { if (command.isEmpty()) { return; } try { Files.write(pendingFile, Collections.singletonList(command), StandardOpenOption.CREATE, StandardOpenOption.APPEND); } catch (IOException e) { throw new IllegalStateException("Cannot write to file " + pendingFile, e); } }
Source:
synchronized void updateMissingMessagesInMetadataResponse(List<MessageInfo> messagesWrittenToStore) { Set<MessageInfo> missingStoreMessages = exchangeMetadataResponse.getMissingStoreMessages(); if (missingStoreMessages != null && !missingStoreMessages.isEmpty()) { Set<StoreKey> keysWrittenToStore = messagesWrittenToStore.stream().map(MessageInfo::getStoreKey).collect(Collectors.toSet()); Set<MessageInfo> missingMessagesFoundInStore = new HashSet<>(); for (MessageInfo messageInfo : missingStoreMessages) { if (keysWrittenToStore.contains(messageInfo.getStoreKey())) { missingMessagesFoundInStore.add(messageInfo); } } exchangeMetadataResponse.removeMissingStoreMessages(missingMessagesFoundInStore); } }

Target:
synchronized void updateMissingMessagesInMetadataResponse(List<MessageInfo> messagesWrittenToStore) { Set<MessageInfo> missingStoreMessages = exchangeMetadataResponse.getMissingStoreMessages(); if (missingStoreMessages != null && !missingStoreMessages.isEmpty()) { Set<StoreKey> keysWrittenToStore = messagesWrittenToStore.stream().map(MessageInfo::getStoreKey).collect(Collectors.toSet()); Set<MessageInfo> missingMessagesFoundInStore = missingStoreMessages.stream() .filter(message -> keysWrittenToStore.contains(message.getStoreKey())) .collect(Collectors.toSet()); exchangeMetadataResponse.removeMissingStoreMessages(missingMessagesFoundInStore); } }
Source:
public static synchronized void executeDropinsCapability(String carbonHome, String carbonProfile) throws IOException { Path dropinsDirectoryPath = Paths.get(carbonHome, Constants.OSGI_REPOSITORY, dropinsDirectory); Path bundlesInfoFile = Paths. get(carbonHome, Constants.OSGI_REPOSITORY, Constants.PROFILE_PATH, carbonProfile, "configuration", "org.eclipse.equinox.simpleconfigurator", "bundles.info"); if (newBundlesInfo == null) { newBundlesInfo = getNewBundlesInfo(dropinsDirectoryPath); } if (hasToUpdateBundlesInfoFile(newBundlesInfo, bundlesInfoFile)) { logger.log(Level.INFO, "New file changes detected in " + dropinsDirectory); List<BundleInfo> effectiveNewBundleInfo = mergeDropinsBundleInfo(newBundlesInfo, bundlesInfoFile); logger.log(Level.INFO, "Updating the OSGi bundle information of Carbon Profile: " + carbonProfile + "..."); updateBundlesInfo(effectiveNewBundleInfo, bundlesInfoFile); logger.log(Level.INFO, "Successfully updated the OSGi bundle information of Carbon Profile: " + carbonProfile); } else { logger.log(Level.INFO, "No changes detected in the dropins directory, skipped the OSGi bundle information " + "update for Carbon Profile: " + carbonProfile); } }

Target:
public static synchronized void executeDropinsCapability(String carbonHome, String carbonProfile) throws IOException { Path dropinsDirectoryPath = Paths.get(carbonHome, Constants.OSGI_REPOSITORY, Constants.DROPINS); Path bundlesInfoFile = Paths. get(carbonHome, Constants.OSGI_REPOSITORY, Constants.PROFILE_PATH, carbonProfile, "configuration", "org.eclipse.equinox.simpleconfigurator", Constants.BUNDLES_INFO); if (newBundlesInfo == null) { logger.log(Level.FINE, "Loading the new OSGi bundle information from " + Constants.DROPINS + " folder..."); newBundlesInfo = getNewBundlesInfo(dropinsDirectoryPath); logger.log(Level.FINE, "Successfully loaded the new OSGi bundle information from " + Constants.DROPINS + " folder"); } else { logger.log(Level.FINE, "The OSGi bundle information from " + Constants.DROPINS + " folder are " + "already loaded"); } if (hasToUpdateBundlesInfoFile(newBundlesInfo, bundlesInfoFile)) { logger.log(Level.INFO, "New file changes detected in " + Constants.DROPINS + " folder"); List<BundleInfo> effectiveNewBundleInfo = mergeDropinsBundleInfo(newBundlesInfo, bundlesInfoFile); logger.log(Level.INFO, "Updating the OSGi bundle information of Carbon Profile: " + carbonProfile + "..."); updateBundlesInfo(effectiveNewBundleInfo, bundlesInfoFile); logger.log(Level.INFO, "Successfully updated the OSGi bundle information of Carbon Profile: " + carbonProfile); } else { logger.log(Level.INFO, "No changes detected in the dropins directory, skipped the OSGi bundle information " + "update for Carbon Profile: " + carbonProfile); } }
Source:
private void findSingletons(BitSet restriction) { for (int i = restriction.nextSetBit(0); i >= 0; i = restriction.nextSetBit(i + 1)) { if (graph.getPredOf(i).size() * graph.getSuccOf(i).size() == 0) { nodeSCC[i] = nbSCC; sccFirstNode[nbSCC++] = i; restriction.clear(i); } } }

Target:
private void findSingletons(BitSet restriction) { for (int i = restriction.nextSetBit(0); i >= 0; i = restriction.nextSetBit(i + 1)) { if (graph.getPredOf(i).size() == 0 || graph.getSuccOf(i).size() == 0) { nodeSCC[i] = nbSCC; sccFirstNode[nbSCC++] = i; restriction.clear(i); } } }
Source:
private String getExifInformation() throws IOException { if (preloadBackgroundImageFile == null){ return ""; } String exifDate =""; String exifTime = ""; String exifCity = ""; String exifCountry = ""; ExifInterface exif = new ExifInterface(preloadBackgroundImageFile); if (exif.getAttribute(ExifInterface.TAG_DATETIME) != null) { String[] exifDateTime = exif.getAttribute(ExifInterface.TAG_DATETIME).split(" "); String[] exifDateSplit = exifDateTime[0].split(":"); exifDate = exifDateSplit[2] + "." + exifDateSplit[1] + "." + exifDateSplit[0]; exifTime = exifDateTime[1]; } if (exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE) != null && exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE) != null) { String[] separatedLat = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE).split(","); String[] separatedLong = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE).split(","); Geocoder geocoder = new Geocoder(mContext, Locale.getDefault()); try { List<Address> addresslist = geocoder.getFromLocation(convertGPS(separatedLat), convertGPS(separatedLong), 1); if (addresslist != null && addresslist.size() > 0) { exifCity = addresslist.get(0).getLocality(); exifCountry = addresslist.get(0).getCountryName(); } } catch (IOException e) { Log.e(TAG, "connect to geocoder failed"+ "\nGPS_LATITUDE = "+ convertGPS(separatedLat)+ "\nGPS_LONGITUDE = "+ convertGPS(separatedLong) , e); } } return exifDate+"\n"+exifTime+"\n"+exifCity+"\n"+exifCountry; }

Target:
private String getExifInformation() throws IOException { if (preloadBackgroundImageFile == null){ return ""; } String exifDate =""; String exifTime = ""; String exifCity = ""; String exifCountry = ""; ExifInterface exif = new ExifInterface(preloadBackgroundImageFile); String DateTimeExif = exif.getAttribute(ExifInterface.TAG_DATETIME); if (DateTimeExif != null) { String[] exifDateTime = DateTimeExif.split(" "); String[] exifDateSplit = exifDateTime[0].split(":"); exifDate = exifDateSplit[2] + "." + exifDateSplit[1] + "." + exifDateSplit[0]; exifTime = exifDateTime[1]; } String separatedLatExif = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE); String separatedLongExif = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE); if (separatedLatExif != null && separatedLongExif != null) { String[] separatedLat =separatedLatExif.split(","); String[] separatedLong = separatedLongExif.split(","); Geocoder geocoder = new Geocoder(mContext, Locale.getDefault()); try { List<Address> addresslist = geocoder.getFromLocation(convertArcMinToDegrees (separatedLat), convertArcMinToDegrees (separatedLong), 1); if (addresslist != null && addresslist.size() > 0) { Address address = addresslist.get(0); exifCity = address.getLocality(); exifCountry = address.getCountryName(); } } catch (IOException e) { Log.e(TAG, "connect to geocoder failed"+ "\nGPS_LATITUDE = "+ convertArcMinToDegrees (separatedLat)+ "\nGPS_LONGITUDE = "+ convertArcMinToDegrees (separatedLong) , e); } } return exifDate+"\n"+exifTime+"\n"+exifCity+"\n"+exifCountry; }
Source:
private CopyFileOption copySecretPropertiesOption() { Path carbonYmlFilePath; String basedir = System.getProperty("basedir"); if (basedir == null) { basedir = Paths.get(".").toString(); } carbonYmlFilePath = Paths.get(basedir, "src", "test", "resources", "property-resolve", SECRET_PROPERTIES_FILENAME); return new CopyFileOption(carbonYmlFilePath, Paths.get("conf", SECRET_PROPERTIES_FILENAME)); }

Target:
private CopyFileOption copySecretPropertiesOption() { Path carbonYmlFilePath; String basedir = System.getProperty("basedir"); if (basedir == null) { basedir = Paths.get(".").toString(); } carbonYmlFilePath = Paths.get(basedir, "src", "test", "resources", "carbon-config", SECRET_PROPERTIES_FILENAME); return new CopyFileOption(carbonYmlFilePath, Paths.get("conf", SECRET_PROPERTIES_FILENAME)); }
Source:
public Comparator<Integer> getComparator() { return REVESE_COMPARATOR; }

Target:
public Comparator<Integer> getComparator() { return Comparator.reverseOrder(); }
Source:
public void deleteCredential(String credentialName) throws RealmUnavailableException { Assert.checkNotNullParam("credentialName", credentialName); if (!exists()) { throw log.ldapRealmIdentityNotExists(name); } Assert.unsupported(); }

Target:
public void deleteCredential(String credentialName) throws RealmUnavailableException { Assert.checkNotNullParam("credentialName", credentialName); if (!exists()) { throw log.ldapRealmIdentityNotExists(name); } throw Assert.unsupported(); }
Source:
private void createActionCombos(Composite parent) { actionComposite = getWidgetFactory().createComposite(parent); GridData actionCompositeLayoutData = new GridData(GridData.FILL, 0, true, false); actionCompositeLayoutData.horizontalSpan = 3; actionComposite.setLayoutData(actionCompositeLayoutData); RowLayout layout = new RowLayout(); layout.fill = true; actionComposite.setLayout(layout); getWidgetFactory().createCLabel(actionComposite, "Algorithm: "); algorithmCombo = new Combo(actionComposite, SWT.SINGLE | SWT.READ_ONLY); algorithmCombo.addListener(SWT.Selection, event -> { removeContentAdapter(); if (ECCHelpers.EMPTY_FIELD.equals(algorithmCombo.getText())) { BasicFBType fb = ECCHelpers.getFBType(getType()); if (null != fb) { executeCommand(new ChangeAlgorithmCommand(getType(), fb.getAlgorithm().get(algorithmCombo.indexOf(algorithmCombo.getText())))); } } else { executeCommand(new ChangeAlgorithmCommand(getType(), null)); } algorithmGroup.setAlgorithm(getAlgorithm()); algorithmList.refresh(); addContentAdapter(); }); getWidgetFactory().createCLabel(actionComposite, "Output Event: "); outputEventCombo = new Combo(actionComposite, SWT.SINGLE | SWT.READ_ONLY); outputEventCombo.addListener(SWT.Selection, event -> { removeContentAdapter(); executeCommand(new ChangeOutputCommand(getType(), events.get(outputEventCombo.getText()))); addContentAdapter(); }); }

Target:
private void createActionCombos(Composite parent) { actionComposite = getWidgetFactory().createComposite(parent); GridData actionCompositeLayoutData = new GridData(GridData.FILL, 0, true, false); actionCompositeLayoutData.horizontalSpan = 3; actionComposite.setLayoutData(actionCompositeLayoutData); RowLayout layout = new RowLayout(); layout.fill = true; actionComposite.setLayout(layout); getWidgetFactory().createCLabel(actionComposite, "Algorithm: "); algorithmCombo = new Combo(actionComposite, SWT.SINGLE | SWT.READ_ONLY); algorithmCombo.addListener(SWT.Selection, event -> { removeContentAdapter(); if (ECCContentAndLabelProvider.EMPTY_FIELD.equals(algorithmCombo.getText())) { executeCommand(new ChangeAlgorithmCommand(getType(), null)); } else { BasicFBType fb = getFBType(); if (null != fb) { executeCommand(new ChangeAlgorithmCommand(getType(), fb.getAlgorithm().get(algorithmCombo.indexOf(algorithmCombo.getText())))); } } algorithmGroup.setAlgorithm(getAlgorithm()); algorithmList.refresh(); addContentAdapter(); }); getWidgetFactory().createCLabel(actionComposite, "Output Event: "); outputEventCombo = new Combo(actionComposite, SWT.SINGLE | SWT.READ_ONLY); outputEventCombo.addListener(SWT.Selection, event -> { removeContentAdapter(); executeCommand(new ChangeOutputCommand(getType(), ECCContentAndLabelProvider.getOutputEvents(getFBType()).get(outputEventCombo.indexOf(outputEventCombo.getText())))); addContentAdapter(); }); }
Source:
public List<JPAObject> query(QueryRequest request) throws EDBException { synchronized (entityManager) { LOGGER.debug("Perform query with the query object: {}", request); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<JPAObject> criteriaQuery = criteriaBuilder.createQuery(JPAObject.class); Root<JPAObject> from = criteriaQuery.from(JPAObject.class); List<Predicate> predicates = convertRequestToPredicateList(request, from, criteriaBuilder); predicates.add(criteriaBuilder.notEqual(from.get("isDeleted"), Boolean.TRUE)); Subquery<Long> subquery = criteriaQuery.subquery(Long.class); Root subFrom = subquery.from(JPAObject.class); Expression<Long> maxExpression = criteriaBuilder.max(subFrom.get("timestamp")); subquery.select(maxExpression); Predicate p1 = criteriaBuilder.equal(subFrom.get("oid"), from.get("oid")); Predicate p2 = criteriaBuilder.le(subFrom.get("timestamp"), request.getTimestamp()); subquery.where(criteriaBuilder.and(p1, p2)); predicates.add(criteriaBuilder.equal(from.get("timestamp"), subquery)); criteriaQuery.where(predicates.toArray(new Predicate[predicates.size()])); TypedQuery<JPAObject> typedQuery = entityManager.createQuery(criteriaQuery); return typedQuery.getResultList(); } }

Target:
public List<JPAObject> query(QueryRequest request) throws EDBException { synchronized (entityManager) { LOGGER.debug("Perform query with the query object: {}", request); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<JPAObject> criteriaQuery = criteriaBuilder.createQuery(JPAObject.class); Root<JPAObject> from = criteriaQuery.from(JPAObject.class); List<Predicate> predicates = convertRequestToPredicateList(request, from, criteriaBuilder); predicates.add(criteriaBuilder.notEqual(from.get("isDeleted"), Boolean.TRUE)); Subquery<Long> subquery = criteriaQuery.subquery(Long.class); Root subFrom = subquery.from(JPAObject.class); Expression<Long> maxExpression = criteriaBuilder.max(subFrom.get("timestamp")); subquery.select(maxExpression); Predicate p1 = criteriaBuilder.equal(subFrom.get("oid"), from.get("oid")); Predicate p2 = criteriaBuilder.le(subFrom.get("timestamp"), request.getTimestamp()); subquery.where(criteriaBuilder.and(p1, p2)); predicates.add(criteriaBuilder.equal(from.get("timestamp"), subquery)); criteriaQuery.where(Iterables.toArray(predicates, Predicate.class)); TypedQuery<JPAObject> typedQuery = entityManager.createQuery(criteriaQuery); return typedQuery.getResultList(); } }
Source:
public void testListServiceKeys() throws Exception { List<ServiceKey> possibleServiceKeys = api().listServiceKeys(); assertNotNull(possibleServiceKeys, "possibleServiceKeys was not set"); assertTrue(possibleServiceKeys.size() > 0, "Expected at least 1 ServiceKey but list was empty"); ServiceKey possibleServiceKey = Iterables.find(possibleServiceKeys, new Predicate<ServiceKey>() { @Override public boolean apply(ServiceKey arg0) { return (arg0.key().equals(serviceKey)) ? true : false; } }); assertNotNull(possibleServiceKey, "Expected but could not find ServiceKey amongst " + possibleServiceKeys.size() + " found"); }

Target:
public void testListServiceKeys() throws Exception { List<ServiceKey> possibleServiceKeys = api().listServiceKeys(); assertNotNull(possibleServiceKeys, "possibleServiceKeys was not set"); assertTrue(possibleServiceKeys.size() > 0, "Expected at least 1 ServiceKey but list was empty"); ServiceKey possibleServiceKey = Iterables.find(possibleServiceKeys, new Predicate<ServiceKey>() { @Override public boolean apply(ServiceKey arg0) { return arg0.key().equals(serviceKey); } }, null); assertNotNull(possibleServiceKey, "Expected but could not find ServiceKey amongst " + possibleServiceKeys.size() + " found"); }
Source:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); ScriptEngine se = getGroovyScriptEngine(); if (se != null) { getExtScript().registerScriptEngineWrapper(new GroovyEngineWrapper(se)); } else { LOGGER.error("No Groovy engine found"); } }

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); groovyEngine = new GroovyEngineWrapper(); getExtScript().registerScriptEngineWrapper(groovyEngine); }
Source:
void recordStorageCacheBehavior(MetaData metaData) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { File cacheDir = appContext.getCacheDir(); try { boolean tombstone = storageManager.isCacheBehaviorTombstone(cacheDir); boolean group = storageManager.isCacheBehaviorGroup(cacheDir); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "cacheTombstone", tombstone); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "cacheGroup", group); } catch (IOException exc) { Logger.warn("Failed to record cache behaviour, skipping diagnostics", exc); } } }

Target:
void recordStorageCacheBehavior(MetaData metaData) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { File cacheDir = appContext.getCacheDir(); File errDir = new File(cacheDir, "bugsnag-errors"); try { boolean tombstone = storageManager.isCacheBehaviorTombstone(errDir); boolean group = storageManager.isCacheBehaviorGroup(errDir); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "cacheTombstone", tombstone); metaData.addToTab(INTERNAL_DIAGNOSTICS_TAB, "cacheGroup", group); } catch (IOException exc) { Logger.warn("Failed to record cache behaviour, skipping diagnostics", exc); } } }
Source:
public void query_explain_multipleIndexes_invalidIndexName() { StubMappingScope scope = indexManager.createScope( otherIndexManager ); LuceneSearchQuery<DocumentReference> query = scope.query().extension( LuceneExtension.get() ) .where( f -> f.id().matching( FIRST_ID ) ) .toQuery(); Assertions.assertThatThrownBy( () -> query.explain( "NotAMappedTypeName", FIRST_ID ) ) .isInstanceOf( SearchException.class ) .hasMessageContaining( "mapped type name 'NotAMappedTypeName' is not among the mapped types targeted by this query: [", TYPE_NAME, OTHER_INDEX_NAME, "]" ); }

Target:
public void query_explain_multipleIndexes_invalidIndexName() { StubMappingScope scope = indexManager.createScope( otherIndexManager ); LuceneSearchQuery<DocumentReference> query = scope.query().extension( LuceneExtension.get() ) .where( f -> f.id().matching( FIRST_ID ) ) .toQuery(); Assertions.assertThatThrownBy( () -> query.explain( "NotAnIndexName", FIRST_ID ) ) .isInstanceOf( SearchException.class ) .hasMessageContaining( "mapped type name 'NotAnIndexName' is not among the mapped types targeted by this query: [" + TYPE_NAME + ", " + OTHER_TYPE_NAME + "]" ); }
Source:
public void prepare() { configureServices(); logger.debug("Preparing kjar"); KieServices ks = KieServices.Factory.get(); ReleaseId releaseId = ks.newReleaseId(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1); List<String> processes = new ArrayList<String>(); processes.add("repo/processes/general/humanTask.bpmn"); InternalKieModule kJar1 = createKieJar(ks, releaseId, processes); File pom = new File("target/admin", "pom.xml"); pom.getParentFile().mkdir(); try { FileOutputStream fs = new FileOutputStream(pom); fs.write(getPom(releaseId).getBytes()); fs.close(); } catch (Exception e) { } MavenRepository repository = getMavenRepository(); repository.installArtifact(releaseId, kJar1, pom); userTaskAdminService = new UserTaskAdminServiceImpl(); ((UserTaskAdminServiceImpl) userTaskAdminService).setUserTaskService(userTaskService); ((UserTaskAdminServiceImpl) userTaskAdminService).setRuntimeDataService(runtimeDataService); ((UserTaskAdminServiceImpl) userTaskAdminService).setIdentityProvider(identityProvider); deploymentUnit = new KModuleDeploymentUnit(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1); deploymentService.deploy(deploymentUnit); units.add(deploymentUnit); identityProvider.setName("Administrator"); identityProvider.setRoles(Arrays.asList("")); }

Target:
public void prepare() { configureServices(); logger.debug("Preparing kjar"); KieServices ks = KieServices.Factory.get(); ReleaseId releaseId = ks.newReleaseId(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1); List<String> processes = new ArrayList<String>(); processes.add("repo/processes/general/humanTask.bpmn"); InternalKieModule kJar1 = createKieJar(ks, releaseId, processes); File pom = new File("target/admin", "pom.xml"); pom.getParentFile().mkdir(); try { FileOutputStream fs = new FileOutputStream(pom); fs.write(getPom(releaseId).getBytes()); fs.close(); } catch (Exception e) { } MavenRepository repository = getMavenRepository(); repository.installArtifact(releaseId, kJar1, pom); userTaskAdminService = new UserTaskAdminServiceImpl(); ((UserTaskAdminServiceImpl) userTaskAdminService).setUserTaskService(userTaskService); ((UserTaskAdminServiceImpl) userTaskAdminService).setRuntimeDataService(runtimeDataService); ((UserTaskAdminServiceImpl) userTaskAdminService).setIdentityProvider(identityProvider); deploymentUnit = new KModuleDeploymentUnit(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1); deploymentService.deploy(deploymentUnit); units.add(deploymentUnit); identityProvider.setName("Administrator"); identityProvider.setRoles(Collections.singletonList("")); }
Source:
String stripInvalidCharacters(String input) { StringBuilder filteredValue = new StringBuilder(input.length()); for (char c : input.toCharArray()) { if (Character.isLetterOrDigit(c)) { filteredValue.append(c); } } return filteredValue.toString(); }

Target:
private String stripInvalidCharacters(String input) { StringBuilder filteredValue = new StringBuilder(input.length()); for (char c : input.toCharArray()) { if (Character.isLetterOrDigit(c)) { filteredValue.append(c); } } return filteredValue.toString(); }
Source:
public String getAccessToken() throws PayPalRESTException { if (accessToken == null) { accessToken = generateAccessToken(); } else if ((accessToken != null) && (expiresIn() <= 0)) { accessToken = generateAccessToken(); } return accessToken; }

Target:
public String getAccessToken() throws PayPalRESTException { if (accessToken == null || expiresIn() <= 0) { accessToken = generateAccessToken(); } return accessToken; }
Source:
public Response deleteRESTConfig(@PathParam("clusterId") String clusterId) { ConfigAccessor accessor = getConfigAccessor(); try { accessor.deleteRESTConfig(clusterId); } catch (HelixException ex) { _logger.info("Failed to delete rest config for cluster " + clusterId + ", cluster rest config is not found, Exception: " + ex); } catch (Exception ex) { _logger.error("Failed to delete rest config, cluster " + clusterId + ", Exception: " + ex); return serverError(ex); } return OK(); }

Target:
public Response deleteRESTConfig(@PathParam("clusterId") String clusterId) { ConfigAccessor accessor = getConfigAccessor(); try { accessor.deleteRESTConfig(clusterId); } catch (HelixException ex) { LOG.info("Failed to delete rest config for cluster {}, cluster rest config is not found. Exception: {}.", clusterId, ex); return notFound(ex.getMessage()); } catch (Exception ex) { LOG.error("Failed to delete rest config, cluster {}, Exception: {}.", clusterId, ex); return serverError(ex); } return OK(); }
Source:
public final void setClassLoader(ClassLoader classLoader) { this.loader = classLoader; }

Target:
public final void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; }
Source:
public List<String> getAvailableTabs(@PathVariable String moduleName) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Map<String, List<String>> tabAccessMap = uiFrameworkService.getModuleData(moduleName).getTabAccessMap(); ArrayList<String> availableTabs = new ArrayList<String>(); for (String tab : tabAccessMap.keySet()) { if(tabAccessMap.get(tab).size() == 0) { availableTabs.add(tab); } for (String permission : tabAccessMap.get(tab)) { if (auth.getAuthorities().contains(new SimpleGrantedAuthority(permission))) { if (!availableTabs.contains(tab)) { availableTabs.add(tab); } } } } return availableTabs; }

Target:
public List<String> getAvailableTabs(@PathVariable String moduleName) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Map<String, List<String>> tabAccessMap = uiFrameworkService.getModuleData(moduleName).getTabAccessMap(); ArrayList<String> availableTabs = new ArrayList<String>(); for (String tab : tabAccessMap.keySet()) { if(tabAccessMap.get(tab) == null || tabAccessMap.get(tab).size() == 0) { availableTabs.add(tab); } else { for (String permission : tabAccessMap.get(tab)) { if (auth.getAuthorities().contains(new SimpleGrantedAuthority(permission))) { if (!availableTabs.contains(tab)) { availableTabs.add(tab); } } } } } return availableTabs; }
Source:
private void parseChangeMessage(PatchSet.Id psId, Account.Id accountId, RevCommit commit) { byte[] raw = commit.getRawBuffer(); int size = raw.length; Charset enc = RawParseUtils.parseEncoding(raw); int subjectStart = RawParseUtils.commitMessage(raw, 0); if (subjectStart < 0 || subjectStart >= size) { return; } int subjectEnd = RawParseUtils.endOfParagraph(raw, subjectStart); if (subjectEnd == size) { return; } int changeMessageStart; if (raw[subjectEnd] == '\n') { changeMessageStart = subjectEnd + 2; } else if (raw[subjectEnd] == '\r') { changeMessageStart = subjectEnd + 4; } else { return; } int ptr = size - 1; int changeMessageEnd = -1; while(ptr > changeMessageStart) { ptr = RawParseUtils.prevLF(raw, ptr, '\r'); if (ptr == -1) { break; } if (raw[ptr] == '\n') { changeMessageEnd = ptr - 1; break; } else if (raw[ptr] == '\r') { changeMessageEnd = ptr - 3; break; } } if (ptr <= changeMessageStart) { return; } String changeMessageString = RawParseUtils.decode(enc, raw, changeMessageStart, changeMessageEnd + 1); ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(psId.getParentKey(), commit.name()), accountId, new Timestamp(commit.getCommitterIdent().getWhen().getTime()), psId); changeMessage.setMessage(changeMessageString); changeMessages.add(changeMessage); }

Target:
private void parseChangeMessage(PatchSet.Id psId, Account.Id accountId, RevCommit commit) { byte[] raw = commit.getRawBuffer(); int size = raw.length; Charset enc = RawParseUtils.parseEncoding(raw); int subjectStart = RawParseUtils.commitMessage(raw, 0); if (subjectStart < 0 || subjectStart >= size) { return; } int subjectEnd = RawParseUtils.endOfParagraph(raw, subjectStart); if (subjectEnd == size) { return; } int changeMessageStart; if (raw[subjectEnd] == '\n') { changeMessageStart = subjectEnd + 2; } else if (raw[subjectEnd] == '\r') { changeMessageStart = subjectEnd + 4; } else { return; } int ptr = size - 1; int changeMessageEnd = -1; while(ptr > changeMessageStart) { ptr = RawParseUtils.prevLF(raw, ptr, '\r'); if (ptr == -1) { break; } if (raw[ptr] == '\n') { changeMessageEnd = ptr - 1; break; } else if (raw[ptr] == '\r') { changeMessageEnd = ptr - 3; break; } } if (ptr <= changeMessageStart) { return; } String changeMsgString = RawParseUtils.decode(enc, raw, changeMessageStart, changeMessageEnd + 1); ChangeMessage changeMessage = new ChangeMessage( new ChangeMessage.Key(psId.getParentKey(), commit.name()), accountId, new Timestamp(commit.getCommitterIdent().getWhen().getTime()), psId); changeMessage.setMessage(changeMsgString); changeMessages.put(psId, changeMessage); }
Source:
public static Map<String,Object> createConfig(String[] args) { String[] cfgItems = { ContextProperties.APP_DIR, ContextProperties.BUNDLE, ContextProperties.KEEP_ARTIFACTS, ContextProperties.TOOLKIT_DIR, ContextProperties.TRACING_LEVEL, JobProperties.GROUP, JobProperties.NAME, JobProperties.OVERRIDE_RESOURCE_LOAD_PROTECTION, JobProperties.DATA_DIRECTORY, JobProperties.PRELOAD_APPLICATION_BUNDLES, }; Map<String,Object> config = new HashMap<String,Object>(); for (String arg : args) { String[] toks = arg.split("=", 2); if (toks.length > 1) { for (String item : cfgItems) { if (toks[0].equals(item)) { String valStr = toks[1]; Object value = valStr; if (item.equals(ContextProperties.BUNDLE)) value = new File(valStr); else if (item.equals(ContextProperties.TRACING_LEVEL)) value = toTracingLevel(valStr); else if (item.equals(ContextProperties.KEEP_ARTIFACTS)) value = Boolean.valueOf(valStr); else if (item.equals(JobProperties.OVERRIDE_RESOURCE_LOAD_PROTECTION)) value = Boolean.valueOf(valStr); else if (item.equals(JobProperties.PRELOAD_APPLICATION_BUNDLES)) value = Boolean.valueOf(valStr); config.put(item, value); System.out.println("Setting config: item="+item+" value="+value+" [arg="+arg+"]"); } } } } return config; }

Target:
public static Map<String,Object> createConfig(String[] args) { String[] cfgItems = { ContextProperties.APP_DIR, ContextProperties.BUNDLE, ContextProperties.KEEP_ARTIFACTS, ContextProperties.TOOLKIT_DIR, ContextProperties.TRACING_LEVEL, JobProperties.GROUP, JobProperties.NAME, JobProperties.OVERRIDE_RESOURCE_LOAD_PROTECTION, JobProperties.DATA_DIRECTORY, JobProperties.PRELOAD_APPLICATION_BUNDLES, }; Map<String,Object> config = new HashMap<String,Object>(); for (String arg : args) { String[] toks = arg.split("=", 2); if (toks.length > 1) { for (String item : cfgItems) { if (toks[0].equals(item)) { String valStr = toks[1]; Object value = valStr; if (item.equals(ContextProperties.BUNDLE)) value = new File(valStr); else if (item.equals(ContextProperties.TRACING_LEVEL)) value = toTracingLevel(valStr); else if (item.equals(ContextProperties.KEEP_ARTIFACTS)) value = Boolean.valueOf(valStr); else if (item.equals(JobProperties.OVERRIDE_RESOURCE_LOAD_PROTECTION)) value = Boolean.valueOf(valStr); else if (item.equals(JobProperties.PRELOAD_APPLICATION_BUNDLES)) value = Boolean.valueOf(valStr); config.put(item, value); LOGGER.info("Setting config: item="+item+" value="+value+" [arg="+arg+"]"); } } } } return config; }
Source:
public IP2Problems check(ObservationElements elements) { Option<ObsContext> opt = elements.getObsContext(); if (opt.isEmpty()) return null; ObsContext ctx = opt.getValue(); P2Problems problems = new P2Problems(); for (ISPProgramNode targetNode : elements.getTargetObsComponentNode()) { for (PwfsGuideProbe pwfs : PwfsGuideProbe.values()) { TargetEnvironment env = ctx.getTargets(); Option<GuideProbeTargets> gtOpt = env.getPrimaryGuideProbeTargets(pwfs); if (gtOpt.isEmpty()) continue; GuideProbeTargets gt = gtOpt.getValue(); Option<SPTarget> primaryOpt = gt.getPrimary(); if (primaryOpt.isEmpty()) continue; SPTarget primary = primaryOpt.getValue(); try { pwfs.checkBoundaries(primary, ctx).foreach(bs -> { switch (bs) { case nearBoundary: problems.addWarning(PREFIX + "WARN", "The " + pwfs.getKey() + WARN, targetNode); break; case inRange: break; case vignetting: case outOfRange: problems.addError(PREFIX + "ERROR", "The " + pwfs.getKey() + ERROR, targetNode); break; } }); } catch (InternalError e) { } } } return problems; }

Target:
public IP2Problems check(ObservationElements elements) { Option<ObsContext> opt = elements.getObsContext(); if (opt.isEmpty()) return null; ObsContext ctx = opt.getValue(); P2Problems problems = new P2Problems(); for (ISPProgramNode targetNode : elements.getTargetObsComponentNode()) { for (PwfsGuideProbe pwfs : PwfsGuideProbe.values()) { TargetEnvironment env = ctx.getTargets(); Option<GuideProbeTargets> gtOpt = env.getPrimaryGuideProbeTargets(pwfs); if (gtOpt.isEmpty()) continue; GuideProbeTargets gt = gtOpt.getValue(); Option<SPTarget> primaryOpt = gt.getPrimary(); if (primaryOpt.isEmpty()) continue; SPTarget primary = primaryOpt.getValue(); try { pwfs.checkBoundaries(primary, ctx).foreach(bs -> { switch (bs) { case vignetting: problems.addWarning(PREFIX + "WARN", "The " + pwfs.getKey() + WARN, targetNode); break; case inRange: break; case outOfRange: problems.addError(PREFIX + "ERROR", "The " + pwfs.getKey() + ERROR, targetNode); break; } }); } catch (InternalError e) { } } } return problems; }
Source:
public void setUp() throws Exception { tmpRoot = Files.createTempDirectory("repo"); tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", "target/test-classes/dummy_empty_deps"); configurationMap = new DynamicDependencyTypeConfigurationMap(); DependencyType depType = new FakeJPATypeDependency(); configurationMap.addDependencies(depType, depType.getDependencies()); JPA_HIBERNATE_VERSION = configurationMap.getMapping().get(depType.getType()).get(0).getVersion(); }

Target:
public void setUp() throws Exception { tmpRoot = Files.createTempDirectory("repo"); tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", "target/test-classes/dummy_empty_deps"); configurationMap = new DynamicDependencyTypeConfigurationMap(); DependencyType depType = new FakeJPATypeDependency(); configurationMap.addDependencies(depType, depType.getDependencies()); FAKE_DEPENDENCY_VERSION = configurationMap.getMapping().get(depType.getType()).get(0).getVersion(); }
Source:
public void onAdEnd(AdResult adResult) { if (mRewardedVideoListener != null) { if (adResult.isCallToActionClicked()) { mRewardedVideoListener.onAdClicked(mMediationRewardedVideoAdAdapter); DuAdMediation.d(TAG, "Dap Rewarded Video clicked."); } if (adResult.isSuccessfulView()) { mRewardedVideoListener.onRewarded(mMediationRewardedVideoAdAdapter, null); } mRewardedVideoListener.onAdClosed(mMediationRewardedVideoAdAdapter); DuAdMediation.d(TAG, "Dap Rewarded Video closed."); } }

Target:
public void onAdEnd(AdResult adResult) { if (mRewardedVideoListener != null) { if (adResult.isCallToActionClicked()) { mRewardedVideoListener.onAdClicked(mMediationRewardedVideoAdAdapter); mRewardedVideoListener.onAdLeftApplication(mMediationRewardedVideoAdAdapter); DuAdMediation.d(TAG, "Dap Rewarded Video clicked."); } if (adResult.isSuccessfulView()) { mRewardedVideoListener.onRewarded(mMediationRewardedVideoAdAdapter, null); } mRewardedVideoListener.onAdClosed(mMediationRewardedVideoAdAdapter); DuAdMediation.d(TAG, "Dap Rewarded Video closed."); } }
Source:
private static boolean isIPv4Address(String name) { Matcher m = IPV4_PATTERN.matcher(name); if (!m.matches() || m.groupCount() != 4) { return false; } for (int i = 1; i < 5; i++) { String ipSegment = m.group(i); if (ipSegment == null || ipSegment.length() == 0) { return false; } int iIpSegment = 0; try { iIpSegment = Integer.parseInt(ipSegment); } catch(NumberFormatException e) { return false; } if (iIpSegment > IPV4_MAX_OCTET_VALUE) { return false; } if (ipSegment.length() > 1 && ipSegment.startsWith("0")) { return false; } } return true; }

Target:
private static boolean isIPv4Address(String name) { Matcher m = IPV4_PATTERN.matcher(name); if (!m.matches() || m.groupCount() != 4) { return false; } for (int i = 1; i <= 4; i++) { String ipSegment = m.group(i); int iIpSegment = Integer.parseInt(ipSegment); if (iIpSegment > IPV4_MAX_OCTET_VALUE) { return false; } if (ipSegment.length() > 1 && ipSegment.startsWith("0")) { return false; } } return true; }
Source:
private RunResult parseResult(ProcessResult processResult, Path path) { Configuration configuration = new Configuration(path); return new CargoResultParser().parse(processResult); }

Target:
private RunResult parseResult(ProcessResult processResult, Path path) { return new CargoResultParser().parse(processResult); }
Source:
public void testPublishWithNullType() { Response response = resource.publish(key, null, null, null, null, null, null); assertEquals(response.getStatusInfo(), Response.Status.BAD_REQUEST); }

Target:
public void testPublishWithNullType() { Response response = resource.publish(key, "Test", null, null, null, null, null); assertEquals(response.getStatusInfo(), Response.Status.BAD_REQUEST); }