auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Map getConfigurationMap(String namespace) throws CarbonConfigurationException { loadDeploymentConfiguration(configFileReader); if (deploymentConfigs.containsKey(namespace)) { String jsonConfigString = deploymentConfigs.get(namespace); String jsonProcessedString = processPlaceholder(jsonConfigString); jsonProcessedString = org.wso2.carbon.kernel.utils.Utils.substituteVariables(jsonProcessedString); Yaml yaml = new Yaml(); return yaml.loadAs(jsonProcessedString, Map.class); } logger.error("configuration doesn't exist for the namespace: " + namespace + " in deployment yaml. hence " + "return null object"); return null; }

Target:
public Map getConfigurationMap(String namespace) throws CarbonConfigurationException { loadDeploymentConfiguration(configFileReader); if (deploymentConfigs.containsKey(namespace)) { String configString = deploymentConfigs.get(namespace); String processedString = processPlaceholder(configString); processedString = org.wso2.carbon.kernel.utils.Utils.substituteVariables(processedString); Yaml yaml = new Yaml(); return yaml.loadAs(processedString, Map.class); } logger.error("configuration doesn't exist for the namespace: " + namespace + " in deployment yaml. Hence " + "return null object"); return null; }
Source:
private List<GroupReference> suggestAccountGroup( @Nullable final ProjectControl projectControl, final String query, final int limit) { final int n = limit <= 0 ? 10 : Math.min(limit, 10); List<GroupReference> out = Lists.newArrayListWithCapacity(n); for (GroupReference g : groupBackend.suggest(query)) { try { if (groupControlFactory.controlFor(g.getUUID()).isVisible() || (GroupBackends.isExactSuggestion(g, query) && (projectControl != null) && projectControl.isOwnerAnyRef())) { out.add(g); if (out.size() == n) { break; } } } catch (NoSuchGroupException e) { continue; } } return out; }

Target:
private List<GroupReference> suggestAccountGroup( @Nullable final ProjectControl projectControl, final String query, final int limit) { final int n = limit <= 0 ? 10 : Math.min(limit, 10); List<GroupReference> out = Lists.newArrayListWithCapacity(n); for (GroupReference g : groupBackend.suggest(query)) { try { if (groupControlFactory.controlFor(g.getUUID()).isVisible() || (GroupBackends.isExactSuggestion(g, query) && projectControl != null && projectControl.isOwnerAnyRef())) { out.add(g); if (out.size() == n) { break; } } } catch (NoSuchGroupException e) { continue; } } return out; }
Source:
public Word getWordFromLocal(String serverID, String langCode) { SQLiteDatabase db = openOrCreateWordsDatebase(langCode); String[] columns = new String[] { "*" }; Cursor cursor = db.query("words", columns, "serverID='" + serverID + "'", null, null, null, null); Word word = null; if (cursor.moveToFirst()) { word = new Word(); word.serverID = cursor.getString(cursor.getColumnIndex("serverID")); word.label = cursor.getString(cursor.getColumnIndex("label")); word.languageCode = cursor.getString(cursor .getColumnIndex("languageCode")); word.url = cursor.getString(cursor.getColumnIndex("url")); word.latitude = cursor.getString(cursor.getColumnIndex("latitude")); word.longitude = cursor.getString(cursor .getColumnIndex("longtitude")); word.imageURL = cursor.getString(cursor.getColumnIndex("imageURL")); word.shortDesc = cursor.getString(cursor .getColumnIndex("shortDesc")); word.category = cursor.getInt(cursor.getColumnIndex("category")); } return word; }

Target:
public Word getWordFromLocal(String serverID, String langCode) { SQLiteDatabase db = openOrCreateWordsDatebase(langCode); Cursor cursor = db.rawQuery("select * from words where serverID = ?", new String[] { serverID }); Word word = null; if (cursor.moveToFirst()) { word = new Word(); word.serverID = cursor.getString(cursor.getColumnIndex("serverID")); word.label = cursor.getString(cursor.getColumnIndex("label")); word.languageCode = cursor.getString(cursor.getColumnIndex("languageCode")); word.url = cursor.getString(cursor.getColumnIndex("url")); word.latitude = cursor.getString(cursor.getColumnIndex("latitude")); word.longitude = cursor.getString(cursor.getColumnIndex("longtitude")); word.imageURL = cursor.getString(cursor.getColumnIndex("imageURL")); word.shortDesc = cursor.getString(cursor.getColumnIndex("shortDesc")); word.category = cursor.getInt(cursor.getColumnIndex("category")); } cursor.close(); return word; }
Source:
public final void shootAlienBullets() { for (int i = 0; i < alienWave.getAliens().size(); i++) { if (Math.random() < (alienWave.getAliens().get(i).getBulletChance() * game.getTickrate())) { Bullet bullet = alienWave.getAliens().get(i).shootBullet(60); game.getBullets().add(bullet); String logMessage = "Alien shot bullet at X: " + bullet.getXCoor() + "\tY: " + bullet.getYCoor(); Game.getLogger().log(logMessage, LogEvent.Type.TRACE); } } }

Target:
public final void shootAlienBullets() { for (Alien alien : alienWave.getAliens()) { if (Math.random() < (alien.getBulletChance() * game.getTickrate())) { Bullet bullet = alien.shootBullet(60); game.getBullets().add(bullet); String logMessage = "Alien shot bullet at X: " + bullet.getXCoor() + "\tY: " + bullet.getYCoor(); Game.getLogger().log(logMessage, LogEvent.Type.TRACE); } } }
Source:
private static boolean rollPendingDraftsIgnorePostIdListIfNeeded(){ String idListString = getString(DeletablePrefKey.PENDING_DRAFTS_NOTIFICATION_IGNORE_LIST, ""); boolean rolled = false; if (!TextUtils.isEmpty(idListString)) { List<String> items = new ArrayList(Arrays.asList(idListString.split("\\s*,\\s*"))); if (items.size() > MAX_PENDING_DRAFTS_AMOUNT) { items.remove(0); idListString = TextUtils.join(",", items); setString(DeletablePrefKey.PENDING_DRAFTS_NOTIFICATION_IGNORE_LIST, idListString); rolled = true; } } return rolled; }

