auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onDragDrop(TreeDragDropEvent event) { TreeNode dragTreeNode = event.getDragNode(); TreeNode dropTreeNode = event.getDropNode(); Object dragNodeObject = dragTreeNode.getData(); Object dropNodeObject = dropTreeNode.getData(); if (!(dragNodeObject instanceof StructureTreeNode) || !(dropNodeObject instanceof StructureTreeNode)) { Helper.setErrorMessage("Unable to move structure element!"); return; } StructureTreeNode dropNode = (StructureTreeNode) dropNodeObject; StructureTreeNode dragNode = (StructureTreeNode) dragNodeObject; if (dropNode.getDataObject() instanceof IncludedStructuralElement && dragNode.getDataObject() instanceof IncludedStructuralElement) { checkLogicalDragDrop((IncludedStructuralElement) dragNode.getDataObject(), (IncludedStructuralElement) dropNode.getDataObject()); } else if (dropNode.getDataObject() instanceof MediaUnit && dropNode.getDataObject() instanceof MediaUnit) { checkPhysicalDragDrop((MediaUnit) dragNode.getDataObject(), (MediaUnit) dropNode.getDataObject()); } else { Helper.setErrorMessage("Unable to move structure element!"); } }

Target:
public void onDragDrop(TreeDragDropEvent event) { TreeNode dragTreeNode = event.getDragNode(); TreeNode dropTreeNode = event.getDropNode(); Object dragNodeObject = dragTreeNode.getData(); Object dropNodeObject = dropTreeNode.getData(); if (!(dragNodeObject instanceof StructureTreeNode) || !(dropNodeObject instanceof StructureTreeNode)) { Helper.setErrorMessage("Unable to move structure element!"); return; } StructureTreeNode dropNode = (StructureTreeNode) dropNodeObject; StructureTreeNode dragNode = (StructureTreeNode) dragNodeObject; if (dropNode.getDataObject() instanceof IncludedStructuralElement && dragNode.getDataObject() instanceof IncludedStructuralElement) { checkLogicalDragDrop((IncludedStructuralElement) dragNode.getDataObject(), (IncludedStructuralElement) dropNode.getDataObject()); } else if ((dropNode.getDataObject()) instanceof MediaUnit && dropNode.getDataObject() instanceof MediaUnit) { checkPhysicalDragDrop((MediaUnit) dragNode.getDataObject(), (MediaUnit) dropNode.getDataObject()); } else { Helper.setErrorMessage("Unable to move structure element!"); } }
Source:
public void onConnectionStateChange(final ConnectionStateChange change) { if (change.getCurrentState() == ConnectionState.CONNECTED) { for(InternalChannel channel : channelNameToChannelMap.values()){ sendOrQueueSubscribeMessage(channel); } } }

Target:
public void onConnectionStateChange(final ConnectionStateChange change) { if (change.getCurrentState() == ConnectionState.CONNECTED) { for(final InternalChannel channel : channelNameToChannelMap.values()){ sendOrQueueSubscribeMessage(channel); } } }
Source:
private void deleteBranches(final Set<String> branches) { ProjectApi.deleteBranches(getProjectKey(), branches, new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { for (int row = 1; row < table.getRowCount();) { BranchInfo k = getRowItem(row); if (k != null && branches.contains(k.ref())) { table.removeRow(row); } else { row++; } } updateDeleteButton(); delBranch.setVisible(branchTable.hasBranchCanDelete()); } @Override public void onFailure(Throwable caught) { query = new Query(match).start(start).run(); super.onFailure(caught); } }); }

Target:
private void deleteBranches(final Set<String> branches) { ProjectApi.deleteBranches(getProjectKey(), branches, new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { query = new Query(match).start(start).run(); } @Override public void onFailure(Throwable caught) { query = new Query(match).start(start).run(); super.onFailure(caught); } }); }
Source:
public void updateResponse(String id, InputStream stream) { BufferedInputStream dataStream = new BufferedInputStream(stream, DATA_BUFFER_SIZE); try (Connection connection = getConnection(); PreparedStatement myUpdateSQL = connection.prepareStatement(updateString)) { myUpdateSQL.setString(UPDATE_COLUMN_REQUEST_ID, id); myUpdateSQL.setAsciiStream(UPDATE_COLUMN_RESPONSE, dataStream, DATA_BUFFER_SIZE); myUpdateSQL.executeUpdate(); } catch (SQLException ex) { LOGGER.error("Could not update response in database", ex); } }

Target:
public void updateResponse(String id, InputStream stream) { BufferedInputStream dataStream = new BufferedInputStream(stream, DATA_BUFFER_SIZE); try (Connection connection = getConnection(); PreparedStatement updateStatement = connection.prepareStatement(updateString)) { updateStatement.setString(UPDATE_COLUMN_REQUEST_ID, id); updateStatement.setAsciiStream(UPDATE_COLUMN_RESPONSE, dataStream, DATA_BUFFER_SIZE); updateStatement.executeUpdate(); } catch (SQLException ex) { LOGGER.error("Could not update response in database", ex); } }
Source:
protected Entity replaceMember(Entity member, Location memberLoc) { synchronized (mutex) { Optional<Entity> added = growByOne(memberLoc, ImmutableMap.of()); if (!added.isPresent()) { String msg = String.format("In %s, failed to grow, to replace %s; not removing", this, member); throw new IllegalStateException(msg); } try { stopAndRemoveNode(member); } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new IllegalStateException("replaceMember failed to stop and remove old member "+member.getId(), e); } return added.get(); } }

