auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private <T extends Message> CompletableFuture<T> call(Callable<T> callable, Predicate<T> isValidResp, String debug) { CompletableFuture<T> future = new CompletableFuture<>(); ConcurrentLinkedQueue<Throwable> errors = new ConcurrentLinkedQueue<>(); groupCall(future, 0, callable, isValidResp, debug, errors); return future; }

Target:
private <T extends Message> CompletableFuture<T> call(Callable<T> callable, Predicate<T> isValidResp, String debug) { List<ClientMetaService.Interface> masterStubs = new ArrayList<>(masterAddr2Stub.values()); Collections.shuffle(masterStubs, ThreadLocalRandom.current()); CompletableFuture<T> future = new CompletableFuture<>(); groupCall(future, masterStubs, 0, callable, isValidResp, debug, new ConcurrentLinkedQueue<>()); return future; }
Source:
public void shouldBeAbleToReplaceLoggingHandler() { CollectingHandler collectingHandler = new CollectingHandler(); ExecuteJobHelper.LOGGING_HANDLER = collectingHandler; BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("failingDelegate") .startEvent() .serviceTask() .camundaClass("org.camunda.bpm.engine.test.jobexecutor.FailingDelegate") .camundaAsyncBefore() .done(); testRule.deploy(modelInstance); engineRule.getRuntimeService().startProcessInstanceByKey("failingDelegate"); final String jobId = engineRule.getManagementService().createJobQuery().singleResult().getId(); processEngineConfiguration.getJobExecutor().start(); testRule.waitForJobExecutorToProcessAllJobs(); processEngineConfiguration.getJobExecutor().shutdown(); Throwable collectedException = collectingHandler.collectedExceptions.get(jobId); assertTrue(collectedException instanceof RuntimeException); assertThat(collectedException.getMessage(), is("Expected Exception")); ExecuteJobHelper.LOGGING_HANDLER = originalHandler; }

Target:
public void shouldBeAbleToReplaceLoggingHandler() { CollectingHandler collectingHandler = new CollectingHandler(); ExecuteJobHelper.LOGGING_HANDLER = collectingHandler; BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("failingDelegate") .startEvent() .serviceTask() .camundaClass("org.camunda.bpm.engine.test.jobexecutor.FailingDelegate") .camundaAsyncBefore() .done(); testRule.deploy(modelInstance); engineRule.getRuntimeService().startProcessInstanceByKey("failingDelegate"); final String jobId = engineRule.getManagementService().createJobQuery().singleResult().getId(); processEngineConfiguration.getJobExecutor().start(); testRule.waitForJobExecutorToProcessAllJobs(); processEngineConfiguration.getJobExecutor().shutdown(); Throwable collectedException = collectingHandler.collectedExceptions.get(jobId); assertTrue(collectedException instanceof RuntimeException); assertThat(collectedException.getMessage(), is("Expected Exception")); }
Source:
public void checkLanguageServerInitialized() { ide.waitOpenedWorkspaceIsReadyToUse(); menu.runCommand(WORKSPACE, CREATE_PROJECT); wizard.selectProjectAndCreate(CONSOLE_PYTHON3_SIMPLE, PROJECT_NAME); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.openItemByPath(PROJECT_NAME + "/main.py"); editor.waitTabIsPresent(PYTHON_FILE_NAME); consoles.selectProcessByTabName("dev-machine"); consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE); }

