auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void nextTuple() { LOG.trace("Next Tuple {}", spoutId); if (!retryList.isEmpty()) { LOG.debug("Sending tuple from retry list"); HdfsUtils.Pair<MessageId, List<Object>> pair = retryList.remove(); emitData(pair.getValue(), pair.getKey()); return; } if (ackEnabled && tracker.size() >= maxOutstanding) { LOG.warn("Waiting for more ACKs before generating new tuples. " + "Progress tracker size has reached limit {}, SpoutID {}", maxOutstanding, spoutId); return; } while (true) { try { boolean newReader = false; if (reader == null) { reader = pickNextFile(); if (reader == null) { LOG.debug("Currently no new files to process under : " + sourceDirPath); return; } else { fileReadCompletely = false; newReader = true; } } else { newReader = false; } if (fileReadCompletely) { return; } List<Object> tuple = reader.next(); if (tuple != null) { fileReadCompletely = false; ++tupleCounter; MessageId msgId = new MessageId(tupleCounter, reader.getFilePath(), reader.getFileOffset()); emitData(tuple, msgId); if (!ackEnabled) { ++acksSinceLastCommit; commitProgress(reader.getFileOffset()); } else { commitProgress(tracker.getCommitPosition()); } return; } else { fileReadCompletely = true; if (!ackEnabled || newReader) { markFileAsDone(reader.getFilePath()); } } } catch (IOException e) { LOG.error("I/O Error processing at file location " + getFileProgress(reader), e); return; } catch (ParseException e) { LOG.error("Parsing error when processing at file location " + getFileProgress(reader) + ". Skipping remainder of file.", e); markFileAsBad(reader.getFilePath()); } } }

Target:
public void nextTuple() { LOG.trace("Next Tuple {}", spoutId); if (!retryList.isEmpty()) { LOG.debug("Sending tuple from retry list"); HdfsUtils.Pair<MessageId, List<Object>> pair = retryList.remove(); emitData(pair.getValue(), pair.getKey()); return; } if (ackEnabled && tracker.size() >= maxOutstanding) { LOG.warn("Waiting for more ACKs before generating new tuples. " + "Progress tracker size has reached limit {}, SpoutID {}", maxOutstanding, spoutId); return; } while (true) { try { boolean newReader = false; if (reader == null) { reader = pickNextFile(); if (reader == null) { LOG.debug("Currently no new files to process under : " + sourceDirPath); return; } else { fileReadCompletely = false; newReader = true; } } if (fileReadCompletely) { return; } List<Object> tuple = reader.next(); if (tuple != null) { fileReadCompletely = false; ++tupleCounter; MessageId msgId = new MessageId(tupleCounter, reader.getFilePath(), reader.getFileOffset()); emitData(tuple, msgId); if (!ackEnabled) { ++acksSinceLastCommit; commitProgress(reader.getFileOffset()); } else { commitProgress(tracker.getCommitPosition()); } return; } else { fileReadCompletely = true; if (!ackEnabled || newReader) { markFileAsDone(reader.getFilePath()); } } } catch (IOException e) { LOG.error("I/O Error processing at file location " + getFileProgress(reader), e); return; } catch (ParseException e) { LOG.error("Parsing error when processing at file location " + getFileProgress(reader) + ". Skipping remainder of file.", e); markFileAsBad(reader.getFilePath()); } } }
Source:
public String load(IResource resource, Connection connection) throws CoreException { IProject project = resource.getProject(); IPod pod = getPod(resource, project, connection); String imageRef = getImageRef(connection, project, pod); int imageDigestIndex = imageRef.indexOf(DOCKER_IMAGE_DIGEST_IDENTIFIER); if (imageDigestIndex > 0) { String imageDigest = imageRef.substring(imageDigestIndex); IResource imageStreamTag = getImageStreamTag(connection, project, imageRef, imageDigest); return getPodPath(imageStreamTag); } else { String imageMetaData = getImageMetaData(imageRef, project); if (imageMetaData != null) { return getPodPath(imageMetaData); } else { return ""; } } }

Target:
public String load(IResource resource, Connection connection) throws CoreException { IProject project = resource.getProject(); IPod pod = getPod(resource, project, connection); String imageRef = getImageRef(connection, project, pod); int imageDigestIndex = imageRef.indexOf(DOCKER_IMAGE_DIGEST_IDENTIFIER); if (imageDigestIndex > 0) { String imageDigest = imageRef.substring(imageDigestIndex); IResource imageStreamTag = getImageStreamTag(connection, project, imageRef, imageDigest); return getPodPath(imageStreamTag); } else { String imageMetaData = getImageMetaData(imageRef, project); return getPodPath(imageMetaData); } }
Source:
public SerialPortRxTx(String port, SerialPortParameters parameters) { super(port, parameters, DEFAULT_PORT_TIMEOUT); this.logger = LoggerFactory.getLogger(SerialPortRxTx.class); }

Target:
public SerialPortRxTx(String port, SerialPortParameters parameters) { this(port, parameters, DEFAULT_PORT_TIMEOUT); }
Source:
public void testCleanPayeeACHAccountExtractDetailNoClean() { String bankAccountNumber = "12345"; PayeeACHAccountExtractDetail detail = new PayeeACHAccountExtractDetail(); detail.setBankAccountNumber(bankAccountNumber); payeeACHAccountExtractService.cleanPayeeACHAccountExtractDetail(detail); String expectedBankAccount = bankAccountNumber; assertEquals(expectedBankAccount, detail.getBankAccountNumber()); }

Target:
public void testCleanPayeeACHAccountExtractDetailNoClean() { String bankAccountNumber = "12345"; validateCleanPayeeACHAccountExtractDetail(bankAccountNumber, bankAccountNumber); }
Source:
private static List<Field> getAllFields(Class clazz){ List<Field> fields = new ArrayList<>(); fields.addAll(Arrays.asList(clazz.getDeclaredFields())); Class superClass = clazz.getSuperclass(); if (superClass != null) fields.addAll(getAllFields(superClass)); return fields; }

Target:
private static List<Field> getAllFields(Class clazz){ final List<Field> fields = new ArrayList<>(); fields.addAll(Arrays.asList(clazz.getDeclaredFields())); final Class superClass = clazz.getSuperclass(); if (superClass != null) fields.addAll(getAllFields(superClass)); return fields; }
Source:
public int setTabIndexes(int nextTabIndex) { nextTabIndex++; nameEditor.setTabIndex(nextTabIndex++); cidrEditor.setTabIndex(nextTabIndex++); ipVersionEditor.setTabIndex(nextTabIndex++); gatewayEditor.setTabIndex(nextTabIndex++); return dnsServersEditor.setTabIndexes(nextTabIndex); }