Target:
protected Entity replaceMember(Entity member, Location memberLoc) { synchronized (mutex) { Optional<Entity> added = growByOne(memberLoc, ImmutableMap.of()); if (!added.isPresent()) { String msg = String.format("In %s, failed to grow, to replace %s; not removing", this, member); throw new IllegalStateException(msg); } try { stopAndRemoveNode(member); } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new StopFailedRuntimeException("replaceMember failed to stop and remove old member "+member.getId(), e); } return added.get(); } }
Source:
private List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames){ ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); String locales = configurationService.getArrayProperty("webui.supported.locales"); List<String> newAcceptableFilenames = new ArrayList<>(); newAcceptableFilenames.addAll(acceptableFilenames); for(String local : locales){ for(String acceptableFilename : acceptableFilenames){ String values = acceptableFilename.split("\\."); newAcceptableFilenames.add(values[0] + "_" + local + "." + values[1]); } } return newAcceptableFilenames; }

Target:
protected List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames){ String locales = configurationService.getArrayProperty("webui.supported.locales"); List<String> newAcceptableFilenames = new ArrayList<>(); newAcceptableFilenames.addAll(acceptableFilenames); for(String local : locales){ for(String acceptableFilename : acceptableFilenames){ int lastPoint = acceptableFilename.lastIndexOf("."); newAcceptableFilenames.add( acceptableFilename.substring(0, lastPoint) + "_" + local + acceptableFilename.substring(lastPoint)); } } return newAcceptableFilenames; }
Source:
public void setReferenceIndex(final int referenceIndex) { if (referenceIndex == NO_ALIGNMENT_REFERENCE_INDEX) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; mReferenceName = NO_ALIGNMENT_REFERENCE_NAME; } else if (null == mHeader) { throw new IllegalArgumentException("A non-null SAMFileHeader is required to resolve the reference index"); } else { SAMSequenceRecord samSequence = mHeader.getSequence(referenceIndex); if (null != samSequence) { mReferenceIndex = referenceIndex; mReferenceName = samSequence.getSequenceName(); } else { throw new IllegalArgumentException("Reference index " + referenceIndex + " not found in sequence dictionary."); } } }

Target:
public void setReferenceIndex(final int referenceIndex) { if (referenceIndex == NO_ALIGNMENT_REFERENCE_INDEX) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; mReferenceName = NO_ALIGNMENT_REFERENCE_NAME; } else if (null == mHeader) { throw new IllegalStateException("A non-null SAMFileHeader is required to resolve the reference index"); } else { SAMSequenceRecord samSequence = mHeader.getSequence(referenceIndex); if (null != samSequence) { mReferenceIndex = referenceIndex; mReferenceName = samSequence.getSequenceName(); } else { throw new IllegalArgumentException("Reference index " + referenceIndex + " not found in sequence dictionary."); } } }
Source:
protected void checkProjectMapping(final Map<String, IReferencePoint> mapping) { for (final Entry<String, IReferencePoint> entry : mapping.entrySet()) { final String id = entry.getKey(); final IReferencePoint referencePoint = entry.getValue(); final ProjectNegotiationData data = getProjectNegotiationData(id); if (data == null) throw new IllegalArgumentException("invalid reference point id: " + id); if (!referencePointManager.projectExists(referencePoint)) throw new IllegalArgumentException("reference point does not exist: " + referencePoint); } }

Target:
protected void checkProjectMapping(final Map<String, IReferencePoint> mapping) { for (final Entry<String, IReferencePoint> entry : mapping.entrySet()) { final String id = entry.getKey(); final IReferencePoint referencePoint = entry.getValue(); final ProjectNegotiationData data = getProjectNegotiationData(id); if (data == null) throw new IllegalArgumentException("invalid reference point id: " + id); if (!referencePointManager.projectExists(referencePoint)) throw new IllegalArgumentException( "project does not exist at the referencePoint " + referencePoint); } }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); for (int i = 0; i < fLocations.length; i++) { if (i > 0) { sb.append(", "); } sb.append("[location="); sb.append(fLocations[i]); sb.append(",rank="); sb.append(fRanks[i]); sb.append("]"); } sb.append("]"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(' ').append('['); for (int i = 0; i < fLocations.length; i++) { if (i > 0) { sb.append(", "); } sb.append("[location="); sb.append(fLocations[i]); sb.append(",rank="); sb.append(fRanks[i]); sb.append(']'); } sb.append(']'); return sb.toString(); }
Source:
public Result<BpmnNode> convert(IntermediateCatchEvent event) { CatchEventPropertyReader p = propertyReaderFactory.of(event); List<EventDefinition> eventDefinitions = p.getEventDefinitions(); switch (eventDefinitions.size()) { case 0: throw new UnsupportedOperationException("An intermediate catch event should contain exactly one definition"); case 1: return Match.of(EventDefinition.class, Result.class) .when(TimerEventDefinition.class, e -> timerEvent(event, e)) .when(SignalEventDefinition.class, e -> signalEvent(event, e)) .when(MessageEventDefinition.class, e -> messageEvent(event, e)) .when(ErrorEventDefinition.class, e -> errorEvent(event, e)) .when(ConditionalEventDefinition.class, e -> conditionalEvent(event, e)) .when(EscalationEventDefinition.class, e -> escalationEvent(event, e)) .when(CompensateEventDefinition.class, e -> compensationEvent(event, e)) .defaultValue(Result.ignored("Ignored IntermediateCatchEvent")) .mode(getMode()) .apply(eventDefinitions.get(0)) .value() .get(); default: throw new UnsupportedOperationException("Multiple definitions not supported for intermediate catch event"); } }

Target:
public Result<BpmnNode> convert(IntermediateCatchEvent event) { CatchEventPropertyReader p = propertyReaderFactory.of(event); List<EventDefinition> eventDefinitions = p.getEventDefinitions(); switch (eventDefinitions.size()) { case 0: throw new UnsupportedOperationException("An intermediate catch event should contain exactly one definition"); case 1: return Match.of(EventDefinition.class, Result.class) .when(TimerEventDefinition.class, e -> timerEvent(event, e)) .when(SignalEventDefinition.class, e -> signalEvent(event, e)) .when(MessageEventDefinition.class, e -> messageEvent(event, e)) .when(ErrorEventDefinition.class, e -> errorEvent(event, e)) .when(ConditionalEventDefinition.class, e -> conditionalEvent(event, e)) .when(EscalationEventDefinition.class, e -> escalationEvent(event, e)) .when(CompensateEventDefinition.class, e -> compensationEvent(event, e)) .defaultValue(Result.ignored("Ignored IntermediateCatchEvent", getNotFoundMessage(event))) .mode(getMode()) .apply(eventDefinitions.get(0)) .value(); default: throw new UnsupportedOperationException("Multiple definitions not supported for intermediate catch event"); } }
Source:
int getScreenProtection() { if (settings.contains("restlessMode") && (!settings.contains("restlessMode"))){ settings.edit().putString("screenProtection", "0").apply(); settings.edit().remove("restlessMode").apply(); } return Integer.parseInt(settings.getString("screenProtection", "1")); }

