auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void loadConfiguration(final ServletContextEvent servletContextEvent) { LOGGER.info(" Loading configuration ..."); final String configurationDirectoryPath = documentationPathLogic.getDocumentationPath(servletContextEvent); RepositoryLocator.INSTANCE.initializeConfigurationRepository(configurationDirectoryPath); final ConfigurationRepository configurationRepository = RepositoryLocator.INSTANCE.getConfigurationRepository(); final Configuration configuration = configurationRepository.getConfiguration(); LOGGER.info(" Configuration loaded."); LOGGER.info(" Configured documentation content directory: " + configurationDirectoryPath); }

Target:
private void loadConfiguration(final ServletContextEvent servletContextEvent) { final String configurationDirectoryPath = scenariooDataPathLogic.getDataPath(servletContextEvent); LOGGER.info(" Configured scenarioo data directory: " + configurationDirectoryPath); LOGGER.info(" Loading configuration ..."); RepositoryLocator.INSTANCE.initializeConfigurationRepository(configurationDirectoryPath); final ConfigurationRepository configurationRepository = RepositoryLocator.INSTANCE.getConfigurationRepository(); final Configuration configuration = configurationRepository.getConfiguration(); LOGGER.info(" Configuration loaded."); }
Source:
public boolean enableWagedRebalance(String clusterName, List<String> resourceNames) { if (clusterName == null || clusterName.isEmpty()) { throw new HelixException("Cluster name is invalid!"); } if (resourceNames == null || resourceNames.isEmpty()) { throw new HelixException("Resource name list is invalid!"); } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_zkClient)); Builder keyBuilder = accessor.keyBuilder(); List<IdealState> idealStates = accessor.getChildValues(keyBuilder.idealStates()); List<String> nullIdealStates = new ArrayList<>(); for (int i = 0; i < idealStates.size(); i++) { if (idealStates.get(i) == null) { nullIdealStates.add(resourceNames.get(i)); } else { idealStates.get(i) .setRebalancerClassName("org.apache.helix.controller.rebalancer.WagedRebalancer"); } } if (!nullIdealStates.isEmpty()) { throw new HelixException( String.format("Not all IdealStates exist in the cluster: %s", nullIdealStates)); } List<PropertyKey> idealStateKeys = new ArrayList<>(); idealStates.forEach( idealState -> idealStateKeys.add(keyBuilder.idealStates(idealState.getResourceName()))); boolean[] success = accessor.setChildren(idealStateKeys, idealStates); for (boolean s : success) { if (!s) { return false; } } return true; }

Target:
public boolean enableWagedRebalance(String clusterName, List<String> resourceNames) { if (clusterName == null || clusterName.isEmpty()) { throw new HelixException("Cluster name is invalid!"); } if (resourceNames == null || resourceNames.isEmpty()) { throw new HelixException("Resource name list is invalid!"); } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_zkClient)); Builder keyBuilder = accessor.keyBuilder(); List<IdealState> idealStates = accessor.getChildValues(keyBuilder.idealStates()); List<String> nullIdealStates = new ArrayList<>(); for (int i = 0; i < idealStates.size(); i++) { if (idealStates.get(i) == null) { nullIdealStates.add(resourceNames.get(i)); } else { idealStates.get(i).setRebalancerClassName(WagedRebalancer.class.getName()); idealStates.get(i).setRebalanceMode(RebalanceMode.FULL_AUTO); } } if (!nullIdealStates.isEmpty()) { throw new HelixException( String.format("Not all IdealStates exist in the cluster: %s", nullIdealStates)); } List<PropertyKey> idealStateKeys = new ArrayList<>(); idealStates.forEach( idealState -> idealStateKeys.add(keyBuilder.idealStates(idealState.getResourceName()))); boolean[] success = accessor.setChildren(idealStateKeys, idealStates); for (boolean s : success) { if (!s) { return false; } } return true; }
Source:
public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { if (message.isScheduled()) { LOGGER.info("Handling scheduled protocol response message."); this.handleScheduleTask(message); } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (JMSException | FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } }

Target:
public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { if (message.isScheduled()) { LOGGER.info("Handling scheduled protocol response message."); this.handleScheduledTask(message); } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (JMSException | FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } }
Source:
ShoppingBagItemPresenter( EventBus eventBus, MyView view, @Assisted ShoppingBagItem item, CurrentShoppingBag currentShoppingBag) { super(eventBus, view); this.currentShoppingBag = currentShoppingBag; getView().setUiHandlers(this); this.item = item; }

Target:
ShoppingBagItemPresenter( EventBus eventBus, MyView view, @Assisted ShoppingBagItem item, CurrentShoppingBag currentShoppingBag) { super(eventBus, view); this.currentShoppingBag = currentShoppingBag; this.item = item; getView().setUiHandlers(this); }
Source:
public ResultSetMetaData getMetaData() throws SQLException { try (PrestoStatement statement = (PrestoStatement) getConnection().createStatement()) { ResultSet rs = statement.executeQuery("DESCRIBE OUTPUT " + statementName); ImmutableList.Builder<ColumnInfo> list = ImmutableList.builder(); while (rs.next()) { ColumnInfo.Builder builder = new ColumnInfo.Builder() .setCatalogName(rs.getString(2)) .setSchemaName(rs.getString(3)) .setTableName(rs.getString(4)) .setColumnLabel(rs.getString(1)) .setColumnName(rs.getString(1)) .setColumnTypeSignature(parseTypeSignature(rs.getString(5))) .setNullable(NULLABLE) .setCurrency(false); ColumnInfo.setTypeInfo(builder, parseTypeSignature(rs.getString(5))); list.add(builder.build()); } return new PrestoResultSetMetaData(list.build()); } }

