auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Array<T> dropRightUntil(Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); <START> for (int i = length() - 1; i >= 0; i--) { <END> if (predicate.test(get(i))) { return take(i + 1); } } return empty(); }</code><technical_language>yes, great! remove Objects.requireNonNull checks of drop*Until drop*While then. is sufficient checks Collections: java @SuppressWarnings("unchecked") static <T, S extends IndexedSeq<T>> S dropUntil(S empty, S seq, Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); for (int i = 0; i < seq.length(); i++) { if (predicate.test(seq.get(i))) { return (S) seq.drop(i); } } return empty; }</technical_language>

Target:
public Array<T> dropRightUntil(Predicate<? super T> predicate) { return Collections.dropRightUntil(this, predicate); }
Source:
<code>private void drain() { synchronized (this) { if (busy) { missed = true; return; } } while (!child.isUnsubscribed()) { Notification<T> tn; tn = terminalNotification; if (tn != null) { <START> if (requested.get() > 0) { <END> terminalNotification = null; child.onNext(tn); if (!child.isUnsubscribed()) { child.onCompleted(); } return; } } synchronized (this) { if (!missed) { busy = false; return; } } } }</code><technical_language>requested reference a local variable avoid re-reading in loop get() is a load-load barrier forces subsequent field accesses happen fresh LLC, including requested reference itself</technical_language>

Target:
private void drain() { synchronized (this) { if (busy) { missed = true; return; } } final AtomicLong localRequested = this.requested; while (!child.isUnsubscribed()) { Notification<T> tn; tn = terminalNotification; if (tn != null) { if (localRequested.get() > 0) { terminalNotification = null; child.onNext(tn); if (!child.isUnsubscribed()) { child.onCompleted(); } return; } } synchronized (this) { if (!missed) { busy = false; return; } } } }
Source:
<code>public void addResponseToRecipientStats(FeedbackResponseAttributes response) { if (!response.recipient.equalsIgnoreCase(recipientEmail)) { return; } FeedbackRubricResponseDetails rubricResponse = (FeedbackRubricResponseDetails) response.getResponseDetails(); for (int i = 0; i < getNumOfRubricSubQuestions(); i++) { int choice = rubricResponse.getAnswer(i); if (choice >= 0) { ++numOfResponsesPerSubQuestionPerChoice[i][choice]; <START> totalPerSubQuestion[i] += rubricWeightsForEachCell.get(i).get(choice); <END> respondentsPerSubQuestion[i]++; } } }</code><technical_language>This method called if weights enabled? RubricRecipientStatistics if weights enabled. I need add assumption constructor</technical_language>

Target:
public void addResponseToRecipientStats(FeedbackResponseAttributes response) { if (!response.recipient.equalsIgnoreCase(recipientEmail)) { return; } FeedbackRubricResponseDetails rubricResponse = (FeedbackRubricResponseDetails) response.getResponseDetails(); for (int i = 0; i < getNumOfRubricSubQuestions(); i++) { int choice = rubricResponse.getAnswer(i); if (choice >= 0) { ++numOfResponsesPerSubQuestionPerChoice[i][choice]; totalPerSubQuestion[i] += weights.get(i).get(choice); respondentsPerSubQuestion[i]++; } } }
Source:
<code>public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { String claims = Optional.of(exception) .map(e -> (OAuth2AuthenticationException) e) .map(OAuth2AuthenticationException::getError) .map(e -> (AzureOAuthError)e) .map(AzureOAuthError ::getClaims) .orElse(null); if (claims == null) { defaultHandler.onAuthenticationFailure(request, response, exception); } else { response.setStatus(302); <START> request.getSession().setAttribute(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS,claims); <END> String redirectUrl = Optional.of(request) .map(HttpServletRequest::getSession) .map(s -> s.getAttribute(Constants.SAVED_REQUEST)) .map(r -> (DefaultSavedRequest) r) .map(DefaultSavedRequest::getRedirectUrl) .orElse(null); response.sendRedirect(redirectUrl); } }</code><technical_language>work, please: 1. Write a new java class named AzureOAuth2AuthorizationRequestResolver, AADOAuth2AuthorizationRequestResolver. 2. Update AzureOAuth2Configuration.configure(...)</technical_language>

Target:
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { String claims = Optional.of(exception) .map(e -> (OAuth2AuthenticationException) e) .map(OAuth2AuthenticationException::getError) .map(e -> (AzureOAuth2Error) e) .map(AzureOAuth2Error::getClaims) .orElse(null); if (claims == null) { defaultHandler.onAuthenticationFailure(request, response, exception); } else { response.setStatus(302); request.getSession().setAttribute(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS, claims); String redirectUrl = Optional.of(request) .map(HttpServletRequest::getSession) .map(s -> s.getAttribute(Constants.SAVED_REQUEST)) .map(r -> (DefaultSavedRequest) r) .map(DefaultSavedRequest::getRedirectUrl) .orElse(null); response.sendRedirect(redirectUrl); } }
Source:
<code>private <C> C populateProperties(String channelName, Class<C> propertiesClass, Properties defaults) { C beanInstance; try { beanInstance = propertiesClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new BeanInitializationException(e.getMessage()); } RelaxedDataBinder dataBinder = new RelaxedDataBinder(beanInstance); dataBinder.setIgnoreUnknownFields(false); dataBinder.setDisallowedFields(bindingPropertyFields); dataBinder.bind(new MutablePropertyValues(defaults)); <START> dataBinder = new RelaxedDataBinder(beanInstance, "spring.cloud.stream.bindings." + channelName); <END> dataBinder.setIgnoreUnknownFields(false); dataBinder.setDisallowedFields(bindingPropertyFields); if (applicationContext != null && applicationContext.getEnvironment() != null) { dataBinder.bind(new PropertySourcesPropertyValues(applicationContext.getEnvironment().getPropertySources())); } return beanInstance; }</code><technical_language>move this prefix spring.cloud.stream.bindings a constant? a constant for spring.cloud.stream prefix in ChannelBindingServiceProperties itself</technical_language>