Target:
public int setTabIndexes(int nextTabIndex) { nameEditor.setTabIndex(nextTabIndex++); cidrEditor.setTabIndex(nextTabIndex++); ipVersionEditor.setTabIndex(nextTabIndex++); gatewayEditor.setTabIndex(nextTabIndex++); return dnsServersEditor.setTabIndexes(nextTabIndex); }
Source:
Validator createValidator(ConstraintValidatorFactory constraintValidatorFactory, ValueExtractorManager valueExtractorManager, ValidatorFactoryScopedContext validatorFactoryScopedContext, MethodValidationConfiguration methodValidationConfiguration) { ConstraintMetaDataManager constraintMetaDataManager = beanMetaDataManagers.computeIfAbsent( new BeanMetaDataManagerKey( validatorFactoryScopedContext.getParameterNameProvider(), valueExtractorManager, methodValidationConfiguration ), key -> new ConstraintMetaDataManager( constraintHelper, executableHelper, typeResolutionHelper, validatorFactoryScopedContext.getParameterNameProvider(), valueExtractorManager, javaBeanHelper, validationOrderGenerator, methodValidationConfiguration, buildMetaDataProviders(), buildPropertyHolderMetaDataProvider() ) ); return new ValidatorImpl( constraintValidatorFactory, constraintMetaDataManager, valueExtractorManager, constraintValidatorManager, validationOrderGenerator, validatorFactoryScopedContext ); }

Target:
Validator createValidator(ConstraintValidatorFactory constraintValidatorFactory, ValueExtractorManager valueExtractorManager, ValidatorFactoryScopedContext validatorFactoryScopedContext, MethodValidationConfiguration methodValidationConfiguration) { ConstraintMetaDataManager constraintMetaDataManager = beanMetaDataManagers.computeIfAbsent( new BeanMetaDataManagerKey( validatorFactoryScopedContext.getParameterNameProvider(), valueExtractorManager, methodValidationConfiguration ), key -> new ConstraintMetaDataManager( constraintHelper, executableHelper, typeResolutionHelper, validatorFactoryScopedContext.getParameterNameProvider(), valueExtractorManager, propertyAccessorCreatorProvider, javaBeanHelper, validationOrderGenerator, methodValidationConfiguration, buildMetaDataProviders(), buildPropertyHolderMetaDataProvider() ) ); return new ValidatorImpl( constraintValidatorFactory, constraintMetaDataManager, valueExtractorManager, constraintValidatorManager, validationOrderGenerator, validatorFactoryScopedContext ); }
Source:
private static void getVisibleModes(List<ApplicationMode> values, Set<ApplicationMode> selected, List<ApplicationMode> visible) { if (visible.size() == 3) { for (ApplicationMode mode : selected){ if (visible.contains(mode)){ return; } } } visible.clear(); if (selected.size() > 0) { List<Integer> positions = new ArrayList<Integer>(); for (ApplicationMode mode : selected){ for (int i =0; i< values.size(); i++){ if (mode.equals(values.get(i))){ positions.add(i); } } } if (positions.size() == 1) { int pos = positions.get(0); if (pos < values.size() - 2 && pos > 0){ visible.add(values.get(pos - 1)); visible.add(values.get(pos)); visible.add(values.get(pos + 1)); } else if (pos == 0) { visible.add(values.get(pos)); visible.add(values.get(1)); visible.add(values.get(2)); } else if (pos == values.size() -1) { visible.add(values.get(pos - 1)); visible.add(values.get(pos - 2)); visible.add(values.get(pos)); } } else if (positions.size() == 2) { int pos1 = positions.get(0); int pos2 = positions.get(1); if (pos1 + 1 != pos2){ visible.add(values.get(pos1)); visible.add(values.get(pos1 + 1)); visible.add(values.get(pos2)); } else if (pos1 > 0 && pos1 + 1 == pos2) { visible.add(values.get(pos1 - 1)); visible.add(values.get(pos1)); visible.add(values.get(pos2)); } else if (pos1 == 0 && pos1 + 1 == pos2) { visible.add(values.get(pos1)); visible.add(values.get(pos2)); visible.add(values.get(pos2 + 1)); } } } else { for (int i =0; i<3; i++){ visible.add(values.get(i)); } } }

Target:
private static void getVisibleModes(List<ApplicationMode> values, Set<ApplicationMode> selected, List<ApplicationMode> visible) { if (visible.size() == 3) { for (ApplicationMode mode : selected){ if (visible.contains(mode)){ return; } } } visible.clear(); visible.add(ApplicationMode.DEFAULT); for (ApplicationMode mode : selected){ if (mode != ApplicationMode.DEFAULT) { visible.add(mode); break; } } for(ApplicationMode mode : values) { if (!visible.contains(mode)) { visible.add(mode); if (visible.size() == 3){ break; } } } }
Source:
public InternalParquetRecordWriter( ParquetFileWriter parquetFileWriter, WriteSupport<T> writeSupport, MessageType schema, Map<String, String> extraMetaData, long rowGroupSize, int pageSize, BytesCompressor compressor, int dictionaryPageSize, boolean enableDictionary, boolean validating, WriterVersion writerVersion, ByteBufferAllocator allocator) { this.parquetFileWriter = parquetFileWriter; this.writeSupport = checkNotNull(writeSupport, "writeSupport"); this.schema = schema; this.extraMetaData = extraMetaData; this.rowGroupSize = rowGroupSize; this.rowGroupSizeThreshold = rowGroupSize; this.nextRowGroupSize = rowGroupSizeThreshold; this.pageSize = pageSize; this.compressor = compressor; this.validating = validating; this.parquetProperties = new ParquetProperties(dictionaryPageSize, writerVersion, enableDictionary); this.allocator=allocator; initStore(); }

