auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void add(String... searchStrings) { if (searchStrings != null) { for (String searchString : searchStrings) { if (searchString == null || searchString.isEmpty()) { return; } Node node= root; for (char c : searchString.toCharArray()) { node= node.add(c); } node.match= searchString; } } }

Target:
private void add(String... searchStrings) { if (searchStrings != null) { for (String searchString : searchStrings) { if (searchString == null || searchString.isEmpty()) { continue; } Node node= root; for (char c : searchString.toCharArray()) { node= node.add(c); } node.match= searchString; } } }
Source:
public JSONMetricsContainer(String tenantId, List<JSONMetric> metrics) { this.tenantId = tenantId; this.jsonMetrics = metrics; }

Target:
public JSONMetricsContainer(String tenantId, List<JSONMetric> metrics) { this.tenantId = tenantId; this.jsonMetrics = metrics; processJson(); }
Source:
static String safeName(String name) { if (name == null) { return null; } boolean prevCharIsUnderscore = false; StringBuilder safeNameBuilder = new StringBuilder(name.length()); if (!name.isEmpty() && Character.isDigit(name.charAt(0))) { safeNameBuilder.append("l"); } for (char nameChar : name.toCharArray()) { boolean isUnsafeChar = !(Character.isLetterOrDigit(nameChar) || nameChar == ':' || nameChar == '_'); if ((isUnsafeChar || nameChar == '_')) { if (prevCharIsUnderscore) { continue; } else { safeNameBuilder.append("_"); prevCharIsUnderscore = true; } } else { safeNameBuilder.append(nameChar); prevCharIsUnderscore = false; } } return safeNameBuilder.toString(); }

Target:
static String safeName(String name) { if (name == null) { return null; } boolean prevCharIsUnderscore = false; StringBuilder safeNameBuilder = new StringBuilder(name.length()); if (!name.isEmpty() && Character.isDigit(name.charAt(0))) { safeNameBuilder.append("_"); } for (char nameChar : name.toCharArray()) { boolean isUnsafeChar = !(Character.isLetterOrDigit(nameChar) || nameChar == ':' || nameChar == '_'); if ((isUnsafeChar || nameChar == '_')) { if (prevCharIsUnderscore) { continue; } else { safeNameBuilder.append("_"); prevCharIsUnderscore = true; } } else { safeNameBuilder.append(nameChar); prevCharIsUnderscore = false; } } return safeNameBuilder.toString(); }
Source:
CloudBigtableConnectionPool(ExecutorService executorService) { this.connectionStartupExecutor = executorService; }

Target:
CloudBigtableConnectionPool(ExecutorService executorService) { this.connectionCloseExecutor = executorService; }
Source:
public void addAttribute(ICPPASTAttribute attribute) { attributes = ArrayUtil.append(attributes, attribute); }

Target:
public void addAttribute(ICPPASTAttribute attribute) { assertNotFrozen(); attributes = ArrayUtil.append(attributes, attribute); }
Source:
private byte[] getByteArray() { if ( data.hasArray() ) { return data.array(); } else { byte[] arr = new byte[data.capacity()]; int originalPosition = data.position(); int originalLimit = data.limit(); data.get( arr, 0, data.limit() ); data.position( originalPosition ); data.limit( originalLimit ); return arr; } }

Target:
private byte[] getByteArray() { byte[] arr = new byte[data.capacity()]; int originalPosition = data.position(); int originalLimit = data.limit(); data.get( arr, 0, data.limit() ); data.position( originalPosition ); data.limit( originalLimit ); return arr; }
Source:
public void testOutOfOrderStack() throws Exception { mApp = new MockApp("/session-tests-template/"); SessionWrapper session = mApp.getSession(); Assert.assertEquals(SessionFrame.STATE_COMMAND_ID, session.getNeededData()); session.setCommand("m0"); Assert.assertEquals(SessionFrame.STATE_COMMAND_ID, session.getNeededData()); session.setCommand("m0-f3"); session.setDatum("case_id", "case_id_value"); session.setDatum("usercase_id", "usercase_id_value"); Assert.assertEquals(SessionFrame.STATE_DATUM_COMPUTED, session.getNeededData()); Assert.assertEquals("case_id_new_visit_0", session.getNeededDatum().getDataId()); }

Target:
public void testOutOfOrderStack() throws Exception { mApp = new MockApp("/session-tests-template/"); SessionWrapper session = mApp.getSession(); Assert.assertEquals(SessionFrame.STATE_COMMAND_ID, session.getNeededData()); session.setCommand("m0"); Assert.assertEquals(SessionFrame.STATE_COMMAND_ID, session.getNeededData()); session.setCommand("m0-f3"); session.setDatum("case_id", "case_id_value"); session.setDatum("usercase_id", "usercase_id_value"); Assert.assertEquals(SessionFrame.STATE_DATUM_COMPUTED, session.getNeededData()); Assert.assertEquals("case_id_new_visit_0", session.getNeededDatum().getDataId()); session.setDatum("case_id_new_visit_0", "visit_id_value"); Assert.assertEquals(null, session.getNeededData()); }
Source:
public Table get_table(final String dbname, final String name) throws MetaException, NoSuchObjectException { String[] parsedDbName = parseDbName(dbname, conf); return getTableInternal( parsedDbName[CAT_NAME], parsedDbName[DB_NAME], name, null, null, false, null); }

Target:
public Table get_table(final String dbname, final String name) throws MetaException, NoSuchObjectException { String[] parsedDbName = parseDbName(dbname, conf); return getTableInternal( parsedDbName[CAT_NAME], parsedDbName[DB_NAME], name, null, null, false, null, null, null); }
Source:
public Collection<URI> getDependencies(URI uri) { Set<URI> uris = new LinkedHashSet<URI>(); uris.add(uri); for (DependencyProviderDescriptor descriptor : registeredDescriptors.values()) { IDependencyProvider provider = descriptor.getDependencyProvider(); if (provider != null && provider.apply(uri)) { Collection<URI> dependencies = provider.getDependencies(uri); if (dependencies != null) { uris.addAll(dependencies); } } } return uris; }