Target:
private <C> C populateProperties(String channelName, Class<C> propertiesClass, Properties defaults) { C beanInstance; try { beanInstance = propertiesClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new BeanInitializationException(e.getMessage()); } RelaxedDataBinder dataBinder = new RelaxedDataBinder(beanInstance); dataBinder.setIgnoreUnknownFields(ignoreUnknownProperties); dataBinder.setDisallowedFields(bindingPropertyFields); dataBinder.bind(new MutablePropertyValues(defaults)); if (applicationContext != null && applicationContext.getEnvironment() != null) { dataBinder = new RelaxedDataBinder(beanInstance, "spring.cloud.stream.bindings." + channelName); dataBinder.setConversionService(conversionService); dataBinder.setIgnoreUnknownFields(ignoreUnknownProperties); dataBinder.setDisallowedFields(bindingPropertyFields); dataBinder.bind(new PropertySourcesPropertyValues(applicationContext.getEnvironment().getPropertySources())); } return beanInstance; }
Source:
<code>public void onComplete() { final Subscription s = this.s; final ReconnectMono<T> p = this.parent; final T value = p.value; if (s == Operators.cancelledSubscription() || !S.compareAndSet(this, s, null)) { p.doFinally(); return; } if (value == null) { <START> p.terminate(new IllegalStateException("Unexpected empty source")); <END> } else { p.complete(); } }</code><technical_language>suggestion p.terminate(new IllegalStateException("Source completed empty"));</technical_language>

Target:
public void onComplete() { final Subscription s = this.s; final ReconnectMono<T> p = this.parent; final T value = p.value; if (s == Operators.cancelledSubscription() || !S.compareAndSet(this, s, null)) { p.doFinally(); return; } if (value == null) { p.terminate(new IllegalStateException("Source completed empty")); } else { p.complete(); } }
Source:
<code><START> public ReportDocument(String targetDir, String testName, int testsSize, boolean separateClusterCharts) { <END> super(targetDir, String.format("test_%s.html", testName), "Test " + testName); this.testSize = testsSize; this.testName = testName; this.separateClusterCharts = separateClusterCharts; }</code><technical_language>'testsSize' is descriptive name, please 'maxConfigurations' (is number of configurations executed this test?)</technical_language>

Target:
public ReportDocument(String targetDir, String testName, int testsSize, boolean separateClusterCharts) { super(targetDir, String.format("test_%s.html", testName), "Test " + testName); this.testName = testName; this.testSize = testsSize; this.separateClusterCharts = separateClusterCharts; }
Source:
<code>public static JSONObject getUsageCountForMonetization(long from, long to) throws APIManagementException { JSONObject jsonObject = null; String granularity = null; APIManagerConfiguration configuration = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService() .getAPIManagerConfiguration(); granularity = configuration.getFirstProperty( APIConstants.Monetization.USAGE_PUBLISHER_GRANULARITY); if (StringUtils.isEmpty(granularity)) { granularity = APIConstants.Monetization.USAGE_PUBLISH_DEFAULT_GRANULARITY; } StringBuilder query = new StringBuilder( "from " + APIConstants.Monetization.MONETIZATION_USAGE_RECORD_AGG + " within " + from + "L, " + to + "L per '" + granularity + "' select " + APIConstants.Analytics.API_NAME + ", " + APIConstants.Analytics.API_VERSION + ", " + APIConstants.Analytics.API_CREATOR + ", " + APIConstants.Analytics.API_CREATOR_TENANT_DOMAIN + ", " + APIConstants.Analytics.APPLICATION_ID + ", " + "sum (requestCount) as requestCount " + "group by " + APIConstants.Analytics.API_NAME + ", " + APIConstants.Analytics.API_VERSION + ", " + APIConstants.Analytics.API_CREATOR + ", " + APIConstants.Analytics.API_CREATOR_TENANT_DOMAIN + ", " + APIConstants.Analytics.APPLICATION_ID ); try { jsonObject = APIUtil.executeQueryOnStreamProcessor( APIConstants.Monetization.MONETIZATION_USAGE_RECORD_APP, query.toString()); } catch (APIManagementException ex) { String msg = "Unable to Retrieve monetization usage records"; handleException(msg, ex); } <START> return jsonObject; <END> }</code><technical_language>JsonObject null</technical_language>

Target:
public static JSONObject getUsageCountForMonetization(long from, long to) throws APIManagementException { JSONObject jsonObject = null; String granularity = null; APIManagerConfiguration configuration = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService() .getAPIManagerConfiguration(); granularity = configuration.getFirstProperty( APIConstants.Monetization.USAGE_PUBLISHER_GRANULARITY); if (StringUtils.isEmpty(granularity)) { granularity = APIConstants.Monetization.USAGE_PUBLISH_DEFAULT_GRANULARITY; } StringBuilder query = new StringBuilder( "from " + APIConstants.Monetization.MONETIZATION_USAGE_RECORD_AGG + " within " + from + "L, " + to + "L per '" + granularity + "' select " + APIConstants.Analytics.API_NAME + ", " + APIConstants.Analytics.API_VERSION + ", " + APIConstants.Analytics.API_CREATOR + ", " + APIConstants.Analytics.API_CREATOR_TENANT_DOMAIN + ", " + APIConstants.Analytics.APPLICATION_ID + ", " + "sum (requestCount) as requestCount " + "group by " + APIConstants.Analytics.API_NAME + ", " + APIConstants.Analytics.API_VERSION + ", " + APIConstants.Analytics.API_CREATOR + ", " + APIConstants.Analytics.API_CREATOR_TENANT_DOMAIN + ", " + APIConstants.Analytics.APPLICATION_ID ); try { jsonObject = APIUtil.executeQueryOnStreamProcessor( APIConstants.Monetization.MONETIZATION_USAGE_RECORD_APP, query.toString()); if(jsonObject == null){ jsonObject = new JSONObject(); } } catch (APIManagementException ex) { String msg = "Unable to Retrieve monetization usage records"; handleException(msg, ex); } return jsonObject; }
Source:
<code>protected String buildEmailMessage(List<ProcurementCardSkippedTransaction> skippedTransactions) { <START> StringBuilder sb = new StringBuilder(); <END> sb.append("The ").append(bankFileType).append(" bank file had the following transactions skipped: "); sb.append(KFSConstants.NEWLINE).append(KFSConstants.NEWLINE); for (ProcurementCardSkippedTransaction skippedTransaction : skippedTransactions) { sb.append("File Line Number: ").append(skippedTransaction.getFileLineNumber()); sb.append(" Card Holder Name: ").append(skippedTransaction.getCardHolderName()); sb.append(" Transaction Amount: ").append(skippedTransaction.getTransactionAmount()); sb.append(KFSConstants.NEWLINE); } return sb.toString(); }</code><technical_language>I if create a parameter for email template. check functional if this text flexible</technical_language>

