auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LookupsStateWithMap getLookupStateForNode( HostAndPort node ) throws IOException, InterruptedException, ExecutionException { final URL url = getLookupsURL(node); final AtomicInteger returnCode = new AtomicInteger(0); final AtomicReference<String> reasonString = new AtomicReference<>(null); LOG.debug("Getting lookups from [%s]", url); try (final InputStream result = httpClient.go( new Request(HttpMethod.GET, url) .addHeader(HttpHeaders.Names.ACCEPT, SmileMediaTypes.APPLICATION_JACKSON_SMILE), makeResponseHandler(returnCode, reasonString), lookupCoordinatorManagerConfig.getHostTimeout() ).get()) { if (returnCode.get() == 200) { try { final LookupsStateWithMap response = smileMapper.readValue(result, LookupsStateWithMap.class); LOG.debug( "Get on [%s], Status: %s reason: [%s], Response [%s].", url, returnCode.get(), reasonString.get(), response ); return response; } catch(IOException ex) { throw new IOE( ex, "Failed to parser GET lookups response from [%s]. response [%s].", url, result ); } } else { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { StreamUtils.copyAndClose(result, baos); } catch (IOException ex) { LOG.warn(ex, "Error reading response from GET on url [%s]", url); } throw new IOE( "GET request failed to [%s] : [%d] : [%s] Response: [%s]", url, returnCode.get(), reasonString.get(), StringUtils.fromUtf8(baos.toByteArray()) ); } } }

Target:
public LookupsState<LookupExtractorFactoryMapContainer> getLookupStateForNode( HostAndPort node ) throws IOException, InterruptedException, ExecutionException { final URL url = getLookupsURL(node); final AtomicInteger returnCode = new AtomicInteger(0); final AtomicReference<String> reasonString = new AtomicReference<>(null); LOG.debug("Getting lookups from [%s]", url); try (final InputStream result = httpClient.go( new Request(HttpMethod.GET, url) .addHeader(HttpHeaders.Names.ACCEPT, SmileMediaTypes.APPLICATION_JACKSON_SMILE), makeResponseHandler(returnCode, reasonString), lookupCoordinatorManagerConfig.getHostTimeout() ).get()) { if (returnCode.get() == HttpURLConnection.HTTP_OK) { try { final LookupsState<LookupExtractorFactoryMapContainer> response = smileMapper.readValue( result, LOOKUPS_STATE_TYPE_REFERENCE ); LOG.debug( "Get on [%s], Status: %s reason: [%s], Response [%s].", url, returnCode.get(), reasonString.get(), response ); return response; } catch(IOException ex) { throw new IOE( ex, "Failed to parser GET lookups response from [%s]. response [%s].", url, result ); } } else { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { StreamUtils.copyAndClose(result, baos); } catch (IOException ex) { LOG.warn(ex, "Error reading response from GET on url [%s]", url); } throw new IOE( "GET request failed to [%s] : [%d] : [%s] Response: [%s]", url, returnCode.get(), reasonString.get(), StringUtils.fromUtf8(baos.toByteArray()) ); } } }
Source:
public void deleteSlideshow() { new ArticleContent().push( "<gallery type=\"slideshow\">\nImage010.jpg\ndefault_Image009.jpg\ndefault_Image008.jpg\ndefault_Image007.jpg\n" + "Image010.jpg\ndefault_Image009.jpg\ndefault_Image008.jpg\ndefault_Image007.jpg\ndefault_Image006.jpg\ndefault_Image005.jpg\n" + "default_Image004.jpg\ndefault_Image003.jpg\n</gallery>"); VisualEditModePageObject visualEditMode = new VisualEditModePageObject().open(); visualEditMode.removeComponent(Components.SLIDESHOW); visualEditMode.verifyComponentRemoved(Components.SLIDESHOW); }