Target:
private static boolean rollPendingDraftsIgnorePostIdListIfNeeded(){ String idListString = getString(DeletablePrefKey.PENDING_DRAFTS_NOTIFICATION_IGNORE_LIST, ""); boolean rolled = false; if (!TextUtils.isEmpty(idListString)) { List<String> items = new ArrayList(Arrays.asList(idListString.split(","))); if (items.size() > MAX_PENDING_DRAFTS_AMOUNT) { items.remove(0); idListString = TextUtils.join(",", items); setString(DeletablePrefKey.PENDING_DRAFTS_NOTIFICATION_IGNORE_LIST, idListString); rolled = true; } } return rolled; }
Source:
public static void main(String args[]) { try { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpReplicaTokenTool dumpReplicaTokenTool = new DumpReplicaTokenTool(verifiableProperties); dumpReplicaTokenTool.dumpReplicaToken(); } catch (Exception e) { logger.error("Closed with exception ", e); } }

Target:
public static void main(String args[]) throws Exception { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpReplicaTokenTool dumpReplicaTokenTool = new DumpReplicaTokenTool(verifiableProperties); dumpReplicaTokenTool.dumpReplicaToken(); }
Source:
private String getIsoDateRangeFromEpoch(String value) { if (value.indexOf('/') >= 0) { String dates[] = value.split("/", 2); Instant instantFrom = instantFromEpoch(dates[0]); Instant instantTo = instantFromEpoch(dates[1]); String fromDate = ""; String toDate = ""; if (instantFrom != null) { fromDate = instantFrom.toString(); } if (instantTo != null) { toDate = instantTo.toString(); } return fromDate + '/' + toDate; } return null; }

Target:
private String getIsoDateRangeFromEpoch(String value) { if (value.indexOf('/') >= 0) { String dates[] = value.split("/", 2); Instant instantFrom = instantFromEpoch(dates[0]); Instant instantTo = instantFromEpoch(dates[1]); final String fromDate = (instantFrom != null) ? instantFrom.toString() : ""; final String toDate = (instantTo != null) ? instantTo.toString() : ""; return fromDate + '/' + toDate; } return null; }
Source:
public String exportFinances(String path, String format) { String report; try { BufferedWriter writer = Files.newBufferedWriter(Paths.get(path)); CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT.withHeader("Date", "Category", "Description", "Amount")); SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); for (int i = 0; i < transactions.size(); i++) { csvPrinter.printRecord( df.format(transactions.get(i).getDate()), transactions.get(i).getCategoryName(), transactions.get(i).getDescription(), transactions.get(i).getAmount() ); } csvPrinter.flush(); csvPrinter.close(); report = transactions.size() + " " + resourceMap.getString("FinanceExport.text"); } catch(IOException ioe) { MekHQ.getLogger().log(getClass(), "exportFinances", LogLevel.INFO, "Error exporting finances to " + format); report = "Error exporting finances. See log for details."; } return report; }

Target:
public String exportFinances(String path, String format) { String report; try { BufferedWriter writer = Files.newBufferedWriter(Paths.get(path)); CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT.withHeader("Date", "Category", "Description", "Amount", "RunningTotal")); SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); int running_total = 0; for (int i = 0; i < transactions.size(); i++) { running_total += transactions.get(i).getAmount(); csvPrinter.printRecord( df.format(transactions.get(i).getDate()), transactions.get(i).getCategoryName(), transactions.get(i).getDescription(), transactions.get(i).getAmount(), running_total ); } csvPrinter.flush(); csvPrinter.close(); report = transactions.size() + " " + resourceMap.getString("FinanceExport.text"); } catch(IOException ioe) { MekHQ.getLogger().log(getClass(), "exportFinances", LogLevel.INFO, "Error exporting finances to " + format); report = "Error exporting finances. See log for details."; } return report; }
Source:
private View render(LayoutInflater inflater, Activity activity, ViewGroup parent, DisplayMode mode) { View container = inflater.inflate(R.layout.collection_udf_element_row, parent, false); TextView labelView = (TextView) container.findViewById(R.id.primary_text); TextView secondaryTextView = (TextView) container.findViewById(R.id.secondary_text); TextView sortTextView = (TextView) container.findViewById(R.id.sort_key_field); labelView.setText(label); List<String> secondaryText = new ArrayList<>(); for (String key : nameToType.keySet()) { String formattedValue = formatSubValue(key); if (sortKey.equals(key)) { sortTextView.setText(formattedValue); } else { secondaryText.add(formattedValue); } } secondaryTextView.setText(Joiner.on('\n').join(secondaryText)); View chevron = container.findViewById(R.id.chevron); if (mode == DisplayMode.VIEW) { chevron.setVisibility(View.GONE); } else if (udfDef.isEditable()) { chevron.setVisibility(View.VISIBLE); container.setOnClickListener(v -> { Intent intent = new Intent(activity, UDFCollectionEditActivity.class); intent.putParcelableArrayListExtra(UDFCollectionEditActivity.UDF_DEFINITIONS, newArrayList(udfDef)); intent.putExtra(UDFCollectionEditActivity.INITIAL_VALUE, value.toString()); intent.putExtra(UDFCollectionEditActivity.TAG, tag); activity.startActivityForResult(intent, TreeEditDisplay.FIELD_ACTIVITY_REQUEST_CODE); }); } return container; }

Target:
private View render(LayoutInflater inflater, Activity activity, ViewGroup parent, DisplayMode mode) { View container = inflater.inflate(R.layout.collection_udf_element_row, parent, false); TextView labelView = (TextView) container.findViewById(R.id.primary_text); TextView secondaryTextView = (TextView) container.findViewById(R.id.secondary_text); TextView sortTextView = (TextView) container.findViewById(R.id.sort_key_field); labelView.setText(label); List<String> secondaryText = new ArrayList<>(); for (String key : subFieldDefinitionsByName.keySet()) { String formattedValue = formatSubValue(key); if (sortKey.equals(key)) { sortTextView.setText(formattedValue); } else { secondaryText.add(formattedValue); } } secondaryTextView.setText(Joiner.on('\n').join(secondaryText)); View chevron = container.findViewById(R.id.chevron); if (udfDef.isEditable()) { chevron.setVisibility(View.VISIBLE); container.setOnClickListener(v -> { Intent intent = new Intent(activity, UDFCollectionEditActivity.class); intent.putParcelableArrayListExtra(UDFCollectionEditActivity.UDF_DEFINITIONS, newArrayList(udfDef)); intent.putExtra(UDFCollectionEditActivity.INITIAL_VALUE, value.toString()); intent.putExtra(UDFCollectionEditActivity.TAG, tag); activity.startActivityForResult(intent, TreeEditDisplay.FIELD_ACTIVITY_REQUEST_CODE); }); } return container; }
Source:
private void doAddReviewer() { final String userNameOrEmailOrGroupName = addMemberBox.getText(); if (userNameOrEmailOrGroupName.length() == 0) { return; } addMemberBox.setEnabled(false); final List<String> reviewers = new ArrayList<String>(); reviewers.add(userNameOrEmailOrGroupName); addReviewers(reviewers, false); }