Target:
public ResultSetMetaData getMetaData() throws SQLException { try (Statement statement = getConnection().createStatement()) { try (ResultSet rs = statement.executeQuery("DESCRIBE OUTPUT " + statementName)) { ImmutableList.Builder<ColumnInfo> list = ImmutableList.builder(); while (rs.next()) { ColumnInfo.Builder builder = new ColumnInfo.Builder() .setCatalogName(rs.getString(2)) .setSchemaName(rs.getString(3)) .setTableName(rs.getString(4)) .setColumnLabel(rs.getString(1)) .setColumnName(rs.getString(1)) .setTypeSignature(parseTypeSignature(rs.getString(5))) .setNullable(NULLABLE) .setCurrency(false); list.add(builder.build()); } return new PrestoResultSetMetaData(list.build()); } } }
Source:
public void endVisit(@Nonnull JMethodCall call) { Collection<JMethod> targets = call.getMethodId().getMethods(); if (targets.size() != 1) { return; } JMethod target = targets.iterator().next(); if (target.isAbstract() || target.isNative()) { return; } Location location = target.getEnclosingType().getLocation(); if (location instanceof TypeInInputLibraryLocation) { InputLibrary inputLibrary = ((TypeInInputLibraryLocation) location).getInputLibrary(); if (inputLibrary.containsFileType(FileType.PREBUILT)) { return; } } List<JAnnotation> annotationList = target.getAnnotations(forceInlineAnnotationType); if (!annotationList.isEmpty()) { call.addMarker(new InlineMarker(target)); } }

Target:
public void endVisit(@Nonnull JMethodCall call) { Collection<JMethod> targets = call.getMethodId().getMethods(); if (targets.size() != 1) { return; } JMethod target = targets.iterator().next(); if (target.isAbstract() || target.isNative()) { return; } Location location = target.getEnclosingType().getLocation(); if (location instanceof TypeInInputLibraryLocation) { InputLibrary inputLibrary = ((TypeInInputLibraryLocation) location).getInputLibrary(); if (inputLibrary.containsFileType(FileType.PREBUILT)) { return; } } assert forceInlineAnnotationType != null; List<JAnnotation> annotationList = target.getAnnotations(forceInlineAnnotationType); if (!annotationList.isEmpty()) { call.addMarker(new InlineMarker(target)); } }
Source:
public CatchAllImpl(OMElement omElement) { super(omElement); name = "CATCHALL" + System.currentTimeMillis(); displayName = "Catch All"; startIconPath = BPEL2SVGFactory.getInstance().getIconPath(this.getClass().getName()); endIconPath = BPEL2SVGFactory.getInstance().getEndIconPath(this.getClass().getName()); }

Target:
public CatchAllImpl(OMElement omElement) { super(omElement); name = "CATCHALL"; displayName = "Catch All"; startIconPath = BPEL2SVGFactory.getInstance().getIconPath(this.getClass().getName()); endIconPath = BPEL2SVGFactory.getInstance().getEndIconPath(this.getClass().getName()); }
Source:
public PdpFeedDetailEntry buildPdpFeedDetailEntry(ConcurStandardAccountingExtractDetailLine line) { PdpFeedDetailEntry currentDetailEntry = new PdpFeedDetailEntry(); currentDetailEntry.setSourceDocNbr(buildSourceDocumentNumber(line.getReportId())); currentDetailEntry.setFsOriginCd(getConcurParamterValue(ConcurConstants.DEFAULT_ORIGINATION_CODE_PARAMETER_NAME)); currentDetailEntry.setFdocTypCd(getConcurParamterValue(ConcurConstants.DEFAULT_SAW_PDP_DOCUMENT_TYPE_PARAMETER_NAME)); currentDetailEntry.setInvoiceNbr(""); currentDetailEntry.setPoNbr(""); currentDetailEntry.setInvoiceDate(formatDate(line.getBatchDate())); return currentDetailEntry; }

Target:
public PdpFeedDetailEntry buildPdpFeedDetailEntry(ConcurStandardAccountingExtractDetailLine line) { PdpFeedDetailEntry currentDetailEntry = new PdpFeedDetailEntry(); currentDetailEntry.setSourceDocNbr(buildSourceDocumentNumber(line.getReportId())); currentDetailEntry.setFsOriginCd(getConcurParameterValue(ParameterNames.CONCUR_AP_PDP_ORIGINATION_CODE)); currentDetailEntry.setFdocTypCd(getConcurParameterValue(ParameterNames.CONCUR_SAE_PDP_DOCUMENT_TYPE)); currentDetailEntry.setInvoiceNbr(StringUtils.EMPTY); currentDetailEntry.setPoNbr(StringUtils.EMPTY); currentDetailEntry.setInvoiceDate(formatDate(line.getBatchDate())); return currentDetailEntry; }
Source:
private void commitOnePhase(Xid xid) throws XAException { try { if (xid.equals(preparedXid)) { throw new PGXAException(GT.tr("One-phase commit called for prepared"), XAException.XAER_PROTO); } if (currentXid == null && !committedOrRolledBack) { throw new PGXAException( GT.tr( "Not implemented: one-phase commit must be issued using the same connection that was used to start it"), XAException.XAER_RMERR); } if (!xid.equals(currentXid) || committedOrRolledBack) { throw new PGXAException(GT.tr("One-phase commit with unknown xid "), XAException.XAER_NOTA); } if (state != State.ENDED) { throw new PGXAException(GT.tr("commit called before end"), XAException.XAER_PROTO); } state = State.IDLE; currentXid = null; committedOrRolledBack = true; conn.commit(); conn.setAutoCommit(localAutoCommitMode); } catch (SQLException ex) { throw new PGXAException(GT.tr("Error during one-phase commit"), ex, XAException.XAER_RMFAIL); } }

Target:
private void commitOnePhase(Xid xid) throws XAException { try { if (xid.equals(preparedXid)) { throw new PGXAException(GT.tr("One-phase commit called for xid {0} but connection was prepared with xid {1}", xid, preparedXid), XAException.XAER_PROTO); } if (currentXid == null && !committedOrRolledBack) { throw new PGXAException(GT.tr( "Not implemented: one-phase commit must be issued using the same connection that was used to start it", xid), XAException.XAER_RMERR); } if (!xid.equals(currentXid) || committedOrRolledBack) { throw new PGXAException(GT.tr("One-phase commit with unknown xid. commit xid={0}, currentXid={1}", xid, currentXid), XAException.XAER_NOTA); } if (state != State.ENDED) { throw new PGXAException(GT.tr("commit called before end. commit xid={0}, state={1}", xid, state), XAException.XAER_PROTO); } state = State.IDLE; currentXid = null; committedOrRolledBack = true; conn.commit(); conn.setAutoCommit(localAutoCommitMode); } catch (SQLException ex) { throw new PGXAException(GT.tr("Error during one-phase commit. commit xid={0}", xid), ex, XAException.XAER_RMFAIL); } }
Source:
public void write(DataOutput output) throws IOException { Bytes.writeByteArray(output, name.getBytes()); Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName.getBytes()); WritableUtils.writeVInt(output, dataType.ordinal()); WritableUtils.writeVInt(output, maxLength == null ? Integer.MIN_VALUE : maxLength); WritableUtils.writeVInt(output, scale == null ? Integer.MIN_VALUE : scale); output.writeBoolean(nullable); WritableUtils.writeVInt(output, position); }