Target:
public void deleteSlideshow() { new ArticleContent().push( "<gallery type=\"slideshow\">\ndefault_Image010.jpg\ndefault_Image009.jpg\ndefault_Image008.jpg\ndefault_Image007.jpg\n" + "default_Image010.jpg\ndefault_Image009.jpg\ndefault_Image008.jpg\ndefault_Image007.jpg\ndefault_Image006.jpg\ndefault_Image005.jpg\n" + "default_Image004.jpg\ndefault_Image003.jpg\n</gallery>"); VisualEditModePageObject visualEditMode = new VisualEditModePageObject().open(); visualEditMode.removeComponent(Components.SLIDESHOW); visualEditMode.verifyComponentRemoved(Components.SLIDESHOW); }
Source:
protected float getAssignmentScore(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { float estimatedMaxPartitionCount = clusterContext.getEstimatedMaxPartitionCount(); float currentPartitionCount = node.getAssignedReplicaCount(); return computeUtilizationScore(estimatedMaxPartitionCount, currentPartitionCount); }

Target:
protected double getAssignmentScore(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { int estimatedMaxPartitionCount = clusterContext.getEstimatedMaxPartitionCount(); int currentPartitionCount = node.getAssignedReplicaCount(); return computeUtilizationScore(estimatedMaxPartitionCount, currentPartitionCount); }
Source:
public void testPushNetworkExceptionAndResend() throws NetworkException, InterruptedException { final CountDownLatch sendLatch = new CountDownLatch(1 + ParameterWorkerImpl.MAX_RESEND_COUNT); final long gracePeriod = 1000; doAnswer(invocationOnMock -> { sendLatch.countDown(); throw new NetworkException("exception"); }).when(mockSender).sendPushMsg(anyString(), any(EncodedKey.class), anyObject()); final int key = 0; new Thread(() -> { worker.push(key, key); }).start(); assertTrue(sendLatch.await(ParameterWorkerImpl.RESEND_INTERVAL_MS * ParameterWorkerImpl.MAX_RESEND_COUNT + gracePeriod, TimeUnit.MILLISECONDS)); verify(mockSender, times(1 + ParameterWorkerImpl.MAX_RESEND_COUNT)).sendPushMsg(anyString(), any(EncodedKey.class), anyObject()); }

Target:
public void testPushNetworkExceptionAndResend() throws NetworkException, InterruptedException { final CountDownLatch sendLatch = new CountDownLatch(1 + ParameterWorkerImpl.MAX_RESEND_COUNT); final long gracePeriodMs = 100; final ExecutorService pool = Executors.newSingleThreadExecutor(); doAnswer(invocationOnMock -> { sendLatch.countDown(); throw new NetworkException("exception"); }).when(mockSender).sendPushMsg(anyString(), any(EncodedKey.class), anyObject()); final int key = 0; pool.execute(() -> worker.push(key, key)); pool.shutdown(); assertTrue(sendLatch.await((ParameterWorkerImpl.RESEND_INTERVAL_MS + gracePeriodMs) * ParameterWorkerImpl.MAX_RESEND_COUNT, TimeUnit.MILLISECONDS)); END_COUNT resend). verify(mockSender, times(1 + ParameterWorkerImpl.MAX_RESEND_COUNT)).sendPushMsg(anyString(), any(EncodedKey.class), anyObject()); }
Source:
public BaseIlluminaDataProvider(final int lane, final OutputMapping outputMapping) { numReads = outputMapping.numOutputReads(); this.lane = lane; this.outputReadTypes = new ReadType[numReads]; final int[] i = {0}; outputMapping.getOutputDescriptors().forEach(rd -> outputReadTypes[i[0]++] = rd.type); }

Target:
public BaseIlluminaDataProvider(final int lane, final OutputMapping outputMapping) { numReads = outputMapping.numOutputReads(); this.lane = lane; this.outputReadTypes = StreamSupport.stream(outputMapping.getOutputDescriptors().spliterator(), false) .map(rd -> rd.type).toArray(ReadType[]::new); }
Source:
public Map<Operation, Collection<Variable>> getOperations(View view) { String viewName = view.getName(); if (viewOperations.containsKey(viewName)) { Map<Operation, Collection<Variable>> operations = viewOperations.get(viewName); if (operations != null && operations.size() > 0) return operations; } return null; }

Target:
public Map<Operation, Collection<Variable>> getOperations(View view) { String viewName = view.getName(); if (viewOperations.containsKey(viewName)) { return viewOperations.get(viewName); } throw new NoSuchViewException(view.getName()); }
Source:
private static Thread slowScan(final Connector c, final String tableName, final AtomicBoolean stop) { Thread thread = new Thread() { @Override public void run() { try { while (stop.get() == false) { Scanner s = c.createScanner(tableName, Authorizations.EMPTY); IteratorSetting is = new IteratorSetting(50, SlowIterator.class); SlowIterator.setSleepTime(is, 10); s.addScanIterator(is); Iterator<Entry<Key,Value>> iterator = s.iterator(); while (iterator.hasNext() && stop.get() == false) { iterator.next(); } s.close(); } } catch (Exception ex) { log.trace("{}", ex.getMessage(), ex); stop.set(true); } } }; return thread; }

Target:
private static Thread slowScan(final Connector c, final String tableName, final AtomicBoolean stop) { Thread thread = new Thread() { @Override public void run() { try { while (stop.get() == false) { try (Scanner s = c.createScanner(tableName, Authorizations.EMPTY)) { IteratorSetting is = new IteratorSetting(50, SlowIterator.class); SlowIterator.setSleepTime(is, 10); s.addScanIterator(is); Iterator<Entry<Key,Value>> iterator = s.iterator(); while (iterator.hasNext() && stop.get() == false) { iterator.next(); } } } } catch (Exception ex) { log.trace("{}", ex.getMessage(), ex); stop.set(true); } } }; return thread; }
Source:
public Response processRequest(String requestId, Optional<RequestAction> maybeAction) throws InterruptedException { final Optional<BaragonRequest> maybeRequest = requestDatastore.getRequest(requestId); if (!maybeRequest.isPresent()) { return Response.status(Response.Status.NOT_FOUND).entity(String.format("Request %s does not exist", requestId)).build(); } final BaragonRequest request = maybeRequest.get(); RequestAction action = maybeAction.or(request.getAction().or(RequestAction.UPDATE)); Optional<BaragonService> maybeOldService = getOldService(request); try { LOG.info(String.format("Received request to %s with id %s", action, requestId)); switch (action) { case DELETE: return delete(request, maybeOldService); case RELOAD: return reload(); case REVERT: return revert(request, maybeOldService); default: return apply(request, maybeOldService); } } catch (LockTimeoutException e) { LOG.error(String.format("Could not acquire lock before timeout for request %s", requestId), e); return Response.status(Response.Status.CONFLICT).build(); } catch (Exception e) { LOG.error(String.format("Caught exception while %sING for request %s", action, requestId), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(String.format("Caught exception while %sING for request %s: %s", action, requestId, e.getMessage())).build(); } finally { LOG.info(String.format("Done processing %s request: %s", action, requestId)); } }

Target:
public Response processRequest(String requestId, Optional<RequestAction> maybeAction) throws InterruptedException { final Optional<BaragonRequest> maybeRequest = requestDatastore.getRequest(requestId); if (!maybeRequest.isPresent()) { return Response.status(Response.Status.NOT_FOUND).entity(String.format("Request %s does not exist", requestId)).build(); } final BaragonRequest request = maybeRequest.get(); RequestAction action = maybeAction.or(request.getAction().or(RequestAction.UPDATE)); Optional<BaragonService> maybeOldService = getOldService(request); try { LOG.info(String.format("Received request to %s with id %s", action, requestId)); switch (action) { case DELETE: return delete(request, maybeOldService); case RELOAD: return reload(request); case REVERT: return revert(request, maybeOldService); default: return apply(request, maybeOldService); } } catch (LockTimeoutException e) { LOG.warn(String.format("Couldn't acquire agent lock for %s in %s ms", requestId, agentLockTimeoutMs), e); return Response.status(Response.Status.CONFLICT).entity(String.format("Couldn't acquire agent lock for %s in %s ms. Lock Info: %s", requestId, agentLockTimeoutMs, e.getLockInfo())).build(); } catch (Exception e) { LOG.error(String.format("Caught exception while %sING for request %s", action, requestId), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(String.format("Caught exception while %sING for request %s: %s", action, requestId, e.getMessage())).build(); } finally { LOG.info(String.format("Done processing %s request: %s", action, requestId)); } }
Source:
public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider arg2) throws IOException { if(value.equals(new LocalDate(0,1,1))) { gen.writeString((String)null); } else { gen.writeString(FORMATTER.print(value)); } }

Target:
public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider arg2) throws IOException { gen.writeString(FORMATTER.print(value)); }
Source:
public String getQuestionSpecificEditFormHtml() { if (qnNumber == 1) { FeedbackContributionQuestionDetails fcqd = new FeedbackContributionQuestionDetails(); return fcqd.getQuestionSpecificEditFormHtml(qnNumber); } else { FeedbackTextQuestionDetails ftq = new FeedbackTextQuestionDetails(); return ftq.getQuestionSpecificEditFormHtml(qnNumber); } }

Target:
public String getQuestionSpecificEditFormHtml() { return feedbackQuestion.getQuestionDetails().getQuestionSpecificEditFormHtml(qnNumber); }
Source:
static void validateRefreshRate(int refreshRate) { if (0 != refreshRate && (RefreshRate.MIN > refreshRate || RefreshRate.MAX < refreshRate)) { throw new IllegalArgumentException(String.format(Locale.US, "refreshRate '%d' is out of range.", refreshRate)); } }

Target:
static void validateRefreshRate(int refreshRate) { if (RefreshRate.NO_CACHING != refreshRate && (RefreshRate.MIN > refreshRate || RefreshRate.MAX < refreshRate)) { throw new IllegalArgumentException(String.format(Locale.US, "refreshRate '%d' is out of range.", refreshRate)); } }
Source:
@Override public void clear() { super.clear(); for (RelOptRule rule : ImmutableList.copyOf(mapDescToRule.values())) { removeRule(rule); } this.classOperands.clear(); this.allSets.clear(); this.mapDigestToRel.clear(); this.mapRel2Subset.clear(); this.relImportances.clear(); this.ruleQueue.clear(); this.materializations.clear(); this.latticeByName.clear(); this.provenanceMap.clear(); }

Target:
@Override public void clear() { super.clear(); for (RelOptRule rule : getRules()) { removeRule(rule); } this.classOperands.clear(); this.allSets.clear(); this.mapDigestToRel.clear(); this.mapRel2Subset.clear(); this.prunedNodes.clear(); this.ruleQueue.clear(); this.materializations.clear(); this.latticeByName.clear(); this.provenanceMap.clear(); }
Source:
public final Serializable getId() { if ( id instanceof DelayedPostInsertIdentifier ) { final Serializable eeId = session.getPersistenceContext().getEntry( instance ).getId(); return eeId instanceof DelayedPostInsertIdentifier ? null : eeId; } return id; }

Target:
public final Serializable getId() { if ( id instanceof DelayedPostInsertIdentifier ) { final EntityEntry entry = session.getPersistenceContext().getEntry( instance ); final Serializable eeId = entry == null ? null : entry.getId(); return eeId instanceof DelayedPostInsertIdentifier ? null : eeId; } return id; }
Source:
public static <A> UniConstraintCollector<A, ?, Integer> sum(ToIntFunction<? super A> groupValueMapping) { return new DefaultUniConstraintCollector<>( () -> new int[1], (resultContainer, a) -> { int value = groupValueMapping.applyAsInt(a); if (value == 0) { return NOOP; } resultContainer[0] += value; return (() -> resultContainer[0] -= value); }, resultContainer -> resultContainer[0]); }

Target:
public static <A> UniConstraintCollector<A, ?, Integer> sum(ToIntFunction<? super A> groupValueMapping) { return new DefaultUniConstraintCollector<>( () -> new int[1], (resultContainer, a) -> { int value = groupValueMapping.applyAsInt(a); resultContainer[0] += value; return (() -> resultContainer[0] -= value); }, resultContainer -> resultContainer[0]); }
Source:
public void setEyeHeight(Float eyeHeight) { this.eyeHeight = eyeHeight; }

Target:
public void setEyeHeight(Float eyeHeight) { if (eyeHeight< this.height) this.eyeHeight = eyeHeight; }
Source:
public Boolean isFileSizeValid() { return getComponentModel().validFileSize; }

Target:
public boolean isFileSizeValid() { return getComponentModel().validFileSize; }
Source:
private void revokeToken(final OAuth20RefreshToken token) { LOGGER.debug("Revoking token [{}]", token); getOAuthConfigurationContext().getTicketRegistry().deleteTicket(token); token.getAccessTokens().forEach(item-> { LOGGER.debug("Revoking Access Token related to Refresh Token [{}]", item, token); getOAuthConfigurationContext().getTicketRegistry().deleteTicket(item); }); }

Target:
private void revokeToken(final OAuth20RefreshToken token) { revokeToken(token.getId()); token.getAccessTokens().forEach(item-> { revokeToken(item); }); }
Source:
public static OVirtNodeInfo[] get() { final String delimiter = ":"; final String[] path = Config.resolveOVirtISOsRepositoryPath().split(delimiter); final String minimumVersion[] = Config.<String> GetValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); final String regex[] = Config.<String> GetValue(ConfigValues.OvirtIsoPrefix).split(delimiter); List<OVirtNodeInfo> info = new LinkedList<OVirtNodeInfo>(); log.debugFormat("NodeInfo: regex length {0} minimum length {1} path length {2}", regex.length, minimumVersion.length, path.length); if (regex.length != minimumVersion.length || regex.length != path.length) { throw new IllegalArgumentException("Illegal NodeInfo - length"); } for (int i=0; i < regex.length; i++) { log.debugFormat("NodeInfo: regex {0} path {1}, minimumVersion {2}", regex[i], path[i], minimumVersion[i]); info.add(new OVirtNodeInfo(Pattern.compile(regex[i]), new File(path[i]), minimumVersion[i])); } return info.toArray(new OVirtNodeInfo[info.size()]); }