Target:
public Collection<URI> getDependencies(URI uri) { Set<URI> uris = new LinkedHashSet<URI>(); uris.add(uri); for (DependencyProviderDescriptor descriptor : registeredDescriptors.values()) { IDependencyProvider provider = descriptor.getDependencyProvider(); if (provider != null && provider.apply(uri)) { Collection<URI> dependencies = provider.getDependencies(uri); if (dependencies != null) { addAll(uris, Iterables.filter(dependencies, notNull())); } } } return uris; }
Source:
public UpdateCalibrationResponse putBatchForceCalibration(@Auth final AccessToken accessToken, final List<Calibration> calibrations) { if (calibrations.size() > CalibrationDynamoDB.MAX_PUT_FORCE_SIZE){ throw new WebApplicationException(Response.status(400).entity(new JsonError(400, String.format("Batch size shhould be less than %s", CalibrationDynamoDB.MAX_PUT_FORCE_SIZE))).build()); } final Map<String, Boolean> putBatchForceResponse = calibrationDAO.putBatchForce(calibrations); return UpdateCalibrationResponse.createFromPutBatchForceResponse(putBatchForceResponse); }

Target:
public UpdateCalibrationResponse putBatchForceCalibration(@Auth final AccessToken accessToken, final List<Calibration> calibrations) { if (calibrations.size() > CalibrationDynamoDB.MAX_PUT_FORCE_SIZE){ throw new WebApplicationException(Response.status(400).entity(new JsonError(400, String.format("Batch size should be less than %s", CalibrationDynamoDB.MAX_PUT_FORCE_SIZE))).build()); } final Map<String, Boolean> putBatchForceResponse = calibrationDAO.putBatchForce(calibrations); return UpdateCalibrationResponse.createFromPutBatchForceResponse(putBatchForceResponse); }
Source:
private SMREntryList next(OpaqueStreamIterator stream) { List<SMREntry> smrList = new ArrayList<>(); int currentMsgSize = 0; try { while (currentMsgSize < maxDataSizePerMsg) { if (lastEntry != null) { List<SMREntry> smrEntries = lastEntry.getEntries().get(stream.uuid); if (smrEntries != null) { int currentEntrySize = calculateSize(smrEntries); if (currentEntrySize > DEFAULT_LOG_REPLICATION_DATA_MSG_SIZE) { log.error("The current entry size is bigger than the maxDataSizePerMsg supported", currentEntrySize, DEFAULT_LOG_REPLICATION_DATA_MSG_SIZE); } else if (currentEntrySize > maxDataSizePerMsg) { log.warn("The current entry size is bigger than the configured maxDataSizePerMsg {}", currentEntrySize, maxDataSizePerMsg); } if (currentEntrySize + currentMsgSize > maxDataSizePerMsg && currentMsgSize != 0) { break; } smrList.addAll(smrEntries); currentMsgSize += currentEntrySize; stream.maxVersion = Math.max(stream.maxVersion, lastEntry.getVersion()); } lastEntry = null; } if (stream.iterator.hasNext()) { lastEntry = (OpaqueEntry) stream.iterator.next(); } if (lastEntry == null) { break; } } } catch (TrimmedException e) { log.error("Catch an TrimmedException exception ", e); throw e; } log.trace("CurrentMsgSize lastEntrySize maxDataSizePerMsg {}", currentMsgSize, lastEntry == null ? 0 : calculateSize(lastEntry.getEntries().get(stream.uuid)), maxDataSizePerMsg); return new SMREntryList(currentMsgSize, smrList); }

Target:
private SMREntryList next(OpaqueStreamIterator stream) { List<SMREntry> smrList = new ArrayList<>(); int currentMsgSize = 0; try { while (currentMsgSize < maxDataSizePerMsg) { if (lastEntry != null) { List<SMREntry> smrEntries = lastEntry.getEntries().get(stream.uuid); if (smrEntries != null) { int currentEntrySize = ReaderUtility.calculateSize(smrEntries); if (currentEntrySize > MAX_DATA_MSG_SIZE_SUPPORTED) { log.error("The current entry size is bigger than the maxDataSizePerMsg supported", currentEntrySize, MAX_DATA_MSG_SIZE_SUPPORTED); throw new IllegalSnapshotEntrySizeException(" The snapshot entry is bigger than the system supported"); } else if (currentEntrySize > maxDataSizePerMsg) { observeBiggerMsg.setValue(observeBiggerMsg.getValue()+1); log.warn("The current entry size is bigger than the configured maxDataSizePerMsg {}", currentEntrySize, maxDataSizePerMsg); } if (currentEntrySize + currentMsgSize > maxDataSizePerMsg && currentMsgSize != 0) { break; } smrList.addAll(smrEntries); currentMsgSize += currentEntrySize; stream.maxVersion = Math.max(stream.maxVersion, lastEntry.getVersion()); } lastEntry = null; } if (stream.iterator.hasNext()) { lastEntry = (OpaqueEntry) stream.iterator.next(); } if (lastEntry == null) { break; } } } catch (TrimmedException e) { log.error("Catch an TrimmedException exception ", e); throw e; } log.trace("CurrentMsgSize lastEntrySize maxDataSizePerMsg {}", currentMsgSize, lastEntry == null ? 0 : ReaderUtility.calculateSize(lastEntry.getEntries().get(stream.uuid)), maxDataSizePerMsg); return new SMREntryList(currentMsgSize, smrList); }
Source:
public Bitmap createImage() { Bitmap resultBitmap = drawBackground(leadImageBitmap, leadImageFocusY); Canvas canvas = new Canvas(resultBitmap); final int gradientStartColor = 0x20000000; final int gradientStopColor = 0x60000000; Shader shader = new LinearGradient(0, 0, 0, canvas.getHeight(), gradientStartColor, gradientStopColor, Shader.TileMode.CLAMP); Paint paint = new Paint(); paint.setShader(shader); canvas.drawRect(new Rect(0, 0, canvas.getWidth(), canvas.getHeight()), paint); Layout textLayout = drawTextSnippet(canvas, textSnippet); isArticleRTL = textLayout.getParagraphDirection(0) == Layout.DIR_RIGHT_TO_LEFT; int top = drawLicenseIcons(canvas, context); if (!TextUtils.isEmpty(description)) { top = drawDescription(canvas, description, top); } drawTitle(canvas, title, top); drawWordmark(canvas, context); return resultBitmap; }

