auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public AsyncTaskResult<List<EnrolledCoursesResponse>> loadInBackground() { ProfileModel profile = loginPrefs.getCurrentUserProfile(); List<EnrolledCoursesResponse> enrolledCoursesResponse = null; AsyncTaskResult<List<EnrolledCoursesResponse>> result = new AsyncTaskResult<>(); try { if (profile != null) { <START> String org = config.getOrganizationCode(); <END> enrolledCoursesResponse = api.getUserEnrolledCourses(profile.username, org, false); environment.getNotificationDelegate().syncWithServerForFailure(); environment.getNotificationDelegate().checkCourseEnrollment(enrolledCoursesResponse); } } catch (Exception exception) { result.setEx(exception); } result.setResult(enrolledCoursesResponse); return result; }</code><technical_language>change variable name org orgCode consistent naming in RestApiManager</technical_language>

Target:
public AsyncTaskResult<List<EnrolledCoursesResponse>> loadInBackground() { ProfileModel profile = loginPrefs.getCurrentUserProfile(); List<EnrolledCoursesResponse> enrolledCoursesResponse = null; AsyncTaskResult<List<EnrolledCoursesResponse>> result = new AsyncTaskResult<>(); try { if (profile != null) { String orgCode = config.getOrganizationCode(); enrolledCoursesResponse = api.getUserEnrolledCourses(profile.username, orgCode, false); environment.getNotificationDelegate().syncWithServerForFailure(); environment.getNotificationDelegate().checkCourseEnrollment(enrolledCoursesResponse); } } catch (Exception exception) { result.setEx(exception); } result.setResult(enrolledCoursesResponse); return result; }
Source:
<code><START> public boolean equals(Object o) { <END> if (o instanceof SoulTicket) return ((SoulTicket) o).getDescription().equals(description); return false; }</code><technical_language>If override equals, override hashCode well</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o instanceof SoulTicket) return ((SoulTicket) o).getDescription().equals(description); return false; }
Source:
<code>public boolean apply(Game game, Ability source) { game.getPlayers().forEach((playerId, player) -> { if (!(player == null)) { FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent(); filter.add(new ControllerIdPredicate(playerId)); if (game.getBattlefield().getActivePermanents( filter, source.getControllerId(), game ).isEmpty()) { Effect discardEffect = new DiscardTargetEffect(1); discardEffect.setTargetPointer(new FixedTarget(playerId, game)); discardEffect.apply(game, source); } else { Effect effect = new SacrificeEffect( StaticFilters.FILTER_PERMANENT_CREATURE_OR_PLANESWALKER_A, 1, null ); effect.setTargetPointer(new FixedTarget(playerId, game)); effect.apply(game, source); } } <START> }); <END> return true; }</code><technical_language>[release notes](<LINK_0> > Plaguecrafter's ability resolves, player turn is chooses a creature planeswalker control, other player in turn order same, knowing choices them. chosen permanents sacrificed time. Next, player in order sacrifice a permanent chooses a card in hand revealing it, chosen cards discarded time. need change order in events occur</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } List<UUID> perms = new ArrayList<>(); List<UUID> cantSac = new ArrayList<>(); for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { FilterControlledPermanent filter = new FilterControlledPermanent(); filter.add(Predicates.or( new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.PLANESWALKER))); TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); if (target.canChoose(player.getId(), game)) { while (!target.isChosen() && player.canRespond()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } perms.addAll(target.getTargets()); } else { cantSac.add(playerId); } } } for (UUID permID : perms) { Permanent permanent = game.getPermanent(permID); if (permanent != null) { permanent.sacrifice(source.getSourceId(), game); } } for (UUID playerId : cantSac) { Effect discardEffect = new DiscardTargetEffect(1); discardEffect.setTargetPointer(new FixedTarget(playerId, game)); discardEffect.apply(game, source); } return true; }
Source:
<code>protected CloseResourceAction(IShellProvider provider, String text) { <START> super(provider, text); <END> }</code><technical_language>more this invoke this(provider,text, IDEWorkbenchMessages.CloseResourceAction_tooltip, IDEWorkbenchMessages.CloseResourceAction_text_plural, IDEWorkbenchMessages.CloseResourceAction_toolTip_plural) This allow a factorization, turn fields final</technical_language>

Target:
protected CloseResourceAction(IShellProvider provider, String text) { this(provider, text, IDEWorkbenchMessages.CloseResourceAction_toolTip, IDEWorkbenchMessages.CloseResourceAction_text_plural, IDEWorkbenchMessages.CloseResourceAction_toolTip_plural); }
Source:
<code>public void updateMenuState(int numSelectedProjects, int numProjects) { boolean allowDelete = !isReadOnly && numSelectedProjects > 0; boolean allowExport = numSelectedProjects > 0; boolean allowExportAll = numProjects > 0; boolean allowExportSelected = numSelectedProjects > 1; fileDropDown.setItemEnabled(MESSAGES.deleteProjectMenuItem(), allowDelete); fileDropDown.setItemEnabled(MESSAGES.exportProjectMenuItem(), allowExport); <START> fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), allowExportAll); <END> fileDropDown.setItemEnabled(MESSAGES.exportSelectedProjectsMenuItem(), allowExportSelected); }</code><technical_language>wondering if sense repurpose export menu item changing text another menu item..</technical_language>

Target:
public void updateMenuState(int numSelectedProjects, int numProjects) { boolean allowDelete = !isReadOnly && numSelectedProjects > 0; boolean allowExport = numSelectedProjects > 0; boolean allowExportAll = numProjects > 0; String exportProjectLabel = numSelectedProjects > 1 ? MESSAGES.exportSelectedProjectsMenuItem(numSelectedProjects) : MESSAGES.exportProjectMenuItem(); fileDropDown.setItemHtmlById(WIDGET_NAME_EXPORTPROJECT, exportProjectLabel); fileDropDown.setItemEnabled(MESSAGES.deleteProjectMenuItem(), allowDelete); fileDropDown.setItemEnabledById(WIDGET_NAME_EXPORTPROJECT, allowExport); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), allowExportAll); }
Source:
<code>protected abstract BatchJob createJob(ProcessContext process) throws Exception; private void logParameters(ProcessContext process) { <START> String output = "Parameter \"%s\": %s"; <END> getParameters().forEach(param -> { String value = process.getParameter(param).map(NLS::toUserString).orElse(""); process.log(ProcessLog.info().withFormattedMessage(output, param.getLabel(), value)); }); }</code><technical_language>a stringbuilder output a Parameters: x: y a: b ..</technical_language>