Target:
public static List<OVirtNodeInfo> get() { final String delimiter = ":"; final String[] path = Config.resolveOVirtISOsRepositoryPath().split(delimiter); final String minimumVersion[] = Config.<String> GetValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); final String regex[] = Config.<String> GetValue(ConfigValues.OvirtIsoPrefix).split(delimiter); List<OVirtNodeInfo> info = new LinkedList<OVirtNodeInfo>(); log.debugFormat("NodeInfo: regex length {0} minimum length {1} path length {2}", regex.length, minimumVersion.length, path.length); if (regex.length != minimumVersion.length || regex.length != path.length) { throw new IllegalArgumentException("Illegal NodeInfo - length"); } for (int i=0; i < regex.length; i++) { log.debugFormat("NodeInfo: regex {0} path {1}, minimumVersion {2}", regex[i], path[i], minimumVersion[i]); info.add(new OVirtNodeInfo(Pattern.compile(regex[i]), new File(path[i]), minimumVersion[i])); } return info; }
Source:
KieAssetsDropdownItem asKieAsset(final DMNIncludeModel dmnIncludeModel) { final String text = dmnIncludeModel.getModelName(); final String value = dmnIncludeModel.getNamespace(); final Map<String, String> metaData = new HashMap<String, String>() {{ put(PATH_METADATA, dmnIncludeModel.getPath()); put(SUBTEXT_METADATA, dmnIncludeModel.getModelPackage()); }}; return new KieAssetsDropdownItem(text, value, metaData); }