Target:
public void checkLanguageServerInitialized() { ide.waitOpenedWorkspaceIsReadyToUse(); menu.runCommand(WORKSPACE, CREATE_PROJECT); wizard.selectProjectAndCreate(CONSOLE_PYTHON3_SIMPLE, PROJECT_NAME); projectExplorer.waitAndSelectItem(PROJECT_NAME); projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.openItemByPath(PATH_TO_PYTHON_FILE); editor.waitTabIsPresent(PYTHON_FILE_NAME); consoles.selectProcessByTabName("dev-machine"); consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE); }
Source:
public void onPlayerDeathEvent(final PlayerDeathEvent event) { Entity entity = event.getEntity(); if (entity.hasMetadata("NPC")) { return; } final User user = ess.getUser(event.getEntity()); if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back")) { user.setLastLocation(); user.sendMessage(tl("backAfterDeath")); } if (!ess.getSettings().areDeathMessagesEnabled()) { event.setDeathMessage(""); } if (ess.getSettings().infoAfterDeath()) { final Location loc = user.getLocation(); user.sendMessage(tl("infoAfterDeath", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } }

Target:
public void onPlayerDeathEvent(final PlayerDeathEvent event) { Entity entity = event.getEntity(); if (entity.hasMetadata("NPC")) { return; } final User user = ess.getUser(event.getEntity()); if (ess.getSettings().infoAfterDeath()) { final Location loc = user.getLocation(); user.sendMessage(tl("infoAfterDeath", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back")) { user.setLastLocation(); user.sendMessage(tl("backAfterDeath")); } if (!ess.getSettings().areDeathMessagesEnabled()) { event.setDeathMessage(""); } }
Source:
public void create_instance() { final StringValue failure = newStringValue(newUuid()); final FailureThrowable failureThrowable = new TestFailure(failure); assertEquals(failure, failureThrowable.getFailure()); Timestamps.isValid(failureThrowable.getTimestamp()); }

Target:
public void create_instance() { final StringValue failure = newStringValue(newUuid()); final FailureThrowable failureThrowable = new TestFailure(failure); assertEquals(failure, failureThrowable.getFailure()); assertTrue(Timestamps.isValid(failureThrowable.getTimestamp())); }
Source:
public CustomTabsSession newSession(@Nullable final CustomTabsCallback callback) { return newSessionInternal(callback, null); }

Target:
public @Nullable CustomTabsSession newSession(@Nullable final CustomTabsCallback callback) { return newSessionInternal(callback, null); }
Source:
private StoreKey getKeyAt(ByteBuffer mmap, int index) throws IOException { mmap.position(VERSION_FIELD_LENGTH + KEY_SIZE_FIELD_LENGTH + VALUE_SIZE_FIELD_LENGTH + LOG_END_OFFSET_FIELD_LENGTH + ((version == (short) 1) ? (LAST_MODIFIED_TIME_FIELD_LENGTH + resetKey.getFirst().sizeInBytes() + RESET_KEY_TYPE_FIELD_LENGTH) : 0) + (index * (keySize + valueSize))); return factory.getStoreKey(new DataInputStream(new ByteBufferInputStream(mmap))); }

Target:
private StoreKey getKeyAt(ByteBuffer mmap, int index) throws IOException { mmap.position(firstKeyRelativeOffset + (index * (keySize + valueSize))); return factory.getStoreKey(new DataInputStream(new ByteBufferInputStream(mmap))); }
Source:
public void dispose() { logger.debug("Handler disposed."); if (devStatMan != null) { devStatMan.unregisterTotalPowerConsumptionListener(); devStatMan.unregisterStatusListener(); this.devStatMan.stop(); } if (connMan != null) { connMan.unregisterConnectionListener(); } if (this.getThing().getStatus().equals(ThingStatus.ONLINE)) { updateStatus(ThingStatus.OFFLINE); } }

Target:
public void dispose() { logger.debug("Handler disposed"); if (devStatMan != null) { devStatMan.unregisterTotalPowerConsumptionListener(); devStatMan.unregisterStatusListener(); this.devStatMan.stop(); } if (connMan != null) { connMan.unregisterConnectionListener(); } }
Source:
public boolean canSwitchToBroker() { return verifyBroker() && verifyAuthenticator(mAcctManager) && !mContext.getPackageName().equalsIgnoreCase( AuthenticationSettings.INSTANCE.getBrokerPackageName()); }

Target:
public boolean canSwitchToBroker() { return !mContext.getPackageName().equalsIgnoreCase( AuthenticationSettings.INSTANCE.getBrokerPackageName()) && verifyBroker() && verifyAuthenticator(mAcctManager); }
Source:
public Group takeGroup(PerunSessionImpl sess) throws InterruptedException, InternalErrorException { while(true) { notEmptyGroupsPoolSemaphore.acquire(); try { poolAccessLock.lock(); boolean removedGroup = false; for (Group group : poolOfGroupsToBeSynchronized.getWaitingJobs()) { boolean allowed = true; List<Group> groupStructureJobs = poolOfGroupsStructuresToBeSynchronized.getWaitingJobs(); groupStructureJobs.addAll(poolOfGroupsStructuresToBeSynchronized.getRunningJobs()); for (Group groupStructure : groupStructureJobs) { List<Group> allSubGroups = sess.getPerunBl().getGroupsManagerBl().getAllSubGroups(sess, groupStructure); if (allSubGroups.contains(group)) { allowed = false; } } if (allowed) { poolOfGroupsToBeSynchronized.putJobIfAbsent(group, true); try { sess.getPerunBl().getGroupsManagerBl().checkGroupExists(sess, group); } catch (GroupNotExistsException e) { log.warn("Group was removed from a Vo while it was waiting for a synchronization.", group); poolOfGroupsToBeSynchronized.removeJob(poolOfGroupsToBeSynchronized.takeJob()); removedGroup = true; break; } return poolOfGroupsToBeSynchronized.takeJob(); } } if (!removedGroup) notEmptyGroupsPoolSemaphore.release(); } finally { poolAccessLock.unlock(); } Thread.sleep(10000); } }

Target:
public Group takeGroup(PerunSessionImpl sess) throws InterruptedException, InternalErrorException { while(true) { notEmptyGroupsPoolSemaphore.acquire(); try { poolAccessLock.lock(); boolean removedGroup = false; for (Group group : poolOfGroupsToBeSynchronized.getWaitingJobs()) { boolean allowed = true; List<Group> groupStructureJobs = poolOfGroupsStructuresToBeSynchronized.getWaitingJobs(); groupStructureJobs.addAll(poolOfGroupsStructuresToBeSynchronized.getRunningJobs()); for (Group groupStructure : groupStructureJobs) { List<Group> allSubGroups = sess.getPerunBl().getGroupsManagerBl().getAllSubGroups(sess, groupStructure); if (allSubGroups.contains(group)) { allowed = false; break; } } if (allowed) { poolOfGroupsToBeSynchronized.putJobIfAbsent(group, true); try { sess.getPerunBl().getGroupsManagerBl().checkGroupExists(sess, group); } catch (GroupNotExistsException e) { log.warn("Group was removed from a Vo while it was waiting for a synchronization.", group); poolOfGroupsToBeSynchronized.removeJob(poolOfGroupsToBeSynchronized.takeJob()); removedGroup = true; break; } return poolOfGroupsToBeSynchronized.takeJob(); } } if (!removedGroup) notEmptyGroupsPoolSemaphore.release(); } finally { poolAccessLock.unlock(); } Thread.sleep(1000 + random.nextInt(1001)); } }
Source:
private void onError() throws StoreException { int count = errorCount.incrementAndGet(); if (count == config.storeIOErrorCountToTriggerShutdown) { logger.info("Shutting down BlobStore because IO error count exceeds threshold", storeId); shutdown(); } }

Target:
private void onError() throws StoreException { int count = errorCount.incrementAndGet(); if (count == config.storeIoErrorCountToTriggerShutdown) { logger.error("Shutting down BlobStore because IO error count exceeds threshold", storeId); shutdown(); metrics.storeIoErrorTriggeredShutdownCount.inc(); } }
Source:
public Message(int sequence, Map map) { setSequence(sequence); setData(map); }

Target:
public Message(int sequence, Map map) { this.sequence = sequence; this.data = map; identityStream = extractIdentityStream(); }
Source:
private void loadItemHandlers() { for (ItemHandler handler : itemhandlers.values()) { Optional<IncompatibleItemHandlerException> exception = handler.validate(this); if (exception.isPresent()) { throw exception.get(); } if (!handler.isPrivate()) { Set<ItemHandler> handlerset = getPublicItemHandlers(handler.getIdentifier()); handlerset.add(handler); SlimefunPlugin.getRegistry().getPublicItemHandlers().replace(handler.getIdentifier(), handlerset); } } }

Target:
private void loadItemHandlers() { for (ItemHandler handler : itemhandlers.values()) { Optional<IncompatibleItemHandlerException> exception = handler.validate(this); if (exception.isPresent()) { throw exception.get(); } else { checkForDeprecations(handler.getClass()); } if (!handler.isPrivate()) { Set<ItemHandler> handlerset = getPublicItemHandlers(handler.getIdentifier()); handlerset.add(handler); } } }
Source:
private EventData createEventData(Object value) { byte[] eventBinaryData; if (value instanceof IndexedRecord) { IndexedRecord payloadRecord = (IndexedRecord) value; try { eventBinaryData = AvroUtils.encodeAvroIndexedRecord(payloadRecord.getSchema(), payloadRecord); } catch (IOException e) { String msg = "Failed to encode event in Avro, event=" + payloadRecord; LOG.error(msg, e); throw new DatastreamRuntimeException(msg, e); } } else if (value instanceof String) { eventBinaryData = ((String) value).getBytes(); } else { throw new DatastreamRuntimeException("Transport provider supports payloads of type String or AvroRecords"); } return new EventData(eventBinaryData); }

Target:
private EventData createEventData(Object value) { byte[] eventBinaryData; if (value instanceof IndexedRecord) { IndexedRecord payloadRecord = (IndexedRecord) value; try { eventBinaryData = AvroUtils.encodeAvroIndexedRecord(payloadRecord.getSchema(), payloadRecord); } catch (IOException e) { String msg = "Failed to encode event in Avro, event=" + payloadRecord; LOG.error(msg, e); throw new DatastreamRuntimeException(msg, e); } } else if (value instanceof String) { eventBinaryData = ((String) value).getBytes(); } else { String msg = String.format( "Transport provider supports payloads of type String or AvroRecords, Record {%s} is of type: %s", value.toString(), value.getClass().toString()); LOG.error(msg); throw new DatastreamRuntimeException(msg); } return new EventData(eventBinaryData); }
Source:
public void processQualifier_useValidUsername_noUsernameWarning() { TurboUser user = new TurboUser(REPO, "fox", "charlie"); IModel model = TestUtils.singletonModel(new Model(REPO, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(Arrays.asList(user)))); verifyUserWarning(model, "involves:fOX", new ArrayList<>()); verifyUserWarning(model, "assignee:FOX", new ArrayList<>()); verifyUserWarning(model, "assignee:CHAR", new ArrayList<>()); }

Target:
public void processQualifier_useValidUsername_noUsernameWarning() { TurboUser user = new TurboUser(REPO, "fox", "charlie"); IModel model = TestUtils.singletonModel(createModelFromUsers(REPO, user)); verifyUserWarning(model, "involves:fOX", new ArrayList<>()); verifyUserWarning(model, "assignee:FOX", new ArrayList<>()); verifyUserWarning(model, "assignee:CHAR", new ArrayList<>()); }
Source:
public RevTag call() throws JGitInternalException, NoHeadException { checkCallable(); RepositoryState state = repo.getRepositoryState(); processOptions(state); try { Tag newTag = new Tag(repo); newTag.setTag(name); newTag.setMessage(message); newTag.setAuthor(author); Ref head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); if (id == null) { id = repo.resolve(Constants.HEAD + "^{commit}"); } newTag.setObjId(id); ObjectInserter inserter = repo.newObjectInserter(); try { ObjectLoader object = repo.open(newTag.getObjId()); newTag.setType(Constants.typeString(object.getType())); ObjectId tagId = inserter.insert(Constants.OBJ_TAG, inserter.format(newTag)); newTag.setTagId(tagId); inserter.flush(); RevWalk revWalk = new RevWalk(repo); try { RevTag revTag = revWalk.parseTag(newTag.getTagId()); String refName = Constants.R_TAGS + newTag.getTag(); RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); Result updateResult = tagRef.update(); switch (updateResult) { case NEW: case FORCED: return revTag; default: throw new JGitInternalException(MessageFormat .format(JGitText.get().updatingRefFailed, Constants.HEAD, newTag.toString(), updateResult)); } } finally { revWalk.release(); } } finally { inserter.release(); } } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfTagCommand, e); } }

Target:
public RevTag call() throws JGitInternalException, ConcurrentRefUpdateException, NoHeadException { checkCallable(); RepositoryState state = repo.getRepositoryState(); processOptions(state); try { Tag newTag = new Tag(repo); newTag.setTag(name); newTag.setMessage(message); newTag.setAuthor(author); if (id == null) { Ref head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); id = repo.resolve(Constants.HEAD + "^{commit}"); } newTag.setObjId(id); ObjectInserter inserter = repo.newObjectInserter(); try { ObjectLoader object = repo.open(newTag.getObjId()); newTag.setType(Constants.typeString(object.getType())); ObjectId tagId = inserter.insert(Constants.OBJ_TAG, inserter.format(newTag)); newTag.setTagId(tagId); inserter.flush(); RevWalk revWalk = new RevWalk(repo); try { RevTag revTag = revWalk.parseTag(newTag.getTagId()); String refName = Constants.R_TAGS + newTag.getTag(); RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); Result updateResult = tagRef.update(); switch (updateResult) { case NEW: case FORCED: return revTag; case LOCK_FAILURE: throw new ConcurrentRefUpdateException(JGitText .get().couldNotLockHEAD, tagRef.getRef(), updateResult); default: throw new JGitInternalException(MessageFormat .format(JGitText.get().updatingRefFailed, refName, newTag.toString(), updateResult)); } } finally { revWalk.release(); } } finally { inserter.release(); } } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfTagCommand, e); } }
Source:
public void testGetContent_gzipEncoding_finishReadingWithDifferentDefaultLocaleAndUppercaseContentEncoding() throws IOException { Locale originalDefaultLocale = Locale.getDefault(); Locale.setDefault(Locale.JAPAN); do_testGetContent_gzipEncoding_finishReading("GZIP"); Locale.setDefault(originalDefaultLocale); }