Target:
public InternalParquetRecordWriter( ParquetFileWriter parquetFileWriter, WriteSupport<T> writeSupport, MessageType schema, Map<String, String> extraMetaData, long rowGroupSize, int pageSize, BytesCompressor compressor, int dictionaryPageSize, boolean enableDictionary, boolean validating, WriterVersion writerVersion, ByteBufferAllocator allocator) { this.parquetFileWriter = parquetFileWriter; this.writeSupport = checkNotNull(writeSupport, "writeSupport"); this.schema = schema; this.extraMetaData = extraMetaData; this.rowGroupSize = rowGroupSize; this.rowGroupSizeThreshold = rowGroupSize; this.nextRowGroupSize = rowGroupSizeThreshold; this.pageSize = pageSize; this.compressor = compressor; this.validating = validating; this.parquetProperties = new ParquetProperties(dictionaryPageSize, writerVersion, enableDictionary, allocator); initStore(); }
Source:
public void unlock(Collection<Object> lockedKeys, Object lockOwner) { for (Object k : lockedKeys) { if (trace) log.tracef("Attempting to unlock key %s", toStr(k)); lockContainer.releaseLock(lockOwner, k); } }

Target:
public void unlock(Collection<Object> lockedKeys, Object lockOwner) { log.tracef("Attempting to unlock keys %s", lockedKeys); for (Object k : lockedKeys) lockContainer.releaseLock(lockOwner, k); }
Source:
private static boolean isInContext(Pair<IErrorParserNamed, Integer> pair, int context) { return (pair.second & context) == context; }

Target:
private static boolean isInContext(Pair<IErrorParserNamed, Integer> pair, int context) { return (pair.second & context) != 0; }
Source:
private void updateActionAvailability() { Disk disk = (Disk) getSelectedItem(); getNewCommand().setIsExecutionAllowed(true); getAttachCommand().setIsExecutionAllowed(true); getEditCommand().setIsExecutionAllowed(disk != null && isSingleDiskSelected() && !isDiskLocked(disk) && (isVmDown() || !disk.getPlugged() || (isExtendImageSizeSupported() && isExtendImageSizeEnabled()) || getEntity().getStatus().equals(VMStatus.Paused))); getRemoveCommand().setIsExecutionAllowed(atLeastOneDiskSelected() && isRemoveCommandAvailable()); getMoveCommand().setIsExecutionAllowed(atLeastOneDiskSelected() && (isMoveCommandAvailable() || isLiveMoveCommandAvailable())); updateScanAlignmentCommandAvailability(); getPlugCommand().setIsExecutionAllowed(isPlugCommandAvailable(true)); getUnPlugCommand().setIsExecutionAllowed(isPlugCommandAvailable(false)); ChangeQuotaModel.updateChangeQuotaActionAvailability(getItems() != null ? (List<Disk>) getItems() : null, getSelectedItems() != null ? (List<Disk>) getSelectedItems() : null, getSystemTreeSelectedItem(), getChangeQuotaCommand()); }

Target:
private void updateActionAvailability() { Disk disk = (Disk) getSelectedItem(); getNewCommand().setIsExecutionAllowed(true); getAttachCommand().setIsExecutionAllowed(true); getEditCommand().setIsExecutionAllowed(disk != null && isSingleDiskSelected() && !isDiskLocked(disk) && isEnvironmentValidForDiskEdit(disk)); getRemoveCommand().setIsExecutionAllowed(atLeastOneDiskSelected() && isRemoveCommandAvailable()); getMoveCommand().setIsExecutionAllowed(atLeastOneDiskSelected() && (isMoveCommandAvailable() || isLiveMoveCommandAvailable())); updateScanAlignmentCommandAvailability(); getPlugCommand().setIsExecutionAllowed(isPlugCommandAvailable(true)); getUnPlugCommand().setIsExecutionAllowed(isPlugCommandAvailable(false)); ChangeQuotaModel.updateChangeQuotaActionAvailability(getItems() != null ? (List<Disk>) getItems() : null, getSelectedItems() != null ? (List<Disk>) getSelectedItems() : null, getSystemTreeSelectedItem(), getChangeQuotaCommand()); }
Source:
public void storageDomainWithId() { b.setStorageDomainId(GUID); b.setStoragePoolId(GUID); final StorageDomain s = b.getStorageDomain(); assertEquals(StorageDomainStatus.Active, s.getStatus()); }

Target:
public void storageDomainWithId() { b.setStorageDomainId(GUID); b.setStoragePoolId(GUID); final StorageDomain s = b.getStorageDomain(); assertEquals(STORAGE_DOMAIN, s); }
Source:
public HiveOrcAggregatedMemoryContext(AggregatedMemoryContext delegate) { this.delegate = delegate; }

Target:
private HiveOrcAggregatedMemoryContext(AggregatedMemoryContext delegate) { this.delegate = requireNonNull(delegate, "delegate is null"); }
Source:
private void resetFieldValues(MethodInvocationTree tree) { final PMap<Symbol, SymbolicValue>[] values = new PMap[]{programState.values}; programState.values.forEach(new PMap.Consumer<Symbol, SymbolicValue>() { @Override public void accept(Symbol symbol, SymbolicValue value) { if (isField(symbol)) { VariableTree variable = ((Symbol.VariableSymbol) symbol).declaration(); if (variable != null) { SymbolicValue nonNullValue = constraintManager.supersedeSymbolicValue(variable); values[0] = values[0].put(symbol, nonNullValue); } } } }); if(programState.values != values [0]) { programState = new ProgramState(values[0], programState.constraints, programState.visitedPoints, programState.stack); } }

Target:
private void resetFieldValues(MethodInvocationTree tree) { final PMap<Symbol, SymbolicValue>[] values = new PMap[]{programState.values}; programState.values.forEach(new PMap.Consumer<Symbol, SymbolicValue>() { @Override public void accept(Symbol symbol, SymbolicValue value) { if (isField(symbol)) { VariableTree variable = ((Symbol.VariableSymbol) symbol).declaration(); if (variable != null) { SymbolicValue nonNullValue = constraintManager.createSymbolicValue(variable); values[0] = values[0].put(symbol, nonNullValue); } } } }); if(programState.values != values [0]) { programState = new ProgramState(values[0], programState.constraints, programState.visitedPoints, programState.stack); } }
Source:
private BiConsumer<Throwable, Object> getRetryHandler() { return (error, offendingEvent) -> { MessagingException messagingError = (MessagingException) error; RetryContext ctx = getRetryContextForEvent(messagingError.getEvent()); int retriesLeft = ctx.retryCount.getAndDecrement(); if (retriesLeft > 0) { LOGGER.error("Retrying execution of event, attempt of {}.", ctx.getRetriesLeft(), ctx.maxRetries != RETRY_COUNT_FOREVER ? ctx.maxRetries : "unlimited"); UntilSuccessfulRouter.this.delayScheduler.schedule(() -> innerRecorder.next(eventWithCurrentContext(ctx.event, ctx)), ctx.delayInMillis, TimeUnit.MILLISECONDS); } else { LOGGER.error("Retry attempts exhausted. Failing..."); Throwable resolvedError = getThrowableFunction(ctx.event).apply(error); eventWithCurrentContextDeleted(messagingError.getEvent()); downstreamRecorder.next(left(resolvedError, CoreEvent.class)); completeRouterIfNecessary(); } }; }