Target:
public Bitmap createImage() { Bitmap resultBitmap = drawBackground(leadImageBitmap, leadImageFocusY); Canvas canvas = new Canvas(resultBitmap); if (leadImageBitmap != null) { drawGradient(canvas); } Layout textLayout = drawTextSnippet(canvas, textSnippet); isArticleRTL = textLayout.getParagraphDirection(0) == Layout.DIR_RIGHT_TO_LEFT; int top = drawLicenseIcons(canvas, context); if (!TextUtils.isEmpty(description)) { top = drawDescription(canvas, description, top); } drawTitle(canvas, title, top); drawWordmark(canvas, context); return resultBitmap; }
Source:
public boolean isHostControllerStarted() { try { ModelNode address = new ModelNode(); address.add("host", configuration.getHostName()); ControlledProcessState.State status = Enum.valueOf(ControlledProcessState.State.class, readAttribute("host-state", address).asString().toUpperCase(Locale.ENGLISH)); log.warning("status: " + status); return status == ControlledProcessState.State.RUNNING; } catch (Exception ignored) { log.severe(ignored.getLocalizedMessage()); } return false; }

Target:
public boolean isHostControllerStarted() { try { ModelNode address = new ModelNode(); address.add("host", configuration.getHostName()); ControlledProcessState.State status = Enum.valueOf(ControlledProcessState.State.class, readAttribute("host-state", address).asString().toUpperCase(Locale.ENGLISH)); return status == ControlledProcessState.State.RUNNING; } catch (Exception ignored) { } return false; }
Source:
public Map<String, String> labelsToNames(Map<String, String> labels) { Map<String, String> names = new HashMap<>(); for (Map.Entry<String, String> entry : labels.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (value == null) { continue; } if (!key.startsWith(CHE_SERVER_LABEL_PREFIX)) { LOG.warn("Expected CreateContainerParams label key " + entry.getKey() + " to start with " + CHE_SERVER_LABEL_PREFIX); } else if (key.contains(".") || key.contains("_") || value.contains("_")) { LOG.error(String.format("Cannot convert label %s to DNS Name: " + "'-' and '.' are used as escape characters", entry.toString())); continue; } key = key.replaceAll(":", ".").replaceAll("/", "_"); value = value.replaceAll("/", "_"); key = String.format(CHE_SERVER_LABEL_PADDING, key); value = String.format(CHE_SERVER_LABEL_PADDING, value); if (!key.matches(KUBERNETES_ANNOTATION_REGEX) || !value.matches(KUBERNETES_ANNOTATION_REGEX)) { LOG.error(String.format("Could not convert label %s into Kubernetes annotation: " + "labels must be alphanumeric with ':' and '/'", entry.toString())); continue; } names.put(key, value); } return names; }

Target:
public Map<String, String> labelsToNames(Map<String, String> labels) { Map<String, String> names = new HashMap<>(); for (Map.Entry<String, String> label : labels.entrySet()) { if (!hasConversionProblems(label)) { String key = label.getKey(); String value = label.getValue(); key = convertLabelKey(key); value = convertLabelValue(value); key = addPadding(key); value = addPadding(value); if (matchesKubernetesLabelRegex(key) && matchesKubernetesLabelRegex(value)) { names.put(key, value); } else { LOG.error( "Could not convert label into Kubernetes annotation: labels must be alphanumeric with ':' and '/'", label.toString()); } } } return names; }
Source:
protected void checkBounds( PageCursor cursor ) { if ( cursor.checkAndClearBoundsFlag() ) { throw new IllegalStateException(); } }

Target:
protected void checkBounds( PageCursor cursor ) { if ( cursor.checkAndClearBoundsFlag() ) { throw new IllegalStateException( String.format( "Cursor %s access out of bounds, page id %d, offset %d", cursor.toString(), cursor.getCurrentPageId(), cursor.getOffset() ) ); } }
Source:
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (!enabled) { return super.setBlock(location, block); } BlockState existing = getBlock(location); int priority = getPlacementPriority(block); int srcPriority = getPlacementPriority(existing); if (srcPriority == 1 || srcPriority == 2) { super.setBlock(location, BlockTypes.AIR.getDefaultState()); return super.setBlock(location, block); } stages.get(priority).add(location, block); return !existing.equalsFuzzy(block); }

Target:
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (!enabled) { return super.setBlock(location, block); } BlockState existing = getBlock(location); PlacementPriority priority = getPlacementPriority(block); PlacementPriority srcPriority = getPlacementPriority(existing); if (srcPriority != PlacementPriority.FIRST) { BlockStateHolder replacement = block.getBlockType().getMaterial().isAir() ? block : BlockTypes.AIR.getDefaultState(); switch (srcPriority) { case FINAL: stages.get(PlacementPriority.CLEAR_FINAL).add(location, replacement); break; case LATE: stages.get(PlacementPriority.CLEAR_LATE).add(location, replacement); break; case LAST: stages.get(PlacementPriority.CLEAR_LAST).add(location, replacement); break; } if (block.getBlockType().getMaterial().isAir()) { return !existing.equalsFuzzy(block); } } stages.get(priority).add(location, block); return !existing.equalsFuzzy(block); }
Source:
protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { if (out.isDirect() && out.order() == ByteOrder.BIG_ENDIAN) { IconvProvider.release(iconv_tPointer); this.iconv_tPointer = IconvProvider.initConversion(((IconvCharset) charset()).getIconvName(), "UTF-16BE"); if (this.iconv_tPointer < 10) { return CoderResult.malformedForLength(1); } } IconvResult result = IconvProvider.decode(iconv_tPointer, in, out); switch (result.getResultCode()) { case OUTPUT_BUFFER_TOO_SMALL: return CoderResult.OVERFLOW; case ILLEGAL_SEQUENCE: return CoderResult.unmappableForLength(result.getBytesWrittenFromSource()); case INCOMPLETE_SEQUENCE: return CoderResult.malformedForLength(result.getBytesWrittenFromSource()); case WEIRD_ERROR: return CoderResult.malformedForLength(1); default: break; } return CoderResult.UNDERFLOW; }