Target:
KieAssetsDropdownItem asKieAsset(final DMNIncludeModel dmnIncludeModel) { final String text = dmnIncludeModel.getModelName(); final String subText = dmnIncludeModel.getModelPackage(); final String value = dmnIncludeModel.getNamespace(); final Map<String, String> metaData = buildMetaData(dmnIncludeModel); return new KieAssetsDropdownItem(text, subText, value, metaData); }
Source:
public boolean unRegister(String name) { if (asyncHttpClientMap.remove(name) == null) return false; else return true; }

Target:
public boolean unRegister(String name) { return asyncHttpClientMap.remove(name) != null; }
Source:
public static int getTypeId(String type) { return ID_MAP.get(type); }

Target:
public static int getTypeId(String type) { return ID_MAP.getOrDefault(type, -1); }
Source:
public void addMetadata(Map<String, String> metadata) { if (null != metadata) { metadata.forEach((k, v) -> { Element metadataElement = new Element("metadata"); metadataElement.setAttribute("id", k.trim()); if (null != v) { metadataElement.setText(v.trim()); } else { metadataElement.setText(""); } this._root.getChild(TAG_METADATA).addContent(metadataElement); }); } }

Target:
public void addMetadata(Map<String, String> metadata) { if (null != metadata) { metadata.forEach((k, v) -> { Element metadataElement = new Element("metadata"); metadataElement.setAttribute("id", k.trim()); metadataElement.setText(v.trim()); this._root.getChild(TAG_METADATA).addContent(metadataElement); }); } }
Source:
protected List<? extends Message> dispatchCommand(CommandEnvelope command) { idempotencyGuard.ensureIdempotence(command); final CommandHandlerMethod method = thisClass().getHandler(command.getMessageClass()); final List<? extends Message> result = method.invoke(this, command.getMessage(), command.getCommandContext()); return result; }

Target:
protected List<? extends Message> dispatchCommand(CommandEnvelope command) { idempotencyGuard.check(command); final CommandHandlerMethod method = thisClass().getHandler(command.getMessageClass()); final List<? extends Message> messages = method.invoke(this, command.getMessage(), command.getCommandContext()); return from(messages).filter(nonEmpty()).toList(); }
Source:
public boolean visit(@Nonnull JMethodCall call) { Collection<JMethod> targets = call.getMethodId().getMethods(); if (targets.size() != 1) { return false; } JMethod target = targets.iterator().next(); if (target.isAbstract() || target.isNative()) { return false; } boolean foundForceInline = false; for (JAnnotation annotation : target.getAnnotations()) { if (annotation.getType().getName().endsWith("ForceInline")) { foundForceInline = true; } } if (!foundForceInline) { return false; } call.addMarker(new InlineMarker(target)); return false; }

Target:
public boolean visit(@Nonnull JMethodCall call) { Collection<JMethod> targets = call.getMethodId().getMethods(); if (targets.size() != 1) { return false; } JMethod target = targets.iterator().next(); if (target.isAbstract() || target.isNative()) { return false; } boolean foundForceInline = false; for (JAnnotation annotation : target.getAnnotations()) { if (BinarySignatureFormatter.getFormatter() .getName(annotation.getType()) .equals(NamingTools.getTypeSignatureName(ForceInline.class.getName()))) { foundForceInline = true; } } if (!foundForceInline) { return false; } call.addMarker(new InlineMarker(target)); return false; }
Source:
public void setDefaultParseFilter(ParseFilter filter) { log.debug("Loading parse filter: " + filter.getClass().getSimpleName()); defaultParseFilter = filter; }

Target:
protected void setDefaultParseFilter(ParseFilter filter) { log.debug("Setting Default filter: " + filter.getClass().getSimpleName()); defaultParseFilter = filter; }
Source:
public void uncaughtException(Thread t, Throwable e) { client.autoNotify(e); if(originalHandler != null) { originalHandler.uncaughtException(t, e); } }

Target:
public void uncaughtException(Thread t, Throwable e) { client.autoNotify(e); if(originalHandler != null) { originalHandler.uncaughtException(t, e); } else { System.err.printf("Exception in thread \"%s\" ", t.getName()); e.printStackTrace(System.err); } }
Source:
void onSaveProfileClicked() { Timber.v("Attempting to save profile"); String firstName = firstNameEditText.getText().toString(); String lastName = lastNameEditText.getText().toString(); String email = emailEditText.getText().toString(); UserSpec spec = new UserSpec(); User user = new User(); user.getData().attributes().firstName(firstName); user.getData().attributes().lastName(lastName); user.getData().attributes().email(email); spec.create(new CreateUserRequest()); spec.update(user); userRepo.update(spec) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnCompleted( new Action0() { @Override public void call() { Timber.v("Profile saved"); ProfileEditView view = getView(); if (view != null) { ToastService.get(view).bern(view.getContext().getString(R.string.profile_saved)); Flow.get(view.getContext()).set(new HomeScreen()); } else { Timber.w("getView() null, cannot notify user of successful profile save"); } } } ) .doOnError( new Action1<Throwable>() { @Override public void call(Throwable throwable) { Timber.e(throwable, "Unable to save profile"); Bugsnag.notify(throwable); ProfileEditView view = getView(); if (view != null) { ToastService.get(view).bern(view.getContext().getString(R.string.error_saving_profile)); } else { Timber.w("getView() null, cannot notify user of failed profile save"); } } } ) .subscribe(); }