Target:
public void testGetContent_gzipEncoding_finishReadingWithDifferentDefaultLocaleAndUppercaseContentEncoding() throws IOException { Locale originalDefaultLocale = Locale.getDefault(); try { Locale.setDefault(Locale.forLanguageTag("tr-TR")); do_testGetContent_gzipEncoding_finishReading("GZIP"); } finally { Locale.setDefault(originalDefaultLocale); } }
Source:
public float getPrefWidth() { return Editor.getWidth() * PREF_WIDTH; }

Target:
public float getPrefWidth() { return this.viewport == null ? 0 : this.viewport.x * PREF_WIDTH; }
Source:
private boolean isValidationNecessaryOnReads(TableReference tableRef) { return validateLocksOnReads && isThoroughSwept(tableRef); }

Target:
private boolean isValidationNecessaryOnReads(TableReference tableRef) { return validateLocksOnReads && isThoroughlySwept(tableRef); }
Source:
static PemObject loadPemResource(String resource) throws IOException { try (InputStream s = new FileInputStream(resource)) { PemReader p = new PemReader(new InputStreamReader(s)); PemObject o = p.readPemObject(); p.close(); return o; } }

Target:
static PemObject loadPemResource(String resource) throws IOException { InputStream s = new FileInputStream(resource); try (PemReader p = new PemReader(new InputStreamReader(s))) { PemObject o = p.readPemObject(); return o; } }
Source:
public Member expireMember(PerunSession sess, Member member) throws InternalErrorException, MemberNotValidYetException, WrongReferenceAttributeValueException, WrongAttributeValueException { if(this.haveStatus(sess, member, Status.EXPIRED)) { log.debug("Trying to set member expired but he's already expired. " + member); return member; } if(this.haveStatus(sess, member, Status.INVALID)) throw new MemberNotValidYetException(member); Status oldStatus = member.getStatus(); getMembersManagerImpl().setStatus(sess, member, Status.EXPIRED); member.setStatus(Status.EXPIRED); getPerunBl().getAuditer().log(sess, new MemberExpired(member)); if(oldStatus.equals(Status.INVALID) || oldStatus.equals(Status.DISABLED)) { getPerunBl().getAttributesManagerBl().doTheMagic(sess, member); } return member; }