Target:
protected String buildEmailMessage(List<ProcurementCardSkippedTransaction> skippedTransactions) { StringBuilder sb = new StringBuilder(); String body = MessageFormat.format(getEmailBodyTempalte(), bankFileType); sb.append(body).append(KFSConstants.NEWLINE).append(KFSConstants.NEWLINE); for (ProcurementCardSkippedTransaction skippedTransaction : skippedTransactions) { sb.append("File Line Number: ").append(skippedTransaction.getFileLineNumber()); sb.append(" Card Holder Name: ").append(skippedTransaction.getCardHolderName()); sb.append(" Transaction Amount: ").append(skippedTransaction.getTransactionAmount()); sb.append(KFSConstants.NEWLINE); } return sb.toString(); }
Source:
<code>public Object invoke(MethodInvocation invocation) throws Throwable { DigdagTimed timed = invocation.getMethod().getAnnotation(DigdagTimed.class); Category category = Category.fromString(timed.category()); String value = mkValue(timed, invocation); String metricsName = metrics.mkMetricsName(category, value); Timer.Sample sample = metrics.timerStart(category); try { return invocation.proceed(); } catch (Exception ex) { throw ex; } finally { try { <START> Tags taskTags = timed.taskRequest() ? getTaskRequest(invocation) : Tags.empty(); <END> metrics.timerStop(category, metricsName, taskTags.and(timed.extraTags()), sample); } catch (Exception e) { } } }</code><technical_language>This method call invoked timerStart call for elapsed time accuracy</technical_language>

Target:
public Object invoke(MethodInvocation invocation) throws Throwable { DigdagTimed timed = invocation.getMethod().getAnnotation(DigdagTimed.class); Category category = Category.fromString(timed.category()); String value = mkValue(timed, invocation); String metricsName = metrics.mkMetricsName(category, value); Tags taskTags = Tags.empty(); try { taskTags = timed.taskRequest() ? getTaskRequest(invocation) : Tags.empty(); } catch (Exception e) { logger.debug(e.toString()); } Timer.Sample sample = metrics.timerStart(category); try { return invocation.proceed(); } catch (Exception ex) { throw ex; } finally { try { metrics.timerStop(category, metricsName, taskTags.and(timed.extraTags()), sample); } catch (Exception e) { } } }
Source:
<code>public static ForgeArchive getDeployment() { ForgeArchive archive = ShrinkWrap .create(ForgeArchive.class) .addBeansXML() .addAsResource(WindupCommandTest.class.getResource(TEST_OLD_WINDUP), TEST_OLD_WINDUP) .addAsAddonDependencies( AddonDependencyEntry.create("org.jboss.windup.ui:windup-ui"), <START> AddonDependencyEntry.create("org.jboss.windup.exec:windup-exec"), <END> AddonDependencyEntry.create("org.jboss.windup.graph:windup-graph"), AddonDependencyEntry.create("org.jboss.windup.rules.apps:windup-rules-java"), AddonDependencyEntry.create("org.jboss.windup.utils:windup-utils"), AddonDependencyEntry.create("org.jboss.forge.furnace.container:cdi"), AddonDependencyEntry.create("org.jboss.forge.addon:maven"), AddonDependencyEntry.create("org.jboss.forge.addon:ui-test-harness") ); return archive; }</code><technical_language>"duplicate" entries longer required afaik, @AddonDependency adds implicit dependency. Try out</technical_language>

Target:
public static AddonArchive getDeployment() { AddonArchive archive = ShrinkWrap .create(AddonArchive.class) .addBeansXML() .addAsResource(WindupCommandTest.class.getResource(TEST_OLD_WINDUP), TEST_OLD_WINDUP); return archive; }
Source:
<code>private static AsyncCallback<JavaScriptObject> mine() { return new GerritCallback<JavaScriptObject>() { public void onSuccess(JavaScriptObject result) { redisplay(); } public void onFailure(Throwable err) { if (SubmitFailureDialog.isConflict(err)) { new SubmitFailureDialog(err.getMessage()).center(); redisplay(); } else { super.onFailure(err); } } <START> private void redisplay() { Gerrit.display(PageLinks.MINE); } <END> }; }</code><technical_language>shorter line this</technical_language>

Target:
private static AsyncCallback<JavaScriptObject> mine() { return new GerritCallback<JavaScriptObject>() { public void onSuccess(JavaScriptObject result) { Gerrit.display(PageLinks.MINE); } public void onFailure(Throwable err) { if (SubmitFailureDialog.isConflict(err)) { new SubmitFailureDialog(err.getMessage()).center(); Gerrit.display(PageLinks.MINE); } else { super.onFailure(err); } } }; }
Source:
<code>private void message(String prefix, String string, Object[] objects) { Throwable e = null; for (int n = 0; n < objects.length; n++) { Object o = objects[n]; if (o instanceof Throwable) { Throwable t = e = (Throwable) o; if (t instanceof BundleException) { objects[n] = translateToMessage((BundleException) t); } else { for (Throwable cause; (t instanceof InvocationTargetException) && ((cause = t.getCause()) != null);) { t = cause; } objects[n] = t.getMessage(); } } } StringBuilder sb = new StringBuilder(prefix); try (Formatter f = new Formatter(sb)) { f.format(string, objects); } catch (IllegalFormatException fe) { sb.append(fe); } String message = sb.toString(); out.println(message); if (e != null) e.printStackTrace(out); out.flush(); DatagramSocket socket = commsSocket.get(); if (socket != null) { int severity; if (message.startsWith("! ")) { severity = 0; } else if (message.startsWith("# ") && parms.trace) { severity = 2; } else { return; } try (ByteBufferOutputStream outputStream = new ByteBufferOutputStream(); DataOutputStream dos = new DataOutputStream(outputStream)) { dos.writeInt(severity); dos.writeUTF(message.substring(2)); if (e != null) { <START> dos.writeUTF(Exceptions.toString(e)); <END> } ByteBuffer bb = outputStream.toByteBuffer(); socket.send(new DatagramPacket(bb.array(), bb.arrayOffset(), bb.remaining())); } catch (IOException ioe) { out.println("! Unable to send notification to " + socket.getRemoteSocketAddress()); if (parms.trace) ioe.printStackTrace(out); out.flush(); } } }</code><technical_language>avoid dragging in aQute.lib.exceptions package for this method. copy method this class</technical_language>