Target:
int getScreenProtection() { if (settings.contains("restlessMode") && (!settings.getBoolean("restlessMode",true))){ settings.edit().putString("screenProtection", "0").apply(); settings.edit().remove("restlessMode").apply(); } return Integer.parseInt(settings.getString("screenProtection", "1")); }
Source:
private MElementContainer<?> getLastContainer() { MElementContainer<MUIElement> searchRoot = getContainer(); List<MUIElement> children = searchRoot.getChildren(); if (children.size() == 0) { MPartStack stack = modelService.createModelElement(MPartStack.class); searchRoot.getChildren().add(stack); return stack; } MElementContainer<?> lastContainer = getLastContainer(searchRoot, children); if (lastContainer == null) { MPartStack stack = modelService.createModelElement(MPartStack.class); modelService.insert(stack, (MPartSashContainerElement) children.get(0), EModelService.RIGHT_OF, 0.5f); return stack; } else if (!(lastContainer instanceof MPartStack)) { MPartStack stack = modelService.createModelElement(MPartStack.class); modelService.insert(stack, (MPartSashContainerElement) children.get(0), EModelService.RIGHT_OF, 0.5f); return stack; } return lastContainer; }

Target:
private MElementContainer<?> getLastContainer() { MElementContainer<MUIElement> searchRoot = getContainer(); List<MUIElement> children = searchRoot.getChildren(); if (children.size() == 0) { MPartStack stack = modelService.createModelElement(MPartStack.class); searchRoot.getChildren().add(stack); return stack; } MElementContainer<?> lastContainer = getLastContainer(searchRoot, children); if (lastContainer instanceof MPartStack) { return lastContainer; } MPartStack stack = modelService.createModelElement(MPartStack.class); stack.setElementId("CreatedByGetLastContainer"); if (children.get(0) instanceof MPartSashContainer) { MPartSashContainer psc = (MPartSashContainer) children.get(0); psc.getChildren().add(stack); } else { modelService.insert(stack, (MPartSashContainerElement) children.get(0), EModelService.RIGHT_OF, 0.5f); } return stack; }
Source:
protected boolean canDoAction() { disk = getDiskDao().get(getParameters().getDiskId()); return isVmExist() && isVmUpOrDown() && isDiskExist(disk) && checkCanPerformPlugUnPlugDisk() && acquireLockInternal(); }

Target:
protected boolean canDoAction() { disk = getDiskDao().get(getParameters().getDiskId()); return isVmExist() && isVmUpOrDown() && isDiskExist(disk) && checkCanPerformPlugUnPlugDisk(); }
Source:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); <<<<<<< HEAD ContextHolder.setServerName(client.getHostname()); ======= ContextHolder.setServerName(client.getRetryPolicy().getIdentifier()); log.debug("client policy identifier {}", client.getRetryPolicy().getIdentifier()); >>>>>>> 5029ec3... image delete ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }

Target:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); ContextHolder.setServerName(client.getRetryPolicy().getIdentifier()); log.debug("client policy identifier {}", client.getRetryPolicy().getIdentifier()); ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }
Source:
public static DocumentUriMaker uriMaker(String format) { final class FormatUriMaker { private String formatter; FormatUriMaker(String format) { this.formatter = format; } String makeUri(AbstractWriteHandle content) { return String.format(formatter, UUID.randomUUID()); } } FormatUriMaker formatUriMaker = new FormatUriMaker(format); return formatUriMaker::makeUri; }

Target:
public static DocumentUriMaker uriMaker(String format) throws IllegalArgumentException{ if(format == null || format.length() == 0) throw new IllegalArgumentException("Format cannot be null or empty"); final class FormatUriMaker { private String uriFormat; FormatUriMaker(String format) { this.uriFormat = format; } String makeUri(AbstractWriteHandle content) { return String.format(uriFormat, UUID.randomUUID()); } } FormatUriMaker formatUriMaker = new FormatUriMaker(format); return formatUriMaker::makeUri; }
Source:
public void addRegistryHook(RegistryHook<Item> hook) { throw new UnsupportedOperationException("This registry does not support hooks"); }

Target:
public void addRegistryHook(RegistryHook<Item> hook) { if (itemRegistry != null) { itemRegistry.addRegistryHook(hook); } }
Source:
public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, userInfo.getId()), logic.getCourse(courseId)); }

Target:
public void checkSpecificAccessControl() { if (!(userInfo.isInstructor || userInfo.isStudent)) { throw new UnauthorizedAccessException("Student or instructor account is required to access this resource."); } String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); if (userInfo.isInstructor) { gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, userInfo.getId()), logic.getCourse(courseId)); } if (userInfo.isStudent) { CourseAttributes course = logic.getCourse(courseId); gateKeeper.verifyAccessible(logic.getStudentForGoogleId(courseId, userInfo.id), course); } }
Source:
public short undelete(MessageInfo info) throws StoreException { checkStarted(); try { BlobId blobId = (BlobId) info.getStoreKey(); short newLifeVersion = requestAgent.doWithRetries(() -> cloudDestination.undeleteBlob(blobId, info.getLifeVersion()), "Undelete", partitionId.toPathString()); addToCache(blobId.getID(), BlobState.CREATED); return newLifeVersion; } catch (CloudStorageException ex) { StoreErrorCodes errorCode = (ex.getStatusCode() == STATUS_NOT_FOUND) ? StoreErrorCodes.ID_Not_Found : StoreErrorCodes.IOError; throw new StoreException(ex, errorCode); } }