Target:
private void doAddReviewer() { final String reviewer = addMemberBox.getText(); if (reviewer.length() == 0) { return; } addMemberBox.setEnabled(false); final List<String> reviewers = new ArrayList<String>(); reviewers.add(reviewer); addReviewers(reviewers, false); }
Source:
public Response add(Host host) { validateParameters(host, "name", "address"); VdsStatic staticHost = getMapper(Host.class, VdsStatic.class).map(host, null); staticHost.setClusterId(getClusterId(host)); AddVdsActionParameters addParams = new AddVdsActionParameters(staticHost, host.getRootPassword()); if (host.isSetOverrideIptables()) { addParams.setOverrideFirewall(host.isOverrideIptables()); } else { addParams.setOverrideFirewall(true); } addParams.setHostedEngineDeployConfiguration(HostResourceParametersUtil.getHostedEngineDeployConfiguration(this)); addParams = (AddVdsActionParameters) getMapper (Host.class, VdsOperationActionParameters.class).map(host, addParams); return performCreate(VdcActionType.AddVds, addParams, new QueryIdResolver<Guid>(VdcQueryType.GetVdsByVdsId, IdQueryParameters.class)); }

Target:
public Response add(Host host) { validateParameters(host, "name", "address"); VdsStatic staticHost = getMapper(Host.class, VdsStatic.class).map(host, null); staticHost.setClusterId(getClusterId(host)); AddVdsActionParameters addParams = new AddVdsActionParameters(staticHost, host.getRootPassword()); if (host.isSetOverrideIptables()) { addParams.setOverrideFirewall(host.isOverrideIptables()); } addParams.setHostedEngineDeployConfiguration(HostResourceParametersUtil.getHostedEngineDeployConfiguration(this)); addParams = (AddVdsActionParameters) getMapper (Host.class, VdsOperationActionParameters.class).map(host, addParams); return performCreate(VdcActionType.AddVds, addParams, new QueryIdResolver<Guid>(VdcQueryType.GetVdsByVdsId, IdQueryParameters.class)); }
Source:
public void write(byte[] source, int offset, int len) throws IOException { S3ADataBlocks.validateWriteArgs(source, offset, len); if (len == 0) { return; } acquireLock(true); try { innerWrite(source, offset, len); } catch (IOException ex) { throw stateModel.enterErrorState(ex); } finally { stateModel.releaseLock(); } }

Target:
public void write(byte[] source, int offset, int len) throws IOException { S3ADataBlocks.validateWriteArgs(source, offset, len); if (len == 0) { return; } acquireLock(true); try { innerWrite(source, offset, len); } catch (IOException ex) { throw enterErrorState(ex); } finally { releaseLock(); } }
Source:
void monitorPendingAddOps() { int timedOut = 0; for (PendingAddOp op : pendingAddOps) { if (op.maybeTimeout()) { timedOut++; } } LOG.info("Timed out add ops", timedOut); }

Target:
private void monitorPendingAddOps() { int timedOut = 0; for (PendingAddOp op : pendingAddOps) { if (op.maybeTimeout()) { timedOut++; } } if (timedOut > 0) { LOG.info("Timed out add ops", timedOut); } }
Source:
public static void disablePrinting() { try (PrintStream ps = new PrintStream(new NullOutputStream())) { System.setOut(ps); System.setErr(ps); } }