Target:
protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { allocateContentDescriptor(out.isDirect(), out.order()); IconvResult result = IconvProvider.decode(iconv_tPointer, in, out); int bytesFromSource = result.getBytesReadFromSource(); switch (result.getResultCode()) { case CONVERSION_OK: return CoderResult.UNDERFLOW; case OUTPUT_BUFFER_TOO_SMALL: return CoderResult.OVERFLOW; case ILLEGAL_SEQUENCE: return CoderResult.unmappableForLength(bytesFromSource); case INCOMPLETE_SEQUENCE: return CoderResult.UNDERFLOW; default: throw new IllegalStateException(); } }
Source:
static void populateKiePMMLFieldOperatorValueListWithSimplePredicates(final List<KiePMMLFieldOperatorValue> toPopulate, final CompoundPredicate.BooleanOperator booleanOperator, final Map<String, List<SimplePredicate>> predicatesByField, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap) { switch (booleanOperator) { case AND: predicatesByField.forEach((fieldName, predicates) -> toPopulate.add(getConstraintEntryFromSimplePredicates(fieldName, "&&", predicates, fieldTypeMap))); break; case OR: predicatesByField.forEach((fieldName, predicates) -> toPopulate.add(getConstraintEntryFromSimplePredicates(fieldName, "||", predicates, fieldTypeMap))); break; default: throw new IllegalStateException(String.format("CompoundPredicate.booleanOperator should never be %s at this point", booleanOperator)); } }

Target:
static void populateKiePMMLFieldOperatorValueListWithSimplePredicates(final List<KiePMMLFieldOperatorValue> toPopulate, final CompoundPredicate.BooleanOperator booleanOperator, final Map<String, List<SimplePredicate>> predicatesByField, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap) { switch (booleanOperator) { case AND: predicatesByField.forEach((fieldName, predicates) -> toPopulate.add(getConstraintEntryFromSimplePredicates(fieldName, BOOLEAN_OPERATOR.AND, predicates, fieldTypeMap))); break; case OR: predicatesByField.forEach((fieldName, predicates) -> toPopulate.add(getConstraintEntryFromSimplePredicates(fieldName, BOOLEAN_OPERATOR.OR, predicates, fieldTypeMap))); break; default: throw new IllegalStateException(String.format("CompoundPredicate.booleanOperator should never be %s at this point", booleanOperator)); } }
Source:
public void inflateSubmissionDate() { mfDatePicker = MFDatePicker.newInsance(this); tvSubmittedonDate.setText(MFDatePicker.getDatePickedAsString()); tvSubmittedonDate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { issubmittedDate = true; mfDatePicker.show(getActivity().getSupportFragmentManager(), FragmentConstants .DFRAG_DATE_PICKER); } }); }

Target:
public void inflateSubmissionDate() { mfDatePicker = MFDatePicker.newInsance(this); tvSubmittedonDate.setText(MFDatePicker.getDatePickedAsString()); }
Source:
private ListenableFuture<ResultSet> selectPeersFuture(final Connection connection) { String query = cluster.configuration.getProtocolOptions().isAllowHostPortDiscovery() ? SELECT_PEERS_V2 : SELECT_PEERS; DefaultResultSetFuture peersFuture = new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(query)); connection.write(peersFuture); return peersFuture; }

Target:
private ListenableFuture<ResultSet> selectPeersFuture(final Connection connection) { if (isPeersV2) { DefaultResultSetFuture peersV2Future = new DefaultResultSetFuture( null, cluster.protocolVersion(), new Requests.Query(SELECT_PEERS_V2)); connection.write(peersV2Future); final SettableFuture<ResultSet> peersFuture = SettableFuture.create(); GuavaCompatibility.INSTANCE.addCallback( peersV2Future, new FutureCallback<ResultSet>() { @Override public void onSuccess(ResultSet result) { peersFuture.set(result); } @Override public void onFailure(Throwable t) { if (t instanceof InvalidQueryException) { isPeersV2 = false; MoreFutures.propagateFuture(peersFuture, selectPeersFuture(connection)); } else { peersFuture.setException(t); } } }); return peersFuture; } else { DefaultResultSetFuture peersFuture = new DefaultResultSetFuture( null, cluster.protocolVersion(), new Requests.Query(SELECT_PEERS)); connection.write(peersFuture); return peersFuture; } }
Source:
private Request.Builder setupRequest(HttpUrl requestUri, String path, RequestParameters params) { if ( path == null ) throw new IllegalArgumentException("path cannot be null"); if ( path.startsWith("/") ) path = path.substring(1); HttpUrl.Builder uri = requestUri.resolve(path).newBuilder(); if ( params != null ) { for ( String key : params.keySet() ) { for ( String value : params.get(key) ) { uri.addQueryParameter(key, value); } } } if ( database != null && ! path.startsWith("config/") ) { uri.addQueryParameter("database", database); } Request.Builder request = new Request.Builder() .url(uri.build()); if(headerValue!=null && headerValue.length()!=0) { String samlHeaderValue = "Authorization: SAML token="+ headerValue; request = request.header(HEADER_AUTHORIZATION, samlHeaderValue); } return request; }

Target:
private Request.Builder setupRequest(HttpUrl requestUri, String path, RequestParameters params) { if ( path == null ) throw new IllegalArgumentException("path cannot be null"); if ( path.startsWith("/") ) path = path.substring(1); HttpUrl.Builder uri = requestUri.resolve(path).newBuilder(); if ( params != null ) { for ( String key : params.keySet() ) { for ( String value : params.get(key) ) { uri.addQueryParameter(key, value); } } } if ( database != null && ! path.startsWith("config/") ) { uri.addQueryParameter("database", database); } Request.Builder request = new Request.Builder() .url(uri.build()); return request; }
Source:
public SpecializedSignature getSpecializedSignature() { SpecializedSignature specializedSignature = new SpecializedSignature( signature, argumentNativeContainerTypes, specializedTypeParameters, returnNativeContainerType); return specializedSignature; }

Target:
SpecializedSignature getSpecializedSignature() { return new SpecializedSignature( signature, argumentNativeContainerTypes, specializedTypeParameters, returnNativeContainerType); }
Source:
private boolean needsExtendsDecomposing(Node classNode) { checkArgument(classNode.isClass()); if (classNode.getSecondChild().isEmpty() || classNode.getSecondChild().isQualifiedName()) { return false; } Node ancestor = classNode.getParent(); switch (ancestor.getToken()) { case RETURN: ancestor = ancestor.getParent(); break; case NAME: if (ancestor.getParent() != null && NodeUtil.isNameDeclaration(ancestor.getParent()) && ancestor.getParent().hasOneChild()) { ancestor = ancestor.getGrandparent(); } break; case ASSIGN: if (classNode.getPrevious() != null && ancestor.getParent() != null && ancestor.getParent().isExprResult()) { ancestor = ancestor.getGrandparent(); } break; } if (NodeUtil.isStatementParent(ancestor)) { return true; } return false; }