Target:
public short undelete(MessageInfo info) throws StoreException { checkStarted(); try { return requestAgent.doWithRetries(() -> undeleteIfNeeded((BlobId) info.getStoreKey(), info.getLifeVersion()), "Undelete", partitionId.toPathString()); } catch (CloudStorageException cex) { StoreErrorCodes errorCode = (cex.getStatusCode() == STATUS_NOT_FOUND) ? StoreErrorCodes.ID_Not_Found : StoreErrorCodes.IOError; throw new StoreException(cex, errorCode); } }
Source:
public String[] getParameterTypes() { return parameterTypes.clone(); }

Target:
public String[] getParameterTypes() { return parameterTypes; }
Source:
public void addContainers(Set<PackingPlan.ContainerPlan> containersToAdd) { String basePodName = Runtime.topologyName(runtime) + "-0"; JsonNode podConfig; try { podConfig = controller.getBasePod(basePodName); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Problem retrieving base pod configuration", ioe); throw new TopologyRuntimeManagementException("Unable to add containers for update"); } ObjectMapper mapper = new ObjectMapper(); for (PackingPlan.ContainerPlan containerPlan : containersToAdd) { String newContainer = rebuildKubernetesPodSpec(podConfig, mapper, containerPlan, 0); try { controller.deployContainer(newContainer); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Problem deploying new container", ioe); throw new TopologyRuntimeManagementException("Unable to add container for update"); } } }

Target:
public void addContainers(Set<PackingPlan.ContainerPlan> containersToAdd) { String basePodName = Runtime.topologyName(runtime) + "-0"; JsonNode podConfig; try { podConfig = controller.getBasePod(basePodName); } catch (IOException ioe) { throw new TopologyRuntimeManagementException("Unable to retrieve base pod configuration from " + basePodName, ioe); } ObjectMapper mapper = new ObjectMapper(); int totalNewContainerCount = containersToAdd.size(); int deployedContainerCount = 0; for (PackingPlan.ContainerPlan containerPlan : containersToAdd) { String newContainer = rebuildKubernetesPodSpec(podConfig, mapper, containerPlan, 0); try { controller.deployContainer(newContainer); LOG.log(Level.INFO, "New container " + ++deployedContainerCount + "/" + totalNewContainerCount + " deployed"); } catch (IOException ioe) { throw new TopologyRuntimeManagementException("Problem adding container with id " + containerPlan.getId() + ". Deployed " + deployedContainerCount + " out of " + totalNewContainerCount + " containers", ioe); } } }
Source:
public boolean canLogAtLevel(LogLevel logLevel) { LogLevel environmentLoggingLevel = getEnvironmentLoggingLevel(); return canLogAtLevel(logLevel, environmentLoggingLevel); }

Target:
public boolean canLogAtLevel(LogLevel logLevel) { return canLogAtLevel(logLevel, getEnvironmentLoggingLevel()); }
Source:
public void testExecute_withInvalidEnrollRequests_shouldNotBeEnrolled() { String courseId = typicalBundle.students.get("student1InCourse1").getCourse(); StudentAttributes validNewStudent = getTypicalNewStudent(courseId); StudentAttributes invalidNewStudent = getTypicalNewStudent(courseId); invalidNewStudent.email = "invalidEmail"; StudentAttributes validExistingStudent = typicalBundle.students.get("student1InCourse1"); validExistingStudent.name = "new name"; StudentAttributes invalidExistingStudent = typicalBundle.students.get("student2InCourse1"); invalidExistingStudent.team = "invalid | team % name"; StudentsEnrollRequest req = prepareRequest( Arrays.asList(validNewStudent, invalidNewStudent, validExistingStudent, invalidExistingStudent)); loginAsInstructor(typicalBundle.instructors.get("instructor1OfCourse1").getGoogleId()); List<StudentData> enrolledStudents = executeActionAndReturnResults(courseId, req); assertEquals(2, enrolledStudents.size()); verifyStudentInDatabase(validNewStudent, enrolledStudents.get(0).getCourseId(), enrolledStudents.get(0).getEmail()); verifyStudentInDatabase(validExistingStudent, enrolledStudents.get(1).getCourseId(), enrolledStudents.get(1).getEmail()); }

Target:
public void testExecute_withInvalidEnrollRequests_shouldNotBeEnrolled() { String courseId = typicalBundle.students.get("student1InCourse1").getCourse(); StudentAttributes validNewStudent = getTypicalNewStudent(courseId); StudentAttributes invalidNewStudent = getTypicalNewStudent(courseId); invalidNewStudent.email = "invalidEmail"; StudentAttributes validExistingStudent = typicalBundle.students.get("student1InCourse1"); validExistingStudent.name = "new name"; StudentAttributes invalidExistingStudent = typicalBundle.students.get("student2InCourse1"); invalidExistingStudent.team = "invalid | team % name"; StudentsEnrollRequest req = prepareRequest( Arrays.asList(validNewStudent, invalidNewStudent, validExistingStudent, invalidExistingStudent)); loginAsInstructor(typicalBundle.instructors.get("instructor1OfCourse1").getGoogleId()); List<StudentData> enrolledStudents = executeActionAndReturnResults(courseId, req); assertEquals(2, enrolledStudents.size()); verifyStudentInDatabase(validNewStudent, enrolledStudents.get(0).getCourseId(), enrolledStudents.get(0).getEmail()); verifyStudentInDatabase(validExistingStudent, enrolledStudents.get(1).getCourseId(), enrolledStudents.get(1).getEmail()); verifyCorrectResponseData(req.getStudentEnrollRequests().get(0), enrolledStudents.get(0)); verifyCorrectResponseData(req.getStudentEnrollRequests().get(2), enrolledStudents.get(1)); }
Source:
public Mono<String> convert(@NonNull ServerWebExchange exchange) { return this.converter.convert(exchange).handle((convertedToken, sink) -> { BearerTokenAuthenticationToken token = (BearerTokenAuthenticationToken) convertedToken; try { String issuer = JWTParser.parse(token.getToken()).getJWTClaimsSet().getIssuer(); if (issuer == null) { sink.error(new InvalidBearerTokenException("Missing issuer")); } else { sink.next(issuer); } } catch (Exception e) { sink.error(new InvalidBearerTokenException(e.getMessage())); } }); }