Target:
public static void disablePrinting() { outPS = System.out; errPS = System.err; try (PrintStream ps = new PrintStream(new NullOutputStream())) { System.setOut(ps); System.setErr(ps); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SecurityConfig other = (SecurityConfig) obj; if (clientBlockUnmappedActions != other.clientBlockUnmappedActions) { return false; } if (clientPermissionConfigs == null) { if (other.clientPermissionConfigs != null) { return false; } } else if (!clientPermissionConfigs.equals(other.clientPermissionConfigs)) { return false; } if (clientPolicyConfig == null) { if (other.clientPolicyConfig != null) { return false; } } else if (!clientPolicyConfig.equals(other.clientPolicyConfig)) { return false; } if (clientRealm == null) { if (other.clientRealm != null) { return false; } } else if (!clientRealm.equals(other.clientRealm)) { return false; } if (enabled != other.enabled) { return false; } if (memberRealm == null) { if (other.memberRealm != null) { return false; } } else if (!memberRealm.equals(other.memberRealm)) { return false; } if (onJoinPermissionOperation != other.onJoinPermissionOperation) { return false; } if (realmConfigs == null) { if (other.realmConfigs != null) { return false; } } else if (!realmConfigs.equals(other.realmConfigs)) { return false; } if (securityInterceptorConfigs == null) { if (other.securityInterceptorConfigs != null) { return false; } } else if (!securityInterceptorConfigs.equals(other.securityInterceptorConfigs)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SecurityConfig other = (SecurityConfig) obj; return clientBlockUnmappedActions == other.clientBlockUnmappedActions && Objects.equals(clientPermissionConfigs, other.clientPermissionConfigs) && Objects.equals(clientPolicyConfig, other.clientPolicyConfig) && Objects.equals(clientRealm, other.clientRealm) && enabled == other.enabled && Objects.equals(memberRealm, other.memberRealm) && onJoinPermissionOperation == other.onJoinPermissionOperation && Objects.equals(realmConfigs, other.realmConfigs) && Objects.equals(securityInterceptorConfigs, other.securityInterceptorConfigs); }
Source:
void internalStopRiver() { logger.info("Stopping river {}", riverName.getName()); try { if (startupThread != null) { startupThread.interrupt(); startupThread = null; } for (Thread thread : tailerThreads) { thread.interrupt(); thread = null; } tailerThreads.clear(); if (indexerThread != null) { indexerThread.interrupt(); indexerThread = null; } } catch (Throwable t) { logger.error("Failed to stop river {}", t, riverName.getName()); } finally { this.context.setStatus(Status.STOPPED); } }

Target:
void internalStopRiver() { logger.info("Stopping river {}", riverName.getName()); try { if (startupThread != null) { startupThread.interrupt(); startupThread = null; } for (Thread thread : tailerThreads) { thread.interrupt(); thread = null; } tailerThreads.clear(); if (indexerThread != null) { indexerThread.interrupt(); indexerThread = null; } logger.info("Stopped river {}", riverName.getName()); } catch (Throwable t) { logger.error("Failed to stop river {}", t, riverName.getName()); } finally { this.context.setStatus(Status.STOPPED); } }
Source:
static Pair<byte[], Integer> findTandemRepeatUnits(final byte[] readBases, final int offset) { int maxBW = 0; byte[] bestBWRepeatUnit = {readBases[offset]}; for (int str = 1; str <= MAX_STR_UNIT_LENGTH; str++) { if (offset+1-str < 0) { break; } maxBW = GATKVariantContextUtils.findNumberOfRepetitions(readBases, offset - str + 1, str , readBases, 0, offset + 1, false); if (maxBW > 1) { bestBWRepeatUnit = Arrays.copyOfRange(readBases, offset - str + 1, offset + 1); break; } } byte[] bestRepeatUnit = bestBWRepeatUnit; int maxRL = maxBW; if (offset < readBases.length-1) { byte[] bestFWRepeatUnit = {readBases[offset+1]}; int maxFW = 0; final byte[] testString = Arrays.copyOfRange(readBases, 0, offset + 1); for (int str = 1; str <= MAX_STR_UNIT_LENGTH; str++) { if (offset+str+1 > readBases.length) { break; } maxFW = GATKVariantContextUtils.findNumberOfRepetitions(readBases, offset + 1, str, readBases, offset + 1, readBases.length-offset -1, true); if (maxFW > 1) { bestFWRepeatUnit = Arrays.copyOfRange(readBases, offset + 1, offset+str+1); break; } } if (Arrays.equals(bestFWRepeatUnit, bestBWRepeatUnit)) { maxRL = maxBW + maxFW; bestRepeatUnit = bestFWRepeatUnit; } else { maxBW = GATKVariantContextUtils.findNumberOfRepetitions(bestFWRepeatUnit, testString, false); maxRL = maxFW + maxBW; bestRepeatUnit = bestFWRepeatUnit; } } if(maxRL > MAX_REPEAT_LENGTH) { maxRL = MAX_REPEAT_LENGTH; } return Pair.of(bestRepeatUnit, maxRL); }

Target:
static Pair<byte[], Integer> findTandemRepeatUnits(final byte[] readBases, final int offset) { int maxBW = 0; byte[] bestBWRepeatUnit = {readBases[offset]}; for (int str = 1; str <= MAX_STR_UNIT_LENGTH; str++) { if (offset+1-str < 0) { break; } maxBW = GATKVariantContextUtils.findNumberOfRepetitions(readBases, offset - str + 1, str , readBases, 0, offset + 1, false); if (maxBW > 1) { bestBWRepeatUnit = Arrays.copyOfRange(readBases, offset - str + 1, offset + 1); break; } } byte[] bestRepeatUnit = bestBWRepeatUnit; int maxRL = maxBW; if (offset < readBases.length-1) { byte[] bestFWRepeatUnit = {readBases[offset+1]}; int maxFW = 0; for (int str = 1; str <= MAX_STR_UNIT_LENGTH; str++) { if (offset+str+1 > readBases.length) { break; } maxFW = GATKVariantContextUtils.findNumberOfRepetitions(readBases, offset + 1, str, readBases, offset + 1, readBases.length-offset -1, true); if (maxFW > 1) { bestFWRepeatUnit = Arrays.copyOfRange(readBases, offset + 1, offset+str+1); break; } } if (Arrays.equals(bestFWRepeatUnit, bestBWRepeatUnit)) { maxRL = maxBW + maxFW; bestRepeatUnit = bestFWRepeatUnit; } else { final byte[] testString = Arrays.copyOfRange(readBases, 0, offset + 1); maxBW = GATKVariantContextUtils.findNumberOfRepetitions(bestFWRepeatUnit, testString, false); maxRL = maxFW + maxBW; bestRepeatUnit = bestFWRepeatUnit; } } if(maxRL > MAX_REPEAT_LENGTH) { maxRL = MAX_REPEAT_LENGTH; } return Pair.of(bestRepeatUnit, maxRL); }
Source:
public PhoneNumbersResponse listNumbersForPurchase(String countryCode) throws IllegalArgumentException, GeneralException, UnauthorizedException, NotFoundException { final String url = String.format("%s/v1/available-phone-numbers", NUMBERS_CALLS_BASE_URL); return messageBirdService.requestByID(url, countryCode, PhoneNumbersResponse.class); }

Target:
public PhoneNumbersResponse listNumbersForPurchase(String countryCode) throws GeneralException, UnauthorizedException, NotFoundException, IllegalArgumentException { countryCodeIsValid(countryCode); final String url = String.format("%s/available-phone-numbers", NUMBERS_CALLS_BASE_URL); return messageBirdService.requestByID(url, countryCode, PhoneNumbersResponse.class); }
Source:
public ProxyEndpointService createProxyEndpointService(String serviceType) { ProxyEndpointService proxyEndpointService = null; try { proxyEndpointService = (ProxyEndpointService) Class.forName(fileProxyMap.get(serviceType)).newInstance(); } catch (InstantiationException e) { logger.log(Level.SEVERE, e.getMessage(), e); e.printStackTrace(); } catch (IllegalAccessException e) { logger.log(Level.SEVERE, e.getMessage(), e); } catch (ClassNotFoundException e) { logger.log(Level.SEVERE, e.getMessage(), e); } return proxyEndpointService; }

Target:
public ProxyEndpointService createProxyEndpointService(String serviceType) { ProxyEndpointService proxyEndpointService = null; try { proxyEndpointService = (ProxyEndpointService) Class.forName(fileProxyMap.get(serviceType)).newInstance(); } catch (InstantiationException e) { logger.log(Level.SEVERE, e.getMessage(), e); } catch (IllegalAccessException e) { logger.log(Level.SEVERE, e.getMessage(), e); } catch (ClassNotFoundException e) { logger.log(Level.SEVERE, e.getMessage(), e); } return proxyEndpointService; }
Source:
public void addToMutedTopics(JSONArray jsonArray) { Stream stream; for (int i = 0; i < jsonArray.length(); i++) { try { JSONArray mutedTopic = jsonArray.getJSONArray(i); stream = Stream.getByName(this, mutedTopic.get(0).toString()); mutedTopics.add(stream.getId() + mutedTopic.get(1).toString()); } catch (JSONException e) { e.printStackTrace(); } } SharedPreferences.Editor editor = settings.edit(); editor.putStringSet(MUTED_TOPIC_KEY, new HashSet<String>(mutedTopics)); editor.apply(); }

Target:
public void addToMutedTopics(JSONArray jsonArray) { Stream stream; for (int i = 0; i < jsonArray.length(); i++) { try { JSONArray mutedTopic = jsonArray.getJSONArray(i); stream = Stream.getByName(this, mutedTopic.get(0).toString()); mutedTopics.add(stream.getId() + mutedTopic.get(1).toString()); } catch (JSONException e) { Log.e("JSONException", "JSON Is not correct", e); } } SharedPreferences.Editor editor = settings.edit(); editor.putStringSet(MUTED_TOPIC_KEY, new HashSet<String>(mutedTopics)); editor.apply(); }
Source:
public void streamData(PID pid, String dsName, AccessGroupSet principals, boolean asAttachment, HttpServletResponse response) throws IOException { String datastream = dsName == null ? ORIGINAL_FILE : dsName; accessControlService.assertHasAccess("Insufficient permissions to access " + datastream + " for object " + pid, pid, principals, getPermissionForDatastream(datastream)); LOG.debug("Streaming datastream from object {}", datastream, pid); FileObject fileObj = repositoryObjectLoader.getFileObject(pid); BinaryObject binObj; if (ORIGINAL_FILE.equals(datastream)) { binObj = fileObj.getOriginalFile(); } else { binObj = fileObj.getBinaryObject(datastream); } response.setHeader(CONTENT_LENGTH, Long.toString(binObj.getFilesize())); response.setHeader(CONTENT_TYPE, binObj.getMimetype()); String filename = binObj.getFilename() == null ? pid.getId() : binObj.getFilename(); if (asAttachment) { response.setHeader(CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\""); } else { response.setHeader(CONTENT_DISPOSITION, "inline; filename=\"" + filename + "\""); } OutputStream outStream = response.getOutputStream(); IOUtils.copy(binObj.getBinaryStream(), outStream, 4096); }

Target:
public void streamData(PID pid, String dsName, AccessGroupSet principals, boolean asAttachment, HttpServletResponse response) throws IOException { String datastream = dsName == null ? ORIGINAL_FILE : dsName; accessControlService.assertHasAccess("Insufficient permissions to access " + datastream + " for object " + pid, pid, principals, getPermissionForDatastream(datastream)); LOG.debug("Streaming datastream from object {}", datastream, pid); FileObject fileObj = repositoryObjectLoader.getFileObject(pid); BinaryObject binObj; if (ORIGINAL_FILE.equals(datastream)) { binObj = fileObj.getOriginalFile(); } else { binObj = fileObj.getBinaryObject(datastream); } response.setHeader(CONTENT_LENGTH, Long.toString(binObj.getFilesize())); response.setHeader(CONTENT_TYPE, binObj.getMimetype()); String binaryName = binObj.getFilename(); String filename = binaryName == null ? pid.getId() : binaryName; if (asAttachment) { response.setHeader(CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\""); } else { response.setHeader(CONTENT_DISPOSITION, "inline; filename=\"" + filename + "\""); } OutputStream outStream = response.getOutputStream(); IOUtils.copy(binObj.getBinaryStream(), outStream, BUFFER_SIZE); }
Source:
public void getObjectNullChannelDeprecatedConstructorTest() { try { new GetObjectRequest("BucketName", "ObjectName", null); fail(); } catch (final NullPointerException e) { assertThat(e.getMessage(), is("Channel may not be null.")); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is("Argument for @Nonnull parameter 'channel' of com/spectralogic/ds3client/commands/GetObjectRequest.<init> must not be null")); } }

Target:
public void getObjectNullChannelDeprecatedConstructorTest() { testNonnullStreamChannelExceptions("Channel", () -> new GetObjectRequest("BucketName", "ObjectName", null)); }
Source:
private ChromeDriverEx createChromeDriver() { ChromeOptions options = new ChromeOptions(); if (USE_MOBILE_USER_AGENT) { options.addArguments(String.format("user-agent=\"%s\"", MOBILE_USER_AGENT)); } ChromeDriverEx driver = new ChromeDriverEx(options, isTestChromeDriver); WebDriver.Options manage = driver.manage(); if (!isTestChromeDriver) { setWindowSize(manage); initialiseJNA(); } return driver; }

Target:
private ChromeDriverEx createChromeDriver() { ChromeOptions options = new ChromeOptions(); if (USE_MOBILE_USER_AGENT) { options.addArguments(String.format("user-agent=\"%s\"", MOBILE_USER_AGENT)); } ChromeDriverEx driver = new ChromeDriverEx(options, isTestChromeDriver); WebDriver.Options driverOptions = driver.manage(); if (!isTestChromeDriver) { setWindowBounds(driverOptions); initialiseJNA(); } return driver; }
Source:
public void assertIsDirectoryRecursivelyContaining(AssertionInfo info, File actual, String syntaxAndPattern) { requireNonNull(syntaxAndPattern, "The syntax and pattern to build PathMatcher should not be null"); Predicate<File> pathMatcher = pathMatcher(info, actual, syntaxAndPattern); assertIsDirectoryRecursivelyContaining(info, actual, pathMatcher, format("the '%s' pattern", syntaxAndPattern)); }

Target:
public void assertIsDirectoryRecursivelyContaining(AssertionInfo info, File actual, String syntaxAndPattern) { requireNonNull(syntaxAndPattern, "The syntax and pattern should not be null"); Predicate<File> fileMatcher = fileMatcher(info, actual, syntaxAndPattern); assertIsDirectoryRecursivelyContaining(info, actual, fileMatcher, format("the '%s' pattern", syntaxAndPattern)); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((availableDiskSize == null) ? 0 : availableDiskSize.hashCode()); result = prime * result + ((usedDiskSize == null) ? 0 : usedDiskSize.hashCode()); result = prime * result + ((externalStatus == null) ? 0 : externalStatus.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((availableDiskSize == null) ? 0 : availableDiskSize.hashCode()); result = prime * result + ((usedDiskSize == null) ? 0 : usedDiskSize.hashCode()); result = prime * result + ((externalStatus == null) ? 0 : Objects.hashCode(externalStatus)); return result; }
Source:
public IBinding resolveBinding() { if (!useCachedBinding()) { if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) { setBinding(createRecursionResolvingBinding()); } else { fIsFinal= false; final IBinding b= createIntermediateBinding(); if (b instanceof ProblemBinding) { ProblemBinding pb= (ProblemBinding) b; final IASTNode node= pb.getASTNode(); if (node == null || node.getParent() == null) { pb.setASTNode(this); } } setBinding(b); } } if (!fIsFinal) resolveFinalBinding(this); return fBinding; }

Target:
public IBinding resolveBinding() { return CPPSemantics.isUsingPromiscuousBindingResolution() ? resolveBindingPromiscuous() : resolveBindingNormal(); }
Source:
public void create_iterable_children() { RulesTreeNode.Language parent = new RulesTreeNode.Language("lang"); RulesTreeNode.Rule n1 = new RulesTreeNode.Rule(mockRuleDetails("r1"), true, new HashMap<>()); RulesTreeNode.Rule n2 = new RulesTreeNode.Rule(mockRuleDetails("r2"), true, new HashMap<>()); RulesTreeNode.Rule n3 = new RulesTreeNode.Rule(mockRuleDetails("r3"), true, new HashMap<>()); parent.add(n1); parent.add(n2); parent.add(n3); assertThat(parent.childrenIterable().iterator()).toIterable().containsExactly(n1, n2, n3); }

Target:
public void create_iterable_children() { RulesTreeNode.Language parent = new RulesTreeNode.Language("lang"); RulesTreeNode.Rule n1 = new RulesTreeNode.Rule(mockRuleDetails("r1"), true, new HashMap<>()); RulesTreeNode.Rule n2 = new RulesTreeNode.Rule(mockRuleDetails("r2"), true, new HashMap<>()); RulesTreeNode.Rule n3 = new RulesTreeNode.Rule(mockRuleDetails("r3"), true, new HashMap<>()); parent.add(n1); parent.add(n2); parent.add(n3); assertThat(parent.childrenIterable()).containsExactly(n1, n2, n3); }
Source:
void notifyChatRoomMemberLeft(ChatRoomMember member) { participantsCount--; }

Target:
void notifyChatRoomMemberLeft(ChatRoomMember member) { }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); File imageFile = new File(picturePath); final String attachmentName = getApplication().getString(R.string.attachment) + "_" + System.currentTimeMillis() + ".png"; progressDialog.setTitle(getApplication().getString(R.string.apply_edit_message)); progressDialog.setMessage(getApplication().getString(R.string.wait)); progressDialog.show(); ListenableFuture<Attachment> addResult = mSelectedArcGISFeature.addAttachmentAsync(imageFile, "image/png", attachmentName); addResult.addDoneListener(new Runnable() { @Override public void run() { final ListenableFuture<Void> tableResult = mServiceFeatureTable.updateFeatureAsync(mSelectedArcGISFeature); tableResult.addDoneListener(new Runnable() { @Override public void run() { applyServerEdits(); } }); } }); } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); if (cursor != null && cursor.moveToFirst()) { int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); File imageFile = new File(picturePath); final String attachmentName = getApplication().getString(R.string.attachment) + "_" + System.currentTimeMillis() + ".png"; progressDialog.setTitle(getApplication().getString(R.string.apply_edit_message)); progressDialog.setMessage(getApplication().getString(R.string.wait)); progressDialog.show(); ListenableFuture<Attachment> addResult = mSelectedArcGISFeature.addAttachmentAsync(imageFile, "image/png", attachmentName); addResult.addDoneListener(new Runnable() { @Override public void run() { final ListenableFuture<Void> tableResult = mServiceFeatureTable.updateFeatureAsync(mSelectedArcGISFeature); tableResult.addDoneListener(new Runnable() { @Override public void run() { applyServerEdits(); } }); } }); } } }
Source:
public CassandraStreamHeader deserialize(DataInputPlus in, int version, Function<TableId, IPartitioner> partitionerMapper) throws IOException { Version sstableVersion = SSTableFormat.Type.current().info.getVersion(in.readUTF()); SSTableFormat.Type format = SSTableFormat.Type.validate(in.readUTF()); long estimatedKeys = in.readLong(); int count = in.readInt(); List<SSTableReader.PartitionPositionBounds> sections = new ArrayList<>(count); for (int k = 0; k < count; k++) sections.add(new SSTableReader.PartitionPositionBounds(in.readLong(), in.readLong())); CompressionInfo compressionInfo = CompressionInfo.serializer.deserialize(in, version); int sstableLevel = in.readInt(); SerializationHeader.Component header = SerializationHeader.serializer.deserialize(sstableVersion, in); TableId tableId = TableId.deserialize(in); boolean fullStream = in.readBoolean(); ComponentManifest manifest = null; DecoratedKey firstKey = null; if (fullStream) { manifest = ComponentManifest.serializer.deserialize(in, version); ByteBuffer keyBuf = ByteBufferUtil.readWithVIntLength(in); IPartitioner partitioner = partitionerMapper.apply(tableId); if (partitioner == null) throw new IllegalArgumentException(String.format("Could not determine partitioner for tableId {}", tableId)); firstKey = partitioner.decorateKey(keyBuf); } return new CassandraStreamHeader(sstableVersion, format, estimatedKeys, sections, compressionInfo, sstableLevel, header, manifest, fullStream, firstKey, tableId); }