Target:
public Member expireMember(PerunSession sess, Member member) throws InternalErrorException, WrongReferenceAttributeValueException, WrongAttributeValueException { if(this.haveStatus(sess, member, Status.EXPIRED)) { log.debug("Trying to set member expired but he's already expired. " + member); return member; } Status oldStatus = member.getStatus(); getMembersManagerImpl().setStatus(sess, member, Status.EXPIRED); member.setStatus(Status.EXPIRED); getPerunBl().getAuditer().log(sess, new MemberExpired(member)); if(oldStatus.equals(Status.INVALID) || oldStatus.equals(Status.DISABLED)) { try { getPerunBl().getAttributesManagerBl().doTheMagic(sess, member); } catch (Exception ex) { member.setStatus(oldStatus); throw ex; } } return member; }
Source:
public boolean accept(Key k, Value v) { if(v.get().length > 0) { Map<String, Object> metadata = metadataSerDe.deserialize(v.get()); if(metadata != null && metadata.containsKey(EXPIRATION)) { long threshold = (Long)metadata.get(EXPIRATION); long currentTime = currentTimeMillis(); if (k.getTimestamp() > currentTime || currentTime - k.getTimestamp() > threshold) return false; return true; } } return true; }

Target:
public boolean accept(Key k, Value v) { if (v.get().length > 0) { Map<String, Object> metadata = metadataSerDe.deserialize(v.get()); if (metadata != null) { long threshold = getExpiration(metadata, -1); if (threshold > -1) { long currentTime = currentTimeMillis(); if (k.getTimestamp() > currentTime || currentTime - k.getTimestamp() > threshold) return false; } return true; } } return true; }
Source:
public void removeCapabilityRequirement(RuntimeRequirementRegistration requirementRegistration) { try { writeLock.lock(); removeRequirement(requirementRegistration, false); removeRequirement(requirementRegistration, true); } finally { writeLock.unlock(); } }

Target:
public void removeCapabilityRequirement(RuntimeRequirementRegistration requirementRegistration) { writeLock.lock(); try { removeRequirement(requirementRegistration, false); removeRequirement(requirementRegistration, true); } finally { writeLock.unlock(); } }
Source:
public void testNetworkBlocked() throws Exception { assertEquals(VPN_PACKAGE, mDevicePolicyManager.getAlwaysOnVpnPackage( ADMIN_RECEIVER_COMPONENT)); for(int i=0; i < MAX_NUMBER_OF_ATTEMPT && VpnTestHelper.isNetworkVpn(mContext); ++i) { Thread.sleep(1000); } assertFalse(VpnTestHelper.isNetworkVpn(mContext)); try { VpnTestHelper.tryPosixConnect(TEST_ADDRESS); fail("sendIcmpMessage doesn't throw Exception during network lockdown"); } catch (ErrnoException e) { assertTrue((e.errno == OsConstants.ENETUNREACH) || (e.errno == OsConstants.EACCES)); } }

Target:
public void testNetworkBlocked() throws Exception { assertEquals(VPN_PACKAGE, mDevicePolicyManager.getAlwaysOnVpnPackage( ADMIN_RECEIVER_COMPONENT)); for(int i = 0; i < MAX_NUMBER_OF_ATTEMPTS && VpnTestHelper.isNetworkVpn(mContext); ++i) { Thread.sleep(TimeUnit.SECONDS.toMillis(1)); } assertFalse(VpnTestHelper.isNetworkVpn(mContext)); try { VpnTestHelper.tryPosixConnect(TEST_ADDRESS); fail("sendIcmpMessage doesn't throw Exception during network lockdown"); } catch (ErrnoException e) { assertTrue((e.errno == OsConstants.ENETUNREACH) || (e.errno == OsConstants.EACCES)); } }
Source:
default String getApplicationTargetName() { return ""; }

Target:
default Optional<String> getApplicationTargetName() { return Optional.empty(); }
Source:
public void check(CoreEvent event) throws FlowBackPressureException { if (abstractPipeline.getSource().getBackPressureStrategy() == MessageSource.BackPressureStrategy.WAIT) { checkWithWaitStrategy(event); } else { checkWithFailDropStrategy(event); } }