Target:
private BiConsumer<Throwable, Object> getRetryHandler() { return (error, offendingEvent) -> { MessagingException messagingError = (MessagingException) error; RetryContext ctx = getRetryContextForEvent(messagingError.getEvent()); int retriesLeft = ctx.retryCount.getAndDecrement(); if (retriesLeft > 0) { LOGGER.error("Retrying execution of event, attempt of {}.", ctx.getRetriesLeft(), ctx.maxRetries != RETRY_COUNT_FOREVER ? ctx.maxRetries : "unlimited"); UntilSuccessfulRouter.this.delayScheduler.schedule(() -> innerRecorder.next(eventWithCurrentContext(ctx.event, ctx)), ctx.delayInMillis, MILLISECONDS); } else { LOGGER.error("Retry attempts exhausted. Failing..."); Throwable resolvedError = getThrowableFunction(ctx.event).apply(error); eventWithCurrentContextDeleted(messagingError.getEvent()); downstreamRecorder.next(left(resolvedError, CoreEvent.class)); completeRouterIfNecessary(); } }; }
Source:
public static void updateSearchItemQA(Context context, Map<String, String> item, Card c) { Map<String, String> qa = c._getQA(true, true); if (qa.get("q").equals("") || qa.get("a").equals("")) { HashMap<String, String> qaFull = c._getQA(true, false); if (qa.get("q").equals("")) { qa.put("q", qaFull.get("q")); } if (qa.get("a").equals("")) { qa.put("a", qaFull.get("a")); } } String q = qa.get("q"); String a = qa.get("a"); if (a.startsWith(q)) { a = a.replaceFirst(Pattern.quote(q), ""); } item.put("answer", formatQA(a)); item.put("card", c.template().optString("name")); int type = c.getType(); if (type == 0) { item.put("interval","(new)"); } else if (type == 1) { item.put("interval", "(learning)"); } else { item.put("interval", Utils.timeSpan(context, c.getIvl()*86400)); } item.put("lapses", Integer.toString(c.getLapses())); item.put("note", c.model().optString("name")); item.put("question", formatQA(q)); item.put("reviews", Integer.toString(c.getReps())); }

Target:
public static void updateSearchItemQA(Context context, Map<String, String> item, Card c) { Map<String, String> qa = c._getQA(true, true); if (qa.get("q").equals("") || qa.get("a").equals("")) { HashMap<String, String> qaFull = c._getQA(true, false); if (qa.get("q").equals("")) { qa.put("q", qaFull.get("q")); } if (qa.get("a").equals("")) { qa.put("a", qaFull.get("a")); } } String q = qa.get("q"); String a = qa.get("a"); if (a.startsWith(q)) { a = a.replaceFirst(Pattern.quote(q), ""); } item.put("answer", formatQA(a)); item.put("card", c.template().optString("name")); int type = c.getType(); if (type == 0) { item.put("interval", context.getString(R.string.card_browser_interval_new_card)); } else if (type == 1) { item.put("interval", context.getString(R.string.card_browser_interval_learning_card)); } else { item.put("interval", Utils.timeSpan(context, c.getIvl()*86400)); } item.put("lapses", Integer.toString(c.getLapses())); item.put("note", c.model().optString("name")); item.put("question", formatQA(q)); item.put("reviews", Integer.toString(c.getReps())); }
Source:
public void testIsAvailable() throws Exception { server.enqueue(jsonResponse("/isavailablestorageservice.json")); final StorageAccountApi storageAPI = api.getStorageAccountApi(resourceGroup); assertEquals(storageAPI.isAvailable("TESTSTORAGE"), Availability.create("true")); assertSent(server, "POST", "/subscriptions/" + subsriptionId + "/providers/Microsoft.Storage/checkNameAvailability?api-version=2015-06-15"); }

Target:
public void testIsAvailable() throws Exception { server.enqueue(jsonResponse("/isavailablestorageservice.json")); final StorageAccountApi storageAPI = api.getStorageAccountApi(resourceGroup); assertEquals(storageAPI.isAvailable("TESTSTORAGE"), Availability.create("true")); assertSent(server, "POST", "/subscriptions/" + subsriptionId + "/providers/Microsoft.Storage/checkNameAvailability?api-version=2015-06-15", String.format("{\"name\":\"TESTSTORAGE\",\"type\":\"Microsoft.Storage/storageAccounts\"}")); }
Source:
protected void doInit() throws Exception { super.doInit(); setXslt(createXsltBuilder()); setProcessor(getXslt()); }

Target:
protected void doInit() throws Exception { super.doInit(); setXslt(createXsltBuilder()); if (ResourceHelper.isClasspathUri(resourceUri)) { loadResource(resourceUri, xslt); } setProcessor(getXslt()); }
Source:
private static void cmd(ZipOutputStream zipStream, String[] command, String folderPath, String resFilename) throws IOException, TarMalformatException { File tempFile = File.createTempFile(resFilename, null); tempFile.deleteOnExit(); Process p = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader ereader = new BufferedReader(new InputStreamReader(p.getErrorStream())); BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); String line = null; while ((line = reader.readLine()) != null) { writer.write(line); writer.newLine(); } if (tempFile.length() <= 0) { if (ereader != null) { while ((line = ereader.readLine()) != null) { writer.write(line); writer.newLine(); } } } writer.close(); if (tempFile.length() > 0) { ZipEntry zEntry= new ZipEntry(folderPath + resFilename); zipStream.putNextEntry(zEntry); FileInputStream in = new FileInputStream(tempFile); int len; byte[] buffer = new byte[1024]; while ((len = in.read(buffer)) > 0) { zipStream.write(buffer, 0, len); } in.close(); zipStream.closeEntry(); } }