Target:
public CassandraStreamHeader deserialize(DataInputPlus in, int version, Function<TableId, IPartitioner> partitionerMapper) throws IOException { Version sstableVersion = SSTableFormat.Type.current().info.getVersion(in.readUTF()); SSTableFormat.Type format = SSTableFormat.Type.validate(in.readUTF()); long estimatedKeys = in.readLong(); int count = in.readInt(); List<SSTableReader.PartitionPositionBounds> sections = new ArrayList<>(count); for (int k = 0; k < count; k++) sections.add(new SSTableReader.PartitionPositionBounds(in.readLong(), in.readLong())); CompressionInfo compressionInfo = CompressionInfo.serializer.deserialize(in, version); int sstableLevel = in.readInt(); SerializationHeader.Component header = SerializationHeader.serializer.deserialize(sstableVersion, in); TableId tableId = TableId.deserialize(in); boolean isEntireSSTable = in.readBoolean(); ComponentManifest manifest = null; DecoratedKey firstKey = null; if (isEntireSSTable) { manifest = ComponentManifest.serializer.deserialize(in, version); ByteBuffer keyBuf = ByteBufferUtil.readWithVIntLength(in); IPartitioner partitioner = partitionerMapper.apply(tableId); if (partitioner == null) throw new IllegalArgumentException(String.format("Could not determine partitioner for tableId %s", tableId)); firstKey = partitioner.decorateKey(keyBuf); } return builder().withSSTableFormat(format) .withSSTableVersion(sstableVersion) .withSSTableLevel(sstableLevel) .withEstimatedKeys(estimatedKeys) .withSections(sections) .withCompressionInfo(compressionInfo) .withSerializationHeader(header) .withComponentManifest(manifest) .isEntireSSTable(isEntireSSTable) .withFirstKey(firstKey) .withTableId(tableId) .build(); }
Source:
public final String getDescription() { StringBuilder sb = new StringBuilder("rel#"); sb = sb.append(id).append(':').append(digest); return sb.toString(); }