Target:
public Mono<String> convert(@NonNull ServerWebExchange exchange) { return this.converter.convert(exchange).map(convertedToken -> { BearerTokenAuthenticationToken token = (BearerTokenAuthenticationToken) convertedToken; try { String issuer = JWTParser.parse(token.getToken()).getJWTClaimsSet().getIssuer(); if (issuer == null) { throw new InvalidBearerTokenException("Missing issuer"); } else { return issuer; } } catch (Exception e) { throw new InvalidBearerTokenException(e.getMessage(), e); } }); }
Source:
public int size() { int size = 0; for (Iterator<InternalCacheEntry<K, V>> iter = iterator(); iter.hasNext(); ) { if (iter.next().getValue() == null) continue; if (++size == Integer.MAX_VALUE) return Integer.MAX_VALUE; } return size; }

Target:
public int size() { int size = 0; for (Iterator<InternalCacheEntry<K, V>> iter = iterator(); iter.hasNext(); ) { iter.next(); if (++size == Integer.MAX_VALUE) return Integer.MAX_VALUE; } return size; }
Source:
public AbstractSerializationNode getSerializer() { return ((SerializerRootNode) serializationRoot.getRootNode()).getSerializer(); }

Target:
public AbstractSerializationNode getSerializer() { return instanceClassGroup.getSerializer(); }
Source:
public PdpFeedTrailerEntry buildPdpFeedTrailerEntry(PdpFeedFileBaseEntry pdpFeedFileBaseEntry, ConcurStandardAccountingExtractBatchReportData reportData) { PdpFeedTrailerEntry trailerEntry = new PdpFeedTrailerEntry(); KualiDecimal pdpTotal = KualiDecimal.ZERO; int numberOfDetails = 0; for (PdpFeedGroupEntry group : pdpFeedFileBaseEntry.getGroup()) { numberOfDetails += group.getDetail().size(); for(PdpFeedDetailEntry detailEntry : group.getDetail()) { for (PdpFeedAccountingEntry accountingEntry : detailEntry.getAccounting()) { pdpTotal = pdpTotal.add(accountingEntry.getAmount()); } } } trailerEntry.setDetailCount(numberOfDetails); trailerEntry.setDetailTotAmt(pdpTotal); reportData.getPdpRecordsProcessed().setRecordCount(numberOfDetails); reportData.getPdpRecordsProcessed().setDollarAmount(pdpTotal);; return trailerEntry; }

Target:
public PdpFeedTrailerEntry buildPdpFeedTrailerEntry(PdpFeedFileBaseEntry pdpFeedFileBaseEntry, ConcurStandardAccountingExtractBatchReportData reportData) { PdpFeedTrailerEntry trailerEntry = new PdpFeedTrailerEntry(); KualiDecimal pdpTotal = KualiDecimal.ZERO; int numberOfDetails = 0; for (PdpFeedGroupEntry group : pdpFeedFileBaseEntry.getGroup()) { numberOfDetails += group.getDetail().size(); for(PdpFeedDetailEntry detailEntry : group.getDetail()) { for (PdpFeedAccountingEntry accountingEntry : detailEntry.getAccounting()) { pdpTotal = pdpTotal.add(accountingEntry.getAmount()); } } } trailerEntry.setDetailCount(numberOfDetails); trailerEntry.setDetailTotAmt(pdpTotal); reportData.getPdpRecordsProcessed().setRecordCount(numberOfDetails); reportData.getPdpRecordsProcessed().setDollarAmount(pdpTotal); return trailerEntry; }
Source:
void notifyCurrentMediaItemChanged(final MediaItem item, int currentMediaItemIndex, int previousMediaItemIndex, int nextMediaItemIndex) { synchronized (mLock) { mCurrentMediaItem = item; mCurrentMediaItemIndex = currentMediaItemIndex; mPreviousMediaItemIndex = previousMediaItemIndex; mNextMediaItemIndex = nextMediaItemIndex; if (mPlaylist != null && currentMediaItemIndex != -1 && currentMediaItemIndex < mPlaylist.size()) { mPlaylist.set(currentMediaItemIndex, item); } } mCallbackExecutor.execute(new Runnable() { @Override public void run() { if (!mInstance.isConnected()) { return; } mCallback.onCurrentMediaItemChanged(mInstance, item); } }); }

Target:
void notifyCurrentMediaItemChanged(final MediaItem item, int currentMediaItemIndex, int previousMediaItemIndex, int nextMediaItemIndex) { synchronized (mLock) { mCurrentMediaItem = item; mCurrentMediaItemIndex = currentMediaItemIndex; mPreviousMediaItemIndex = previousMediaItemIndex; mNextMediaItemIndex = nextMediaItemIndex; if (mPlaylist != null && currentMediaItemIndex != ITEM_INDEX_INVALID && currentMediaItemIndex < mPlaylist.size()) { mPlaylist.set(currentMediaItemIndex, item); } } mCallbackExecutor.execute(new Runnable() { @Override public void run() { if (!mInstance.isConnected()) { return; } mCallback.onCurrentMediaItemChanged(mInstance, item); } }); }
Source:
void should_create_error_message_with_escaping_percent() { RuntimeException actual = new RuntimeException("You know nothing %"); String errorMessage = ShouldContainCharSequence.shouldContain(actual, "You know nothing % Jon Snow") .create(new TestDescription("TEST")); assertThat(errorMessage).isEqualTo("[TEST] %n" + "Expecting:%n" + " <\"You know nothing %%\">%n" + "to contain:%n" + " <\"You know nothing %% Jon Snow\">%n" + "but did not.%n" + "%n" + "Throwable that failed the check:%n" + "%n%s", getStackTrace(actual)); }