Target:
public void check(CoreEvent event) throws FlowBackPressureException { if (abstractPipeline.getSource().getBackPressureStrategy() == WAIT) { checkWithWaitStrategy(event); } else { checkWithFailDropStrategy(event); } }
Source:
private Manager getManager(ServletContext servletContext) { try { ApplicationContextFacade acf = (ApplicationContextFacade) servletContext; Field privateField = ApplicationContextFacade.class.getDeclaredField("context"); privateField.setAccessible(true); ApplicationContext appContext = (ApplicationContext) privateField.get(acf); Field privateField2 = ApplicationContext.class.getDeclaredField("context"); privateField2.setAccessible(true); StandardContext stdContext = (StandardContext) privateField2.get(appContext); return stdContext.getManager(); } catch (Exception e) { LOG.error(e.getMessage(), e); } return null; }

Target:
private Manager getManager(ServletContext servletContext) { try { ApplicationContextFacade acf = (ApplicationContextFacade) servletContext; Field applicationContextFacadeField = ApplicationContextFacade.class.getDeclaredField("context"); applicationContextFacadeField.setAccessible(true); ApplicationContext appContext = (ApplicationContext) applicationContextFacadeField.get(acf); Field applicationContextField = ApplicationContext.class.getDeclaredField("context"); applicationContextField.setAccessible(true); StandardContext stdContext = (StandardContext) applicationContextField.get(appContext); return stdContext.getManager(); } catch (Exception e) { LOG.error("Unable to get catalina manager. Cause: {}", e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } }
Source:
private BsonDocument getCommand() { BsonDocument cursorDocument = batchSize == null ? new BsonDocument() : new BsonDocument("batchSize", new BsonInt32(batchSize)); BsonDocument command = new BsonDocument("listCollections", new BsonInt32(1)).append("cursor", cursorDocument); if (filter != null) { command.append("filter", filter); } return command; }

Target:
private BsonDocument getCommand() { BsonDocument command = new BsonDocument("listCollections", new BsonInt32(1)) .append("cursor", getCursorDocumentFromBatchSize(batchSize)); if (filter != null) { command.append("filter", filter); } if (maxTimeMS > 0) { command.put("maxTimeMS", new BsonInt64(maxTimeMS)); } return command; }
Source:
public void read(CorfuPayloadMsg<ReadRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { long address = msg.getPayload().getAddress(); boolean cacheable = msg.getPayload().isCacheReadResult(); log.trace("read: {}, cacheable: {}", msg.getPayload().getAddress(), cacheable); ReadResponse rr = new ReadResponse(); try { ILogData logData; if (config.isMemoryMode()) { logData = dataCache.get(address, false); } else { logData = dataCache.get(address, cacheable); } if (logData == null) { rr.put(address, LogData.getEmpty(address)); } else { rr.put(address, (LogData) logData); } r.sendResponse(ctx, msg, CorfuMsgType.READ_RESPONSE.payloadMsg(rr)); } catch (DataCorruptionException e) { r.sendResponse(ctx, msg, CorfuMsgType.ERROR_DATA_CORRUPTION.msg()); } }

Target:
public void read(CorfuPayloadMsg<ReadRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { long address = msg.getPayload().getAddress(); boolean cacheable = msg.getPayload().isCacheReadResult(); log.trace("read: {}, cacheable: {}", msg.getPayload().getAddress(), cacheable); ReadResponse rr = new ReadResponse(); try { ILogData logData; if (config.isMemoryMode()) { logData = dataCache.get(address, false); } else { logData = dataCache.get(address, cacheable); } if (logData == null) { rr.put(address, LogData.getEmpty(address)); } else { rr.put(address, (LogData) logData); } r.sendResponse(ctx, msg, CorfuMsgType.READ_RESPONSE.payloadMsg(rr)); } catch (DataCorruptionException e) { log.error("Data corruption exception while reading address {}", address, e); r.sendResponse(ctx, msg, CorfuMsgType.ERROR_DATA_CORRUPTION.payloadMsg(address)); } }
Source:
public String promptForJdkPath(Server server) { List<String> paths = new ArrayList<>(); paths.add("JAVA_HOME (currently: " + System.getProperty("java.home") + ")"); try { paths.addAll(getJdkPathsFromProperties(getSdkProperties())); } catch (IOException e) { e.printStackTrace(); } if (!interactiveMode) { return paths.get(0); } String path = promptForMissingValueWithOptions(SDKConstants.OPENMRS_SDK_JDK_OPTION, server.getJdkPath(), "path", paths, SDKConstants.OPENMRS_SDK_JDK_CUSTOM, null); if (path.equals(paths.get(0))) { server.setJdkPath(System.getProperty("java.home")); } if (!isThereJdkUnderPath(path)) { System.out.println(SDKConstants.OPENMRS_SDK_JDK_CUSTOM_INVALID); server.setJdkPath(promptForJdkPath(server)); } else { if (!isPathLineDuplicated(paths, path)) { try { addJdkPathToSdkProperties(path); } catch (IOException e) { e.printStackTrace(); } } return path; } return null; }

Target:
public String promptForJdkPath(Server server) { List<String> paths = new ArrayList<>(); paths.add("JAVA_HOME (currently: " + System.getProperty("java.home") + ")"); paths.addAll(getJdkPaths()); if (!interactiveMode) { return paths.get(0); } String javaHome = server.getJavaHome(); if (javaHome.equals(System.getProperty("java.home"))) { javaHome = null; } String path = promptForMissingValueWithOptions(SDKConstants.OPENMRS_SDK_JDK_OPTION, javaHome, "path", paths, SDKConstants.OPENMRS_SDK_JDK_CUSTOM, null); if (path.equals(paths.get(0))) { return null; } if (!isThereJdkUnderPath(path)) { System.out.println(SDKConstants.OPENMRS_SDK_JDK_CUSTOM_INVALID); server.setJavaHome(promptForJdkPath(server)); } else { if (!isPathLineDuplicated(paths, path)) { addJdkPathToSdkProperties(path); } return path; } return null; }
Source:
public synchronized void updateCommittedTail(long newCommittedTail) { if (committedTail.get() >= newCommittedTail) { log.trace("New committed tail less than or equals to the old one. Ignore", newCommittedTail); return; } log.debug("Update committed tail to: {}, current: ", newCommittedTail, committedTail.get()); dataStore.put(COMMITTED_TAIL_RECORD, newCommittedTail); committedTail.set(newCommittedTail); }

Target:
public synchronized void updateCommittedTail(long newCommittedTail) { if (committedTail.get() >= newCommittedTail) { log.trace("New committed tail less than or equals to the old one. Ignore", newCommittedTail); return; } log.debug("Update committed tail to: {}, current: {}", newCommittedTail, committedTail.get()); dataStore.put(COMMITTED_TAIL_RECORD, newCommittedTail); committedTail.set(newCommittedTail); }
Source:
private void handleQxlClusterLevel() { boolean isQxl = getDisplayType() == DisplayType.qxl; getBehavior().enableSinglePCI(getDefalutQxlValue()); if (getSelectedCluster() != null) { boolean spiceFileTransferToggle = isQxl && AsyncDataProvider.isSpiceFileTransferToggleSupported(getSelectedCluster().getcompatibility_version().toString()); if (!spiceFileTransferToggle) { handleQxlChangeProhibitionReason(getSpiceFileTransferEnabled(), getSelectedCluster().getcompatibility_version().toString(), isQxl); } getSpiceFileTransferEnabled().setIsChangable(spiceFileTransferToggle); boolean spiceCopyPasteToggle = isQxl && AsyncDataProvider.isSpiceCopyPasteToggleSupported(getSelectedCluster().getcompatibility_version().toString()); if (!spiceCopyPasteToggle) { handleQxlChangeProhibitionReason(getSpiceCopyPasteEnabled(), getSelectedCluster().getcompatibility_version().toString(), isQxl); } getSpiceCopyPasteEnabled().setIsChangable(spiceCopyPasteToggle); } }

Target:
private void handleQxlClusterLevel() { getBehavior().enableSinglePCI(getDefalutQxlValue()); if (getSelectedCluster() != null) { boolean isQxl = getDisplayType() == DisplayType.qxl; boolean spiceFileTransferToggle = isQxl && AsyncDataProvider.isSpiceFileTransferToggleSupported(getSelectedCluster().getcompatibility_version().toString()); if (!spiceFileTransferToggle) { handleQxlChangeProhibitionReason(getSpiceFileTransferEnabled(), getSelectedCluster().getcompatibility_version().toString(), isQxl); } getSpiceFileTransferEnabled().setIsChangable(spiceFileTransferToggle); boolean spiceCopyPasteToggle = isQxl && AsyncDataProvider.isSpiceCopyPasteToggleSupported(getSelectedCluster().getcompatibility_version().toString()); if (!spiceCopyPasteToggle) { handleQxlChangeProhibitionReason(getSpiceCopyPasteEnabled(), getSelectedCluster().getcompatibility_version().toString(), isQxl); } getSpiceCopyPasteEnabled().setIsChangable(spiceCopyPasteToggle); } }
Source:
public void jobToBeExecuted(JobExecutionContext context) { String name = String.format("Job: %s; Trigger: %s", context.getTrigger().getJobKey(), context.getTrigger().getKey()); Span span = tracer.nextSpan().name(name); jobSpans.put(context.getFireInstanceId(), span); tracer.withSpanInScope(span.start()); }

Target:
public void jobToBeExecuted(JobExecutionContext context) { }
Source:
MappedServlet(PathSpec pathSpec, ServletHolder servletHolder) { super(pathSpec, servletHolder); _pathSpec = pathSpec; _servletHolder = servletHolder; if (pathSpec instanceof ServletPathSpec) { switch (pathSpec.getGroup()) { case EXACT: case DEFAULT: case ROOT: _httpServletMapping = getServletMapping(pathSpec, pathSpec.getDeclaration(), servletHolder.getName()); break; default: _httpServletMapping = null; break; } } else { _httpServletMapping = null; } }

Target:
MappedServlet(PathSpec pathSpec, ServletHolder servletHolder) { _pathSpec = pathSpec; _servletHolder = servletHolder; if (pathSpec instanceof ServletPathSpec) { switch (pathSpec.getGroup()) { case EXACT: case ROOT: _servletPathMapping = new ServletPathMapping(_pathSpec, _servletHolder.getName(), _pathSpec.getPrefix()); break; default: _servletPathMapping = null; break; } } else { _servletPathMapping = null; } }
Source:
public static Collection<Integer> getSupportedCountryCodes() { final Set<Integer> supportedCountryCodes = new HashSet<>(); final PhoneNumberUtil pnUtil = PhoneNumberUtil.getInstance(); for (final String region : pnUtil.getSupportedRegions()) { supportedCountryCodes.add(pnUtil.getCountryCodeForRegion(region)); } return supportedCountryCodes; }

Target:
public static Collection<Integer> getSupportedCountryCodes() { final Collection<Integer> supportedCountryCodes = new HashSet<>(); final PhoneNumberUtil pnUtil = PhoneNumberUtil.getInstance(); for (final String region : pnUtil.getSupportedRegions()) { supportedCountryCodes.add(pnUtil.getCountryCodeForRegion(region)); } return supportedCountryCodes; }
Source:
public default <E2> GraphTraversal<S, Map<Object, E2>> valueMap(final String... propertyKeys) { this.asAdmin().getBytecode().addStep(Symbols.valueMap, propertyKeys); return this.asAdmin().addStep(new PropertyMapStep<>(this.asAdmin(), false, PropertyType.VALUE, propertyKeys)); }

Target:
public default <E2> GraphTraversal<S, Map<String, E2>> valueMap(final String... propertyKeys) { this.asAdmin().getBytecode().addStep(Symbols.valueMap, propertyKeys); return this.asAdmin().addStep(new PropertyMapStep<>(this.asAdmin(), false, PropertyType.VALUE, propertyKeys)); }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { Schema.Type columnToBeTokenizedType = inputSchema.getField(config.columnToBeTokenized) .getSchema().getType(); Preconditions.checkArgument(columnToBeTokenizedType == Schema.Type.STRING, "Column ,to be tokenized, must be of type String, but was %s.", columnToBeTokenizedType); } }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null && inputSchema.getField(config.columnToBeTokenized) != null) { Schema.Type columnToBeTokenizedType = inputSchema.getField(config.columnToBeTokenized) .getSchema().getType(); Preconditions.checkArgument(columnToBeTokenizedType == Schema.Type.STRING, "Column to be tokenized %s must be of type String, but was of type %s.", config.columnToBeTokenized, columnToBeTokenizedType); } }
Source:
private void advance0() { while (true) { if (currentRecordStoreIterator == null) { if (!partsIterator.hasNext()) { nextKey = null; nextValue = null; return; } else { int nextPart = partsIterator.next(); boolean isOwned = map.getMapServiceContext().getOwnedPartitions().contains(nextPart); if (!isOwned) { throw QueryException.error(SqlErrorCode.PARTITION_MIGRATED, "Partition is not owned by member: " + nextPart); } currentRecordStore = map.getExistingRecordStore(nextPart); if (currentRecordStore == null) { continue; } currentRecordStore.checkIfLoaded(); currentRecordStoreIterator = currentRecordStore.getStorage().mutationTolerantIterator(); } } assert currentRecordStoreIterator != null; while (currentRecordStoreIterator.hasNext()) { Map.Entry<Data, Record<Object>> entry = currentRecordStoreIterator.next(); if (!currentRecordStore.isExpired(entry.getValue(), now, false)) { nextKey = entry.getKey(); nextValue = entry.getValue().getValue(); return; } } currentRecordStore = null; currentRecordStoreIterator = null; } }