Target:
public final String getDescription() { return this.toString(); }
Source:
public boolean equals(Object object) { if (this == object) { return true; } if (object == null || getClass() != object.getClass()) { return false; } final LocalizedMessage localizedMessage = (LocalizedMessage) object; return severityLevel == localizedMessage.severityLevel && Objects.equals(lineNo, localizedMessage.lineNo) && Objects.equals(columnNo, localizedMessage.columnNo) && Objects.equals(columnCharIndex, localizedMessage.columnCharIndex) && Objects.equals(tokenType, localizedMessage.tokenType) && Objects.equals(moduleId, localizedMessage.moduleId) && Objects.equals(key, localizedMessage.key) && Objects.equals(bundle, localizedMessage.bundle) && Objects.equals(sourceClass, localizedMessage.sourceClass) && Objects.equals(customMessage, localizedMessage.customMessage) && Arrays.equals(args, localizedMessage.args); }

Target:
public boolean equals(Object object) { if (this == object) { return true; } if (object == null || getClass() != object.getClass()) { return false; } final LocalizedMessage localizedMessage = (LocalizedMessage) object; return Objects.equals(lineNo, localizedMessage.lineNo) && Objects.equals(columnNo, localizedMessage.columnNo) && Objects.equals(columnCharIndex, localizedMessage.columnCharIndex) && Objects.equals(tokenType, localizedMessage.tokenType) && Objects.equals(severityLevel, localizedMessage.severityLevel) && Objects.equals(moduleId, localizedMessage.moduleId) && Objects.equals(key, localizedMessage.key) && Objects.equals(bundle, localizedMessage.bundle) && Objects.equals(sourceClass, localizedMessage.sourceClass) && Objects.equals(customMessage, localizedMessage.customMessage) && Arrays.equals(args, localizedMessage.args); }
Source:
public void execute(String[] args, Console console) { if (args.length > 0) { String subCommand = args[0]; switch (subCommand) { case SUBCMD_SAY: if (args.length > 1) { say((String[]) ArrayUtils.subarray(args, 1, args.length), console); } else { console.println("Specify text to say (e.g. 'say hello')"); } return; case SUBCMD_INTERPRET: if (args.length > 1) { interpret((String[]) ArrayUtils.subarray(args, 1, args.length), console); } else { console.println("Specify text to interpret (e.g. 'interpret turn all lights off')"); } return; case SUBCMD_VOICES: Locale locale = localeProvider.getLocale(); Voice v = voiceManager.getDefaultVoice(); if (v == null) { TTSService tts = voiceManager.getTTS(); if (tts != null) { v = voiceManager.getPreferredVoice(tts.getAvailableVoices()); } } final Voice defaultVoice = v; VoiceHelper.withSortedVoices(voiceManager.getTTSs().stream(), locale, (ttsService, voice) -> { console.println(String.format("%s%s - %s - %s (%s)", voice.equals(defaultVoice) ? "*" : "", ttsService.getLabel(locale), voice.getLocale().getDisplayName(locale), voice.getLabel(), voice.getUID())); }); return; default: break; } } else { printUsage(console); } }