Target:
private boolean needsExtendsDecomposing(Node classNode) { checkArgument(classNode.isClass()); if (classNode.getSecondChild().isEmpty() || classNode.getSecondChild().isQualifiedName()) { return false; } return true; }
Source:
private VenueDTO adapt(Venue venue) { if (venue == null) { return DefaultVenueDTO(); } List<VenueNameInformationDTO> nameInformationDTOs = Lists.newArrayList(); for (VenueNameInformation info : venue.nameInformation) { nameInformationDTOs.add(new VenueNameInformationDTO(info.nameInformation, info.language.code)); } return new VenueDTO(venue.group.name, venue.type.name, nameInformationDTOs); }

Target:
private VenueDTO adapt(Venue venue) { List<VenueNameDTO> names = Lists.newArrayList(); for (VenueName info : venue.names) { names.add(new VenueNameDTO(info.name, info.language.code)); } return new VenueDTO(venue.group.name, venue.type.name, names); }
Source:
public void setColumn(Function<T, Comparable<?>> column, int idx) { this.func = column; if (idx == this.propertyIndex) { direction = Direction.getDirection(1 - direction.ordinal()); } else { this.propertyIndex = idx; direction = Direction.DESCENDING; } }

Target:
public void setColumn(Function<T, Comparable<?>> column, int idx) { this.func = column; if (idx == this.propertyIndex) { direction = Direction.toggle(direction); } else { this.propertyIndex = idx; direction = Direction.DESCENDING; } }
Source:
synchronized SchedulerState getState(boolean myJobsOnly) throws NotConnectedException, PermissionException { checkPermission("getState", "You do not have permission to get the state !"); ListeningUser ui = identifications .get(PAActiveObject.getContext().getCurrentRequest().getSourceBodyID()); return myJobsOnly ? sState.filterOnUser(ui.getUser().getUsername()) : sState; }

Target:
synchronized SchedulerState getState(boolean myJobsOnly) throws NotConnectedException, PermissionException { checkPermission("getState", YOU_DO_NOT_HAVE_PERMISSION_TO_GET_THE_STATE); ListeningUser ui = identifications .get(PAActiveObject.getContext().getCurrentRequest().getSourceBodyID()); return myJobsOnly ? sState.filterOnUser(ui.getUser().getUsername()) : sState; }
Source:
public void sendData(String metricId, RawDataPackageProtos.RawDataPackage metricData) { String messageKey = nodeName + KAFKA_KEY_SEPARATOR + metricId + KAFKA_KEY_SEPARATOR + sentMetricsCounter.getAndIncrement(); ProducerRecord<String, byte[]> producerRecord = new ProducerRecord<>(kafkaTopic, messageKey, metricData.toByteArray()); kafkaProducer.send(producerRecord, (metadata, exception) -> { if (exception == null) LOGGER.debug("Sent: nodeName = {}, metricId = {}, offset = {}", nodeName, metricId, metadata.offset()); else LOGGER.error("Exception on sending message.", exception); }); }

Target:
public void sendData(String metricId, RawDataPackageProtos.RawDataPackage metricData) { String messageKey = nodeName + KAFKA_KEY_SEPARATOR + metricId + KAFKA_KEY_SEPARATOR + sentMetricsCounter.getAndIncrement(); ProducerRecord<String, byte[]> producerRecord = new ProducerRecord<>(kafkaTopic, messageKey, metricData.toByteArray()); kafkaProducer.send(producerRecord, (metadata, exception) -> { LOGGER.debug("Sent: nodeName = {}, metricId = {}, offset = {}", nodeName, metricId, metadata.offset()); if (exception != null) LOGGER.error("Exception on sending message.", exception); }); }
Source:
protected void findReferences(ITypeRoot[] roots, Set<String> pkgs, IProgressMonitor monitor, boolean binary) throws JavaModelException { monitor.beginTask("", roots.length); for (int i = 0; i < roots.length; i++) { findReferences(roots[i].findPrimaryType(), pkgs, binary); monitor.worked(1); } }

Target:
protected void findReferences(ITypeRoot[] roots, Set<String> pkgs, IProgressMonitor monitor, boolean binary) throws JavaModelException { SubMonitor subMonitor = SubMonitor.convert(monitor, roots.length); for (int i = 0; i < roots.length; i++) { findReferences(roots[i].findPrimaryType(), pkgs, binary); subMonitor.worked(1); } }
Source:
private void activateMarkers() { if (!fGerritClient.getRepository().getServerInfo().isAnonymous()) { String value = NLS.bind(Messages.ChangeDetailEditor_EGerriTipValue, fChangeInfo.getUserSelectedRevision().get_number()); UIUtils.showDialogTip(MARKERS_KEY, headerSection.getShell(), Messages.EGerriTip, value); } }

Target:
private void activateMarkers() { if (!fGerritClient.getRepository().getServerInfo().isAnonymous()) { UIUtils.showDialogTip(MARKERS_KEY, headerSection.getShell(), Messages.EGerriTip, Messages.ChangeDetailEditor_EGerriTipValue); } }
Source:
public LuceneCollectors build() { if ( luceneCollectors.isEmpty() ) { throw new AssertionFailure( "No collectors have been defined: we need at least one." ); } Collector compositeCollector; if ( luceneCollectors.size() == 1 ) { compositeCollector = topDocsCollector != null ? topDocsCollector : totalHitCountCollector; } else { compositeCollector = MultiCollector.wrap( luceneCollectors ); } return new LuceneCollectors( topDocsCollector, totalHitCountCollector, compositeCollector ); }

Target:
public LuceneCollectors build() { Collector compositeCollector; if ( luceneCollectors.size() == 1 ) { compositeCollector = luceneCollectors.get( 0 ); } else { compositeCollector = MultiCollector.wrap( luceneCollectors ); } return new LuceneCollectors( topDocsCollector, totalHitCountCollector, compositeCollector ); }
Source:
public void testwithCustomRetryTemplate() { StatefulRetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateful() .setRetryOperations(new RetryTemplate()) .build(); assertEquals(3, TestUtils.getPropertyValue(interceptor, "retryOperations.retryPolicy.maxAttempts")); }

Target:
public void testwithCustomRetryTemplate() { RetryOperations retryOperations = new RetryTemplate(); StatefulRetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateful() .retryOperations(retryOperations) .build(); assertEquals(3, TestUtils.getPropertyValue(interceptor, "retryOperations.retryPolicy.maxAttempts")); assertSame(retryOperations, TestUtils.getPropertyValue(interceptor, "retryOperations")); }
Source:
public ApplicationFetchException(String apiKey, ErrorCode errorCode) { super(); this.apiKey = apiKey; this.errorCode = errorCode; }