Target:
private void advance0() { while (true) { if (currentRecordStoreIterator == null) { if (!partsIterator.hasNext()) { nextKey = null; nextValue = null; return; } else { int nextPart = partsIterator.next(); boolean isOwned = map.getMapServiceContext().getOwnedPartitions().contains(nextPart); if (!isOwned) { throw QueryException.error(SqlErrorCode.PARTITION_MIGRATED, "Partition is not owned by member: " + nextPart); } currentRecordStore = map.getMapServiceContext().getRecordStore(nextPart, map.getName()); if (currentRecordStore == null) { continue; } try { currentRecordStore.checkIfLoaded(); } catch (RetryableHazelcastException e) { throw QueryException.error(SqlErrorCode.MAP_LOADING_IN_PROGRESS, "Map loading is in progress: " + map.getName(), e); } currentRecordStoreIterator = currentRecordStore.getStorage().mutationTolerantIterator(); } } assert currentRecordStoreIterator != null; while (currentRecordStoreIterator.hasNext()) { Map.Entry<Data, Record<Object>> entry = currentRecordStoreIterator.next(); if (!currentRecordStore.isExpired(entry.getValue(), now, false)) { nextKey = entry.getKey(); nextValue = entry.getValue().getValue(); return; } } currentRecordStore = null; currentRecordStoreIterator = null; } }
Source:
public void postCollectionDefaultItemReadGroupCreateDefaultItemReadGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/itemReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); }