Target:
public void write(DataOutput output) throws IOException { Bytes.writeByteArray(output, name.getBytes()); Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName.getBytes()); WritableUtils.writeVInt(output, dataType.ordinal()); WritableUtils.writeVInt(output, maxLength == null ? QueryConstants.NO_MAXLENGTH : maxLength); WritableUtils.writeVInt(output, scale == null ? QueryConstants.NO_SCALE : scale); output.writeBoolean(nullable); WritableUtils.writeVInt(output, position); }
Source:
public RealMatrix normalizedPercentCoverage() { final double[][] values = reader.readDoubleMatrix(NORMALIZED_PCOV_PATH); final RealMatrix result = new Array2DRowRealMatrix(values,false); if (result.getRowDimension() != targetNames.size()) { throw new GATKException(String.format("wrong number of rows in normalized p-cov matrix from file '%s': %d != %d", reader.getFile(),result.getRowDimension(),targetNames.size())); } if (result.getColumnDimension() != sampleNames.size()) { throw new GATKException(String.format("wrong number of columns in normalized p-cov matrix from file '%s': %d != %d", reader.getFile(),result.getColumnDimension(),sampleNames.size())); } return result; }

Target:
public RealMatrix normalizedPercentCoverage() { return readMatrixAndCheckDimensions(NORMALIZED_PCOV_PATH,targetNames.size(), sampleNames.size()); }
Source:
public void testNonPrintableCharsAreSorted() throws Exception { final String fieldName = "NON_PRINTABLE_CHARS"; final Field field = AvoidEscapedUnicodeCharactersCheck.class.getDeclaredField(fieldName); field.setAccessible(true); String expression = ((Pattern) field.get(null)).pattern(); final String charExpressions = "Aa,Bb,Cc,Dd,Ee,Ff"; for (String charExpression : charExpressions.split(",")) { final String regex = "\\[[" + charExpression + "]{2}]"; expression = expression.replaceAll(regex, charExpression.substring(0, 1)); } for (int i = 4; i > 1; i--) { final String regex = "([A-F])\\{" + i + "}"; String replacement = "$1$1{" + (i - 1) + "}"; if (i == 2) { replacement = "$1$1"; } expression = expression.replaceAll(regex, replacement); } final String[] expressionParts = expression.split("\\|"); final Pattern unicodeCharPattern = Pattern.compile("^\\\\\\\\u[0-9A-F]{4}$"); String lastChar = null; for (int i = 0; i < expressionParts.length; i++) { final String currentChar = expressionParts[i]; final Matcher matcher = unicodeCharPattern.matcher(currentChar); if (!matcher.matches()) { final String message = "Character '" + currentChar + "' (at position " + i + ") doesn't match the pattern"; assertTrue(message, matcher.matches()); } if (lastChar != null) { final String message = "Character '" + lastChar + "' should be after '" + currentChar + "', position: " + i; assertTrue(message, lastChar.compareTo(currentChar) < 0); } lastChar = currentChar; } }

Target:
public void testNonPrintableCharsAreSorted() throws Exception { final Field field = TestUtil.getClassDeclaredField( AvoidEscapedUnicodeCharactersCheck.class, "NON_PRINTABLE_CHARS"); field.setAccessible(true); String expression = ((Pattern) field.get(null)).pattern(); final String[] charExpressions = {"Aa", "Bb", "Cc", "Dd", "Ee", "Ff"}; for (String charExpression : charExpressions) { final String regex = "\\[[" + charExpression + "]{2}]"; expression = expression.replaceAll(regex, charExpression.substring(0, 1)); } for (int i = 4; i > 1; i--) { final String regex = "([A-F])\\{" + i + "}"; String replacement = "$1$1{" + (i - 1) + "}"; if (i == 2) { replacement = "$1$1"; } expression = expression.replaceAll(regex, replacement); } final String[] expressionParts = expression.split("\\|"); final Pattern unicodeCharPattern = Pattern.compile("^\\\\\\\\u[0-9A-F]{4}$"); String lastChar = null; for (int i = 0; i < expressionParts.length; i++) { final String currentChar = expressionParts[i]; final Matcher matcher = unicodeCharPattern.matcher(currentChar); if (!matcher.matches()) { final String message = "Character '" + currentChar + "' (at position " + i + ") doesn't match the pattern"; assertTrue(message, matcher.matches()); } if (lastChar != null) { final String message = "Character '" + lastChar + "' should be after '" + currentChar + "', position: " + i; assertTrue(message, lastChar.compareTo(currentChar) < 0); } lastChar = currentChar; } }
Source:
public void generateWriterTopology() { final StreamGraph streamGraph = buildGraph( TestSink.newBuilder().build(), runtimeExecutionMode); final StreamNode sourceNode = findNodeNameContains(streamGraph, "Source"); final StreamNode writerNode = findNodeNameContains(streamGraph, "Writer"); assertThat(streamGraph.getStreamNodes().size(), equalTo(2)); validateTopology( sourceNode, IntSerializer.class, writerNode, "Writer", StatelessWriterOperatorFactory.class, ChainingStrategy.NEVER, PARALLELISM, -1); }

Target:
public void generateWriterTopology() { final StreamGraph streamGraph = buildGraph( TestSink.newBuilder().build(), runtimeExecutionMode); final StreamNode sourceNode = findNodeNameContains(streamGraph, "Source"); final StreamNode writerNode = findNodeNameContains(streamGraph, "Writer"); assertThat(streamGraph.getStreamNodes().size(), equalTo(2)); validateTopology( sourceNode, IntSerializer.class, writerNode, "Writer", StatelessWriterOperatorFactory.class, PARALLELISM, -1); }
Source:
private BulkExportJobEntity loadJob(String theJobUUID) { Optional<BulkExportJobEntity> jobOpt = myBulkExportJobDao.findByJobId(theJobUUID); if (!jobOpt.isPresent()) { ourLog.info("Job appears to be deleted"); return null; } return jobOpt.get(); }