Target:
protected abstract BatchJob createJob(ProcessContext process) throws Exception; private void logParameters(ProcessContext process) { StringBuilder output = new StringBuilder(); output.append("Parameter:\n\n"); getParameters().forEach(param -> { String value = process.getParameter(param).map(NLS::toUserString).orElse(""); output.append(param.getLabel()); output.append(": "); output.append(value); output.append("\n"); }); process.log(ProcessLog.info().withMessage(output.toString().trim())); }
Source:
<code>public TBuilder setParentContextUID(UID parentUID) { if (parentUID == null) { this.getTypeInstance().setParentContext(null); } else { ContextEntity c = this.daoContext.get(parentUID); BillyValidator.found(c, ContextBuilderImpl.LOCALIZER.getString("field.parent_context")); if (!this.getTypeInstance().isNew() && this.daoContext.isSameOrSubContext(c, this.getTypeInstance())) { <START> throw new BillyRuntimeException(); <END> } this.getTypeInstance().setParentContext(c); } return this.getBuilder(); }</code><technical_language>add a message this exception</technical_language>

Target:
public TBuilder setParentContextUID(UID parentUID) { if (parentUID == null) { this.getTypeInstance().setParentContext(null); } else { ContextEntity c = this.daoContext.get(parentUID); BillyValidator.found(c, ContextBuilderImpl.LOCALIZER.getString("field.parent_context")); if (!this.getTypeInstance().isNew() && this.daoContext.isSameOrSubContext(c, this.getTypeInstance())) { throw new BillyRuntimeException("Can't set Parent Context on old instance, itself or sub context"); } this.getTypeInstance().setParentContext(c); } return this.getBuilder(); }
Source:
<code>protected void executeVdsBrokerCommand() { GlusterVolumeGeoRepSessionVDSParameters parameter = getParameters(); if (parameter.getVolumeName() == null) { result = getBroker().glusterVolumeGeoRepStatus(); <START> } else if (parameter.getVolumeName() != null && (parameter.getSlaveHost() == null || parameter.getSlaveVolume() == null)) { <END> result = getBroker().glusterVolumeGeoRepStatus(parameter.getVolumeName()); } else { result = getBroker().glusterVolumeGeoRepStatus(parameter.getVolumeName(), parameter.getSlaveHost(), parameter.getSlaveVolume()); } proceedProxyReturnValue(); if (getVDSReturnValue().getSucceeded()) { setReturnValue(result.getGeoRepSessions()); } }</code><technical_language>parameter.getVolumeName() != null is a redundant check</technical_language>

Target:
protected void executeVdsBrokerCommand() { GlusterVolumeGeoRepSessionVDSParameters parameter = getParameters(); if (parameter.getVolumeName() == null) { result = getBroker().glusterVolumeGeoRepStatus(); } else if (parameter.getSlaveHost() == null || parameter.getSlaveVolume() == null) { result = getBroker().glusterVolumeGeoRepStatus(parameter.getVolumeName()); } else { result = getBroker().glusterVolumeGeoRepStatus(parameter.getVolumeName(), parameter.getSlaveHost(), parameter.getSlaveVolume()); } proceedProxyReturnValue(); if (getVDSReturnValue().getSucceeded()) { setReturnValue(result.getGeoRepSessions()); } }
Source:
<code>public void startListeners(ClientInterface cif) { m_ci = cif; m_migrateRowAdapter = new SimpleClientResponseAdapter( ClientInterface.MIGRATE_ROWS_DELETE_CID, "MigrateRowsAdapter"); <START> m_ci.bindAdapter(m_migrateRowAdapter, null); <END> m_migratePartitionAdapter = new SimpleClientResponseAdapter( ClientInterface.EXPORT_MANAGER_CID, getClass().getSimpleName()); cif.bindAdapter(m_migratePartitionAdapter, new ClientInterfaceRepairCallback() { @Override public void repairCompleted(int partitionId, long initiatorHSId) { handlePartitionLeader(partitionId, initiatorHSId); } @Override public void leaderMigrated(int partitionId, long initiatorHSId) { handlePartitionLeader(partitionId, initiatorHSId); } private void handlePartitionLeader(int partitionId, long initiatorHSId) { if (partitionId == MpInitiator.MP_INIT_PID) { return; } onPartitionLeaderMigrated(isLocalHost(initiatorHSId), partitionId); } private boolean isLocalHost(long hsId) { return CoreUtils.getHostIdFromHSId(hsId) == m_hostId; } }); }</code><technical_language>I pretty remove this adapter bind. I pretty needed adapter is is CID is registered</technical_language>

Target:
public void startListeners(ClientInterface cif) { m_ci = cif; m_migratePartitionAdapter = new SimpleClientResponseAdapter( ClientInterface.EXPORT_MANAGER_CID, getClass().getSimpleName()); cif.bindAdapter(m_migratePartitionAdapter, new ClientInterfaceRepairCallback() { @Override public void repairCompleted(int partitionId, long initiatorHSId) { handlePartitionLeader(partitionId, initiatorHSId); } @Override public void leaderMigrated(int partitionId, long initiatorHSId) { handlePartitionLeader(partitionId, initiatorHSId); } private void handlePartitionLeader(int partitionId, long initiatorHSId) { if (partitionId == MpInitiator.MP_INIT_PID) { return; } onPartitionLeaderMigrated(isLocalHost(initiatorHSId), partitionId); } private boolean isLocalHost(long hsId) { return CoreUtils.getHostIdFromHSId(hsId) == m_hostId; } }); }
Source:
<code>protected void listenerRemoved(ViatraQueryModelUpdateListener listener) { ChangeLevel changeLevel = listener.getLevel(); Collection<ViatraQueryModelUpdateListener> old = listenerMap.getOrDefault(changeLevel, Collections.emptySet()); <START> boolean removed = old.remove(listener); <END> if(!removed) { handleUnsuccesfulRemove(listener); } updateMaxLevel(); if(listenerMap.isEmpty()) { this.queryEngine.removeLifecycleListener(selfListener); removeBaseIndexChangeListener(); } }</code><technical_language>more do here: if collection empty, remove collection map ensure listenerMap.contains() behaves expect. handleUnsuccesfulRemove handles this kind of deletion, called collection 'old' a single element</technical_language>