Target:
private static void cmd(ZipOutputStream zipStream, String[] command, String folderPath, String resFilename) throws IOException, ZipException { File tempFile = File.createTempFile(resFilename, null); tempFile.deleteOnExit(); Process p = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader ereader = new BufferedReader(new InputStreamReader(p.getErrorStream())); BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); String line = null; while ((line = reader.readLine()) != null) { writer.write(line); writer.newLine(); } if (tempFile.length() <= 0) { if (ereader != null) { while ((line = ereader.readLine()) != null) { writer.write(line); writer.newLine(); } } } writer.close(); if (tempFile.length() > 0) { ZipEntry zEntry= new ZipEntry(folderPath + resFilename); zipStream.putNextEntry(zEntry); FileInputStream in = new FileInputStream(tempFile); int len; byte[] buffer = new byte[1024]; while ((len = in.read(buffer)) > 0) { zipStream.write(buffer, 0, len); } in.close(); zipStream.closeEntry(); } }
Source:
public static ReadMapping jsonReadMapping() { return sliceReadMapping(JSON, (resultSet, columnIndex) -> utf8Slice(resultSet.getString(columnIndex))); }

Target:
private static ReadMapping jsonReadMapping() { return sliceReadMapping(JSON, (resultSet, columnIndex) -> jsonParse(utf8Slice(resultSet.getString(columnIndex)))); }
Source:
public Response getExampleResource() { log.info("getExampleResource: called"); URI selfUri = fromResource(ExampleCollectionResource.class).build(); return Response.ok("There is not much to show, buddy").location(selfUri).build(); }

Target:
public Response getExampleResource() { log.fine("getExampleResource: called"); return Response.ok("There is not much to show, buddy").build(); }
Source:
public void createOneForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = CommunityBuilder.createCommunity(context) .withName("My commynity") .build(); EPerson eperson1 = EPersonBuilder.createEPerson(context) .withEmail("eperson1@mail.com") .withPassword("qwerty01") .build(); context.restoreAuthSystemState(); ObjectMapper mapper = new ObjectMapper(); ResourcePolicyRest resourcePolicyRest = new ResourcePolicyRest(); resourcePolicyRest.setPolicyType(ResourcePolicy.TYPE_SUBMISSION); resourcePolicyRest.setAction(Constants.actionText[Constants.ADMIN]); String authToken = getAuthToken(eperson1.getEmail(), "qwerty01"); getClient(authToken).perform(post("/api/authz/resourcepolicies") .content(mapper.writeValueAsBytes(resourcePolicyRest)) .param("resource", community.getID().toString()) .param("eperson", eperson1.getID().toString()) .contentType(contentType)) .andExpect(status().isForbidden()); }