Target:
void onSaveProfileClicked() { Timber.v("Attempting to save profile"); String firstName = firstNameEditText.getText().toString(); String lastName = lastNameEditText.getText().toString(); String email = emailEditText.getText().toString(); UserSpec spec = new UserSpec(); User user = new User(); user.getData().attributes().firstName(firstName); user.getData().attributes().lastName(lastName); user.getData().attributes().email(email); spec.create(new CreateUserRequest()); spec.update(user); userRepo.update(spec) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnCompleted( new Action0() { @Override public void call() { Timber.v("Profile saved"); ProfileEditView view = getView(); if (view != null) { ToastService.get(view).bern(view.getContext().getString(R.string.profile_saved)); Flow.get(view.getContext()).set(new HomeScreen()); } else { Timber.w("getView() null, cannot notify user of successful profile save"); } } } ) .doOnError( new Action1<Throwable>() { @Override public void call(Throwable throwable) { Timber.e(throwable, "Unable to save profile"); Crashlytics.logException(throwable); ProfileEditView view = getView(); if (view != null) { ToastService.get(view).bern(view.getContext().getString(R.string.error_saving_profile)); } else { Timber.w("getView() null, cannot notify user of failed profile save"); } } } ) .subscribe(); }
Source:
public DaoManager() { super(); InvisibleForUsersRule invisible = new InvisibleForUsersRule(new LoggedUser(null, null)); this.randomizer = new Random(); this.session = null; this.questionDao = new QuestionDAO(session, invisible); this.answerDao = new AnswerDAO(session, invisible); this.userDao = new UserDAO(session); this.tagDao = new TagDAO(session); this.loginMethodDao = new LoginMethodDAO(session); }

Target:
public DaoManager() { super(); InvisibleForUsersRule invisible = new InvisibleForUsersRule(new LoggedUser(null, null)); this.randomizer = new Random(); this.session = new ScriptSessionProvider().getInstance(); this.questionDao = new QuestionDAO(session, invisible); this.answerDao = new AnswerDAO(session, invisible); this.userDao = new UserDAO(session); this.tagDao = new TagDAO(session); this.loginMethodDao = new LoginMethodDAO(session); }
Source:
public Range setCell(final int rowIndex, final int columnIndex, final Supplier<GridCell<?>> cellSupplier) { return doSetCell(rowIndex, columnIndex, (p) -> cellSupplier.get()); }

Target:
public Range setCell(final int rowIndex, final int columnIndex, final Supplier<GridCell<?>> cellSupplier) { return doSetCell(rowIndex, columnIndex, (pair) -> cellSupplier.get()); }
Source:
protected void handleChanges(Collection<Change> changes) throws InterruptedException { Set<Change> trueChanges; try (Context ctx = rdfRepositoryFetchTime.time()) { trueChanges = getRevisionUpdates(changes); } noopedChangesByRevisionCheck.inc(changes.size() - trueChanges.size()); List<Change> processedChanges; try (Context ctx = wikibaseDataFetchTime.time()) { List<Future<Change>> futureChanges = new ArrayList<>(); for (Change change : trueChanges) { futureChanges.add(executor.submit(() -> { while (true) { try { handleChange(change); return change; } catch (RetryableException e) { log.warn("Retryable error syncing. Retrying.", e); } catch (ContainedException e) { log.warn("Contained error syncing. Giving up on {}", change.entityId(), e); throw e; } } })); } processedChanges = new ArrayList<>(futureChanges.size()); for (Future<Change> f : futureChanges) { try { processedChanges.add(f.get()); } catch (ExecutionException ignore) { } } } int nbTriples; try (Context ctx = rdfRepositoryImportTime.time()) { nbTriples = rdfRepository.syncFromChanges(processedChanges, verify); } updatesMeter.mark(processedChanges.size()); importedChanged.inc(processedChanges.size()); importedTriples.inc(nbTriples); }

Target:
protected void handleChanges(Collection<Change> changes) throws InterruptedException { final Set<Change> trueChanges = rdfRepositoryFetchTime.time(() -> getRevisionUpdates(changes)); noopedChangesByRevisionCheck.inc(changes.size() - trueChanges.size()); List<Change> processedChanges = wikibaseDataFetchTime .timeCheckedCallable(() -> fetchDataFromWikibaseAndMunge(trueChanges)); int nbTriples = rdfRepositoryImportTime.time(() -> rdfRepository.syncFromChanges(processedChanges, verify)); updatesMeter.mark(processedChanges.size()); importedChanged.inc(processedChanges.size()); importedTriples.inc(nbTriples); }
Source:
private MetricNames workerMetricName(String name, String stormId, String componentId, Integer taskId, Integer workerPort) { StringBuilder sb = new StringBuilder(WORKER_METRIC_PREFIX); sb.append(stormId); sb.append("."); sb.append(hostName); sb.append("."); sb.append(dotToUnderScore(componentId)); sb.append("."); sb.append(taskId); sb.append("."); sb.append(workerPort); sb.append("-"); sb.append(name); String longName = sb.toString(); String shortName = WORKER_METRIC_PREFIX + name; MetricNames names = new MetricNames(longName, shortName); return names; }

Target:
private MetricNames workerMetricName(String name, String stormId, String componentId, Integer taskId, Integer workerPort) { StringBuilder sb = new StringBuilder(WORKER_METRIC_PREFIX); sb.append(stormId); sb.append("."); sb.append(hostName); sb.append("."); sb.append(dotToUnderScore(componentId)); sb.append("."); sb.append(taskId); sb.append("."); sb.append(workerPort); sb.append("-"); sb.append(name); String longName = sb.toString(); MetricNames names = new MetricNames(longName, name); return names; }
Source:
protected static double averageMetricOverOperations(ASTClassOrInterfaceDeclaration node, OperationMetricKey key, MetricVersion version, boolean includeNested) { List<ASTMethodOrConstructorDeclaration> operations = findOperations(node, includeNested); double total = 0; for (ASTMethodOrConstructorDeclaration op : operations) { double val = Metrics.get(key, op, version); total += val == Double.NaN ? 1 : val; } return total / operations.size(); }