Target:
void should_create_error_message_with_escaping_percent() { RuntimeException actual = new RuntimeException("You know nothing %"); String errorMessage = shouldContain(actual, "You know nothing % Jon Snow") .create(new TestDescription("TEST")); then(errorMessage).isEqualTo("[TEST] %n" + "Expecting throwable message:%n" + " <\"You know nothing %%\">%n" + "to contain:%n" + " <\"You know nothing %% Jon Snow\">%n" + "but did not.%n" + "%n" + "Throwable that failed the check:%n" + "%n%s", getStackTrace(actual)); }
Source:
public void resetsProgressIfNotEnoughLogsForVerification() { helper.writeLogsOnDefaultLocalServer(1, 1); helper.assertLocalTimestampInvariantsStand(); helper.writeLogsOnDefaultLocalServer(2, LEARNER_LOG_BATCH_SIZE_LIMIT); helper.forceTimestampToGoBackwards(LEARNER_LOG_BATCH_SIZE_LIMIT / 2); helper.assertClockWentBackwards(); }

Target:
public void resetsProgressIfNotEnoughLogsForVerification() { helper.createTimestampInversion(1); helper.assertLocalTimestampInvariantsStandInNextBatch(); helper.writeLogsOnDefaultLocalServer(2, LEARNER_LOG_BATCH_SIZE_LIMIT); helper.assertClockGoesBackwardsInNextBatch(); }
Source:
public ICommand<MIinfoRecord> createCLIInfoRecord(ICommandControlDMContext ctx) { return new CLIInfoRecord(ctx); }

Target:
public ICommand<CLIInfoRecordInfo> createCLIInfoRecord(ICommandControlDMContext ctx) { return new CLIInfoRecord(ctx); }
Source:
public long open(DataSpec dataSpec) throws ContentDataSourceException { try { uri = dataSpec.uri; assetFileDescriptor = resolver.openAssetFileDescriptor(uri, "r"); inputStream = assetFileDescriptor.createInputStream(); long skipped = inputStream.skip(dataSpec.position); if (skipped < dataSpec.position) { throw new EOFException(); } if (dataSpec.length != C.LENGTH_UNSET) { bytesRemaining = dataSpec.length; } else { bytesRemaining = inputStream.available(); if (bytesRemaining == 0) { bytesRemaining = C.LENGTH_UNSET; } } } catch (IOException e) { throw new ContentDataSourceException(e); } opened = true; if (listener != null) { listener.onTransferStart(this, dataSpec); } return bytesRemaining; }

Target:
public long open(DataSpec dataSpec) throws ContentDataSourceException { try { uri = dataSpec.uri; assetFileDescriptor = resolver.openAssetFileDescriptor(uri, "r"); if (assetFileDescriptor == null) { throw new FileNotFoundException("Could not open file descriptor for: " + uri); } inputStream = new FileInputStream(assetFileDescriptor.getFileDescriptor()); long skipped = inputStream.skip(dataSpec.position); if (skipped < dataSpec.position) { throw new EOFException(); } if (dataSpec.length != C.LENGTH_UNSET) { bytesRemaining = dataSpec.length; } else { bytesRemaining = assetFileDescriptor.getLength(); if (bytesRemaining == AssetFileDescriptor.UNKNOWN_LENGTH) { bytesRemaining = inputStream.available(); if (bytesRemaining == 0) { bytesRemaining = C.LENGTH_UNSET; } } } } catch (IOException e) { throw new ContentDataSourceException(e); } opened = true; if (listener != null) { listener.onTransferStart(this, dataSpec); } return bytesRemaining; }
Source:
public boolean sendSerialData(XBee64BitAddress address, byte[] data) throws InvalidOperatingModeException, XBeeException { XBeePacket xbeePacket; XBeePacket receivedPacket; if (address == null || data == null) throw new XBeeException(XBeeException.INVALID_ARGUMENT, "Address and data cannot be null"); switch (getXBeeProtocol()) { case RAW_802_15_4: xbeePacket = new TX64Packet(getNextFrameID(), address, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket instanceof TXStatusPacket) { switch (((TXStatusPacket)receivedPacket).getStatus()) { case SUCCESS: return true; default: return false; } } else return false; default: xbeePacket = new TransmitPacket(getNextFrameID(), address, XBee16BitAddress.UNKNOWN_ADDRESS, 0, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket instanceof TransmitStatusPacket) { switch (((TransmitStatusPacket)receivedPacket).getDeliveryStatus()) { case SUCCESS: return true; default: return false; } } else return false; } }

Target:
public boolean sendSerialData(XBee64BitAddress address, byte[] data) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); XBeePacket xbeePacket; XBeePacket receivedPacket; if (address == null || data == null) throw new XBeeException(XBeeException.INVALID_ARGUMENT, "Address and data cannot be null"); switch (getXBeeProtocol()) { case RAW_802_15_4: xbeePacket = new TX64Packet(getNextFrameID(), address, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket == null) return true; if (receivedPacket instanceof TXStatusPacket) { switch (((TXStatusPacket)receivedPacket).getTransmitStatus()) { case SUCCESS: return true; default: return false; } } else return false; default: xbeePacket = new TransmitPacket(getNextFrameID(), address, XBee16BitAddress.UNKNOWN_ADDRESS, 0, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket == null) return true; if (receivedPacket instanceof TransmitStatusPacket) { switch (((TransmitStatusPacket)receivedPacket).getTransmitStatus()) { case SUCCESS: return true; default: return false; } } else return false; } }
Source:
public void requestPulse(GlowBlock block, int tickRate) { Map<Location, Integer> map = getTickMap(); Location target = block.getLocation(); for (Location location : map.keySet()) { if (target.equals(location)) { if (tickRate > 0) tickMap.put(location, tickRate); else tickMap.remove(location); return; } } if (tickRate > 0) tickMap.put(target, tickRate); }