Target:
private BulkExportJobEntity loadJob(String theJobUUID) { Optional<BulkExportJobEntity> jobOpt = myBulkExportJobDao.findByJobId(theJobUUID); if (!jobOpt.isPresent()) { ourLog.warn("Job with UUID appears to be deleted", theJobUUID); return null; } return jobOpt.get(); }
Source:
private void createMesosTask(Offer offer, Request request) { TaskID taskId = TaskID.newBuilder().setValue(request.request.slave.name).build(); LOGGER.info("Launching task " + taskId.getValue() + " with URI " + joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)); TaskInfo task = TaskInfo .newBuilder() .setName("task " + taskId.getValue()) .setTaskId(taskId) .setSlaveId(offer.getSlaveId()) .addResources( Resource .newBuilder() .setName("cpus") .setType(Value.Type.SCALAR) .setScalar( Value.Scalar.newBuilder() .setValue(request.request.cpus).build()).build()) .addResources( Resource .newBuilder() .setName("mem") .setType(Value.Type.SCALAR) .setScalar( Value.Scalar .newBuilder() .setValue((1 + JVM_MEM_OVERHEAD_FACTOR) * request.request.mem) .build()).build()) .setCommand( CommandInfo .newBuilder() .setValue( String.format(SLAVE_COMMAND_FORMAT, request.request.slaveJarMem, getJnlpUrl(request.request.slave.name))) .addUris( CommandInfo.URI.newBuilder().setValue( joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)))).build(); List<TaskInfo> tasks = new ArrayList<TaskInfo>(); tasks.add(task); Filters filters = Filters.newBuilder().setRefuseSeconds(1).build(); driver.launchTasks(offer.getId(), tasks, filters); results.put(taskId, new Result(request.result, new Mesos.JenkinsSlave(offer.getSlaveId() .getValue()))); }

Target:
private void createMesosTask(Offer offer, Request request) { TaskID taskId = TaskID.newBuilder().setValue(request.request.slave.name).build(); LOGGER.info("Launching task " + taskId.getValue() + " with URI " + joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)); TaskInfo task = TaskInfo .newBuilder() .setName("task " + taskId.getValue()) .setTaskId(taskId) .setSlaveId(offer.getSlaveId()) .addResources( Resource .newBuilder() .setName("cpus") .setType(Value.Type.SCALAR) .setScalar( Value.Scalar.newBuilder() .setValue(request.request.cpus).build()).build()) .addResources( Resource .newBuilder() .setName("mem") .setType(Value.Type.SCALAR) .setScalar( Value.Scalar .newBuilder() .setValue((1 + JVM_MEM_OVERHEAD_FACTOR) * request.request.mem) .build()).build()) .setCommand( CommandInfo .newBuilder() .setValue( String.format(SLAVE_COMMAND_FORMAT, request.request.slaveMem, request.request.jvmArgs, getJnlpUrl(request.request.slave.name))) .addUris( CommandInfo.URI.newBuilder().setValue( joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)))).build(); List<TaskInfo> tasks = new ArrayList<TaskInfo>(); tasks.add(task); Filters filters = Filters.newBuilder().setRefuseSeconds(1).build(); driver.launchTasks(offer.getId(), tasks, filters); results.put(taskId, new Result(request.result, new Mesos.JenkinsSlave(offer.getSlaveId() .getValue()))); }
Source:
public boolean isMacInUse(String mac) { lockObj.readLock().lock(); try { if (allocatedMacs.containsKey(mac) || allocatedCustomMacs.containsKey(mac)) { return true; } for (String macAddress : allocatedMacs.keySet()) { if (StringUtils.equalsIgnoreCase(macAddress, mac)) { return true; } } for (String macAddress : allocatedCustomMacs.keySet()) { if (StringUtils.equalsIgnoreCase(macAddress, mac)) { return true; } } return false; } finally { lockObj.readLock().unlock(); } }

Target:
public boolean isMacInUse(String mac) { lockObj.readLock().lock(); try { return allocatedMacs.containsKey(mac) || allocatedCustomMacs.containsKey(mac); } finally { lockObj.readLock().unlock(); } }
Source:
public SpongeValue<Boolean> sneaking() { return new SpongeValue<Boolean>(Keys.IS_SNEAKING, Boolean.FALSE, getValue()); }

Target:
public Value<Boolean> sneaking() { return new SpongeValue<Boolean>(Keys.IS_SNEAKING, false, getValue()); }
Source:
private boolean isSerializableParametrized(ParametrizedTypeJavaType type) { return (type.isSubtypeOf("java.io.Serializable") || type.isSubtypeOf("java.util.Collection")) && type.typeParameters().stream().allMatch(t -> { JavaType javaType = type.substitution(t); assert javaType != null; return isSerializable(javaType); }); }

Target:
private static boolean isSerializableParametrized(ParametrizedTypeJavaType type) { return (type.isSubtypeOf("java.io.Serializable") || type.isSubtypeOf("java.util.Collection")) && type.typeParameters().stream().allMatch(t -> isSerializable(type.substitution(t))); }
Source:
private String getGitHistoryTopContent() { String rowTopIndex = Integer.toString(0); return seleniumWebDriverHelper .waitVisibility( By.xpath(String.format(Locators.HISTORY_ROW_NUMBER, rowTopIndex)), ELEMENT_TIMEOUT_SEC) .getText(); }

Target:
private String getGitHistoryTopContent() { String rowTopIndex = Integer.toString(0); return seleniumWebDriverHelper.waitVisibilityAndGetText( By.xpath(String.format(Locators.HISTORY_ROW_NUMBER, rowTopIndex))); }
Source:
private static <E> boolean isSatisfied(List<E>[] satisfiedElementsLists, int begin) { if (begin == satisfiedElementsLists.length) return true; if (satisfiedElementsLists[begin].size() == 0) return false; for (E element : satisfiedElementsLists[begin]) { List<Integer> indeces = newArrayList(); for (int i = begin + 1; i < satisfiedElementsLists.length; i++) { if (satisfiedElementsLists[i].contains(element)) { indeces.add(i); satisfiedElementsLists[i].remove(element); } } if (isSatisfied(satisfiedElementsLists, begin + 1)) return true; for (int i : indeces) satisfiedElementsLists[i].add(element); } return false; }