Target:
private void message(String prefix, String string, Object[] objects) { Throwable e = null; for (int n = 0; n < objects.length; n++) { Object o = objects[n]; if (o instanceof Throwable) { Throwable t = e = (Throwable) o; if (t instanceof BundleException) { objects[n] = translateToMessage((BundleException) t); } else { for (Throwable cause; (t instanceof InvocationTargetException) && ((cause = t.getCause()) != null);) { t = cause; } objects[n] = t.getMessage(); } } } StringBuilder sb = new StringBuilder(prefix); try (Formatter f = new Formatter(sb)) { f.format(string, objects); } catch (IllegalFormatException fe) { sb.append(fe); } String message = sb.toString(); out.println(message); if (e != null) e.printStackTrace(out); out.flush(); DatagramSocket socket = commsSocket.get(); if (socket != null) { int severity; if (message.startsWith("! ")) { severity = 0; } else if (message.startsWith("# ") && parms.trace) { severity = 2; } else { return; } try (ByteBufferOutputStream outputStream = new ByteBufferOutputStream(); DataOutputStream dos = new DataOutputStream(outputStream)) { dos.writeInt(severity); dos.writeUTF(message.substring(2)); if (e != null) { dos.writeUTF(toString(e)); } ByteBuffer bb = outputStream.toByteBuffer(); socket.send(new DatagramPacket(bb.array(), bb.arrayOffset(), bb.remaining())); } catch (IOException ioe) { out.println("! Unable to send notification to " + socket.getRemoteSocketAddress()); if (parms.trace) ioe.printStackTrace(out); out.flush(); } } }
Source:
<code>public void load() throws IOException, ConfigInvalidException { try { fromText(RawParseUtils.decode(IO.readFully(getFile()))); } catch (FileNotFoundException noFile) { clear(); } catch (IOException e) { final IOException e2 = new IOException("Cannot read " + getFile()); e2.initCause(e); throw e2; } catch (ConfigInvalidException e) { throw new ConfigInvalidException("Cannot read " + getFile(), e); } <START> lastModified = getFile().lastModified(); <END> }</code><technical_language>prefer cache modification time read file. if file is modified while scanning it, cached time older final edit time, scan next time asked file. Caching time read opens a race condition finish reading version, else changes file get modification time it. In this case skip update notice occurred</technical_language>

Target:
public void load() throws IOException, ConfigInvalidException { lastModified = getFile().lastModified(); try { fromText(RawParseUtils.decode(IO.readFully(getFile()))); } catch (FileNotFoundException noFile) { clear(); } catch (IOException e) { final IOException e2 = new IOException("Cannot read " + getFile()); e2.initCause(e); throw e2; } catch (ConfigInvalidException e) { throw new ConfigInvalidException("Cannot read " + getFile(), e); } }
Source:
<code>private FirmwareUpdateMessageDataContainer mapFirmwareModuleTypes(final String firmwareIndentification, final List<FirmwareModuleType> firmwareModuleTypes) { <START> String moduleVersionComm = ""; <END> String moduleVersionFunc = ""; String moduleVersionMa = ""; String moduleVersionMbus = ""; String moduleVersionSec = ""; for (final FirmwareModuleType firmwareModuleType : firmwareModuleTypes) { if (FirmwareModuleType.COMMUNICATION.equals(firmwareModuleType)) { moduleVersionComm = firmwareModuleType.toString(); } if (FirmwareModuleType.FUNCTIONAL.equals(firmwareModuleType)) { moduleVersionFunc = firmwareModuleType.toString(); } if (FirmwareModuleType.MODULE_ACTIVE.equals(firmwareModuleType)) { moduleVersionMa = firmwareModuleType.toString(); } if (FirmwareModuleType.M_BUS.equals(firmwareModuleType)) { moduleVersionMbus = firmwareModuleType.toString(); } if (FirmwareModuleType.SECURITY.equals(firmwareModuleType)) { moduleVersionSec = firmwareModuleType.toString(); } } final FirmwareModuleData firmwareModuleData = new FirmwareModuleData(moduleVersionComm, moduleVersionFunc, moduleVersionMa, moduleVersionMbus, moduleVersionSec); return new FirmwareUpdateMessageDataContainer(firmwareModuleData, firmwareIndentification); }</code><technical_language>initialize Strings. code StringUtils.isEmpty(..), initialization is needed</technical_language>

Target:
private FirmwareUpdateMessageDataContainer mapFirmwareModuleTypes(final String firmwareIndentification, final List<FirmwareModuleType> firmwareModuleTypes) { String moduleVersionComm = null; String moduleVersionFunc = null; String moduleVersionMa = null; String moduleVersionMbus = null; String moduleVersionSec = null; for (final FirmwareModuleType firmwareModuleType : firmwareModuleTypes) { final String firmwareModuleTypeString = firmwareModuleType.toString(); if (FirmwareModuleType.COMMUNICATION.equals(firmwareModuleType)) { moduleVersionComm = firmwareModuleTypeString; } if (FirmwareModuleType.FUNCTIONAL.equals(firmwareModuleType)) { moduleVersionFunc = firmwareModuleTypeString; } if (FirmwareModuleType.MODULE_ACTIVE.equals(firmwareModuleType)) { moduleVersionMa = firmwareModuleTypeString; } if (FirmwareModuleType.M_BUS.equals(firmwareModuleType)) { moduleVersionMbus = firmwareModuleTypeString; } if (FirmwareModuleType.SECURITY.equals(firmwareModuleType)) { moduleVersionSec = firmwareModuleTypeString; } } final FirmwareModuleData firmwareModuleData = new FirmwareModuleData(moduleVersionComm, moduleVersionFunc, moduleVersionMa, moduleVersionMbus, moduleVersionSec); return new FirmwareUpdateMessageDataContainer(firmwareModuleData, firmwareIndentification); }
Source:
<code><START> public void onSaveInstanceState(Bundle state) { <END> state.putBoolean(EMAIL_SENT, true); }</code><technical_language>call super</technical_language>