Target:
public void execute(String[] args, Console console) { if (args.length > 0) { String subCommand = args[0]; switch (subCommand) { case SUBCMD_SAY: if (args.length > 1) { say((String[]) ArrayUtils.subarray(args, 1, args.length), console); } else { console.println("Specify text to say (e.g. 'say hello')"); } return; case SUBCMD_INTERPRET: if (args.length > 1) { interpret((String[]) ArrayUtils.subarray(args, 1, args.length), console); } else { console.println("Specify text to interpret (e.g. 'interpret turn all lights off')"); } return; case SUBCMD_VOICES: Locale locale = localeProvider.getLocale(); Voice defaultVoice = getDefaultVoice(); for (Voice voice : voiceManager.getAllVoices()) { TTSService ttsService = voiceManager.getTTS(voice.getUID().split(":")[0]); if (ttsService != null) { console.println(String.format("%s %s - %s - %s (%s)", voice.equals(defaultVoice) ? "*" : " ", ttsService.getLabel(locale), voice.getLocale().getDisplayName(locale), voice.getLabel(), voice.getUID())); } } return; default: break; } } else { printUsage(console); } }
Source:
public void whenStreamTimeoutReachedPossibleToCommit() throws Exception { publishEvent(eventType.getName(),"{\"foo\":\"bar\"}"); publishEvent(eventType.getName(),"{\"foo\":\"bar\"}"); final TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "stream_limit=1&stream_timeout=1") .start(); waitFor(() -> Assert.assertFalse(client.getBatches().isEmpty()), TimeUnit.SECONDS.toMillis(1), 100); final SubscriptionCursor toCommit = client.getBatches().get(0).getCursor(); client.close(); final int statusCode = commitCursors( subscription.getId(), Collections.singletonList(toCommit), client.getSessionId()); Assert.assertEquals(SC_NO_CONTENT, statusCode); }