Target:
private static <E> boolean isSatisfied(List<E>[] satisfiedElementsLists, int begin) { if (begin == satisfiedElementsLists.length) return true; if (satisfiedElementsLists[begin].isEmpty()) return false; for (E element : satisfiedElementsLists[begin]) { List<Integer> removedElementRowIndices = newArrayList(); for (int i = begin + 1; i < satisfiedElementsLists.length; i++) { if (satisfiedElementsLists[i].remove(element)) { removedElementRowIndices.add(i); } } if (isSatisfied(satisfiedElementsLists, begin + 1)) return true; for (int i : removedElementRowIndices) { satisfiedElementsLists[i].add(element); } } return false; }
Source:
public static void replaceUserDataInRequest( HttpMessage msg, Map<String, String> userDataMap, UnaryOperator<String> bodyEncoder) { try { Map<String, String> kvMap = new HashMap<>(userDataMap.size()); for (Entry<String, String> userdata : userDataMap.entrySet()) { kvMap.put( URLEncoder.encode(userdata.getKey(), StandardCharsets.UTF_8.name()), userdata.getValue()); } String uri = AuthenticationHelper.replaceUserData( msg.getRequestHeader().getURI().toString(), kvMap, PostBasedAuthenticationMethodType::encodeParameter); msg.getRequestHeader().setURI(new URI(uri, true)); } catch (Exception e) { log.error(e.getMessage(), e); } if (msg.getRequestBody().length() > 0) { msg.setRequestBody( AuthenticationHelper.replaceUserData( msg.getRequestBody().toString(), userDataMap, bodyEncoder)); msg.getRequestHeader().setContentLength(msg.getRequestBody().length()); } }

Target:
public static void replaceUserDataInRequest( HttpMessage msg, Map<String, String> userDataMap, UnaryOperator<String> bodyEncoder) { try { Map<String, String> kvMap = new HashMap<>(userDataMap.size()); for (Entry<String, String> userdata : userDataMap.entrySet()) { kvMap.put( URLEncoder.encode(userdata.getKey(), StandardCharsets.UTF_8.name()), userdata.getValue()); } String uri = AuthenticationHelper.replaceUserData( msg.getRequestHeader().getURI().toString(), kvMap, PostBasedAuthenticationMethodType::encodeParameter); msg.getRequestHeader().setURI(new URI(uri, true)); } catch (Exception e) { log.error( "Failed to replace user data in request " + msg.getRequestHeader().getURI(), e); } if (msg.getRequestBody().length() > 0) { msg.setRequestBody( AuthenticationHelper.replaceUserData( msg.getRequestBody().toString(), userDataMap, bodyEncoder)); msg.getRequestHeader().setContentLength(msg.getRequestBody().length()); } }
Source:
protected void doStart() { try { this.main.start(); } catch (Throwable exc) { LOG.error("Got unexpected exception while starting AutoRecoveryMain", exc); if (uncaughtExceptionHandler != null) { LOG.error("Calling uncaughtExceptionHandler"); uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), exc); } else { throw new RuntimeException("Failed to start AutoRecoveryMain", exc); } } }

Target:
protected void doStart() { this.main.start(); }
Source:
public ExecutionResult executeInVR(String routerIP, String script, String args) { return executeInVR(routerIP, script, args, Duration.standardSeconds(120L)); }