Target:
public void postCollectionDefaultItemReadGroupCreateDefaultItemReadGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/itemReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); Group anon = groupService.findByName(context, Group.ANONYMOUS); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(anon.getID(), anon.getName()))); }
Source:
public static void setUp() throws Exception { System.setProperty(JiraMailAddressResolver.class.getName() + ".DISABLE", "true"); }

Target:
public static void setUp() throws Exception { System.setProperty("hudson.plugins.jira.JiraMailAddressResolver.disabled", "true"); }
Source:
private String getMigrationNetworkIp() { List<NetworkCluster> allNetworksInCluster = DbFacade.getInstance() .getNetworkClusterDao().getAllForCluster(getVm().getVdsGroupId()); NetworkCluster migrationNetworkCluster = null; for (NetworkCluster tempNetworkCluster : allNetworksInCluster) { if (tempNetworkCluster.isMigration()) { migrationNetworkCluster = tempNetworkCluster; break; } } Network migrationNetwork = null; if (migrationNetworkCluster != null) { migrationNetwork = DbFacade.getInstance().getNetworkDao() .get(migrationNetworkCluster.getNetworkId()); } String migrationNetworkName = migrationNetwork == null ? null : migrationNetwork.getName(); String migrationIp = null; if (migrationNetworkName != null) { final List<VdsNetworkInterface> allInterfacesForDstVds = DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(getDestinationVds().getId()); for (VdsNetworkInterface nic : allInterfacesForDstVds) { if (nic.getNetworkName() != null && nic.getNetworkName().equals(migrationNetworkName)) { migrationIp = nic.getAddress(); break; } } } return migrationIp; }

Target:
private String getMigrationNetworkIp() { List<Network> allNetworksInCluster = DbFacade.getInstance().getNetworkDao().getAllForCluster(getVm().getVdsGroupId()); Network migrationNetwork = null; for (Network tempNetwork : allNetworksInCluster) { if (tempNetwork.getCluster().isMigration()) { migrationNetwork = tempNetwork; break; } } String migrationIp = null; if (migrationNetwork != null) { final List<VdsNetworkInterface> allInterfacesForDstVds = DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(getDestinationVds().getId()); for (VdsNetworkInterface nic : allInterfacesForDstVds) { if (migrationNetwork.getName().equals(nic.getNetworkName())) { migrationIp = nic.getAddress(); break; } } } return migrationIp; }
Source:
public boolean validate(Project current, Project dest) { if(!findIdeaModuleFiles(mySelectedOtpApps)){ return true; } int resultCode = Messages.showYesNoCancelDialog(ApplicationInfoEx.getInstanceEx().getFullApplicationName() + " module files found:\n\n" + StringUtil.join(myFoundOtpApps, new Function<ImportedOtpApp, String>() { @Override public String fun(ImportedOtpApp importedOtpApp) { VirtualFile ideaModuleFile = importedOtpApp.getIdeaModuleFile(); return ideaModuleFile != null ? " " + ideaModuleFile.getPath() + "\n" : ""; } }, "") + "\nWould you licke to reuse them?", "Module files found", Messages.getQuestionIcon()); if(resultCode == Messages.YES){ return true; }else if(resultCode == Messages.NO){ try{ deleteIdeaModuleFiles(mySelectedOtpApps); return true; }catch (IOException e){ LOG.error(e); return false; } }else { return false; } }