Target:
public void createOneForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = CommunityBuilder.createCommunity(context) .withName("My commynity") .build(); EPerson eperson1 = EPersonBuilder.createEPerson(context) .withEmail("eperson1@mail.com") .withPassword("qwerty01") .build(); context.restoreAuthSystemState(); ObjectMapper mapper = new ObjectMapper(); ResourcePolicyRest resourcePolicyRest = new ResourcePolicyRest(); resourcePolicyRest.setPolicyType(ResourcePolicy.TYPE_SUBMISSION); resourcePolicyRest.setAction(Constants.actionText[Constants.ADMIN]); String authToken = getAuthToken(eperson1.getEmail(), "qwerty01"); getClient(authToken).perform(post("/api/authz/resourcepolicies") .content(mapper.writeValueAsBytes(resourcePolicyRest)) .param("resource", community.getID().toString()) .param("eperson", eperson1.getID().toString()) .contentType(contentType)) .andExpect(status().isForbidden()); String authToken2 = getAuthToken(admin.getEmail(), password); getClient(authToken2).perform(get("/api/authz/resourcepolicies/search/resource") .param("uuid", community.getID().toString()) .param("action", "ADMIN")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._links.self.href", Matchers.containsString("api/authz/resourcepolicies/search/resource"))) .andExpect(jsonPath("$.page.totalElements", is(0))); }
Source:
public int compare(final ReadEndsForMarkDuplicates lhs, final ReadEndsForMarkDuplicates rhs) { int compareDifference = lhs.libraryId - rhs.libraryId; if (useBarcodes) { if (compareDifference == 0) compareDifference = compareInteger(((ReadEndsForMarkDuplicatesWithBarcodes) lhs).barcode, ((ReadEndsForMarkDuplicatesWithBarcodes) rhs).barcode); if (compareDifference == 0) compareDifference = compareInteger(((ReadEndsForMarkDuplicatesWithBarcodes) lhs).readOneBarcode, ((ReadEndsForMarkDuplicatesWithBarcodes) rhs).readOneBarcode); if (compareDifference == 0) compareDifference = compareInteger(((ReadEndsForMarkDuplicatesWithBarcodes) lhs).readTwoBarcode, ((ReadEndsForMarkDuplicatesWithBarcodes) rhs).readTwoBarcode); } if (compareDifference == 0) compareDifference = lhs.read1ReferenceIndex - rhs.read1ReferenceIndex; if (compareDifference == 0) compareDifference = lhs.read1Coordinate - rhs.read1Coordinate; if (compareDifference == 0) compareDifference = lhs.orientation - rhs.orientation; if (compareDifference == 0) compareDifference = lhs.read2ReferenceIndex - rhs.read2ReferenceIndex; if (compareDifference == 0) compareDifference = lhs.read2Coordinate - rhs.read2Coordinate; if (compareDifference == 0) compareDifference = (int) (lhs.read1IndexInFile - rhs.read1IndexInFile); if (compareDifference == 0) compareDifference = (int) (lhs.read2IndexInFile - rhs.read2IndexInFile); return compareDifference; }

Target:
public int compare(final ReadEndsForMarkDuplicates lhs, final ReadEndsForMarkDuplicates rhs) { int compareDifference = lhs.libraryId - rhs.libraryId; if (useBarcodes) { final ReadEndsForMarkDuplicatesWithBarcodes lhsWithBarcodes = (ReadEndsForMarkDuplicatesWithBarcodes) lhs; final ReadEndsForMarkDuplicatesWithBarcodes rhsWithBarcodes = (ReadEndsForMarkDuplicatesWithBarcodes) rhs; if (compareDifference == 0) compareDifference = compareInteger(lhsWithBarcodes.barcode, rhsWithBarcodes.barcode); if (compareDifference == 0) compareDifference = compareInteger(lhsWithBarcodes.readOneBarcode, rhsWithBarcodes.readOneBarcode); if (compareDifference == 0) compareDifference = compareInteger(lhsWithBarcodes.readTwoBarcode, rhsWithBarcodes.readTwoBarcode); } if (compareDifference == 0) compareDifference = lhs.read1ReferenceIndex - rhs.read1ReferenceIndex; if (compareDifference == 0) compareDifference = lhs.read1Coordinate - rhs.read1Coordinate; if (compareDifference == 0) compareDifference = lhs.orientation - rhs.orientation; if (compareDifference == 0) compareDifference = lhs.read2ReferenceIndex - rhs.read2ReferenceIndex; if (compareDifference == 0) compareDifference = lhs.read2Coordinate - rhs.read2Coordinate; if (compareDifference == 0) compareDifference = (int) (lhs.read1IndexInFile - rhs.read1IndexInFile); if (compareDifference == 0) compareDifference = (int) (lhs.read2IndexInFile - rhs.read2IndexInFile); return compareDifference; }
Source:
String getPath(ScoreBoardEventProvider p) { String path = ""; if (p.getParent() != null) { path = getPath(p.getParent()) + "."; } path = path + p.getProviderName(); if (!"".equals(p.getProviderId()) && p.getProviderId() != null) { path = path + "(" + p.getProviderId() + ")"; } return path; }

Target:
String getPath(ScoreBoardEventProvider p) { String path = ""; if (p.getParent() != null) { path = getPath(p.getParent()) + "."; } path = path + p.getProviderName(); if (!"".equals(p.getId()) && p.getId() != null) { path = path + "(" + p.getId() + ")"; } return path; }
Source:
public void setUp() throws Exception { storage = new DummyIndexedStorageUtility<Case>(Case.class, new PrototypeFactory()); owner = "owner"; otherOwner = "otherowner"; groupOwner = "groupowned"; userOwned = new Vector<String>(); userOwned.addElement(owner); groupOwned = new Vector<String>(); groupOwned.addElement(owner); groupOwned.addElement(groupOwner); a = new Case("123", "a"); a.setCaseId("a"); a.setUserId(owner); a.setID(12345); b = new Case("b", "b"); b.setCaseId("b"); b.setUserId(owner); c = new Case("c", "c"); c.setCaseId("c"); c.setUserId(owner); d = new Case("d", "d"); d.setCaseId("d"); d.setUserId(owner); e = new Case("e", "e"); e.setCaseId("e"); e.setUserId(groupOwner); l = new Ledger("ledger_entity_id"); l.setID(12345); l.setEntry("test_section_id", "test_entry_id", 2345); }

Target:
public void setUp() throws Exception { owner = "owner"; groupOwner = "groupowned"; userOwned = new Vector<String>(); userOwned.addElement(owner); groupOwned = new Vector<String>(); groupOwned.addElement(owner); groupOwned.addElement(groupOwner); a = new Case("123", "a"); a.setCaseId("a"); a.setUserId(owner); a.setID(12345); b = new Case("b", "b"); b.setCaseId("b"); b.setUserId(owner); c = new Case("c", "c"); c.setCaseId("c"); c.setUserId(owner); d = new Case("d", "d"); d.setCaseId("d"); d.setUserId(owner); e = new Case("e", "e"); e.setCaseId("e"); e.setUserId(groupOwner); l = new Ledger("ledger_entity_id"); l.setID(12345); l.setEntry("test_section_id", "test_entry_id", 2345); }
Source:
public PhysicalOperation visitTableWriter(TableWriterNode node, LocalExecutionPlanContext context) { if (node.getPartitioningScheme().isPresent()) { context.setDriverInstanceCount(1); } else { context.setDriverInstanceCount(getTaskWriterCount(session)); } PhysicalOperation source = node.getSource().accept(this, context); List<Integer> inputChannels = node.getColumns().stream() .map(source::symbolToChannel) .collect(toImmutableList()); OperatorFactory operatorFactory = new TableWriterOperatorFactory( context.getNextOperatorId(), node.getId(), pageSinkManager, node.getTarget(), inputChannels, session); Map<Symbol, Integer> layout = IntStream.range(0, node.getOutputSymbols().size()).boxed() .collect(toImmutableMap(i -> node.getOutputSymbols().get(i), i -> i)); return new PhysicalOperation(operatorFactory, layout, context, source); }

Target:
public PhysicalOperation visitTableWriter(TableWriterNode node, LocalExecutionPlanContext context) { if (node.getPartitioningScheme().isPresent()) { context.setDriverInstanceCount(1); } else { context.setDriverInstanceCount(getTaskWriterCount(session)); } PhysicalOperation source = node.getSource().accept(this, context); ImmutableMap.Builder<Symbol, Integer> outputMapping = ImmutableMap.builder(); outputMapping.put(node.getOutputSymbols().get(0), 0); outputMapping.put(node.getOutputSymbols().get(1), 1); OperatorFactory statisticsAggregation = node.getStatisticsAggregation().map(aggregation -> { List<Symbol> groupingSymbols = aggregation.getGroupingSymbols(); if (groupingSymbols.isEmpty()) { return createAggregationOperatorFactory( node.getId(), aggregation.getAggregations(), PARTIAL, 2, outputMapping, source, context); } else { return createHashAggregationOperatorFactory( node.getId(), aggregation.getAggregations(), ImmutableList.of(groupingSymbols), groupingSymbols, PARTIAL, Optional.empty(), Optional.empty(), source, false, false, false, new DataSize(0, BYTE), context, 2, outputMapping); } }).orElse(new NoOpOperatorFactory(context.getNextOperatorId(), node.getId())); List<Integer> inputChannels = node.getColumns().stream() .map(source::symbolToChannel) .collect(toImmutableList()); OperatorFactory operatorFactory = new TableWriterOperatorFactory( context.getNextOperatorId(), node.getId(), pageSinkManager, node.getTarget(), inputChannels, session, statisticsAggregation, getSymbolTypes(node.getOutputSymbols(), context.getTypes())); return new PhysicalOperation(operatorFactory, outputMapping.build(), context, source); }
Source:
private String getSessionPrefix(List<MetricNameDto> metricNameDtoList) { Set<String> sessionIds = new HashSet<String>(); for (MetricNameDto metricNameDto : metricNameDtoList) { sessionIds.addAll(metricNameDto.getTest().getSessionIds()); } Joiner joiner = Joiner.on(", "); return joiner.join(sessionIds); }

Target:
private String getSessionPrefix(List<MetricNameDto> metricNameDtoList) { Set<String> sessionIds = new HashSet<String>(); for (MetricNameDto metricNameDto : metricNameDtoList) { sessionIds.addAll(metricNameDto.getTest().getSessionIds()); } Joiner joiner = Joiner.on("_"); return joiner.join(sessionIds); }
Source:
protected void updateVmPayload() { VmDeviceDAO dao = DbFacade.getInstance().getVmDeviceDAO(); VmPayload payload = getParameters().getVmStaticData().getVmPayload(); if (payload != null) { List<VmDevice> disks = new ArrayList(dao.getVmDeviceByVmIdAndType(getVmId(), VmDeviceType.DISK.getName())); VmDevice oldPayload = null; for (VmDevice disk: disks) { if (VmPayload.IsPayload(disk.getSpecParams())) { oldPayload = disk; break; } } if (oldPayload != null) { List devs = new ArrayList<VmDeviceId>(); devs.add(oldPayload.getId()); dao.removeAll(devs); } VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), getVmId()), VmDeviceType.DISK, payload.getType(), payload.getSpecParams(), true, true); } }