Target:
protected ApplicationFetchException(String apiKey, ErrorCode errorCode) { super(); this.apiKey = apiKey; this.errorCode = errorCode; }
Source:
private void downloadMedia() { mDownloadMediaUseCase.execute(new DownloadMediaUseCase.Callback() { @Override public void onError(FileDownloadException ex) { if (ex.getCause() instanceof UserRecoverableAuthIOException) { showToast(ex.getCause().getMessage()); DashboardActivity.dashboardActivity.startActivityForResult( ((UserRecoverableAuthIOException) ex.getCause()).getIntent(), REQUEST_AUTHORIZATION); return; } else if (ex.getCause() instanceof GooglePlayServicesAvailabilityIOException) { showDialog( ((GooglePlayServicesAvailabilityIOException) ex.getCause()) .getConnectionStatusCode()); return; } else if (ex.getCause() instanceof GooglePlayAppNotAvailableException) { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); final int connectionStatusCode = apiAvailability.isGooglePlayServicesAvailable( PreferencesState.getInstance().getContext()); if (apiAvailability.isUserResolvableError(connectionStatusCode)) { showDialog(connectionStatusCode); } } else { Log.e(this.getClass().getSimpleName(), "Unexpected error to download Media"); } } @Override public void onSuccess(int syncedFiles) { avFragment.reloadData(); if (syncedFiles > 0) { showToast(String.format("%d files synced", syncedFiles)); } } @Override public void onProgress() { avFragment.showProgress(); } }); }

Target:
private void downloadMedia() { mDownloadMediaUseCase.execute(new DownloadMediaUseCase.Callback() { @Override public void onError(FileDownloadException ex) { if (ex.getCause() instanceof UserRecoverableAuthIOException) { showToast(ex.getCause().getMessage()); DashboardActivity.dashboardActivity.startActivityForResult( ((UserRecoverableAuthIOException) ex.getCause()).getIntent(), REQUEST_AUTHORIZATION); return; } else if (ex.getCause() instanceof GooglePlayServicesAvailabilityIOException) { showDialog( ((GooglePlayServicesAvailabilityIOException) ex.getCause()) .getConnectionStatusCode()); return; } else if (ex.getCause() instanceof GooglePlayAppNotAvailableException) { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); final int connectionStatusCode = apiAvailability.isGooglePlayServicesAvailable( PreferencesState.getInstance().getContext()); if (apiAvailability.isUserResolvableError(connectionStatusCode)) { showDialog(connectionStatusCode); } } else { Log.e(this.getClass().getSimpleName(), ex.getMessage()); } } @Override public void onSuccess(int syncedFiles) { avFragment.reloadData(); if (syncedFiles > 0) { showToast(String.format("%d files synced", syncedFiles)); } } @Override public void onDownloadInProgressChanged(boolean value) { avFragment.showProgress(value); } }); }
Source:
private void executePhotoTask(Task task) { viewHolder.profileImageProgress.setVisibility(View.VISIBLE); if (viewHolder.profileImageProgress.getAnimation() == null) { viewHolder.profileImageProgress.startAnimation( AnimationUtils.loadAnimation(getActivity(), R.anim.rotate)); } if (null != setAccountImageTask) { setAccountImageTask.cancel(true); } setAccountImageTask = task; setAccountImageTask.setProgressCallback(null); task.execute(); }

Target:
private void executePhotoTask(Task task) { viewHolder.profileImageProgress.setVisibility(View.VISIBLE); viewHolder.profileImageProgress.setRotating(true); if (null != setAccountImageTask) { setAccountImageTask.cancel(true); } setAccountImageTask = task; setAccountImageTask.setProgressCallback(null); task.execute(); }
Source:
public void requestAccess(final Activity activity, final Callback<String> callback) { OAuth2AuthzSession storedAccount = sessionStore.read(AuthEndPoints.NAME); final String token = storedAccount.getAccessToken(); try { callback.onSuccess(token); } catch (Exception e) { callback.onFailure(e); } }

Target:
public void requestAccess(final Activity activity, final Callback<String> callback) { callback.onSuccess(sessionStore.read(AuthData.NAME).getAccessToken()); }
Source:
private void checkToolTokens(User authUser, Long userId, String organization) { List<Token> tokens = tokenDAO.findByUserId(userId); List<Tool> tools = userContainers(authUser, userId); if (organization != null && !organization.isEmpty()) { tools.removeIf(tool -> !tool.getNamespace().equals(organization)); } Token gitLabToken = Helper.extractToken(tokens, TokenType.GITLAB_COM.toString()); Token quayioToken = Helper.extractToken(tokens, TokenType.QUAY_IO.toString()); Set<Registry> uniqueRegistry = new HashSet<>(); tools.forEach(tool -> uniqueRegistry.add(tool.getRegistry())); if (uniqueRegistry.size() == 0 && quayioToken == null) { throw new CustomWebApplicationException("Please add a Quay.io token", HttpStatus.SC_BAD_REQUEST); } if (uniqueRegistry.contains(Registry.QUAY_IO) && quayioToken == null) { throw new CustomWebApplicationException("Have Quay.io tools but no Quay.io token", HttpStatus.SC_BAD_REQUEST); } if (uniqueRegistry.contains(Registry.GITLAB) && gitLabToken == null) { throw new CustomWebApplicationException("Have GitLab tools but no GitLab token", HttpStatus.SC_BAD_REQUEST); } }