Target:
public void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putBoolean(EMAIL_SENT, true); }
Source:
<code>public void setState(final String commandId, final boolean state) { <START> if (commandId.equals(IOutlineViewState.SHOW_ELEMENT_CONTENT)) { <END> showElementContent = state; } }</code><technical_language>is SHOW_ELEMENT_CONTENT part of interface IOutlineViewState? constant represents action provided DefaultOutlineProvider implementation, is in conjunction implementation. interface defines a generic mechanism set retrieve state of a command. I SHOW_ELEMENT_CONTENT belongs DefaultOutlineProvider interface</technical_language>

Target:
public void setState(final String commandId, final boolean state) { if (commandId.equals(SHOW_ELEMENT_CONTENT)) { showElementContent = state; } }
Source:
<code>public SessionStore<J2EContext> buildFromTrackableSession(final J2EContext context, final Object trackableSession) { if (trackableSession != null) { return new J2EProvidedSessionStore((HttpSession) trackableSession); } else { <START> return (SessionStore<J2EContext>) SessionStore.EMPTY; <END> } }</code><technical_language>I opinion this, is want? throw exception while returning null? (I finished reading, I get answer in rest of diff : )</technical_language>

Target:
public Optional<SessionStore<J2EContext>> buildFromTrackableSession(final J2EContext context, final Object trackableSession) { return trackableSession != null ? Optional.of(new J2EProvidedSessionStore((HttpSession) trackableSession)) : Optional.empty(); }
Source:
<code>private Collection<T> removeCollection(int priority) { PriorityHolder<T>[] current = getArray(); int len = current.length; int low = 0; int high = len - 1; while (low <= high) { int mid = (low + high) >>> 1; <START> PriorityHolder<T> midVal = current[mid]; <END> if (midVal.getPriority() > priority) low = mid + 1; else if (midVal.getPriority() < priority) high = mid - 1; else { PriorityHolder<T>[] newArray = newPrioritySetArrayInstance(len - 1); System.arraycopy(current, 0, newArray, 0, mid); System.arraycopy(current, mid + 1, newArray, mid, len - mid - 1); setArray(newArray); return midVal.getValues(); } } return null; }</code><technical_language>/2: compiler is smart enough shift :+1:</technical_language>

Target:
private Collection<T> removeCollection(int priority) { PriorityHolder<T>[] current = getArray(); int len = current.length; int low = 0; int high = len - 1; while (low <= high) { int mid = (low + high) / 2; PriorityHolder<T> midVal = current[mid]; if (midVal.getPriority() > priority) low = mid + 1; else if (midVal.getPriority() < priority) high = mid - 1; else { PriorityHolder<T>[] newArray = newPrioritySetArrayInstance(len - 1); System.arraycopy(current, 0, newArray, 0, mid); System.arraycopy(current, mid + 1, newArray, mid, len - mid - 1); setArray(newArray); return midVal.getValues(); } } return null; }
Source:
<code>public void onMessage(Message message) { try { CarbonMessage jmsCarbonMessage = JMSUtils.createJMSCarbonMessage(message); jmsCarbonMessage.setProperty(org.wso2.carbon.messaging.Constants.PROTOCOL, JMSConstants.PROTOCOL_JMS); jmsCarbonMessage.setProperty(JMSConstants.JMS_SERVICE_ID, serviceId); if (Session.CLIENT_ACKNOWLEDGE == this.acknowledgementMode) { carbonMessageProcessor.receive(jmsCarbonMessage, new AcknowledgementCallback(message, session)); } else if (Session.SESSION_TRANSACTED == this.acknowledgementMode) { carbonMessageProcessor.receive(jmsCarbonMessage, new CommitOrRollback(session)); } else { carbonMessageProcessor.receive(jmsCarbonMessage, null); } } catch (Exception e) { logger.error("Error while getting the message from jms server : " + e.getMessage(), e); <START> throw new RuntimeException(new JMSConnectorException("Error while getting the message from jms " <END> + "server", e)); } }</code><technical_language>creating a JMSConnectorException creating a RuntimeException that? create RuntimeException</technical_language>