Target:
public void requestPulse(GlowBlock block, int tickRate) { Location target = block.getLocation(); if (tickRate > 0) tickMap.put(target, tickRate); else if (tickMap.containsKey(target)) tickMap.remove(target); }
Source:
public FeedbackQuestionAttributes() { }

Target:
protected FeedbackQuestionAttributes() { }
Source:
private void updateDefaultQuota() { if (_oldStoragePool.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED && getStoragePool().getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED) { RefObject<Boolean> reuseQuota = new RefObject<Boolean>(true); Quota newDefaultQuota = getQutoaHelper().getUnlimitedQuota(getStoragePool(), true, reuseQuota); if (reuseQuota.argvalue) { log.infoFormat("Reusing quota {0} as the default quota for Storage Pool {1}", newDefaultQuota.getId(), newDefaultQuota.getStoragePoolId()); } else { newDefaultQuota.setQuotaName(getQutoaHelper().getDefaultQuotaName(getStoragePool())); } getQutoaHelper().saveQuotaForUser(newDefaultQuota, MultiLevelAdministrationHandler.EVERYONE_OBJECT_ID, reuseQuota.argvalue); } }

Target:
private void updateDefaultQuota() { if (_oldStoragePool.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED && getStoragePool().getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED) { RefObject<Boolean> reuseQuota = new RefObject<Boolean>(true); Quota newDefaultQuota = getQutoaHelper().getUnlimitedQuota(getStoragePool(), true, reuseQuota); if (reuseQuota.argvalue) { log.debugFormat("Reusing quota {0} as the default quota for Storage Pool {1}", newDefaultQuota.getId(), newDefaultQuota.getStoragePoolId()); } else { newDefaultQuota.setQuotaName(getQutoaHelper().getDefaultQuotaName(getStoragePool())); } getQutoaHelper().saveQuotaForUser(newDefaultQuota, MultiLevelAdministrationHandler.EVERYONE_OBJECT_ID, reuseQuota.argvalue); } }
Source:
private ClusterComposition lookupClusterCompositionOnKnownRouters( ConnectionPool connections, RoutingTable routingTable ) { int size = routingTable.routerSize(); Set<BoltServerAddress> triedServers = new HashSet<>( size ); for ( int i = 0; i < size; i++ ) { BoltServerAddress address = routingTable.nextRouter(); if ( address == null ) { break; } ClusterComposition composition = lookupClusterCompositionOnRouter( address, connections, routingTable ); if ( composition != null ) { return composition; } else { triedServers.add( address ); } } Set<BoltServerAddress> ips = dnsResolver.resolve( initialRouter ); ips.removeAll( triedServers ); for ( BoltServerAddress address : ips ) { ClusterComposition composition = lookupClusterCompositionOnRouter( address, connections, routingTable ); if ( composition != null ) { return composition; } } return null; }

Target:
private ClusterComposition lookupClusterCompositionOnKnownRouters( ConnectionPool connections, RoutingTable routingTable ) { int size = routingTable.routerSize(); Set<BoltServerAddress> triedServers = new HashSet<>(); for ( int i = 0; i < size; i++ ) { BoltServerAddress address = routingTable.nextRouter(); if ( address == null ) { break; } ClusterComposition composition = lookupClusterCompositionOnRouter( address, connections, routingTable ); if ( composition != null ) { return composition; } else { triedServers.add( address ); } } Set<BoltServerAddress> ips = hostNameResolver.resolve( initialRouter ); ips.removeAll( triedServers ); for ( BoltServerAddress address : ips ) { ClusterComposition composition = lookupClusterCompositionOnRouter( address, connections, routingTable ); if ( composition != null ) { return composition; } } return null; }
Source:
long setLastAddConfirmed(long lac) { long lacToReturn; synchronized (this) { if (null == this.lac || this.lac < lac) { this.lac = lac; setChanged(); } lacToReturn = this.lac; } LOG.trace("Updating LAC , {}", lacToReturn, lac); notifyObservers(new LastAddConfirmedUpdateNotification(lacToReturn)); return lacToReturn; }

Target:
long setLastAddConfirmed(long lac) { long lacToReturn; synchronized (this) { if (null == this.lac || this.lac < lac) { this.lac = lac; setChanged(); } lacToReturn = this.lac; } if (LOG.isTraceEnabled()) { LOG.trace("Updating LAC , {}", lacToReturn, lac); } notifyObservers(new LastAddConfirmedUpdateNotification(lacToReturn)); return lacToReturn; }
Source:
public void dropRole(String role) { try { delegate.dropRole(role); } finally { rolesCache.invalidateAll(); } }

Target:
public void dropRole(String role) { try { delegate.dropRole(role); } finally { rolesCache.invalidateAll(); roleGrantsCache.invalidateAll(); } }
Source:
public int getDirectionForBlocks(LayoutBlock a, LayoutBlock b) { if (containsBlock(b.getBlock())) { if (getBlockSequenceNumber(a.getBlock()) > getBlockSequenceNumber(b.getBlock())) { return EntryPoint.FORWARD; } else { return EntryPoint.REVERSE; } } for (int i = 0; i < mForwardEntryPoints.size(); i++) { if (mForwardEntryPoints.get(i).getFromBlock() == b.getBlock()) { return EntryPoint.FORWARD; } } for (int j = 0; j < mReverseEntryPoints.size(); j++) { if (mReverseEntryPoints.get(j).getFromBlock() == b.getBlock()) { return EntryPoint.REVERSE; } } log.error("Unexpected error in getDirectionForBlocks when working with LevelCrossing in Section {}", getDisplayName(USERSYS)); return EntryPoint.UNKNOWN; }