Target:
protected void listenerRemoved(ViatraQueryModelUpdateListener listener) { ChangeLevel changeLevel = listener.getLevel(); Collection<ViatraQueryModelUpdateListener> old = listenerMap.getOrDefault(changeLevel, Collections.emptySet()); boolean removed = old.remove(listener); if(removed) { if (old.isEmpty()) listenerMap.remove(changeLevel); } else { handleUnsuccesfulRemove(listener); } updateMaxLevel(); if(listenerMap.isEmpty()) { this.queryEngine.removeLifecycleListener(selfListener); removeBaseIndexChangeListener(); } }
Source:
<code>private void initialize() { chaserThing = ThingBuilder.create(THING_TYPE_CHASER, "testchaser").withLabel("Chaser Thing") .withBridge(bridge.getUID()).withConfiguration(new Configuration(thingProperties)).build(); managedThingProvider.add(bridge); dmxBridgeHandler = (TestBridgeHandler) waitForAssert(() -> { final ThingHandler thingHandler = bridge.getHandler(); assertThat(thingHandler, notNullValue()); return thingHandler; }); managedThingProvider.add(chaserThing); chaserThingHandler = (ChaserThingHandler) waitForAssert(() -> { final ThingHandler thingHandler = chaserThing.getHandler(); assertThat(thingHandler, notNullValue()); return thingHandler; }); final ManagedItemChannelLinkProvider itemChannelLinkProvider = waitForAssert(() -> { final ManagedItemChannelLinkProvider tmp = getService(ManagedItemChannelLinkProvider.class); assertThat(tmp, is(notNullValue())); return tmp; }); <START> switchItem = new DimmerItem(TEST_SWITCHITEM_NAME); <END> itemRegistry.add(switchItem); itemChannelLinkProvider .add(new ItemChannelLink(TEST_SWITCHITEM_NAME, new ChannelUID(chaserThing.getUID(), CHANNEL_SWITCH))); }</code><technical_language>I stumbled this line assign a Dimmeritem a variable called "switch....", I thinking need items for tests? Background of question is I testing basically framework a lot of JUnit tests "randomly failing" (in some of DMX tests) of timing issues framework behaves in tests. test logic calling methods framework? for parts need frame work do create real registries items instead mocks</technical_language>

Target:
private void initialize() { chaserThing = ThingBuilder.create(THING_TYPE_CHASER, "testchaser").withLabel("Chaser Thing") .withBridge(bridge.getUID()).withConfiguration(new Configuration(thingProperties)) .withChannel( ChannelBuilder.create(CHANNEL_UID_SWITCH, "Switch").withType(SWITCH_CHANNEL_TYPEUID).build()) .build(); chaserThingHandler = new ChaserThingHandler(chaserThing) { @Override protected @Nullable Bridge getBridge() { return bridge; } }; initializeHandler(chaserThingHandler); }
Source:
<code>protected void performOK() { if (isIndexerAffected) return; ICResourceDescription res = getResDesc(); IResourceInfo info = getResCfg(res); ITool[] t1; if (info instanceof IFolderInfo){ t1 = ((IFolderInfo)info).getFilteredTools(); } else if (info instanceof IFileInfo) { t1 = ((IFileInfo)info).getToolsToInvoke(); } else return; <START> isIndexerAffected = <END> false; for (ITool t : t1) { IOption op1[] = t.getOptions(); for (IOption op : op1) { if (((Option)op).isDirty()) { if (op.isForScannerDiscovery()) isIndexerAffected = true; else { try { switch (op.getValueType()) { case IOption.INCLUDE_PATH : case IOption.PREPROCESSOR_SYMBOLS : case IOption.LIBRARIES : case IOption.INCLUDE_FILES: case IOption.MACRO_FILES: case IOption.UNDEF_INCLUDE_PATH: case IOption.UNDEF_PREPROCESSOR_SYMBOLS: case IOption.UNDEF_INCLUDE_FILES: case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_MACRO_FILES: isIndexerAffected = true; break; } } catch (BuildException e) { } } } } } super.performOK(); }</code><technical_language>false here, no</technical_language>

Target:
protected void performOK() { isIndexerAffected = false; if (!isDirty()) { super.performOK(); return; } ICResourceDescription res = getResDesc(); IResourceInfo info = getResCfg(res); ITool[] t1; if (info instanceof IFolderInfo){ t1 = ((IFolderInfo)info).getFilteredTools(); } else if (info instanceof IFileInfo) { t1 = ((IFileInfo)info).getToolsToInvoke(); } else return; for (ITool t : t1) { IOption op1[] = t.getOptions(); for (IOption op : op1) { if (((Option)op).isDirty()) { if (op.isForScannerDiscovery()) isIndexerAffected = true; else { try { switch (op.getValueType()) { case IOption.INCLUDE_PATH : case IOption.PREPROCESSOR_SYMBOLS : case IOption.INCLUDE_FILES: case IOption.MACRO_FILES: case IOption.UNDEF_INCLUDE_PATH: case IOption.UNDEF_PREPROCESSOR_SYMBOLS: case IOption.UNDEF_INCLUDE_FILES: case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_MACRO_FILES: isIndexerAffected = true; break; } } catch (BuildException e) { } } } } } super.performOK(); }
Source:
<code>public Set<Project> searchByReleaseId(String id, User user) { <START> Set<String> ids = new HashSet<>(Arrays.asList(id)); <END> return searchByReleaseId(ids, user); }</code><technical_language>Collections::singleton</technical_language>