Target:
private void checkToolTokens(User authUser, Long userId, String organization) { List<Token> tokens = tokenDAO.findByUserId(userId); List<Tool> tools = userContainers(authUser, userId); if (organization != null && !organization.isEmpty()) { tools.removeIf(tool -> !tool.getNamespace().equals(organization)); } Token gitLabToken = Helper.extractToken(tokens, TokenType.GITLAB_COM.toString()); Token quayioToken = Helper.extractToken(tokens, TokenType.QUAY_IO.toString()); Set<Registry> uniqueRegistry = new HashSet<>(); tools.forEach(tool -> uniqueRegistry.add(tool.getRegistry())); if (uniqueRegistry.size() == 0 && quayioToken == null) { throw new CustomWebApplicationException("You have no tools and no Quay.io token to automatically add tools. Please add a Quay.io token.", HttpStatus.SC_BAD_REQUEST); } if (uniqueRegistry.contains(Registry.QUAY_IO) && quayioToken == null) { throw new CustomWebApplicationException("You have Quay.io tools but no Quay.io token to refresh the tools with. Please add a Quay.io token.", HttpStatus.SC_BAD_REQUEST); } if (uniqueRegistry.contains(Registry.GITLAB) && gitLabToken == null) { throw new CustomWebApplicationException("You have GitLab tools but no GitLab token to refresh the tools with. Please add a GitLab token", HttpStatus.SC_BAD_REQUEST); } }
Source:
public int read(final char[] buf, final int offset, final int length) throws IOException { if (length == 0) { return 0; } final int len = super.read(buf, offset, length); if (len > 0) { for (int i = offset; i < offset + len; i++) { final char ch = buf[i]; if (ch == LF) { if (CR != (i > 0 ? buf[i - 1] : lastChar)) { eolCounter++; } } else if ((ch == CR) || (ch == END_OF_STREAM && (i > 0 ? buf[i - 1] : lastChar) != LF && (i > 0 ? buf[i - 1] : lastChar) != CR)) { eolCounter++; } } lastChar = buf[offset + len - 1]; } else if (len == -1) { lastChar = END_OF_STREAM; } position += len; return len; }

Target:
public int read(final char[] buf, final int offset, final int length) throws IOException { if (length == 0) { return 0; } final int len = super.read(buf, offset, length); if (len > 0) { for (int i = offset; i < offset + len; i++) { final char ch = buf[i]; if (ch == LF) { if (CR != (i > 0 ? buf[i - 1] : lastChar)) { eolCounter++; } } else if (ch == CR) { eolCounter++; } } lastChar = buf[offset + len - 1]; } else if (len == -1) { lastChar = END_OF_STREAM; } position += len; return len; }
Source:
public void testWithoutShop() { try { new BuyClientBuilder().shopDomain("").build(); } catch (IllegalArgumentException e) { return; } fail("Expected IllegalArgumentException"); }

Target:
public void testWithoutShop() { try { new BuyClientBuilder() .apiKey("apiKey") .appId("appId") .applicationName("applicationName") .shopDomain("") .build(); } catch (IllegalArgumentException e) { return; } fail("Expected IllegalArgumentException"); }
Source:
public int getAvailableConnectionsCount() { int count = 0; for (HostPortPoolManager hostPortPoolManager : hostPortToPoolManager.values()) { count += hostPortPoolManager.getAvailableConnectionsCount(); } return count; }

Target:
public int getAvailableConnectionsCount() { if (!isOpen) { throw new IllegalStateException("Connection Manager is closed"); } int count = 0; for (HostPortPoolManager hostPortPoolManager : hostPortToPoolManager.values()) { count += hostPortPoolManager.getAvailableConnectionsCount(); } return count; }
Source:
public void addTags(String remotePath, CVSTag[] tags) { if (tags.length == 0) { return; } addDateTags(tags); addVersionAndBranchTags(remotePath, tags); }

Target:
public void addTags(String remotePath, CVSTag[] tags) { addDateTags(tags); addVersionAndBranchTags(remotePath, tags); }
Source:
public void testOutputStreamAsynchronousByteChannel() throws Exception { AsynchronousByteChannel abc = mock(AsynchronousByteChannel.class); OutputStream os = Channels.newOutputStream(abc); Future<Integer> result = mock(Future.class); ArgumentCaptor<ByteBuffer> bbCaptor = ArgumentCaptor.forClass(ByteBuffer.class); final byte[] data = new byte[]{'a', 'a', 'a'}; when(abc.write(bbCaptor.capture())).thenReturn(result); when(result.get()).thenAnswer( new Answer<Integer>() { public Integer answer(InvocationOnMock invocation) { ByteBuffer bb = bbCaptor.getValue(); assertEquals(data.length, bb.remaining()); byte[] readData = new byte[data.length]; bb.get(readData, 0, data.length); for (int i = 0;i < readData.length;++i) { assertEquals(data[i], readData[i]); } return data.length; } }); os.write(data); }

Target:
public void testOutputStreamAsynchronousByteChannel() throws Exception { AsynchronousByteChannel abc = mock(AsynchronousByteChannel.class); OutputStream os = Channels.newOutputStream(abc); Future<Integer> result = mock(Future.class); ArgumentCaptor<ByteBuffer> bbCaptor = ArgumentCaptor.forClass(ByteBuffer.class); final byte[] data = "world".getBytes(); when(abc.write(bbCaptor.capture())).thenReturn(result); when(result.get()).thenAnswer( new Answer<Integer>() { public Integer answer(InvocationOnMock invocation) { ByteBuffer bb = bbCaptor.getValue(); assertEquals(data.length, bb.remaining()); byte[] readData = new byte[data.length]; bb.get(readData); assertTrue(Arrays.equals(data, readData)); return data.length; } }); os.write(data); Mockito.verify(abc).write(isA(ByteBuffer.class)); Mockito.verify(result).get(); }
Source:
public void testIntegerScale_fromDisk() { objectStorage.put("DummyObject", new DummyObject()); DummyObject dummy = objectStorage.get("DummyObject"); Assert.assertEquals(((BigDecimal) dummy.configuration.get("testShort")).scale(), 0); Assert.assertEquals(((BigDecimal) dummy.configuration.get("testInt")).scale(), 0); Assert.assertEquals(((BigDecimal) dummy.configuration.get("testLong")).scale(), 0); Assert.assertEquals(((BigDecimal) dummy.configuration.get("testBigDecimal")).scale(), 0); Assert.assertEquals(((List<BigDecimal>) dummy.configuration.get("multiInt")).get(0).scale(), 0); Assert.assertEquals(((List<BigDecimal>) dummy.configuration.get("multiInt")).get(1).scale(), 0); Assert.assertEquals(((List<BigDecimal>) dummy.configuration.get("multiInt")).get(2).scale(), 0); Assert.assertEquals(((BigDecimal) dummy.channels.get(0).configuration.get("testChildLong")).scale(), 0); }