Target:
public ExecutionResult executeInVR(String routerIP, String script, String args) { return executeInVR(routerIP, script, args, VRScripts.VR_SCRIPT_EXEC_TIMEOUT); }
Source:
public Response getDeviceOrganizationIsGateway(@PathParam("deviceId") String deviceId) { if (deviceId == null) { String errorMessage = "The parameter of the device organization ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } int result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getDeviceOrganizationIsGateway(deviceId); if (result == -1) { String msg = "Device with ID: " + deviceId + " not found."; log.error(msg); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving id device with ID:" + deviceId + " is gateway in Device Organization "; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { log.error("failed to add operation", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }

Target:
public Response getDeviceOrganizationIsGateway(@PathParam("deviceId") String deviceId) { if (deviceId == null) { String errorMessage = "The parameter of the device organization ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } int result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getDeviceOrganizationIsGateway(deviceId); if (result == -1) { String msg = "Device with ID: " + deviceId + " not found."; if (log.isDebugEnabled()) { log.debug(msg); } return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving device with ID:" + deviceId + " is gateway in Device " + "Organization "; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { String msg = "failed to add operation"; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } }
Source:
public void bztSmokeTests() throws Exception { String path = getClass().getResource("/performanceTest.yml").getPath(); final String bztParams = path + ' ' + "-o modules.jmeter.plugins=[] -o services=[] -o modules.jmeter.version=3.1 -o modules.jmeter.path="; story.addStep(new Statement() { public void evaluate() throws Throwable { DumbSlave s = story.j.createOnlineSlave(); s.setLabelString("test performance test "); WorkflowJob p = story.j.createProject(WorkflowJob.class, "demo"); p.setDefinition(new CpsFlowDefinition( "node{ bzt '" + bztParams + "' + pwd() }", true)); WorkflowRun r = p.scheduleBuild2(0).waitForStart(); story.j.assertBuildStatusSuccess(story.j.waitForCompletion(r)); story.j.assertLogContains("File aggregate-results.xml reported 0.0% of errors [SUCCESS].", r); } }); }

Target:
public void bztSmokeTests() throws Exception { String path = getClass().getResource("/performanceTest.yml").getPath(); final String bztParams = path + ' ' + "-o modules.jmeter.plugins=[] -o services=[] -o modules.jmeter.version=3.1 -o modules.jmeter.path="; story.addStep(new Statement() { public void evaluate() throws Throwable { DumbSlave s = story.j.createOnlineSlave(); s.setLabelString("test performance test "); WorkflowJob p = story.j.createProject(WorkflowJob.class, "demo"); p.setDefinition(new CpsFlowDefinition( "node('master'){ bzt(params: '" + bztParams + "' + pwd(), useSystemSitePackages: false, printDebugOutput: true) }", true)); p.getRootDir().mkdirs(); WorkflowRun r = p.scheduleBuild2(0).waitForStart(); story.j.assertBuildStatusSuccess(story.j.waitForCompletion(r)); story.j.assertLogContains("File aggregate-results.xml reported 0.0% of errors [SUCCESS].", r); } }); }
Source:
private boolean updateTables() { synchronized (db) { final List<String> tables; try { tables = JdbcUtils.getTables(db,table_types); } catch (SQLException e) { log.error("Error while trying to get updated table list, ignoring and waiting for next " + "table poll interval", e); return false; } final List<String> filteredTables; if (whitelist != null) { filteredTables = new ArrayList<>(tables.size()); for (String table : tables) { if (whitelist.contains(table)) { filteredTables.add(table); } } } else if (blacklist != null) { filteredTables = new ArrayList<>(tables.size()); for (String table : tables) { if (!blacklist.contains(table)) { filteredTables.add(table); } } } else { filteredTables = tables; } if (!filteredTables.equals(this.tables)) { List<String> previousTables = this.tables; this.tables = filteredTables; db.notifyAll(); return previousTables != null; } return false; } }

Target:
private boolean updateTables() { synchronized (db) { final List<String> tables; try { tables = JdbcUtils.getTables(db, tableTypes); log.debug("Got the following tables: " + Arrays.toString(tables.toArray())); } catch (SQLException e) { log.error("Error while trying to get updated table list, ignoring and waiting for next " + "table poll interval", e); return false; } final List<String> filteredTables; if (whitelist != null) { filteredTables = new ArrayList<>(tables.size()); for (String table : tables) { if (whitelist.contains(table)) { filteredTables.add(table); } } } else if (blacklist != null) { filteredTables = new ArrayList<>(tables.size()); for (String table : tables) { if (!blacklist.contains(table)) { filteredTables.add(table); } } } else { filteredTables = tables; } if (!filteredTables.equals(this.tables)) { log.debug("After filtering we got tables: " + Arrays.toString(filteredTables.toArray())); List<String> previousTables = this.tables; this.tables = filteredTables; db.notifyAll(); return previousTables != null; } return false; } }
Source:
public TryBodyVisitor(VariableTree catchTree) { this.secondaryLocation = Collections.singletonList(new JavaFileScannerContext.Location( "This parameter will catch the AssertionError thrown by fail()", catchTree.type())); }

Target:
public TryBodyVisitor(VariableTree catchTree) { this.secondaryLocation = Collections.singletonList(new JavaFileScannerContext.Location( "This parameter will catch the AssertionError", catchTree.type())); }
Source:
public void testTagsAreClearedEachRun() { final SuppressionCommentFilter suppressionCommentFilter = new SuppressionCommentFilter(); final FileContents contents = new FileContents("filename", " contents.reportSingleLineComment(1, 0); final TreeWalkerAuditEvent dummyEvent = new TreeWalkerAuditEvent(contents, "filename", new LocalizedMessage(1, null, null, null, null, Object.class, null), null); suppressionCommentFilter.accept(dummyEvent); final FileContents contents2 = new FileContents("filename2", "some line", " contents2.reportSingleLineComment(2, 0); final TreeWalkerAuditEvent dummyEvent2 = new TreeWalkerAuditEvent(contents2, "filename", new LocalizedMessage(1, null, null, null, null, Object.class, null), null); suppressionCommentFilter.accept(dummyEvent2); final List tags = Whitebox.getInternalState(suppressionCommentFilter, "tags"); assertEquals("Invalid tags size", 1, tags.size()); }

Target:
public void testTagsAreClearedEachRun() { final SuppressionCommentFilter suppressionCommentFilter = new SuppressionCommentFilter(); final List<?> tags1 = getTagsAfterExecution(suppressionCommentFilter, "filename1", " assertEquals("Invalid tags size", 1, tags1.size()); final List<?> tags2 = getTagsAfterExecution(suppressionCommentFilter, "filename2", "No comments in this file"); assertEquals("Invalid tags size", 0, tags2.size()); }
Source:
public void testPrintXpathInvalidXpath() throws Exception { exit.expectSystemExitWithStatus(-2); exit.checkAssertionAfterwards(() -> { final String exceptionFirstLine = "com.puppycrawl.tools.checkstyle.api." + "CheckstyleException: Error during xpath evaluation" + EOL; assertTrue("Unexpected system error log", systemErr.getLog().startsWith(exceptionFirstLine)); }); Main.main("--tree-branch-for-xpath", "\\/CLASS_DEF[./IDENT[@text='Two']] getPath("InputMainXPath.java")); }

Target:
public void testPrintXpathInvalidXpath() throws Exception { final String invalidXpath = "\\/CLASS_DEF[./IDENT[@text='Two']] final String filePath = getFilePath("InputMainXPath.java"); exit.expectSystemExitWithStatus(-2); exit.checkAssertionAfterwards(() -> { final String exceptionFirstLine = "com.puppycrawl.tools.checkstyle.api." + "CheckstyleException: Error during evaluation for xpath: " + invalidXpath + ", file: " + filePath + EOL; assertThat("Unexpected system error log", systemErr.getLog().startsWith(exceptionFirstLine), is(true)); }); Main.main("--branch-matching-xpath", invalidXpath, filePath); }
Source:
public NewPacketFormat(BasePeerNode pn, int ourInitialMsgID, int theirInitialMsgID) { this.pn = pn; startedByPrio = new ArrayList(DMT.NUM_PRIORITIES); for(int i = 0; i < DMT.NUM_PRIORITIES; i++) { startedByPrio.add(new HashMap()); } ourInitialMsgID = (ourInitialMsgID & 0x7FFFFFFF) % NUM_MESSAGE_IDS; theirInitialMsgID = (theirInitialMsgID & 0x7FFFFFFF) % NUM_MESSAGE_IDS; nextMessageID = ourInitialMsgID; messageWindowPtrAcked = ourInitialMsgID; messageWindowPtrReceived = theirInitialMsgID; }

Target:
NewPacketFormat(BasePeerNode pn, int ourInitialMsgID, int theirInitialMsgID) { this.pn = pn; startedByPrio = new ArrayList<>(DMT.NUM_PRIORITIES); for(int i = 0; i < DMT.NUM_PRIORITIES; i++) { startedByPrio.add(new HashMap<Integer, MessageWrapper>()); } ourInitialMsgID = (ourInitialMsgID & 0x7FFFFFFF) % NUM_MESSAGE_IDS; theirInitialMsgID = (theirInitialMsgID & 0x7FFFFFFF) % NUM_MESSAGE_IDS; nextMessageID = ourInitialMsgID; messageWindowPtrAcked = ourInitialMsgID; messageWindowPtrReceived = theirInitialMsgID; }
Source:
public ChangePackage getFragment(String proxyId, int fragmentIndex) { final List<AbstractChangePackage> fragments = proxyIdToChangePackageFragments.get(proxyId); if (fragments == null) { throw new IllegalStateException(Messages.ChangePackageFragmentProviderAdapter_NoFragmentsFound); } final AbstractChangePackage abstractChangePackage = fragments.get(fragmentIndex); if (FileBasedChangePackage.class.isInstance(abstractChangePackage)) { final FileBasedChangePackage cp = (FileBasedChangePackage) abstractChangePackage; return cp.toInMemoryChangePackage(); } return (ChangePackage) abstractChangePackage; }

Target:
public List<AbstractOperation> getFragment(String proxyId, int fragmentIndex) throws ESException { final Map<Integer, List<AbstractOperation>> fragments = proxyIdToChangePackageFragments.get(proxyId); if (fragments == null) { throw new ESException(Messages.ChangePackageFragmentProviderAdapter_NoFragmentsFound); } return fragments.get(fragmentIndex); }
Source:
public Collection<String> getProductSearchName() { if (aias != null) { return ActionableItems.getNames(aias); } return new ArrayList<String>(); }

Target:
public Collection<String> getProductSearchName() { if (aias != null) { return ActionableItems.getNames(aias); } return Collections.emptyList(); }
Source:
public void setup() { functionManager = createTestMetadataManager().getFunctionManager(); subfieldExtractor = new SubfieldExtractor(new FunctionResolution(functionManager), new NoopExpressionOptimizer(), TestingSession.SESSION); }

Target:
public void setup() { functionManager = createTestMetadataManager().getFunctionManager(); subfieldExtractor = new SubfieldExtractor( new FunctionResolution(functionManager), (rowExpression, level, session) -> rowExpression, TestingSession.SESSION); }
Source:
private void setTvSubTitle() { Log.d("gouri", "setTvSubTitle: in uploadfragments"); final Activity activity = getActivity(); if (activity instanceof UploadActivity) { final boolean isMultipleFileSelected = ((UploadActivity) activity).getIsMultipleItemSelected(); if (!isMultipleFileSelected) { tvSubTitle.setVisibility(View.GONE); } } }

Target:
private void setTvSubTitle() { final Activity activity = getActivity(); if (activity instanceof UploadActivity) { final boolean isMultipleFileSelected = ((UploadActivity) activity).getIsMultipleFilesSelected(); if (!isMultipleFileSelected) { tvSubTitle.setVisibility(View.GONE); } } }
Source:
public Optional<ReplicaView> select(TopicPartition topicPartition, ClientMetadata clientMetadata, PartitionView partitionView) { if (clientMetadata.rackId != null && !clientMetadata.rackId.isEmpty()) { Set<ReplicaView> sameRackReplicas = partitionView.replicas().stream() .filter(replicaInfo -> clientMetadata.rackId.equalsIgnoreCase(replicaInfo.endpoint().rack())) .collect(Collectors.toSet()); if (sameRackReplicas.isEmpty()) { return partitionView.leader(); } else { Optional<ReplicaView> leader = partitionView.leader().filter(sameRackReplicas::contains); if (leader.isPresent()) { return leader; } else { PartitionView sameRackPartition = new PartitionView() { @Override public Set<ReplicaView> replicas() { return sameRackReplicas; } @Override public Optional<ReplicaView> leader() { return partitionView.leader(); } }; return tieBreaker.select(topicPartition, clientMetadata, sameRackPartition); } } } else { return partitionView.leader(); } }

Target:
public Optional<ReplicaView> select(TopicPartition topicPartition, ClientMetadata clientMetadata, PartitionView partitionView) { if (clientMetadata.rackId() != null && !clientMetadata.rackId().isEmpty()) { Set<ReplicaView> sameRackReplicas = partitionView.replicas().stream() .filter(replicaInfo -> clientMetadata.rackId().equals(replicaInfo.endpoint().rack())) .collect(Collectors.toSet()); if (sameRackReplicas.isEmpty()) { return Optional.of(partitionView.leader()); } else { if (sameRackReplicas.contains(partitionView.leader())) { return Optional.of(partitionView.leader()); } else { return sameRackReplicas.stream().max(ReplicaView.comparator()); } } } else { return Optional.of(partitionView.leader()); } }
Source:
public void execute(IProgressMonitor monitor) throws CoreException { Git repoTree; if (resources == null) { throw new CoreException(new Status(IStatus.ERROR, Activator .getPluginId(), CoreText.OperationAlreadyExecuted)); } if (resources.length > 0) { if (paths != null) { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().setPaths(paths).call(); } } else { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().call(); } } } }

Target:
public void execute(IProgressMonitor monitor) throws CoreException { Git repoTree; Repository repo = getRepository(res); if (repo == null) continue; repoTree = new Git(repo); if (paths != null) { repoTree.clean().setPaths(paths).call(); } else { repoTree.clean().call(); } }
Source:
default String getApiVersion() { final Class<? extends HasMetadata> clazz = getClass(); final ApiGroup group = clazz.getAnnotation(ApiGroup.class); if (group != null) { final ApiVersion version = clazz.getAnnotation(ApiVersion.class); return group.value() + "/" + version.value(); } return null; }

Target:
default String getApiVersion() { return getApiVersion(getClass()); }
Source:
private void collectPluginCapabilities(Map<String, CapabilityInfo> output) { for (String pluginName : pluginCapabilities.plugins()) { if (!isPluginNameSane(pluginName)) { log.warn(String.format("Plugin name is not sane: <%s> " + "dropping all plugin owned capabilities; " + "consider changing the plugin filename.", pluginName)); continue; } for (Map.Entry<String, Provider<CapabilityDefinition>> entry : pluginCapabilities.byPlugin(pluginName).entrySet()) { String id = String.format("%s-%s", pluginName, entry.getKey()); output.put(id, new CapabilityInfo( id, entry.getValue().get().getDescription())); } } }

Target:
private void collectPluginCapabilities(Map<String, CapabilityInfo> output) { for (String pluginName : pluginCapabilities.plugins()) { if (!isPluginNameSane(pluginName)) { log.warn(String.format( "Plugin name %s must match [A-Za-z0-9-]+ to use capabilities;" + " rename the plugin", pluginName)); continue; } for (Map.Entry<String, Provider<CapabilityDefinition>> entry : pluginCapabilities.byPlugin(pluginName).entrySet()) { String id = String.format("%s-%s", pluginName, entry.getKey()); output.put(id, new CapabilityInfo( id, entry.getValue().get().getDescription())); } } }
Source:
public Set<String> getAddOns() { return addOns; }

Target:
public SetView<String> getAddOns() { return this.addOns != null ? new SetView<>(this.addOns) : null; }
Source:
public List<AgentBatchResponseItem> processRequests(List<BaragonRequestBatchItem> batch) throws InterruptedException { Map<String, Optional<BaragonRequest>> requests = new HashMap<>(); Map<String, Collection<UpstreamInfo>> existingUpstreamsForThisBatch = batch.stream() .map(requestItem -> { final Optional<BaragonRequest> maybeRequest = requestDatastore.getRequest(requestItem.getRequestId()); requests.put(requestItem.getRequestId(), maybeRequest); Optional<BaragonService> oldService; if (maybeRequest.isPresent()) { oldService = getOldService(maybeRequest.get()); } else { oldService = Optional.absent(); } return oldService; }) .filter(Optional::isPresent) .map(Optional::get) .distinct() .collect(Collectors.toMap(BaragonService::getServiceId, service -> { try { return stateDatastore.getUpstreams(service.getServiceId()); } catch (Exception e) { LOG.warn("Unable to get upstream information for service {}", service.getServiceId(), e); return new ArrayList<>(); } })); List<AgentBatchResponseItem> responses = new ArrayList<>(batch.size()); int i = 0; for (BaragonRequestBatchItem item : batch) { boolean isLast = i == batch.size() - 1; responses.add(getResponseItem(processRequest(item.getRequestId(), requests.get(item.getRequestId()), existingUpstreamsForThisBatch, actionForBatchItem(item), !isLast, Optional.of(i)), item)); i++; } return responses; }

Target:
public List<AgentBatchResponseItem> processRequests(List<BaragonRequestBatchItem> batch) throws InterruptedException { Map<String, Optional<BaragonRequest>> requests = new HashMap<>(); Map<String, Optional<BaragonService>> services = new HashMap<>(); Map<String, Long> numRequestsByService = batch.stream() .map(requestItem -> { final Optional<BaragonRequest> maybeRequest = requestDatastore.getRequest(requestItem.getRequestId()); requests.put(requestItem.getRequestId(), maybeRequest); Optional<BaragonService> oldService = Optional.absent(); if (maybeRequest.isPresent()) { oldService = services.getOrDefault(maybeRequest.get().getLoadBalancerService().getServiceId(), getOldService(maybeRequest.get())); services.put(maybeRequest.get().getLoadBalancerService().getServiceId(), oldService); } return oldService; }) .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.groupingBy(BaragonService::getServiceId, Collectors.counting())); LOG.debug("Requests in this batch by service: {}", numRequestsByService); Map<String, Collection<UpstreamInfo>> existingUpstreamsForThisBatch = numRequestsByService.keySet().stream() .collect(Collectors.toMap(Function.identity(), serviceId -> { try { return stateDatastore.getUpstreams(serviceId); } catch (Exception e) { LOG.warn("Unable to get upstream information for service {}", serviceId, e); throw new RuntimeException("Unable to get upstream information for service {}", e); } })); List<AgentBatchResponseItem> responses = new ArrayList<>(batch.size()); int i = 0; for (BaragonRequestBatchItem item : batch) { boolean isLast = i == batch.size() - 1; responses.add(getResponseItem(processRequest(item.getRequestId(), existingUpstreamsForThisBatch, services, requests, actionForBatchItem(item), !isLast, Optional.of(i)), item)); i++; } return responses; }
Source:
public void setFactors(List<String> factors) throws Throwable { if ((sourceImmutablePolicy == null) || !(sourceImmutablePolicy instanceof FactorsPolicy)) { throw new Throwable("Source Policy is not of type factors policy cannot add factors"); } boolean inherence = false; boolean possession = false; boolean knowledge = false; for (String factor : factors) { if (factor.equals("KNOWLEDGE")) { knowledge = true; } if (factor.equals("INHERENCE")) { inherence = true; } if (factor.equals("POSSESSION")) { possession = true; } } sourceImmutablePolicy = new FactorsPolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), sourceImmutablePolicy.getFences(), inherence, knowledge, possession); }

Target:
public void setFactors(List<String> factors) throws Throwable { if ((sourceImmutablePolicy == null) || !(sourceImmutablePolicy instanceof FactorsPolicy)) { throw new Throwable("Source Policy is not of type factors policy and thus cannot add factors"); } boolean inherence = false; boolean possession = false; boolean knowledge = false; for (String factor : factors) { if (factor.equals("KNOWLEDGE")) { knowledge = true; } if (factor.equals("INHERENCE")) { inherence = true; } if (factor.equals("POSSESSION")) { possession = true; } } sourceImmutablePolicy = new FactorsPolicy(sourceImmutablePolicy.getDenyRootedJailbroken(), sourceImmutablePolicy.getDenyEmulatorSimulator(), sourceImmutablePolicy.getFences(), inherence, knowledge, possession); }
Source:
public SCryptPasswordEncoder() { this(new String(KeyGenerators.secureRandom().generateKey()), 16384, 8, 1); }

Target:
public SCryptPasswordEncoder() { this(16384, 8, 1, 32, 64); }
Source:
public boolean equals(Plane a){ if((this.name).equals(a.name) && (this.airport).equals(a.airport)){ return true; } else return false; }

Target:
public boolean equals(Plane a){ return (this.name).equals(a.name) && (this.airport).equals(a.airport); }