Target:
protected void updateVmPayload() { VmDeviceDAO dao = getVmDeviceDao(); VmPayload payload = getParameters().getVmStaticData().getVmPayload(); if (payload != null) { List<VmDevice> disks = dao.getVmDeviceByVmIdAndType(getVmId(), VmDeviceType.DISK.getName()); VmDevice oldPayload = null; for (VmDevice disk: disks) { if (VmPayload.isPayload(disk.getSpecParams())) { oldPayload = disk; break; } } if (oldPayload != null) { List<VmDeviceId> devs = new ArrayList<VmDeviceId>(); devs.add(oldPayload.getId()); dao.removeAll(devs); } VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), getVmId()), VmDeviceType.DISK, payload.getType(), payload.getSpecParams(), true, true); } }
Source:
private static Object iterateCompare(long startTime, long endTime, ISegmentStore<@NonNull ISegment> store, @NonNull Comparator<@NonNull ISegment> comparator) { Object shutupCompilerWarnings = null; for (ISegment elem : store.getIntersectingElements((endTime - startTime) / 2, comparator)) { shutupCompilerWarnings = elem; } return shutupCompilerWarnings; }

Target:
private static Object iterateCompare(long startTime, long endTime, ISegmentStore<@NonNull ISegment> store, @NonNull Comparator<@NonNull ISegment> comparator) { Object shutupCompilerWarnings = null; for (ISegment elem : store.getIntersectingElements(startTime, endTime, comparator)) { shutupCompilerWarnings = elem; } return shutupCompilerWarnings; }
Source:
protected BaseEditVmInterfaceModel(VmBase vm, VMStatus vmStatus, Guid dcId, Version clusterCompatibilityVersion, ArrayList<VmNetworkInterface> vmNicList, VmNetworkInterface nic, EntityModel sourceModel) { super(vm, dcId, clusterCompatibilityVersion, vmNicList, sourceModel, new EditProfileBehavior()); this.nic = nic; this.vmStatus = vmStatus; setTitle(ConstantsManager.getInstance().getConstants().editNetworkInterfaceTitle()); setHashName("edit_network_interface_vms"); }

Target:
protected BaseEditVmInterfaceModel(VmBase vm, VMStatus vmStatus, Guid dcId, Version clusterCompatibilityVersion, ArrayList<VmNetworkInterface> vmNicList, VmNetworkInterface nic, EntityModel sourceModel) { super(vm, vmStatus, dcId, clusterCompatibilityVersion, vmNicList, sourceModel, new EditProfileBehavior()); this.nic = nic; setTitle(ConstantsManager.getInstance().getConstants().editNetworkInterfaceTitle()); setHashName("edit_network_interface_vms"); }
Source:
private AllocateResponse sendContainerAskToRM(List<ContainerRequest> containerRequests, List<ContainerRequest> removedContainerRequests, List<ContainerId> releasedContainers) throws YarnException, IOException { if (removedContainerRequests.size() > 0) { LOG.debug("Removing container request: " + removedContainerRequests); for (ContainerRequest cr : removedContainerRequests) { amRmClient.removeContainerRequest(cr); } } if (containerRequests.size() > 0) { LOG.debug("Asking RM for containers: " + containerRequests); for (ContainerRequest cr : containerRequests) { amRmClient.addContainerRequest(cr); } } for (ContainerId containerId : releasedContainers) { LOG.info("Released container, id={}", containerId.getId()); amRmClient.releaseAssignedContainer(containerId); } for (String containerIdStr : dnmgr.containerStopRequests.values()) { AllocatedContainer allocatedContainer = this.allocatedContainers.get(containerIdStr); if (allocatedContainer != null && !allocatedContainer.stopRequested) { nmClient.stopContainerAsync(allocatedContainer.container.getId(), allocatedContainer.container.getNodeId()); LOG.info("Requested stop container {}", containerIdStr); allocatedContainer.stopRequested = true; } dnmgr.containerStopRequests.remove(containerIdStr); } return amRmClient.allocate(0); }

Target:
private AllocateResponse sendContainerAskToRM(List<ContainerRequest> containerRequests, List<ContainerRequest> removedContainerRequests, List<ContainerId> releasedContainers) throws YarnException, IOException { if (removedContainerRequests.size() > 0) { LOG.debug("Removing container request: {}", removedContainerRequests); for (ContainerRequest cr : removedContainerRequests) { amRmClient.removeContainerRequest(cr); } } if (containerRequests.size() > 0) { LOG.debug("Asking RM for containers: {}", containerRequests); for (ContainerRequest cr : containerRequests) { amRmClient.addContainerRequest(cr); } } for (ContainerId containerId : releasedContainers) { LOG.info("Released container, id={}", containerId.getId()); amRmClient.releaseAssignedContainer(containerId); } for (String containerIdStr : dnmgr.containerStopRequests.values()) { AllocatedContainer allocatedContainer = this.allocatedContainers.get(containerIdStr); if (allocatedContainer != null && !allocatedContainer.stopRequested) { nmClient.stopContainerAsync(allocatedContainer.container.getId(), allocatedContainer.container.getNodeId()); LOG.info("Requested stop container {}", containerIdStr); allocatedContainer.stopRequested = true; } dnmgr.containerStopRequests.remove(containerIdStr); } return amRmClient.allocate(0); }
Source:
public void stopShouldDisconnectFromGoogleApiIfConnected_andAlwaysCallOnClientStopIfListenerSet() { TestClientListener testClientListener = new TestClientListener(); client.setListener(testClientListener); when(googleApiClient.isConnected()).thenReturn(true); client.stop(); verify(googleApiClient).disconnect(); assertThat(testClientListener.getOnClientStopCount(), is(1)); testClientListener.reset(); doAnswer(new OnDisconnectedAnswer()).when(googleApiClient).disconnect(); client.stop(); assertThat(testClientListener.getOnClientStopCount(), is(1)); testClientListener.reset(); when(googleApiClient.isConnected()).thenReturn(false); client.stop(); assertThat(testClientListener.getOnClientStopCount(), is(1)); }