Target:
public void testIntegerScale_fromDisk() { objectStorage.put("DummyObject", new DummyObject()); persistAndReadAgain(); DummyObject dummy = objectStorage.get("DummyObject"); assertEquals(((BigDecimal) dummy.configuration.get("testShort")).scale(), 0); assertEquals(((BigDecimal) dummy.configuration.get("testInt")).scale(), 0); assertEquals(((BigDecimal) dummy.configuration.get("testLong")).scale(), 0); assertEquals(((BigDecimal) dummy.configuration.get("testBigDecimal")).scale(), 0); assertEquals(((List<BigDecimal>) dummy.configuration.get("multiInt")).get(0).scale(), 0); assertEquals(((List<BigDecimal>) dummy.configuration.get("multiInt")).get(1).scale(), 0); assertEquals(((List<BigDecimal>) dummy.configuration.get("multiInt")).get(2).scale(), 0); assertEquals(((BigDecimal) dummy.channels.get(0).configuration.get("testChildLong")).scale(), 0); }
Source:
private StringBuilder appendToString(final StringBuilder sb, final String fieldName, final Object fieldValue, final boolean hasNext) { sb.append(fieldName).append('=').append(fieldValue).append(System.lineSeparator()); if (hasNext) { sb.append('\t'); } return sb; }

Target:
private StringBuilder appendToString(final StringBuilder sb, final String fieldName, final Object fieldValue, final boolean hasNext) { sb.append(fieldName).append('=').append(fieldValue).append(System.lineSeparator()); if (hasNext) { sb.append(TAB_CHAR); } return sb; }
Source:
public void setReplicaSealedState(ReplicaId replicaId, boolean isSealed) { HelixAdmin helixAdmin = manager.getClusterManagmentTool(); InstanceConfig instanceConfig = helixAdmin.getInstanceConfig(clusterName, instanceName); List<String> sealedReplicas = ClusterMapUtils.getSealedReplicas(instanceConfig); if (sealedReplicas == null) sealedReplicas = new ArrayList<>(); if (isSealed) { sealedReplicas.add(replicaId.getPartitionId().toPathString()); } else { sealedReplicas.remove(replicaId.getPartitionId().toPathString()); } instanceConfig.getRecord().setListField(ClusterMapUtils.SEALED_STR, sealedReplicas); helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig); }

Target:
public void setReplicaSealedState(ReplicaId replicaId, boolean isSealed) { if (!(replicaId instanceof AmbryReplica)) { throw new IllegalArgumentException( "HelixParticipant only works with the AmbryReplica implementation of ReplicaId"); } HelixAdmin helixAdmin = manager.getClusterManagmentTool(); InstanceConfig instanceConfig = helixAdmin.getInstanceConfig(clusterName, instanceName); List<String> sealedReplicas = ClusterMapUtils.getSealedReplicas(instanceConfig); if (sealedReplicas == null) { sealedReplicas = new ArrayList<>(); } String partitionId = replicaId.getPartitionId().toPathString(); if (!isSealed) { sealedReplicas.remove(partitionId); } else if (!sealedReplicas.contains(partitionId)) { sealedReplicas.add(partitionId); } instanceConfig.getRecord().setListField(ClusterMapUtils.SEALED_STR, sealedReplicas); helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig); }
Source:
public void afterPropertiesSet() { if (this.beanName == null) { logger.error("The MessageHandler [" + this.handler + "] will be created without a 'componentName'. " + "Consider specifying the 'beanName' property on this ConsumerEndpointFactoryBean."); } else { try { if (!this.beanName.startsWith("org.springframework")) { MessageHandler targetHandler = this.handler; if (AopUtils.isAopProxy(targetHandler)) { Object target = ((Advised) targetHandler).getTargetSource().getTarget(); if (target instanceof MessageHandler) { targetHandler = (MessageHandler) target; } } if (targetHandler instanceof IntegrationObjectSupport) { ((IntegrationObjectSupport) targetHandler).setComponentName(this.beanName); } } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Could not set component name for handler " + this.handler + " for " + this.beanName + " :" + e.getMessage()); } } } adviceChain(); if (this.channelResolver == null) { this.channelResolver = new BeanFactoryMessageChannelDestinationResolver(this.beanFactory); } initializeEndpoint(); }

Target:
public void afterPropertiesSet() { if (this.beanName == null) { logger.error("The MessageHandler [" + this.handler + "] will be created without a 'componentName'. " + "Consider specifying the 'beanName' property on this ConsumerEndpointFactoryBean."); } else { try { if (!this.beanName.startsWith("org.springframework")) { MessageHandler targetHandler = this.handler; if (AopUtils.isAopProxy(targetHandler)) { Object target = ((Advised) targetHandler).getTargetSource().getTarget(); if (target instanceof MessageHandler) { targetHandler = (MessageHandler) target; } } if (targetHandler instanceof IntegrationObjectSupport) { ((IntegrationObjectSupport) targetHandler).setComponentName(this.beanName); } } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Could not set component name for handler " + this.handler + " for " + this.beanName + " :" + e.getMessage()); } } } adviceChain(); if (this.channelResolver == null) { this.channelResolver = ChannelResolverUtils.getChannelResolver(this.beanFactory); } initializeEndpoint(); }
Source:
public Result close() throws IOException { logout(); LOGGER.info("Has " + getPastForm(sprops.outputAction.getValue()) + successCount + " record" + (successCount == 1 ? "" : "s") + " successfully."); LOGGER.info("Has rejected record{}.", rejectCount, rejectCount == 1 ? "" : "s"); LOGGER.info("Done."); if (logWriter != null) { logWriter.close(); } return new Result(uId, dataCount, successCount, rejectCount); }

Target:
public Result close() throws IOException { logout(); LOGGER.info(MESSAGES.getMessage("info.seccessfulRecords", getPastForm(sprops.outputAction.getValue()), successCount)); LOGGER.info(MESSAGES.getMessage("info.rejectedRecords", rejectCount)); LOGGER.info(MESSAGES.getMessage("info.finishMessage")); if (logWriter != null) { logWriter.close(); } return new Result(uId, dataCount, successCount, rejectCount); }
Source:
private boolean areFightingOrSupportingUnitsLeft(final BattleState.Side side) { final boolean hasUnitsThatCanRollLeft; hasUnitsThatCanRollLeft = battleState.getUnits(EnumSet.of(side)).stream() .anyMatch( getActiveUnits() .and( Matches.unitIsSupporterOrHasCombatAbility( side == BattleState.Side.OFFENSE))); return hasUnitsThatCanRollLeft; }

Target:
private boolean areFightingOrSupportingUnitsLeft(final BattleState.Side side) { return battleState.getUnits(side).stream().anyMatch(unitIsActiveAndCanFight(side)); }