Target:
public Set<Project> searchByReleaseId(String id, User user) { return searchByReleaseId(Collections.singleton(id), user); }
Source:
<code>public void deleteStep(final WorkflowStep step) throws DotDataException { <START> Savepoint savepoint = null; <END> try { for(WorkflowStep otherStep : findSteps(findScheme(step.getSchemeId()))){ for(WorkflowAction action : findActions(otherStep, APILocator.getUserAPI().getSystemUser())){ if(action.getNextStep().equals(step.getId())) { throw new DotDataException("</br> <b> Step : '" + step.getName() + "' is being referenced by </b> </br></br>" + " Step : '"+otherStep.getName() + "' -> Action : '" + action.getName() + "' </br></br>"); } } } final int countContentletsReferencingStep = getCountContentletsReferencingStep(step); if(countContentletsReferencingStep > 0){ throw new DotDataException("</br> <b> Step : '" + step.getName() + "' is being referenced by: "+countContentletsReferencingStep+" contenlet(s)</b> </br></br>"); } this.workFlowFactory.deleteActions(step); this.workFlowFactory.deleteStep(step); } catch(Exception e){ throw new DotDataException(e.getMessage(), e); } }</code><technical_language>I this variable is delete</technical_language>

Target:
public void deleteStep(final WorkflowStep step) throws DotDataException { try { for(WorkflowStep otherStep : findSteps(findScheme(step.getSchemeId()))){ for(WorkflowAction action : findActions(otherStep, APILocator.getUserAPI().getSystemUser())){ if(action.getNextStep().equals(step.getId())) { throw new DotDataException("</br> <b> Step : '" + step.getName() + "' is being referenced by </b> </br></br>" + " Step : '"+otherStep.getName() + "' -> Action : '" + action.getName() + "' </br></br>"); } } } final int countContentletsReferencingStep = getCountContentletsReferencingStep(step); if(countContentletsReferencingStep > 0){ throw new DotDataException("</br> <b> Step : '" + step.getName() + "' is being referenced by: "+countContentletsReferencingStep+" contenlet(s)</b> </br></br>"); } this.workFlowFactory.deleteActions(step); this.workFlowFactory.deleteStep(step); } catch(Exception e){ throw new DotDataException(e.getMessage(), e); } }
Source:
<code>private static Map<Long, SMRGarbageEntry> generateGarbageEntries(long markerAddress, List<SMRRecordLocator> locators) { Map<Long, SMRGarbageEntry> garbage = new TreeMap<>(); locators.forEach(locator -> { <START> int serializedSize = locator.getSerializedSize(); <END> SMRGarbageRecord garbageRecord = new SMRGarbageRecord(markerAddress, serializedSize); long globalAddress = locator.getGlobalAddress(); garbage.compute(globalAddress, (a, smrGabageEntry) -> { if (smrGabageEntry == null) { smrGabageEntry = new SMRGarbageEntry(); smrGabageEntry.setGlobalAddress(a); } smrGabageEntry.add(locator.getStreamId(), locator.getIndex(), garbageRecord); return smrGabageEntry; }); }); return garbage; }</code><technical_language>Break line. static removed</technical_language>

Target:
private List<SMRGarbageEntry> generateGarbageEntries(long markerAddress, List<SMRRecordLocator> locators) { Map<Long, SMRGarbageEntry> garbage = new HashMap<>(); locators.forEach(locator -> { int serializedSize = locator.getSerializedSize(); SMRGarbageRecord garbageRecord = new SMRGarbageRecord(markerAddress, serializedSize); long globalAddress = locator.getGlobalAddress(); garbage.compute(globalAddress, (a, smrGarbageEntry) -> { if (smrGarbageEntry == null) { smrGarbageEntry = new SMRGarbageEntry(); smrGarbageEntry.setGlobalAddress(a); } smrGarbageEntry.add(locator.getStreamId(), locator.getIndex(), garbageRecord); return smrGarbageEntry; }); }); return new ArrayList<>(garbage.values()); }
Source:
<code>private void addBlockingPanels() { RepeatingView rv; addOrReplace(rv = new RepeatingView("lazy2")); for (int i = 0; i < 5; i++) rv.add(new AjaxLazyLoadPanel(rv.newChildId()) { private static final long serialVersionUID = 1L; private int seconds = r.nextInt(5); @Override public Component getLazyLoadComponent(String markupId) { try { <START> System.out.println("Starting sleep"); <END> Thread.sleep(seconds * 1000); System.out.println("Slept " + seconds + " seconds"); } catch (InterruptedException e) { } return new Label(markupId, "Lazy loaded after blocking the Wicket thread for " + seconds + " seconds"); } }); }</code><technical_language>Logger instead</technical_language>

Target:
private void addBlockingPanels() { RepeatingView rv; addOrReplace(rv = new RepeatingView("lazy2")); for (int i = 0; i < 5; i++) rv.add(new AjaxLazyLoadPanel(rv.newChildId()) { private static final long serialVersionUID = 1L; private int seconds = r.nextInt(5); @Override public Component getLazyLoadComponent(String markupId) { try { Thread.sleep(seconds * 1000); } catch (InterruptedException e) { } return new Label(markupId, "Lazy loaded after blocking the Wicket thread for " + seconds + " seconds"); } }); }
Source:
<code>public void createArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, WAR_NAME); war.addClasses(FooResource.class, TestApplication.class, TestServlet.class); war.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); war.addAsWebInfResource(CDIResourceTest.class.getPackage(), "web-resteasy1082.xml", "web.xml"); war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new SecurityPermission("insertProvider"), <START> new SecurityPermission("insertProvider.BC"), <END> new RuntimePermission("accessDeclaredMembers") ), "permissions.xml"); war.as(ZipExporter.class).exportTo(exportFile, true); }</code><technical_language>2 permissions weird. is this test needs security permissions for security providers, BouncyCastle in particular</technical_language>