Target:
private int getDirectionForBlocks(LayoutBlock a, LayoutBlock b) { if (containsBlock(b.getBlock())) { if (getBlockSequenceNumber(a.getBlock()) > getBlockSequenceNumber(b.getBlock())) { return EntryPoint.FORWARD; } else { return EntryPoint.REVERSE; } } for (int i = 0; i < mForwardEntryPoints.size(); i++) { if (mForwardEntryPoints.get(i).getFromBlock() == b.getBlock()) { return EntryPoint.FORWARD; } } for (int j = 0; j < mReverseEntryPoints.size(); j++) { if (mReverseEntryPoints.get(j).getFromBlock() == b.getBlock()) { return EntryPoint.REVERSE; } } log.error("Unexpected error in getDirectionForBlocks when working with LevelCrossing in Section {}", getDisplayName(USERSYS)); return EntryPoint.UNKNOWN; }
Source:
public void addChild(LaunchObjectModel model) { for (LaunchObjectModel e : children) { model.compareTo(e); } children.add(model); }

Target:
public void addChild(LaunchObjectModel model) { children.add(model); }
Source:
public void requireSystemDuringLoad() throws Exception { r.jenkins.setSecurityRealm(r.createDummySecurityRealm()); r.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy()); try (ACLContext context = ACL.as(User.getOrCreateByIdOrFullName("underprivileged").impersonate())) { dynamicLoad("require-system-during-load.hpi"); } }

Target:
public void requireSystemDuringLoad() throws Exception { r.jenkins.setSecurityRealm(r.createDummySecurityRealm()); r.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy()); try (ACLContext context = ACL.as(User.getById("underprivileged", true).impersonate())) { dynamicLoad("require-system-during-load.hpi"); } }
Source:
public boolean deleteIndicatorData(long indicator, long regionset, int year) { try (final SqlSession session = factory.openSession()) { int updated = getMapper(session).deleteData(indicator, regionset, year); if(updated != 1) { throw new ServiceRuntimeException("Delete wasn't successful"); } } return true; }

Target:
public boolean deleteIndicatorData(long indicator, long regionset, int year) { try (final SqlSession session = factory.openSession()) { int updated = getMapper(session).deleteData(indicator, regionset, year); return updated != 0; } }
Source:
public Map<String, Short> toMap() { return new HashMap<String, Short>() { { put(minKeyLabel, min()); put(maxKeyLabel, max()); } }; }

Target:
public Map<String, Short> toMap() { return Utils.mkMap(Utils.mkEntry(minKeyLabel, min()), Utils.mkEntry(maxKeyLabel, max())); }
Source:
protected RecordingTransactionBase(TransactionBase txb) { this.txb = txb; }

Target:
RecordingTransactionBase(TransactionBase txb) { this.txb = txb; }
Source:
public void complexity() { String path = "src/test/resources/metrics/complexity.js"; Tree tree = p.parse(new File(path)); assertThat(new ComplexityVisitor().getComplexity(tree)).isEqualTo(22); }

Target:
public void complexity() { String path = "src/test/resources/metrics/complexity.js"; Tree tree = p.parse(new File(path)); assertThat(new ComplexityVisitor(true).getComplexity(tree)).isEqualTo(29); }
Source:
private byte[] encrypt(final String name, final Date date, final byte[] rawText) throws NoSuchProviderException, PGPException, IOException { final byte[] zText = compress(name, date, rawText); final BcPGPDataEncryptorBuilder builder = new BcPGPDataEncryptorBuilder(PGPEncryptedData.CAST5) .setSecureRandom(prng); final PGPEncryptedDataGenerator cpk = new PGPEncryptedDataGenerator(builder, true); final BcPublicKeyKeyEncryptionMethodGenerator methodGenerator = new BcPublicKeyKeyEncryptionMethodGenerator(dest); cpk.addMethod(methodGenerator); final ByteArrayOutputStream buf = new ByteArrayOutputStream(); final ArmoredOutputStream aout = new ArmoredOutputStream(buf); final OutputStream cout = cpk.open(aout, zText.length); cout.write(zText); cout.close(); aout.close(); return buf.toByteArray(); }

Target:
private byte[] encrypt(final String name, final Date date, final byte[] rawText) throws NoSuchProviderException, PGPException, IOException { final byte[] zText = compress(name, date, rawText); final ByteArrayOutputStream buf = new ByteArrayOutputStream(); final ArmoredOutputStream aout = new ArmoredOutputStream(buf); final OutputStream cout = cpk().open(aout, zText.length); cout.write(zText); cout.close(); aout.close(); return buf.toByteArray(); }
Source:
public void setAge(Duration age) { setAge(age.get(ChronoUnit.SECONDS)); }

Target:
public void setAge(Duration age) { setAge(age.getSeconds()); }
Source:
private static String indentSql(String sql) { StringBuilder builder = new StringBuilder(); String[] lines = sql.split("\n"); builder.append(lines[0]); for (int i = 1; i < lines.length; i++) { builder.append("\n ").append(lines[i]); } return builder.toString(); }

Target:
private static String indentSql(String sql) { return sql.replace("\n", "\n "); }
Source:
public HttpRequest<T> build() { return new HttpRequestImpl<T>(url, method, headers, outputStreamHandler, new HttpClient.ResponseHandler<T>() { @Override public T handleResponse(InputStream is, Integer statusCode, IOException e) throws IOException { if (errorStatusCodesIgnored.contains(statusCode)) { return null; } else if (statusCode >= 400) { new ErrorLoggingResponseHandler(HttpClient.removeUserInfo(url)).handleResponse(is, statusCode, e); return null; } else { return responseHandler.handleResponse(is, statusCode, e); } } }); }

Target:
public HttpRequest<T> build() { return new HttpRequestImpl<T>(url, method, headers, outputStreamHandler, new HttpClient.ResponseHandler<T>() { @Override public T handleResponse(InputStream is, Integer statusCode, IOException e) throws IOException { if (errorStatusCodesIgnored.contains(statusCode)) { IOUtils.consumeAndClose(is); return null; } else if (statusCode >= 400) { new ErrorLoggingResponseHandler(HttpClient.removeUserInfo(url)).handleResponse(is, statusCode, e); return null; } else { return responseHandler.handleResponse(is, statusCode, e); } } }); }