Target:
public boolean validate(Project current, Project dest) { if(!findIdeaModuleFiles(mySelectedOtpApps)){ return true; } int resultCode = Messages.showYesNoCancelDialog(ApplicationInfoEx.getInstanceEx().getFullApplicationName() + " module files found:\n\n" + StringUtil.join(myFoundOtpApps, new Function<ImportedOtpApp, String>() { @Override public String fun(ImportedOtpApp importedOtpApp) { VirtualFile ideaModuleFile = importedOtpApp.getIdeaModuleFile(); return ideaModuleFile != null ? " " + ideaModuleFile.getPath() + "\n" : ""; } }, "") + "\nWould you like to reuse them?", "Module files found", Messages.getQuestionIcon()); if(resultCode == Messages.YES){ return true; }else if(resultCode == Messages.NO){ try{ deleteIdeaModuleFiles(mySelectedOtpApps); return true; }catch (IOException e){ LOG.error(e); return false; } }else { return false; } }
Source:
public void testAcceleoMTLCompletionWithDependencies() { EClass c = EcoreFactory.eINSTANCE.createEClass(); Collection<String> dependencies = Arrays.asList(IMPORT, SERVICE); ContentContext c1 = createContentContext("[/]", 1, "EClass", EcorePackage.eINSTANCE, Collections.<String, VariableType> emptyMap(), dependencies); ContentContext c2 = createContentContext("[self./]", 6, "EClass", EcorePackage.eINSTANCE, Collections.<String, VariableType> emptyMap(), dependencies); ContentContext c3 = createContentContext("[self.name.concat()/]", 18, "EClass"); doTestAcceleoMTLCompletionWithDependencies(c, c1, c2, c3, proposalFunction, dependencies); }

Target:
public void testAcceleoMTLCompletionWithDependencies() { EClass c = EcoreFactory.eINSTANCE.createEClass(); Collection<String> dependencies = new ArrayList<String>(Arrays.asList(IMPORT, SERVICE)); ContentContext c1 = createContentContext("[/]", 1, "EClass", EcorePackage.eINSTANCE, Collections.<String, VariableType> emptyMap(), dependencies); ContentContext c2 = createContentContext("[self./]", 6, "EClass", EcorePackage.eINSTANCE, Collections.<String, VariableType> emptyMap(), dependencies); ContentContext c3 = createContentContext("[self.name.concat()/]", 18, "EClass"); doTestAcceleoMTLCompletionWithDependencies(c, c1, c2, c3, proposalFunction, dependencies); }
Source:
public boolean createFailedExecutorHealthCheckMessage(final List<ExecutableFlow> flows, final Executor executor, final ExecutorManagerException failureException, final EmailMessage message, final String azkabanName, final String scheme, final String clientHostname, final String clientPortNumber, final List<String> emailList) { if (emailList == null || emailList.isEmpty()) { return false; } message.addAllToAddress(emailList); message.setMimeType("text/html"); message.setSubject( "Alert: Executor is unreachable, " + executor.getHost() + " on " + azkabanName); message.println( "<h2 style=\"color:#FFA500\"> Executor is unreachable. Executor host - " + executor.getHost() + " on Cluster - " + azkabanName + "</h2>"); message.println("Remedial action will be attempted on affected executions - <br>"); message.println("Following flows were reported as running on the executor and will be " + "finalized."); message.println(""); message.println("<h3>Affected executions</h3>"); message.println("<ul>"); appendFlowLinksToMessage(message, flows, scheme, clientHostname, clientPortNumber); message.println("</ul>"); message.println("Executor with id " + executor.getId() + " will be removed."); message.println(""); message.println("<h3>Error detail</h3>"); message.println("<pre>" + ExceptionUtils.getStackTrace(failureException) + "</pre>"); return true; }

Target:
public boolean createFailedExecutorHealthCheckMessage(final List<ExecutableFlow> flows, final Executor executor, final ExecutorManagerException failureException, final EmailMessage message, final String azkabanName, final String scheme, final String clientHostname, final String clientPortNumber, final List<String> emailList) { if (emailList == null || emailList.isEmpty()) { return false; } message.addAllToAddress(emailList); message.setMimeType("text/html"); message.setSubject( "Alert: Executor is unreachable, " + executor.getHost() + " on " + azkabanName); message.println( "<h2 style=\"color:#FFA500\"> Executor is unreachable. Executor host - " + executor .getHost() + " on Cluster - " + azkabanName + "</h2>"); message.println("Remedial action will be attempted on affected executions - <br>"); message.println("Following flows were reported as running on the executor and will be " + "finalized."); message.println(""); message.println("<h3>Affected executions</h3>"); message.println("<ul>"); appendFlowLinksToMessage(message, flows, scheme, clientHostname, clientPortNumber); message.println("</ul>"); message.println(""); message.println("<h3>Error detail</h3>"); message.println(String.format("Following error was reported for executor-id: %s, " + "executor-host: %s, executor-port: %d", executor.getId(), executor.getHost(), executor.getPort())); message.println("<pre>" + ExceptionUtils.getStackTrace(failureException) + "</pre>"); return true; }
Source:
public LogHistoryManager(Path masterLogFile, DataSize maxTotalSize) { requireNonNull(masterLogFile, "masterLogFile is null"); requireNonNull(maxTotalSize, "maxTotalSize is null"); this.masterLogFile = masterLogFile; this.maxTotalSize = maxTotalSize.toBytes(); try { Files.list(masterLogFile.getParent()) .map(this::createLogFile) .filter(Optional::isPresent) .map(Optional::get) .forEach(files::add); totalSize = files.stream() .mapToLong(LogFile::getSize) .sum(); } catch (IOException e) { throw new UncheckedIOException("Unable to list existing log files", e); } pruneLogFilesIfNecessary(0); }

Target:
public LogHistoryManager(Path masterLogFile, DataSize maxTotalSize) { requireNonNull(masterLogFile, "masterLogFile is null"); requireNonNull(maxTotalSize, "maxTotalSize is null"); this.masterLogFile = masterLogFile; this.maxTotalSize = maxTotalSize.toBytes(); try { Files.list(masterLogFile.getParent()) .map(this::createLogFile) .filter(Optional::isPresent) .map(Optional::get) .forEach(files::add); totalSize = files.stream() .mapToLong(LogFile::getSize) .sum(); } catch (IOException e) { throw new UncheckedIOException("Unable to list existing history log files for " + masterLogFile, e); } pruneLogFilesIfNecessary(0); }