Target:
public void createArchive() { WebArchive war = ShrinkWrap.create(WebArchive.class, WAR_NAME); war.addClasses(FooResource.class, TestApplication.class, TestServlet.class); war.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); war.addAsWebInfResource(CDIResourceTest.class.getPackage(), "web-resteasy1082.xml", "web.xml"); war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new RuntimePermission("accessDeclaredMembers") ), "permissions.xml"); war.as(ZipExporter.class).exportTo(exportFile, true); }
Source:
<code>public Object dynamicInvoke(InternalEObject target, EList<?> arguments) throws InvocationTargetException { final Map<String, Object> variables = new HashMap<String, Object>(); variables.put("self", target); for (int index = 0; index < parameterNames.size(); index++) { <START> variables.put(parameterNames.get(index), arguments.get(index)); <END> } final EvaluationResult evaluationResult; try { evaluationResult = engine.eval(astResult, variables); } catch (Exception e) { throw new InvocationTargetException(e); } if (evaluationResult.getDiagnostic().getSeverity() == Diagnostic.ERROR) { throw new InvocationTargetException(new AcceleoQueryEvaluationException(evaluationResult .getDiagnostic().getMessage())); } return evaluationResult.getResult(); }</code><technical_language>parameterNames.size() is equal arguments.size() throw a meaningful IAE otherwise</technical_language>

Target:
public Object dynamicInvoke(InternalEObject target, EList<?> arguments) throws InvocationTargetException { if (arguments.size() != parameterNames.size()) { throw new IllegalArgumentException("number of arguments mismatch " + arguments.size() + " instead of " + parameterNames.size()); } final Map<String, Object> variables = new HashMap<String, Object>(); variables.put("self", target); for (int index = 0; index < parameterNames.size(); index++) { variables.put(parameterNames.get(index), arguments.get(index)); } final EvaluationResult evaluationResult; try { evaluationResult = engine.eval(astResult, variables); } catch (Exception e) { throw new InvocationTargetException(e); } if (evaluationResult.getDiagnostic().getSeverity() == Diagnostic.ERROR) { throw new InvocationTargetException(new AcceleoQueryEvaluationException(evaluationResult .getDiagnostic().getMessage())); } return evaluationResult.getResult(); }
Source:
<code>public IdToken idTokenWithAudience(String targetAudience, List<Option> options) throws IOException { JsonFactory jsonFactory = OAuth2Utils.JSON_FACTORY; GenericData tokenRequest = new GenericData(); tokenRequest.set("grant_type", GRANT_TYPE); tokenRequest.set("client_id", GOOGLE_CLIENT_ID); tokenRequest.set("client_secret", GOOGLE_CLIENT_SECRET); tokenRequest.set("refresh_token", this.refreshToken); Iterator<String> it = this.scopes.iterator(); String customScopes = it.next(); while (it.hasNext()) { customScopes += "+" + it.next(); } <START> tokenRequest.set("scope", customScopes); <END> UrlEncodedContent content = new UrlEncodedContent(tokenRequest, true); HttpRequestFactory requestFactory = transportFactory.create().createRequestFactory(); HttpRequest request = requestFactory.buildPostRequest(new GenericUrl(tokenServerUri), content); request.setParser(new JsonObjectParser(jsonFactory)); request.setCurlLoggingEnabled(true); HttpResponse response = request.execute(); GenericData responseData = response.parseAs(GenericData.class); String rawToken = OAuth2Utils.validateString(responseData, "id_token", PARSE_ERROR_PREFIX); return IdToken.create(rawToken); }</code><technical_language>need update docs</technical_language>

Target:
public IdToken idTokenWithAudience(String targetAudience, List<Option> options) throws IOException { JsonFactory jsonFactory = OAuth2Utils.JSON_FACTORY; GenericData tokenRequest = new GenericData(); tokenRequest.set("grant_type", GRANT_TYPE); tokenRequest.set("client_id", GOOGLE_CLIENT_ID); tokenRequest.set("client_secret", GOOGLE_CLIENT_SECRET); tokenRequest.set("refresh_token", this.refreshToken); UrlEncodedContent content = new UrlEncodedContent(tokenRequest); HttpRequestFactory requestFactory = transportFactory.create().createRequestFactory(); HttpRequest request = requestFactory.buildPostRequest(new GenericUrl(tokenServerUri), content); request.setParser(new JsonObjectParser(jsonFactory)); request.setCurlLoggingEnabled(true); HttpResponse response = request.execute(); GenericData responseData = response.parseAs(GenericData.class); String rawToken = OAuth2Utils.validateString(responseData, "id_token", PARSE_ERROR_PREFIX); return IdToken.create(rawToken); }
Source:
<code><START> public void setListenerOperation(String operation) { <END> listener.setOperation(operation); }</code><technical_language>This test code ? If so, accessibility private set VisibleForTesting</technical_language>

Target:
void setListenerOperation(String operation) { listener.setOperation(operation); }
Source:
<code>public void testExceptionInOnMessage() throws Exception { Nats.shutdownMsgDeliveryThreadPool(); final byte[] payload = "hello".getBytes(); for (int tests=0; tests<2; tests++) { final CountDownLatch latch = new CountDownLatch(1); try (NatsServer srv = runDefaultServer()) { try (final Connection conn = newDefaultConnection()) { <START> try (final Connection pub = newDefaultConnection()) { <END> try (Subscription sub = conn.subscribe("foo", new MessageHandler() { private int count = 0; public void onMessage(Message message) { if (this.count++ == 0) { throw new RuntimeException("On purpose"); } else { latch.countDown(); } } })) { conn.flush(); send(pub, "foo", payload, 2); if (!latch.await(2, TimeUnit.SECONDS)) { fail("Failed to continue receiving messages after exception in message callback"); } } } } } Nats.setMsgDeliveryThreadPoolSize(1); } }</code><technical_language>curious - 2 conns necessary</technical_language>

Target:
public void testExceptionInOnMessage() throws Exception { Nats.shutdownMsgDeliveryThreadPool(); final byte[] payload = "hello".getBytes(); for (int tests=0; tests<2; tests++) { final CountDownLatch latch = new CountDownLatch(1); try (NatsServer srv = runDefaultServer()) { try (final Connection conn = newDefaultConnection()) { try (Subscription sub = conn.subscribe("foo", new MessageHandler() { private int count = 0; public void onMessage(Message message) { if (this.count++ == 0) { throw new RuntimeException("On purpose"); } else { latch.countDown(); } } })) { conn.flush(); send(conn, "foo", payload, 2); if (!latch.await(2, TimeUnit.SECONDS)) { fail("Failed to continue receiving messages after exception in message callback"); } } } } if (tests == 0) { Nats.createMsgDeliveryThreadPool(1); } } }
Source:
<code>public String addDataMovementProtocol(String resourceId, DMType dmType, DataMovementInterface dataMovementInterface) throws AppCatalogException { if (dmType.equals(DMType.COMPUTE_RESOURCE)){ return (new DataMovementRepository()).addDataMovementProtocol(resourceId, dataMovementInterface); } else if (dmType.equals(DMType.STORAGE_RESOURCE)){ <START> Mapper mapper = ObjectMapperSingleton.getInstance(); <END> StorageInterfaceEntity storageInterfaceEntity = mapper.map(dataMovementInterface, StorageInterfaceEntity.class); storageInterfaceEntity.setStorageResourceId(resourceId); execute(entityManager -> entityManager.merge(storageInterfaceEntity)); return storageInterfaceEntity.getStorageResourceId(); } return null; }</code><technical_language>This mapping logic in a repository, DataMovementRepository place</technical_language>