Target:
public void stopShouldDisconnectFromGoogleApiIfConnected_andAlwaysCallOnClientStopIfListenerSet() { LocationClient.LocationClientListener listener = mock(LocationClient.LocationClientListener.class); client.setListener(listener); when(googleApiClient.isConnected()).thenReturn(true); client.stop(); verify(googleApiClient).disconnect(); verify(listener).onClientStop(); reset(listener); doAnswer(new OnDisconnectedAnswer()).when(googleApiClient).disconnect(); client.stop(); verify(listener).onClientStop(); reset(listener); when(googleApiClient.isConnected()).thenReturn(false); client.stop(); verify(listener).onClientStop(); }
Source:
public TabbarArrangeMenuManager(IDiagramWorkbenchPart iDiagramWorkbenchPart) { this.representationPart = iDiagramWorkbenchPart; EclipseUIUtil.getActivePage().addSelectionListener(this); }

Target:
public TabbarArrangeMenuManager(IDiagramWorkbenchPart iDiagramWorkbenchPart) { this.representationPart = iDiagramWorkbenchPart; ISelectionService selectionService = (ISelectionService) representationPart.getSite().getService(ISelectionService.class); if (selectionService != null) { selectionService.addSelectionListener(this); } }
Source:
public void before() { account = mock(Account.class); when(account.getDescription()).thenReturn("account"); folder = "folder"; errorMessage = "errorMessage"; message = mock(Message.class); count = 1; activityListener = new ActivityListener(); }

Target:
public void before() { when(ACCOUNT.getDescription()).thenReturn("account"); activityListener = new ActivityListener(); context = RuntimeEnvironment.application; }
Source:
public TextAnnotation runNER(String s) { TextAnnotationBuilder tab; boolean splitOnHyphens = false; tab = new TokenizerTextAnnotationBuilder(new StatefulTokenizer(splitOnHyphens)); TextAnnotation ta = tab.createTextAnnotation("001", "001", s); NERAnnotator co; try { co = new NERAnnotator(ViewNames.NER_CONLL); co.doInitialize(); co.addView(ta); } catch (IOException e) { e.printStackTrace(); } return ta; }

Target:
public TextAnnotation runNER(String s) { TextAnnotationBuilder tab; boolean splitOnHyphens = false; tab = new TokenizerTextAnnotationBuilder(new StatefulTokenizer(splitOnHyphens)); TextAnnotation ta = tab.createTextAnnotation("001", "001", s); try { co.getView(ta); } catch (Exception e) { e.printStackTrace(); } return ta; }
Source:
public void updateStockPrice(String symbol, double newPrice) throws StockMarketExpection { if (getStockForSymbol(symbol) == null) { throw new StockMarketExpection("Stock not present (" + symbol + ")"); } if (newPrice < 0.0) { throw new StockMarketExpection( "Stock price cannot be set to a negative value (" + symbol + ", " + getStockForSymbol(symbol).getPrice() + ") -> " + newPrice + " X Not Allowed "); } Stock s = removeStockFromStockList(symbol); s.setPrice(newPrice); addStock(s); }

Target:
public void updateStockPrice(String symbol, double newPrice) throws StockMarketExpection { if (getStockForSymbol(symbol) == null) { throw new StockMarketExpection("Stock not present (" + symbol + ")"); } if (newPrice < 0.0) { throw new StockMarketExpection( "Stock price cannot be set to a negative value (" + symbol + ", " + getStockForSymbol(symbol).getPrice() + ") -> " + newPrice + " X Not Allowed "); } Stock stock = removeStockFromList(symbol); stock.setPrice(newPrice); addStock(stock); }
Source:
protected AbstractIntegrationMessageBuilder<Object> doReceive() { Connection connection = this.connectionFactory.createConnection(); Channel channel = connection.createChannel(this.transacted); try { GetResponse resp = channel.basicGet(this.queue, false); if (resp == null) { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); return null; } AcknowledgmentCallback callback = this.ackCallbackFactory .createCallback(new AmqpAckInfo(connection, channel, resp)); MessageProperties messageProperties = this.propertiesConverter.toMessageProperties(resp.getProps(), resp.getEnvelope(), StandardCharsets.UTF_8.name()); Map<String, Object> headers = this.headerMapper.toHeadersFromRequest(messageProperties); Object payload = this.messageConverter .fromMessage(new org.springframework.amqp.core.Message(resp.getBody(), messageProperties)); return getMessageBuilderFactory().withPayload(payload) .copyHeaders(headers) .setHeader(IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK, callback); } catch (IOException e) { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); } return null; }

Target:
protected AbstractIntegrationMessageBuilder<Object> doReceive() { Connection connection = this.connectionFactory.createConnection(); Channel channel = connection.createChannel(this.transacted); try { GetResponse resp = channel.basicGet(this.queue, false); if (resp == null) { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); return null; } AcknowledgmentCallback callback = this.ackCallbackFactory .createCallback(new AmqpAckInfo(connection, channel, this.transacted, resp)); MessageProperties messageProperties = this.propertiesConverter.toMessageProperties(resp.getProps(), resp.getEnvelope(), StandardCharsets.UTF_8.name()); Map<String, Object> headers = this.headerMapper.toHeadersFromRequest(messageProperties); Object payload = this.messageConverter .fromMessage(new org.springframework.amqp.core.Message(resp.getBody(), messageProperties)); return getMessageBuilderFactory().withPayload(payload) .copyHeaders(headers) .setHeader(IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK, callback); } catch (IOException e) { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); throw RabbitExceptionTranslator.convertRabbitAccessException(e); } }
Source:
public ZKDistributedNonblockingLock(LockScope scope, String zkAddress, Long leaseTimeout, String lockMsg, String userId, int priority, long waitingTimeout, long cleanupTimeout, boolean isForceful, LockListener lockListener) { this(scope.getPath(), leaseTimeout, lockMsg, userId, priority, waitingTimeout, cleanupTimeout, isForceful, lockListener, new ZkBaseDataAccessor<ZNRecord>(zkAddress)); }

Target:
private ZKDistributedNonblockingLock(LockScope scope, String zkAddress, Long leaseTimeout, String lockMsg, String userId, int priority, long waitingTimeout, long cleanupTimeout, boolean isForceful, LockListener lockListener) { this(scope.getPath(), leaseTimeout, lockMsg, userId, priority, waitingTimeout, cleanupTimeout, isForceful, lockListener, new ZkBaseDataAccessor<ZNRecord>(zkAddress)); }