Target:
public void whenStreamTimeoutReachedPossibleToCommit() throws Exception { final TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "batch_limit=1&stream_limit=2&stream_timeout=1") .start(); waitFor(() -> assertThat(client.getSessionId(), not(equalTo(SESSION_ID_UNKNOWN)))); publishEvent(eventType.getName(),"{\"foo\":\"bar\"}"); waitFor(() -> Assert.assertFalse(client.getBatches().isEmpty()), TimeUnit.SECONDS.toMillis(2), 100); final SubscriptionCursor toCommit = client.getBatches().get(0).getCursor(); client.close(); Thread.sleep(TimeUnit.SECONDS.toMillis(1)); final int statusCode = commitCursors( subscription.getId(), Collections.singletonList(toCommit), client.getSessionId()); Assert.assertEquals(SC_NO_CONTENT, statusCode); }
Source:
public CurrencyAmount minus(CurrencyAmount amountToSubtract) { ArgChecker.notNull(amountToSubtract, "amountToAdd"); ArgChecker.isTrue(amountToSubtract.getCurrency().equals(currency), "Unable to subtract amounts in different currencies"); return minus(amountToSubtract.getAmount()); }

Target:
public CurrencyAmount minus(CurrencyAmount amountToSubtract) { ArgChecker.notNull(amountToSubtract, "amountToSubtract"); ArgChecker.isTrue(amountToSubtract.getCurrency().equals(currency), "Unable to subtract amounts in different currencies"); return minus(amountToSubtract.getAmount()); }
Source:
public static String formatWaypointInfo(final Waypoint waypoint) { final List<String> infos = new ArrayList<>(3); final WaypointType waypointType = waypoint.getWaypointType(); if (waypointType != WaypointType.OWN && waypointType != null) { infos.add(waypointType.getL10n()); } if (waypoint.getPrefix().toUpperCase().startsWith(Waypoint.PREFIX_OWN.toUpperCase())) { infos.add(CgeoApplication.getInstance().getString(R.string.waypoint_custom)); } else { if (StringUtils.isNotBlank(waypoint.getPrefix())) { infos.add(waypoint.getPrefix()); } if (StringUtils.isNotBlank(waypoint.getLookup())) { infos.add(waypoint.getLookup()); } } return StringUtils.join(infos, SEPARATOR); }

Target:
public static String formatWaypointInfo(final Waypoint waypoint) { final List<String> infos = new ArrayList<>(3); final WaypointType waypointType = waypoint.getWaypointType(); if (waypointType != WaypointType.OWN && waypointType != null) { infos.add(waypointType.getL10n()); } if (waypoint.isUserDefined()) { infos.add(CgeoApplication.getInstance().getString(R.string.waypoint_custom)); } else { if (StringUtils.isNotBlank(waypoint.getPrefix())) { infos.add(waypoint.getPrefix()); } if (StringUtils.isNotBlank(waypoint.getLookup())) { infos.add(waypoint.getLookup()); } } return StringUtils.join(infos, SEPARATOR); }
Source:
private List<DiscoverySelector> getSelectorsFromSuppliedSelectors(BundleDescriptor bd) { List<DiscoverySelector> selectors = new ArrayList<>(); Bundle bundle = bd.getBundle(); Bundle host = BundleUtils.getHost(bundle) .get(); Set<String> testCases = BundleUtils.testCases(bundle) .collect(toSet()); classSelectors.stream() .map(ClassSelector::getClassName) .filter(testCases::contains) .forEach(className -> { try { Class<?> testClass = host.loadClass(className); unresolvedClasses.remove(className); info(() -> "removing resolved class: " + testClass + ", that leaves: " + unresolvedClasses); if (resolvedClasses.add(testClass)) { selectors.add(selectClass(testClass)); } } catch (ClassNotFoundException cnfe) { info(() -> "Unresolved class: " + className + ", bundle: " + bundle.getSymbolicName(), cnfe); } }); methodSelectors.stream() .filter(x -> testCases.contains(x.getClassName())) .forEach(selector -> { try { Class<?> testClass = host.loadClass(selector.getClassName()); if (!resolvedClasses.contains(testClass)) { selectors .add(selectMethod(testClass, selector.getMethodName(), selector.getMethodParameterTypes())); unresolvedClasses.remove(selector.getClassName()); } } catch (ClassNotFoundException cnfe) { info(() -> "Unresolved class: " + selector.getClassName() + ", bundle: " + bundle.getSymbolicName(), cnfe); } }); info(() -> "Selectors: " + selectors); return selectors; }

Target:
private List<DiscoverySelector> getSelectorsFromSuppliedSelectors(BundleDescriptor bd) { List<DiscoverySelector> selectors = new ArrayList<>(); Bundle bundle = bd.getBundle(); Bundle host = BundleUtils.getHost(bundle) .get(); Set<String> testCases = BundleUtils.testCases(bundle) .collect(toSet()); classSelectors.stream() .map(ClassSelector::getClassName) .filter(testCases::contains) .forEach(className -> { try { Class<?> testClass = host.loadClass(className); unresolvedClasses.remove(className); info(() -> "removing resolved class: " + testClass + ", that leaves: " + unresolvedClasses); if (resolvedClasses.add(testClass)) { selectors.add(selectClass(testClass)); } } catch (ClassNotFoundException cnfe) { info(() -> "Unresolved class: " + className + ", bundle: " + bundle.getSymbolicName(), cnfe); } }); methodSelectors.stream() .filter(selector -> testCases.contains(selector.getClassName())) .forEach(selector -> { try { Class<?> testClass = host.loadClass(selector.getClassName()); if (!resolvedClasses.contains(testClass)) { selectors .add(selectMethod(testClass, selector.getMethodName(), selector.getMethodParameterTypes())); unresolvedClasses.remove(selector.getClassName()); } } catch (ClassNotFoundException cnfe) { info(() -> "Unresolved class: " + selector.getClassName() + ", bundle: " + bundle.getSymbolicName(), cnfe); } }); info(() -> "Selectors: " + selectors); return selectors; }