Target:
public String addDataMovementProtocol(String resourceId, DMType dmType, DataMovementInterface dataMovementInterface) throws AppCatalogException { return (new DataMovementRepository()).addDataMovementProtocol(resourceId, dataMovementInterface); }
Source:
<code><START> public RandomSampler(float rate) { <END> checkArgument(rate > 0 && rate < 1, "rate should be between 0 and 1: was %s", rate); this.rate = rate; this.random = new Random(); }</code><technical_language>add docs</technical_language>

Target:
public RandomSampler(float rate) { checkArgument(rate >= 0 && rate <= 1, "rate should be between 0 and 1: was %s", rate); this.rate = rate; }
Source:
<code>public void runCommandAsync(String script) { if (script != null) { KitodoServiceLoader<CommandInterface> serviceLoader = new KitodoServiceLoader<>(CommandInterface.class, ConfigCore.getParameter("moduleFolder")); CommandInterface commandInterface = serviceLoader.loadModule(); Flowable<CommandResult> source = Flowable.fromCallable(() -> { return commandInterface.runCommand(generateId(), script); }); Flowable<CommandResult> commandBackgroundWorker = source.subscribeOn(Schedulers.io()); Flowable<CommandResult> commandResultListener = commandBackgroundWorker.observeOn(Schedulers.single()); commandResultListener.subscribe(commandResult -> handleCommandResult(commandResult), <START> Throwable::printStackTrace); <END> } }</code><technical_language>want include stack trace result</technical_language>

Target:
public void runCommandAsync(String script) { if (script != null) { KitodoServiceLoader<CommandInterface> serviceLoader = new KitodoServiceLoader<>(CommandInterface.class, ConfigCore.getParameter("moduleFolder")); CommandInterface commandInterface = serviceLoader.loadModule(); Flowable<CommandResult> source = Flowable.fromCallable(() -> { return commandInterface.runCommand(generateId(), script); }); Flowable<CommandResult> commandBackgroundWorker = source.subscribeOn(Schedulers.io()); Flowable<CommandResult> commandResultListener = commandBackgroundWorker.observeOn(Schedulers.single()); commandResultListener.subscribe(commandResult -> handleCommandResult(commandResult)); } }
Source:
<code>public void testDuplicateComponentModels() { WMessageBox messageBox = new WMessageBox(WMessageBox.Type.SUCCESS); assertNoDuplicateComponentModels(messageBox, "type", WMessageBox.Type.INFO); <START> } <END></code><technical_language>@Jonno1809 This related var args setter. need cater for empty array of args this:- assertNoDuplicateComponentModels(messageBox, "titleText", "Test", new Serializable[]{});</technical_language>

Target:
public void testDuplicateComponentModels() { WMessageBox messageBox = new WMessageBox(WMessageBox.Type.SUCCESS); assertNoDuplicateComponentModels(messageBox, "type", WMessageBox.Type.INFO); assertNoDuplicateComponentModels(messageBox, "titleText", "Test", new Serializable[]{}); }
Source:
<code>public boolean apply(SshKey key) { checkNotNull(key, "key cannot be null"); <START> checkNotNull(key.getPublicKey(), "key cannot be null"); <END> return fingerprint.equals(computeFingerprint(key.getPublicKey())); }</code><technical_language>[minor] "public key null"</technical_language>

Target:
public boolean apply(SshKey key) { checkNotNull(key, "key cannot be null"); checkNotNull(key.getPublicKey(), "public key cannot be null"); return fingerprint.equals(computeFingerprint(key.getPublicKey())); }
Source:
<code>public void testSessionExpiry() throws Exception { HiveConf conf = new HiveConf(); <START> conf.addResource(TestSessionExpiry.class.getResourceAsStream("/grill-site.xml")); <END> conf.setVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_CLASSNAME, GrillSessionImpl.class.getName()); conf.setLong(GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS, 1L); CLIService cliService = new CLIService(); cliService.init(conf); HiveSessionService grillService = new HiveSessionService(cliService); grillService.init(conf); grillService.start(); try { GrillSessionHandle sessionHandle = grillService.openSession("foo", "bar", new HashMap<String, String>()); GrillSessionImpl session = grillService.getSession(sessionHandle); assertTrue(session.isActive()); session.setLastAccessTime(session.getLastAccessTime() - 2000 * conf.getLong(GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS, GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS_DEFAULT)); assertFalse(session.isActive()); grillService.getSessionExpiryRunnable().run(); try { grillService.getSession(sessionHandle); fail("Expected get session to fail for session " + sessionHandle.getPublicId()); } catch (Exception e) { } } finally { grillService.stop(); } }</code><technical_language>Shouldnt required. create conf GrillServerConf.get()</technical_language>