Target:
public void onMessage(Message message) { try { CarbonMessage jmsCarbonMessage = JMSUtils.createJMSCarbonMessage(message); jmsCarbonMessage.setProperty(org.wso2.carbon.messaging.Constants.PROTOCOL, JMSConstants.PROTOCOL_JMS); jmsCarbonMessage.setProperty(JMSConstants.JMS_SERVICE_ID, serviceId); if (Session.CLIENT_ACKNOWLEDGE == this.acknowledgementMode) { carbonMessageProcessor.receive(jmsCarbonMessage, new AcknowledgementCallback(message, session)); } else if (Session.SESSION_TRANSACTED == this.acknowledgementMode) { carbonMessageProcessor.receive(jmsCarbonMessage, new TransactedSessionCallback(session)); } else { carbonMessageProcessor.receive(jmsCarbonMessage, null); } } catch (Exception e) { throw new RuntimeException("Error while getting the message from jms provider.", e); } }
Source:
<code>public void testCreate() throws StripeException { final List<String> enabledEvents = new ArrayList<String>(); <START> enabledEvents.add("*"); <END> final Map<String, Object> params = new HashMap<String, Object>(); params.put("enabled_events", enabledEvents); params.put("url", "<LINK_0>"); final WebhookEndpoint endpoint = WebhookEndpoint.create(params); assertNotNull(endpoint); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/webhook_endpoints"), params ); }</code><technical_language>actual event type here</technical_language>

Target:
public void testCreate() throws StripeException { final List<String> enabledEvents = new ArrayList<String>(); enabledEvents.add("charge.succeeded"); final Map<String, Object> params = new HashMap<String, Object>(); params.put("enabled_events", enabledEvents); params.put("url", "<LINK_0>"); final WebhookEndpoint endpoint = WebhookEndpoint.create(params); assertNotNull(endpoint); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/webhook_endpoints"), params ); }
Source:
<code>protected static final void commonInit() { if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!"); LoggingHandler loggingHandler = new LoggingHandler(); RuntimeHooks.setUncaughtExceptionPreHandler(loggingHandler); Thread.setDefaultUncaughtExceptionHandler(new KillApplicationHandler(loggingHandler)); <START> RuntimeHooks.setThreadPrioritySetter(new RuntimeThreadPrioritySetter()); <END> RuntimeHooks.setTimeZoneIdSupplier(() -> SystemProperties.get("persist.sys.timezone")); LogManager.getLogManager().reset(); new AndroidConfig(); String userAgent = getDefaultUserAgent(); System.setProperty("http.agent", userAgent); NetworkManagementSocketTagger.install(); String trace = SystemProperties.get("ro.kernel.android.tracing"); if (trace.equals("1")) { Slog.i(TAG, "NOTE: emulator trace profiling enabled"); Debug.enableEmulatorTraceOutput(); } initialized = true; }</code><technical_language>if find this is late, consider moving for example line 208</technical_language>

Target:
protected static final void commonInit() { if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!"); LoggingHandler loggingHandler = new LoggingHandler(); RuntimeHooks.setUncaughtExceptionPreHandler(loggingHandler); Thread.setDefaultUncaughtExceptionHandler(new KillApplicationHandler(loggingHandler)); RuntimeHooks.setTimeZoneIdSupplier(() -> SystemProperties.get("persist.sys.timezone")); LogManager.getLogManager().reset(); new AndroidConfig(); String userAgent = getDefaultUserAgent(); System.setProperty("http.agent", userAgent); NetworkManagementSocketTagger.install(); String trace = SystemProperties.get("ro.kernel.android.tracing"); if (trace.equals("1")) { Slog.i(TAG, "NOTE: emulator trace profiling enabled"); Debug.enableEmulatorTraceOutput(); } initialized = true; }
Source:
<code>private AbstractGCEvent<?> parseShenandoahEvent(String line) { AbstractGCEvent<?> event = null; Matcher noHeapMatcher = PATTERN_WITHOUT_HEAP.matcher(line); Matcher withHeapMatcher = PATTERN_WITH_HEAP.matcher(line); if (noHeapMatcher.find()) { event = new GCEvent(); AbstractGCEvent.Type type = AbstractGCEvent.Type.lookup(noHeapMatcher.group(NO_HEAP_EVENT_NAME)); event.setType(type); setPauseAndTimestamp(event, noHeapMatcher.group(NO_HEAP_DURATION), noHeapMatcher.group(NO_HEAP_TIMESTAMP)); } else if (withHeapMatcher.find()) { event = line.contains("Concurrent") ? new ConcurrentGCEvent() : new GCEvent(); AbstractGCEvent.Type type = AbstractGCEvent.Type.lookup(withHeapMatcher.group(WITH_HEAP_EVENT_NAME)); event.setType(type); setPauseAndTimestamp(event, withHeapMatcher.group(WITH_HEAP_DURATION), withHeapMatcher.group(WITH_HEAP_TIMESTAMP)); addHeapDetailsToEvent(event, withHeapMatcher.group(WITH_HEAP_MEMORY)); } else { <START> getLogger().warning("Found line that has no match:" + line); <END> } return event; }</code><technical_language>Usually, I add line number log warnings, this finding offending line in log easier. able in.getLineNumber() (might work here, of usage of streams - I experience, there). If is difficult add line number - problem. warning helps line number</technical_language>

Target:
private AbstractGCEvent<?> parseShenandoahEvent(String line) { AbstractGCEvent<?> event = null; Matcher noHeapMatcher = PATTERN_WITHOUT_HEAP.matcher(line); Matcher withHeapMatcher = PATTERN_WITH_HEAP.matcher(line); if (noHeapMatcher.find()) { event = new GCEvent(); AbstractGCEvent.Type type = AbstractGCEvent.Type.lookup(noHeapMatcher.group(NO_HEAP_EVENT_NAME)); event.setType(type); setPauseAndDateOrTimestamp(event, noHeapMatcher.group(NO_HEAP_TIMESTAMP), noHeapMatcher.group(NO_HEAP_DURATION)); } else if (withHeapMatcher.find()) { event = line.contains("Concurrent") ? new ConcurrentGCEvent() : new GCEvent(); AbstractGCEvent.Type type = AbstractGCEvent.Type.lookup(withHeapMatcher.group(WITH_HEAP_EVENT_NAME)); event.setType(type); setPauseAndDateOrTimestamp(event, withHeapMatcher.group(WITH_HEAP_TIMESTAMP), withHeapMatcher.group(WITH_HEAP_DURATION)); addHeapDetailsToEvent(event, withHeapMatcher.group(WITH_HEAP_MEMORY)); } else { getLogger().warning(String.format("Failed to parse line number %d in the log file: %s", in.getLineNumber(), line)); } return event; }
Source:
<code>public void validate() throws ValidationException { if (ec2 != null) { ec2.validate(); } if (baremetal != null) { baremetal.validate(); } if (vagrant != null) { vagrant.validate(); } <START> if(occi != null){ <END> occi.validate(); } }</code><technical_language>whitespace</technical_language>

Target:
public void validate() throws ValidationException { if (ec2 != null) { ec2.validate(); } if (baremetal != null) { baremetal.validate(); } if (vagrant != null) { vagrant.validate(); } if(nova != null) { nova.validate(); } if(occi != null) { occi.validate(); } }
Source:
<code>protected void setNavigationBarColor(@ColorInt int color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { getWindow().setNavigationBarColor(color); boolean isDarkThemeOrDarkBackground = WikipediaApp.getInstance().getCurrentTheme().isDark() || color == ContextCompat.getColor(this, android.R.color.black); <START> int systemUiVisibilityFlag = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR | getWindow().getDecorView().getSystemUiVisibility(); <END> getWindow().getDecorView().setSystemUiVisibility(isDarkThemeOrDarkBackground ? 0 : systemUiVisibilityFlag); } }</code><technical_language>If is purpose moving this around, please leave out</technical_language>

Target:
protected void setNavigationBarColor(@ColorInt int color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { boolean isDarkThemeOrDarkBackground = WikipediaApp.getInstance().getCurrentTheme().isDark() || color == ContextCompat.getColor(this, android.R.color.black); getWindow().setNavigationBarColor(color); getWindow().getDecorView().setSystemUiVisibility(isDarkThemeOrDarkBackground ? 0 : View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR | getWindow().getDecorView().getSystemUiVisibility()); } }
Source:
<code>private boolean isPrecedentSourceEntry(LookupEntry entry, Application application) { return application.getConfiguration() .getEnabledReadSources() <START> .asList() <END> .get(0) .equals(entry.lookupRef().publisher()); }</code><technical_language>Ditto. This necessarily return sources in correct precedence</technical_language>

Target:
private boolean isPrecedentSourceEntry(LookupEntry entry, Application application) { return application.getConfiguration() .getReadPrecedenceOrdering() .sortedCopy(application.getConfiguration().getEnabledReadSources()) .get(0) .equals(entry.lookupRef().publisher()); }
Source:
<code>private void scheduleCheckStatus() { <START> if (scheduledStatusCheckInProgress || reportsWebappDeployed) { <END> return; } scheduledStatusCheckInProgress = true; Scheduler.get().scheduleFixedDelay( new Scheduler.RepeatingCommand() { @Override public boolean execute() { if (retryCount > MAX_RETRY_COUNTS || reportsWebappDeployed) { scheduledStatusCheckInProgress = false; return false; } retryCount++; checkReportsWebAppStatus(); return true; } }, RETRY_INTERVAL); }</code><technical_language>I you"ve moved 'reportsWebappDeployed' 'retryCount > MAX_RETRY_COUNTS'</technical_language>

Target:
private void scheduleCheckStatus() { scheduledStatusCheckInProgress = true; Scheduler.get().scheduleFixedDelay( new Scheduler.RepeatingCommand() { @Override public boolean execute() { if (retryCount > MAX_RETRY_COUNTS || reportsWebappDeployed) { scheduledStatusCheckInProgress = false; return false; } retryCount++; checkReportsWebAppStatus(); return true; } }, RETRY_INTERVAL); }
Source:
<code>public List<DeviceOrganizationVisEdge> generateEdges() { List<DeviceOrganizationMetadataHolder> tempDevicesInOrganization = new ArrayList<>(); try { tempDevicesInOrganization = this.getDevicesInOrganization(); } catch (DeviceOrganizationException e) { String msg = "Error while getting devices in organization"; log.error(msg, e); } List<DeviceOrganizationVisEdge> edges = new ArrayList<>(); for (DeviceOrganizationMetadataHolder tempHolder: tempDevicesInOrganization) { String child = tempHolder.getDeviceId(); String parent = tempHolder.getParent(); <START> if (parent.equals("") || parent.equals(" ")) { <END> continue; } else { edges.add(new DeviceOrganizationVisEdge(parent, child)); } } return edges; }</code><technical_language>trim parent check for empty strings</technical_language>

Target:
public List<DeviceOrganizationVisEdge> generateEdges() { List<DeviceOrganizationMetadataHolder> tempDevicesInOrganization = new ArrayList<>(); try { tempDevicesInOrganization = this.getDevicesInOrganization(); } catch (DeviceOrganizationException e) { String msg = "Error while getting devices in organization"; log.error(msg, e); } List<DeviceOrganizationVisEdge> edges = new ArrayList<>(); for (DeviceOrganizationMetadataHolder tempHolder : tempDevicesInOrganization) { String child = tempHolder.getDeviceId(); String parent = tempHolder.getParent(); if (parent.trim().isEmpty()) { continue; } else { edges.add(new DeviceOrganizationVisEdge(parent, child)); } } return edges; }
Source:
<code>public static Function<String, OsFamily> osFamily() { return new Function<String, OsFamily>() { @Override public OsFamily apply(final String label) { if (label != null) { <START> if (label.toUpperCase().contains("CENTOS")) <END> return OsFamily.CENTOS; if (label.toUpperCase().contains("OPENLOGIC")) return OsFamily.CENTOS; else if (label.contains("SUSE")) return OsFamily.SUSE; else if (label.toUpperCase().contains("UBUNTU")) return OsFamily.UBUNTU; else if (label.toUpperCase().contains("WINDOWS")) return OsFamily.WINDOWS; else if (label.toUpperCase().contains("ORACLE LINUX")) return OsFamily.OEL; } return OsFamily.UNRECOGNIZED; } }; }</code><technical_language>worth constant, UNRECOGNIZE, in version method</technical_language>

Target:
public static Function<OSImage, OperatingSystem.Builder> osFamily() { return new Function<OSImage, OperatingSystem.Builder>() { @Override public OperatingSystem.Builder apply(final OSImage image) { final String label = image.label(); checkNotNull(label, "label"); OsFamily family = OsFamily.UNRECOGNIZED; if (label.contains(CENTOS)) family = OsFamily.CENTOS; else if (label.contains(OPENLOGIC)) family = OsFamily.CENTOS; else if (label.contains(SUSE)) family = OsFamily.SUSE; else if (label.contains(UBUNTU)) family = OsFamily.UBUNTU; else if (label.contains(WINDOWS)) family = OsFamily.WINDOWS; else if (label.contains(ORACLE_lINUX)) family = OsFamily.OEL; String version = UNRECOGNIZED; if (label.contains(COREOS)) version = label.replace("CoreOS ", ""); else if (label.contains(OPENSUSE)) version = label.replace("openSUSE ", ""); else if (label.contains(SUSE)) version = label.replace("SUSE ", ""); else if (label.contains(UBUNTU)) version = label.replace("Ubuntu Server ", ""); else if (label.contains(SQL_SERVER)) version = label; else if (label.contains(CENTOS)) version = label; else if (label.contains(WINDOWS)) version = label; else if (label.equals(ORACLE_lINUX)) version = label; if (family != OsFamily.UNRECOGNIZED) { return OperatingSystem.builder().family(family).version(version) .description(image.description() + ""); } else if (family == OsFamily.UNRECOGNIZED && image.os() == OSImage.Type.WINDOWS) { return OperatingSystem.builder().family(OsFamily.WINDOWS).version(version) .description(image.description() + ""); } return OperatingSystem.builder().family(OsFamily.LINUX).version(version).description(image.description()); } }; }
Source:
<code>public void proposeUserIndex(Index idx) throws IgniteCheckedException { assert idx instanceof GridH2IndexBase; lock(true); try { ensureNotDestroyed(); Index idxExist = checkIndexPresence(idx); if (idxExist != null) { <START> String idxCols = Stream.of(idx.getIndexColumns()) <END> .map(k -> k.columnName).collect(Collectors.joining(", ")); U.warn(log, "Index with the given set of columns already exists (consider dropping either new" + " or existing index) [cacheName=" + cacheInfo.name() + ", schemaName=" + getSchema().getName() + ", tableName=" + getName() + ", newIndexName=" + idx.getName() + ", existingIndexName=" + idxExist.getName() + "]"); } Index oldTmpIdx = tmpIdxs.put(idx.getName(), (GridH2IndexBase)idx); assert oldTmpIdx == null; } finally { unlock(true); } }</code><technical_language>a result of operation</technical_language>

Target:
public void proposeUserIndex(Index idx) throws IgniteCheckedException { assert idx instanceof GridH2IndexBase; lock(true); try { ensureNotDestroyed(); Index idxExist = checkIndexPresence(idx); if (idxExist != null) { String idxCols = Stream.of(idxExist.getIndexColumns()) .map(k -> k.columnName).collect(Collectors.joining(", ")); U.warn(log, "Index with the given set or subset of columns already exists " + "(consider dropping either new or existing index) [cacheName=" + cacheInfo.name() + ", " + "schemaName=" + getSchema().getName() + ", tableName=" + getName() + ", newIndexName=" + idx.getName() + ", existingIndexName=" + idxExist.getName() + ", existingIndexColumns=[" + idxCols + "]]"); } Index oldTmpIdx = tmpIdxs.put(idx.getName(), (GridH2IndexBase)idx); assert oldTmpIdx == null; } finally { unlock(true); } }
Source:
<code>public void activate(final BundleContext bundleContext, final Map<String, Object> config) { <START> logger.debug("dynamodb persistence service activated"); <END> resetClient(); try { dbConfig = DynamoDBConfig.fromConfig(config); if (dbConfig == null) { throw new IllegalArgumentException("Something was wrong with configuration"); } tableNameResolver = new DynamoDBTableNameResolver(dbConfig.getTablePrefix()); } catch (Exception e) { logger.error("Error with configuration: {}", e); return; } try { db = new DynamoDBClient(dbConfig); if (!checkConnection()) { logger.error("dynamodb: database connection does not work for now, will retry to use the database."); } } catch (Exception e) { logger.error("Error constructing dynamodb client", e); return; } isProperlyConfigured = true; }</code><technical_language>This needs line of this method</technical_language>

Target:
public void activate(final BundleContext bundleContext, final Map<String, Object> config) { resetClient(); dbConfig = DynamoDBConfig.fromConfig(config); if (dbConfig == null) { return; } tableNameResolver = new DynamoDBTableNameResolver(dbConfig.getTablePrefix()); try { boolean connectionOK = maybeConnectAndCheckConnection(); if (db == null) { logger.error("Error creating dynamodb database client. Aborting service activation."); return; } if (!connectionOK) { logger.warn("Failed to establish the dynamodb database connection. " + "Connection will be retried later on persistence service query/store."); } } catch (Exception e) { logger.error("Error constructing dynamodb client", e); return; } isProperlyConfigured = true; logger.debug("dynamodb persistence service activated"); }
Source:
<code>public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { try { PMML pmmlModel = JpmmlFactory.newPmml( new ByteArrayInputStream(modelProcessor.getPmml().getBytes())); Evaluator jpmmlEvaluator = JpmmlFactory.newEvaluator(pmmlModel); <START> ModelOutputs modelOutputs = JpmmlModelOutputs.toDefaultStream(pmmlModel); <END> this.modelRunner = new StreamlineJPMMLModelRunner( modelProcessor.getOutputStreams(), modelProcessor.getId(), jpmmlEvaluator, modelOutputs); this.collector = collector; } catch (Exception e) { LOG.error("Unexpected exception while preparing the model evaluation bolt", e); throw new RuntimeException("Unexpected exception while preparing the model evaluation bolt", e); } }</code><technical_language>reason create variables used? If them, u final. Thanks</technical_language>

Target:
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { try { PMML pmmlModel = JpmmlFactory.newPmml( new ByteArrayInputStream(modelProcessor.getPmml().getBytes())); this.modelRunner = new StreamlineJPMMLModelRunner( modelProcessor.getOutputStreams(), modelProcessor.getId(), JpmmlFactory.newEvaluator(pmmlModel), JpmmlModelOutputs.toDefaultStream(pmmlModel)); this.collector = collector; } catch (Exception e) { LOG.error("Unexpected exception while preparing the model evaluation bolt", e); throw new RuntimeException("Unexpected exception while preparing the model evaluation bolt", e); } }
Source:
<code>public static List<BatchDTO> getNewspaperBatches() throws DataException, DAOException, IOException { <START> final BatchService batchService = ServiceManager.getBatchService(); <END> final ProcessService processService = ServiceManager.getProcessService(); final FileService fileService = ServiceManager.getFileService(); List<BatchDTO> newspaperBatches = new ArrayList<>(); for (BatchDTO batchTransfer : batchService.findAll()) { if (isNewspaperBatch(batchTransfer, processService, fileService)) { newspaperBatches.add(batchTransfer); } } return newspaperBatches; }</code><technical_language>batch service a class attribute</technical_language>

Target:
public static List<BatchDTO> getNewspaperBatches() throws DataException, DAOException, IOException { List<BatchDTO> newspaperBatches = new ArrayList<>(); for (BatchDTO batchTransfer : batchService.findAll()) { if (isNewspaperBatch(batchTransfer)) { newspaperBatches.add(batchTransfer); } } return newspaperBatches; }