Target:
protected static double averageMetricOverOperations(ASTClassOrInterfaceDeclaration node, OperationMetricKey key, MetricVersion version, boolean includeNested) { List<ASTMethodOrConstructorDeclaration> operations = findOperations(node, includeNested); double total = 0; for (ASTMethodOrConstructorDeclaration op : operations) { double val = Metrics.get(key, op, version); total += val == Double.NaN ? 0 : val; } return total / operations.size(); }
Source:
private Collection<UfsStatus> getChildrenIfAbsent(AlluxioURI path, MountTable mountTable) throws InvalidPathException { Collection<UfsStatus> children = getChildren(path); if (children != null) { return children; } MountTable.Resolution resolution = mountTable.resolve(path); AlluxioURI ufsUri = resolution.getUri(); try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) { UnderFileSystem ufs = ufsResource.get(); UfsStatus[] statuses = ufs.listStatus(ufsUri.toString()); if (statuses == null) { return null; } children = Arrays.asList(statuses); addChildren(path, children); } catch (IllegalArgumentException | IOException e) { LOG.debug("Failed to add status to cache", e); } return children; }

Target:
Collection<UfsStatus> getChildrenIfAbsent(AlluxioURI path, MountTable mountTable) throws InvalidPathException { Collection<UfsStatus> children = getChildren(path); if (children != null) { return children; } MountTable.Resolution resolution = mountTable.resolve(path); AlluxioURI ufsUri = resolution.getUri(); try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) { UnderFileSystem ufs = ufsResource.get(); UfsStatus[] statuses = ufs.listStatus(ufsUri.toString()); if (statuses == null) { return null; } children = Arrays.asList(statuses); addChildren(path, children); } catch (IllegalArgumentException | IOException e) { LOG.debug("Failed to add status to cache {}", path, e); } return children; }
Source:
public void changeSchedulerVer(Integer ver) throws ConfirmModSchemaException { if (ver == schedVer()) { return; } if (!fSupportedSchedulerVersions.contains(ver)) { throw new RuntimeException("Unsupported scheduler version"); } modSchema(true); SchedV2 v2Sched = new SchedV2(this); clearUndo() if (ver == 1) { v2Sched.moveToV1(); } else { v2Sched.moveToV2(); } try { mConf.put("schedVer", ver); } catch (JSONException e) { throw new RuntimeException(e); } setMod(); _loadScheduler(); }

Target:
public void changeSchedulerVer(Integer ver) throws ConfirmModSchemaException { if (ver == schedVer()) { return; } if (!fSupportedSchedulerVersions.contains(ver)) { throw new RuntimeException("Unsupported scheduler version"); } modSchema(true); SchedV2 v2Sched = new SchedV2(this); clearUndo(); if (ver == 1) { v2Sched.moveToV1(); } else { v2Sched.moveToV2(); } try { mConf.put("schedVer", ver); } catch (JSONException e) { throw new RuntimeException(e); } setMod(); _loadScheduler(); }
Source:
public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.bucketName = args.getBucket(); this.priority = args.getPriority(); this.objectName = args.getObjectName(); this.prefix = args.getDirectory(); if (this.prefix == null) { this.prefix = "."; } this.discard = args.isDiscard(); if (this.discard && !Guard.isStringNullOrEmpty(args.getDirectory())) { throw new CommandException("Cannot set both " + DIRECTORY.getOpt() + " and " + DISCARD.getLongOpt()); } if (this.discard) { LOG.warn("Using /dev/null getter -- all incoming data will be discarded"); } if (args.isSync()) { LOG.info("Using sync command"); this.sync = true; } this.numberOfThreads = args.getNumberOfThreads(); if (!Guard.isStringNullOrEmpty(args.getRangeLength()) || !Guard.isStringNullOrEmpty(args.getRangeOffset())) { if (Guard.isStringNullOrEmpty(args.getRangeLength()) || Guard.isStringNullOrEmpty(args.getRangeOffset())) { throw new MissingOptionException("Partial recovery must provide values for both " + RANGE_OFFSET.getLongOpt() + " and " + RANGE_LENGTH.getLongOpt()); } else { this.rangeOffset = Long.parseLong(args.getOptionValue(RANGE_OFFSET.getLongOpt())); this.rangeLength = Long.parseLong(args.getOptionValue(RANGE_LENGTH.getLongOpt())); } } return this; }

Target:
public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.bucketName = args.getBucket(); this.priority = args.getPriority(); this.objectName = args.getObjectName(); this.prefix = args.getDirectory(); if (this.prefix == null) { this.prefix = "."; } this.discard = args.isDiscard(); if (this.discard && !Guard.isStringNullOrEmpty(args.getDirectory())) { throw new CommandException("Cannot set both " + DIRECTORY.getOpt() + " and " + DISCARD.getLongOpt()); } if (this.discard) { LOG.warn("Discard flag set -- all incoming data will be discarded"); } if (args.isSync()) { LOG.info("Using sync command"); this.sync = true; } this.numberOfThreads = args.getNumberOfThreads(); if (!Guard.isStringNullOrEmpty(args.getRangeLength()) || !Guard.isStringNullOrEmpty(args.getRangeOffset())) { if (Guard.isStringNullOrEmpty(args.getRangeLength()) || Guard.isStringNullOrEmpty(args.getRangeOffset())) { throw new MissingOptionException("Partial recovery must provide values for both " + RANGE_OFFSET.getLongOpt() + " and " + RANGE_LENGTH.getLongOpt()); } else { this.rangeOffset = Long.parseLong(args.getOptionValue(RANGE_OFFSET.getLongOpt())); this.rangeLength = Long.parseLong(args.getOptionValue(RANGE_LENGTH.getLongOpt())); } } return this; }
Source:
public HAProxyMessage retain() { if (leak != null) { leak.record(); } return (HAProxyMessage) super.retain(); }

Target:
public HAProxyMessage retain() { tryRecord(); return (HAProxyMessage) super.retain(); }
Source:
public CompletableFuture<Boolean> closeTransaction(PublicKeyHash owner, TransactionId tid) { if (! isPeergosServer) return CompletableFuture.completedFuture(true); return poster.get(apiPrefix + "transaction/close?arg=" + tid.toString() + "&owner=" + encode(owner.toString())) .thenApply(raw -> new String(raw).equals("1")); }

Target:
public CompletableFuture<Boolean> closeTransaction(PublicKeyHash owner, TransactionId tid) { if (! isPeergosServer) return CompletableFuture.completedFuture(true); return poster.get(apiPrefix + TRANSACTION_CLOSE + "?arg=" + tid.toString() + "&owner=" + encode(owner.toString())) .thenApply(raw -> new String(raw).equals("1")); }
Source:
public void onManagementStarting() { super.onManagementStarting(); getBrokerName(); Preconditions.checkNotNull(brokerName, "ActiveMQ broker name must be specified"); try { brokerMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName); jmxHelper = new JmxHelper((EntityLocal) getParent()); } catch (MalformedObjectNameException e) { throw Exceptions.propagate(e); } }