Target:
public void testSessionExpiry() throws Exception { HiveConf conf = GrillServerConf.get(); conf.setVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_CLASSNAME, GrillSessionImpl.class.getName()); conf.setLong(GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS, 1L); CLIService cliService = new CLIService(); cliService.init(conf); HiveSessionService grillService = new HiveSessionService(cliService); grillService.init(conf); grillService.start(); try { GrillSessionHandle sessionHandle = grillService.openSession("foo", "bar", new HashMap<String, String>()); GrillSessionImpl session = grillService.getSession(sessionHandle); assertTrue(session.isActive()); session.setLastAccessTime(session.getLastAccessTime() - 2000 * conf.getLong(GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS, GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS_DEFAULT)); assertFalse(session.isActive()); grillService.getSessionExpiryRunnable().run(); try { grillService.getSession(sessionHandle); fail("Expected get session to fail for session " + sessionHandle.getPublicId()); } catch (Exception e) { } } finally { grillService.stop(); } }
Source:
<code>int getAvailableHeightBellow(int height) { int partialBottomIndex = getPartialBottomIndex(); int topY = getLinePixel(partialBottomIndex); int lineHeight = renderer.getLineHeight(partialBottomIndex); int availableHeight = 0; int clientAreaHeight = this.clientAreaHeight - topMargin - bottomMargin; if (topY + lineHeight > clientAreaHeight) { availableHeight = lineHeight - (clientAreaHeight - topY); } int lineIndex = partialBottomIndex + 1; int lineCount = content.getLineCount(); while (height > availableHeight && lineIndex < lineCount) { <START> availableHeight += renderer.getCachedLineHeight(lineIndex++); <END> } return Math.min(height, availableHeight); }</code><technical_language>afraid other methods get/setTopIndex setTopPixel return incorrect results in some cases, methods APIs break clients..</technical_language>

Target:
int getAvailableHeightBellow(int height) { int partialBottomIndex = getPartialBottomIndex(); int topY = getLinePixel(partialBottomIndex); int lineHeight = renderer.getLineHeight(partialBottomIndex); int availableHeight = 0; int clientAreaHeight = this.clientAreaHeight - topMargin - bottomMargin; if (topY + lineHeight > clientAreaHeight) { availableHeight = lineHeight - (clientAreaHeight - topY); } int lineIndex = partialBottomIndex + 1; int lineCount = content.getLineCount(); while (height > availableHeight && lineIndex < lineCount) { availableHeight += renderer.getLineHeight(lineIndex++); } return Math.min(height, availableHeight); }
Source:
<code>public List<KeySlice> get_range_slices(String kvsMethodName, TableReference tableRef, SlicePredicate predicate, KeyRange range, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { <START> int numberOfQueriedRows = range.count; <END> return qosClient.executeRead( () -> client.get_range_slices(kvsMethodName, tableRef, predicate, range, consistency_level), ThriftQueryWeighers.getRangeSlices(numberOfQueriedRows)); }</code><technical_language>this a aggressive, hit limit</technical_language>

Target:
public List<KeySlice> get_range_slices(String kvsMethodName, TableReference tableRef, SlicePredicate predicate, KeyRange range, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { return qosClient.executeRead( () -> client.get_range_slices(kvsMethodName, tableRef, predicate, range, consistency_level), ThriftQueryWeighers.getRangeSlices(range)); }
Source:
<code>public int disableSegments(String dataSource, Interval interval) { try { return connector.getDBI().withHandle( handle -> handle .createStatement(StringUtils.format( <START> "UPDATE %s SET used=false WHERE datasource = :datasource and created_date between :start_date and :end_date", <END> getSegmentsTable() )) .bind("datasource", dataSource) .bind("start_data", interval.getStart().toString()) .bind("end_data", interval.getEnd().toString()) .execute() ); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>This query do a providedInterval.contains(segmentInterval) check, created_date is right column</technical_language>

Target:
public int disableSegments(String dataSource, Interval interval) { try { return connector.getDBI().withHandle( handle -> handle .createStatement( StringUtils .format( "UPDATE %s SET used=false WHERE datasource = :datasource " + "AND start >= :start AND %2$send%2$s <= :end", getSegmentsTable(), connector.getQuoteString() )) .bind("datasource", dataSource) .bind("start", interval.getStart().toString()) .bind("end", interval.getEnd().toString()) .execute() ); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>protected void handleUiEditElement(JsonEvent event) { <START> String content = event.getData().getString(PROP_ELEMENT_CONTENT); <END> String slot = event.getData().getString(PROP_SLOT); String elementId = event.getData().getString(PROP_ELEMENT_ID); getModel().getUIFacade().editElementFromUi(new ContentElement(content, slot, elementId)); }</code><technical_language>Assign event.getData() a local variable</technical_language>

Target:
protected void handleUiEditElement(JsonEvent event) { JSONObject data = event.getData(); String content = data.getString(PROP_ELEMENT_CONTENT); String slot = data.getString(PROP_SLOT); String elementId = data.getString(PROP_ELEMENT_ID); getModel().getUIFacade().editElementFromUi(new ContentElement(content, slot, elementId)); }
Source:
<code>private Map<String, Pair<FieldType, FlattenExpr>> generateFieldPaths(List<FieldSpec> fieldSpecs) { Map<String, Pair<FieldType, FlattenExpr>> map = new LinkedHashMap<>(); for (FieldSpec fieldSpec : fieldSpecs) { String fieldName = fieldSpec.getName(); if (map.get(fieldName) != null) { throw new IllegalArgumentException("Cannot have duplicate field definition: " + fieldName); } FlattenExpr path = null; if (fieldSpec.getType() == FieldType.PATH) { path = new FlattenExpr(JsonPath.compile(fieldSpec.getExpr())); } else if (fieldSpec.getType() == FieldType.JQ) { try { path = new FlattenExpr(JsonQuery.compile(fieldSpec.getExpr())); } catch (JsonQueryException e) { <START> throw new ParseException(e, "Unable to compile JQ expression [%s]", fieldSpec.getExpr()); <END> } } Pair<FieldType, FlattenExpr> pair = new Pair<>(fieldSpec.getType(), path); map.put(fieldName, pair); } return map; }</code><technical_language>for this IllegalArgumentException. ParseExceptions meant represent parse errors individual lines, this error applies entire flatten spec</technical_language>

Target:
private Map<String, Pair<FieldType, FlattenExpr>> generateFieldPaths(List<FieldSpec> fieldSpecs) { Map<String, Pair<FieldType, FlattenExpr>> map = new LinkedHashMap<>(); for (FieldSpec fieldSpec : fieldSpecs) { String fieldName = fieldSpec.getName(); if (map.get(fieldName) != null) { throw new IllegalArgumentException("Cannot have duplicate field definition: " + fieldName); } FlattenExpr path = null; if (fieldSpec.getType() == FieldType.PATH) { path = new FlattenExpr(JsonPath.compile(fieldSpec.getExpr())); } else if (fieldSpec.getType() == FieldType.JQ) { try { path = new FlattenExpr(JsonQuery.compile(fieldSpec.getExpr())); } catch (JsonQueryException e) { throw new IllegalArgumentException("Unable to compile JQ expression: " + fieldSpec.getExpr()); } } Pair<FieldType, FlattenExpr> pair = new Pair<>(fieldSpec.getType(), path); map.put(fieldName, pair); } return map; }
Source:
<code>public List<FeatureTypeStyle> transformInternal(MBStyle styleContext) { MBStyleTransformer transformer = new MBStyleTransformer(parse); Fill fill; if (hasBackgroundPattern()) { ExternalGraphic eg = transformer.createExternalGraphicForSprite(backgroundPattern(), styleContext); GraphicFill gf = sf.graphicFill(Arrays.asList(eg), backgroundOpacity(), null, null, null, null); fill = sf.fill(gf, backgroundColor(), backgroundOpacity()); } else { fill = sf.fill(null, backgroundColor(), backgroundOpacity()); } Symbolizer symbolizer = sf.polygonSymbolizer(getId(), ff.property((String) null), sf.description(Text.text("fill"), null), NonSI.PIXEL, null, fill, null, ff.literal(0)); List<Symbolizer> symbolizers = new ArrayList<Symbolizer>(); symbolizers.add(symbolizer); MBFilter filter = getFilter(); List<org.opengis.style.Rule> rules = new ArrayList<>(); Rule rule = sf.rule( getId(), null, null, 0.0, Double.POSITIVE_INFINITY, symbolizers, filter.filter()); rule.setLegendGraphic(new Graphic[0]); rules.add(rule); <START> List<FeatureTypeStyle> style = new ArrayList<>(); <END> style.add(sf.featureTypeStyle(getId(), sf.description(Text.text("MBStyle " + getId()), Text.text("Generated for " + getSourceLayer())), null, Collections.emptySet(), filter.semanticTypeIdentifiers(), rules)); return style; }</code><technical_language>Collections.singletonList(sf.featureTypeStyle(...)) instead of creating a new array list. for of other MBLayer implementations</technical_language>

Target:
public List<FeatureTypeStyle> transformInternal(MBStyle styleContext) { MBStyleTransformer transformer = new MBStyleTransformer(parse); Fill fill; if (hasBackgroundPattern()) { ExternalGraphic eg = transformer.createExternalGraphicForSprite(backgroundPattern(), styleContext); GraphicFill gf = sf.graphicFill(Arrays.asList(eg), backgroundOpacity(), null, null, null, null); fill = sf.fill(gf, backgroundColor(), backgroundOpacity()); } else { fill = sf.fill(null, backgroundColor(), backgroundOpacity()); } Symbolizer symbolizer = sf.polygonSymbolizer(getId(), ff.property((String) null), sf.description(Text.text("fill"), null), NonSI.PIXEL, null, fill, null, ff.literal(0)); List<Symbolizer> symbolizers = new ArrayList<Symbolizer>(); symbolizers.add(symbolizer); MBFilter filter = getFilter(); List<org.opengis.style.Rule> rules = new ArrayList<>(); Rule rule = sf.rule( getId(), null, null, 0.0, Double.POSITIVE_INFINITY, symbolizers, filter.filter()); rule.setLegendGraphic(new Graphic[0]); rules.add(rule); return Collections.singletonList(sf.featureTypeStyle(getId(), sf.description(Text.text("MBStyle " + getId()), Text.text("Generated for " + getSourceLayer())), null, Collections.emptySet(), filter.semanticTypeIdentifiers(), rules)); }
Source:
<code>public void socketExpirationIsUsedByDefault() throws LifecycleException, URISyntaxException { ImmutableList<Server> servers = configurationParser.parseServers(ImmutableList.of(file("/graphite-writer-factory-example2.json")), false); <START> assertThat(servers).hasSize(1); <END> Server server = servers.get(0); assertThat(server.getQueries()).hasSize(1); Query query = server.getQueries().iterator().next(); assertThat(query.getOutputWriterInstances()).hasSize(1); OutputWriter outputWriter = query.getOutputWriterInstances().iterator().next(); assertThat(outputWriter).isInstanceOf(ResultTransformerOutputWriter.class); ResultTransformerOutputWriter resultTransformerOutputWriter = (ResultTransformerOutputWriter) outputWriter; OutputWriter target = resultTransformerOutputWriter.getTarget(); assertThat(target).isInstanceOf(WriterPoolOutputWriter.class); LifecycledPool writerPool = ((WriterPoolOutputWriter) target).getWriterPool(); assertThat(writerPool).isInstanceOf(BlazePool.class); BlazePool blazePool = (BlazePool) writerPool; try { Field expirationField = blazePool.getClass().getDeclaredField("deallocRule"); expirationField.setAccessible(true); Object expiration = expirationField.get(blazePool); assertThat(expiration).isInstanceOf(SocketExpiration.class); } catch (IllegalAccessException | NoSuchFieldException e) { fail(); } }</code><technical_language>a lot of assertions do name of test. removed</technical_language>

Target:
public void socketExpirationIsUsedByDefault() throws LifecycleException, URISyntaxException { ImmutableList<Server> servers = configurationParser.parseServers(ImmutableList.of(file("/graphite-writer-factory-example2.json")), false); Server server = servers.get(0); Query query = server.getQueries().iterator().next(); OutputWriter outputWriter = query.getOutputWriterInstances().iterator().next(); ResultTransformerOutputWriter resultTransformerOutputWriter = (ResultTransformerOutputWriter) outputWriter; OutputWriter target = resultTransformerOutputWriter.getTarget(); LifecycledPool writerPool = ((WriterPoolOutputWriter) target).getWriterPool(); BlazePool blazePool = (BlazePool) writerPool; try { Field expirationField = blazePool.getClass().getDeclaredField("deallocRule"); expirationField.setAccessible(true); Object expiration = expirationField.get(blazePool); assertThat(expiration).isInstanceOf(SocketExpiration.class); } catch (IllegalAccessException | NoSuchFieldException e) { fail(); } }