Target:
public void onManagementStarting() { super.onManagementStarting(); String brokerName = getBrokerName(); Preconditions.checkArgument(brokerName != null && !brokerName.isEmpty(), "ActiveMQ brokerName attribute must be specified"); try { brokerMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName); jmxHelper = new JmxHelper((EntityLocal) getParent()); } catch (MalformedObjectNameException e) { throw Exceptions.propagate(e); } }
Source:
public void emitTuples() { if (!readThread.isAlive() && threadFailed) { throw new RuntimeException("Exception in scan thread"); } try { Result result = resultQueue.poll(); if (result == null) { return; } T tuple = getTuple(result); if (tuple != null) { outputPort.emit(tuple); tuplesRead++; } } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public void emitTuples() { if (!readThread.isAlive()) { throw new RuntimeException(threadFailureReason); } try { Result result = resultQueue.poll(); if (result == null) { return; } T tuple = getTuple(result); if (tuple != null) { emitTuple(tuple); tuplesRead++; } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public SessionInfo getSessionInfo(String sessionId) throws Exception { SessionInfo sessionInfo = sessions.get(sessionId); if (sessionInfo == null) { LOGGER.warn("No such session: " + sessionId); return null; } InterpreterGroup interpreterGroup = this.interpreterSettingManager.getInterpreterGroupById(sessionId); if (interpreterGroup != null) { RemoteInterpreterProcess remoteInterpreterProcess = ((ManagedInterpreterGroup) interpreterGroup).getRemoteInterpreterProcess(); if (remoteInterpreterProcess == null) { sessionInfo.setState(SessionState.READY.name()); } else if (remoteInterpreterProcess != null) { sessionInfo.setStartTime(remoteInterpreterProcess.getStartTime()); sessionInfo.setWeburl(interpreterGroup.getWebUrl()); if (remoteInterpreterProcess.isRunning()) { sessionInfo.setState(SessionState.RUNNING.name()); } else { if (sessionInfo.getState() != null && sessionInfo.getState().equals(SessionState.RUNNING.name())) { sessionInfo.setState(SessionState.STOPPED.name()); } } } } else { if (sessionInfo.getState().equals(SessionState.RUNNING.name())) { sessionInfo.setState(SessionState.STOPPED.name()); } } return sessionInfo; }

Target:
public SessionInfo getSessionInfo(String sessionId) throws Exception { SessionInfo sessionInfo = sessions.get(sessionId); if (sessionInfo == null) { LOGGER.warn("No such session: " + sessionId); return null; } InterpreterGroup interpreterGroup = this.interpreterSettingManager.getInterpreterGroupById(sessionId); if (interpreterGroup != null) { RemoteInterpreterProcess remoteInterpreterProcess = ((ManagedInterpreterGroup) interpreterGroup).getRemoteInterpreterProcess(); if (remoteInterpreterProcess == null) { sessionInfo.setState(SessionState.READY.name()); } else if (remoteInterpreterProcess != null) { sessionInfo.setStartTime(remoteInterpreterProcess.getStartTime()); sessionInfo.setWeburl(interpreterGroup.getWebUrl()); if (remoteInterpreterProcess.isRunning()) { sessionInfo.setState(SessionState.RUNNING.name()); } else { if (SessionState.RUNNING.name().equalsIgnoreCase(sessionInfo.getState())) { sessionInfo.setState(SessionState.STOPPED.name()); } } } } else { if (SessionState.RUNNING.name().equalsIgnoreCase(sessionInfo.getState())) { sessionInfo.setState(SessionState.STOPPED.name()); } } return sessionInfo; }
Source:
private void releaseNetworkResourcesOnExpunge(long id) throws ConcurrentOperationException, ResourceUnavailableException { final VMInstanceVO vmInstance = _vmDao.findById(id); final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vmInstance); _networkMgr.release(profile, false); }

Target:
private void releaseNetworkResourcesOnExpunge(long id) throws ConcurrentOperationException, ResourceUnavailableException { final VMInstanceVO vmInstance = _vmDao.findById(id); if (vmInstance != null){ final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vmInstance); _networkMgr.release(profile, false); } else { s_logger.error("Couldn't find vm with id = " + id + ", unable to release network resources"); } }
Source:
private Function<Cursor, Result<TopNResultValue>> getMapFn(TopNQuery query, final StorageAdapter adapter) { final Capabilities capabilities = adapter.getCapabilities(); final String dimension = query.getDimensionSpec().getDimension(); final int cardinality; if (dimension.equals(Column.TIME_COLUMN_NAME)) { cardinality = Integer.MAX_VALUE; } else { cardinality = adapter.getDimensionCardinality(dimension); } int numBytesPerRecord = 0; for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { numBytesPerRecord += aggregatorFactory.getMaxIntermediateSize(); } final TopNAlgorithmSelector selector = new TopNAlgorithmSelector(cardinality, numBytesPerRecord); query.initTopNAlgorithmSelector(selector); final TopNAlgorithm topNAlgorithm; if (selector.isHasExtractionFn() && dimension.equals(Column.TIME_COLUMN_NAME)) { topNAlgorithm = new TimeExtractionTopNAlgorithm(capabilities, query); } else if(selector.isHasExtractionFn()) { topNAlgorithm = new DimExtractionTopNAlgorithm(capabilities, query); } else if (selector.isAggregateAllMetrics()) { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else if (selector.isAggregateTopNMetricFirst() || query.getContextValue("doAggregateTopNMetricFirst", false)) { topNAlgorithm = new AggregateTopNMetricFirstAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } return new TopNMapFn(query, topNAlgorithm); }

Target:
private Function<Cursor, Result<TopNResultValue>> getMapFn(TopNQuery query, final StorageAdapter adapter) { final Capabilities capabilities = adapter.getCapabilities(); final String dimension = query.getDimensionSpec().getDimension(); final int cardinality = adapter.getDimensionCardinality(dimension); int numBytesPerRecord = 0; for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { numBytesPerRecord += aggregatorFactory.getMaxIntermediateSize(); } final TopNAlgorithmSelector selector = new TopNAlgorithmSelector(cardinality, numBytesPerRecord); query.initTopNAlgorithmSelector(selector); final TopNAlgorithm topNAlgorithm; if ( selector.isHasExtractionFn() && dimension.equals(Column.TIME_COLUMN_NAME) ) { topNAlgorithm = new TimeExtractionTopNAlgorithm(capabilities, query); } else if(selector.isHasExtractionFn()) { topNAlgorithm = new DimExtractionTopNAlgorithm(capabilities, query); } else if (selector.isAggregateAllMetrics()) { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else if (selector.isAggregateTopNMetricFirst() || query.getContextValue("doAggregateTopNMetricFirst", false)) { topNAlgorithm = new AggregateTopNMetricFirstAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } return new TopNMapFn(query, topNAlgorithm); }
Source:
public void onOpenTxn(OpenTxnEvent openTxnEvent) throws MetaException { int totalTxns = openTxnEvent.getTxnIds().size() - 1; OpenTxnMessage msg = msgFactory.buildOpenTxnMessage(openTxnEvent.getTxnIds().get(0), openTxnEvent.getTxnIds().get(totalTxns)); NotificationEvent event = new NotificationEvent(0, now(), EventType.OPEN_TXN.toString(), msg.toString()); try { addNotificationLog(event, openTxnEvent); } catch (SQLException e) { throw new MetaException("Unable to execute direct SQL " + StringUtils.stringifyException(e)); } }

Target:
public void onOpenTxn(OpenTxnEvent openTxnEvent) throws MetaException { int lastTxnIdx = openTxnEvent.getTxnIds().size() - 1; OpenTxnMessage msg = msgFactory.buildOpenTxnMessage(openTxnEvent.getTxnIds().get(0), openTxnEvent.getTxnIds().get(lastTxnIdx)); NotificationEvent event = new NotificationEvent(0, now(), EventType.OPEN_TXN.toString(), msg.toString()); try { addNotificationLog(event, openTxnEvent); } catch (SQLException e) { throw new MetaException("Unable to execute direct SQL " + StringUtils.stringifyException(e)); } }
Source:
public List<String> getJobsForAnExtension(final String extensionName) throws FalconException { List<ExtensionJobsBean> extensionJobs = metaStore.getJobsForAnExtension(extensionName); if (null != extensionJobs && !extensionJobs.isEmpty()){ List<String> extensionJobNames = new ArrayList<>(); for (ExtensionJobsBean extensionJobsBean: extensionJobs) { extensionJobNames.add(extensionJobsBean.getJobName()); } return extensionJobNames; } else { return null; } }

Target:
public List<String> getJobsForAnExtension(final String extensionName) throws FalconException { List<ExtensionJobsBean> extensionJobs = metaStore.getJobsForAnExtension(extensionName); List<String> extensionJobNames = new ArrayList<>(); if (null != extensionJobs && !extensionJobs.isEmpty()) { for (ExtensionJobsBean extensionJobsBean : extensionJobs) { extensionJobNames.add(extensionJobsBean.getJobName()); } } return extensionJobNames; }
Source:
private void estimateVoterMatchStrengths(AffOrgMatcher affOrgMatcher, String affOrgMatcherName, List<AffOrgMatchVoter> voters) throws IOException { printMatcherHeader(affOrgMatcherName); affMatchingService.setAffOrgMatchers(of(affOrgMatcher)); AffOrgMatchComputer affOrgMatchComputer = new AffOrgMatchComputer(); for (AffOrgMatchVoter voter : voters) { printVoterHeader(voter); affOrgMatchComputer.setAffOrgMatchVoters(Lists.newArrayList(voter)); affOrgMatcher.setAffOrgMatchComputer(affOrgMatchComputer); affMatchingService.matchAffiliations(sparkContext, inputAffDirPath, inputOrgDirPath, outputDirPath); calcAndPrintResult(of("src/test/resources/experimentalData/expectedOutput/set1/matched_aff.json", "src/test/resources/experimentalData/expectedOutput/set2/matched_aff.json", "src/test/resources/experimentalData/expectedOutput/set4/matched_aff.json")); FileUtils.deleteDirectory(new File(outputDirPath)); } out.println("\n\n"); }

Target:
private void estimateVoterMatchStrengths(AffOrgMatcher affOrgMatcher, String affOrgMatcherName, List<AffOrgMatchVoter> voters) throws IOException { printMatcherHeader(affOrgMatcherName); affMatchingService.setAffOrgMatchers(ImmutableList.of(affOrgMatcher)); AffOrgMatchComputer affOrgMatchComputer = new AffOrgMatchComputer(); for (AffOrgMatchVoter voter : voters) { printVoterHeader(voter); affOrgMatchComputer.setAffOrgMatchVoters(Lists.newArrayList(voter)); affOrgMatcher.setAffOrgMatchComputer(affOrgMatchComputer); affMatchingService.matchAffiliations(sparkContext, inputAffDirPath, inputOrgDirPath, outputDirPath); calcAndPrintResult(ImmutableList.of( "src/test/resources/experimentalData/expectedOutput/set1/matched_aff.json", "src/test/resources/experimentalData/expectedOutput/set2/matched_aff.json", "src/test/resources/experimentalData/expectedOutput/set4/matched_aff.json")); FileUtils.deleteDirectory(new File(outputDirPath)); } out.println("\n\n"); }
Source:
public List<Kind> nodesToVisit() { return ImmutableList.of(Kind.EQUAL_TO, Kind.NOT_EQUAL_TO); }

Target:
public List<Kind> nodesToVisit() { return Lists.newArrayList(EQUALITY_KINDS); }
Source:
public String toString() { return "KubernetesCloud name:" + name +" serverUrl:" + serverUrl; }

Target:
public String toString() { return String.format("KubernetesCloud name: %n serverUrl: %n", name, serverUrl); }
Source:
public static Set<PoolOrderDto> asPoolOrderDtos(Collection<PoolOrder> from) { Set<PoolOrderDto> dtoSet = Sets.newHashSet(); for (PoolOrder kd : from) { dtoSet.add(asDto(kd)); } return dtoSet; }

Target:
public static Set<PoolOrderDto> asPoolOrderDtos(Collection<PoolOrder> from) { Set<PoolOrderDto> dtoSet = Sets.newHashSet(); for (PoolOrder po : from) { dtoSet.add(asDto(po)); } return dtoSet; }