auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testFileObjectPath() throws Exception { List<PID> pids = makePidList(5); when(pathFactory.getAncestorPids(pid)).thenReturn(pids); when(dip.getContentObject()).thenReturn(fileObject); filter.filter(dip); verify(idb).setRollup(eq(pids.get(WORK_OBJECT_DEPTH).getId())); }

Target:
public void testFileObjectPath() throws Exception { List<PID> pids = makePidList(5); when(pathFactory.getAncestorPids(pid)).thenReturn(pids); when(dip.getContentObject()).thenReturn(fileObject); filter.filter(dip); verify(idb).setAncestorPath(listCaptor.capture()); List<String> ancestorPath = listCaptor.getValue(); ancestorPathCheck(ancestorPath, pids); assertEquals(5, ancestorPath.size()); verify(idb).setRollup(eq(pids.get(WORK_OBJECT_DEPTH).getId())); }
Source:
public void start() throws Exception { startClient(httpClient); if (http2Client.isPresent()) { startClient(http2Client.get()); } }

Target:
public void start() throws Exception { startClient(httpClient); http2Client.ifPresent(this::startClient); }
Source:
public void otherNodeCanBecomeLeaderAfterSteppingDown() { LeadershipToken token = state.gainLeadership(0); assertThat(state.leader(0).isStillLeading(token)).isEqualTo(StillLeadingStatus.LEADING); assertThat(state.leader(0).stepDown()).isTrue(); LeadershipToken token2 = state.gainLeadership(1); assertThat(state.leader(1).isStillLeading(token2)).isEqualTo(StillLeadingStatus.LEADING); }

Target:
public void otherNodeCanBecomeLeaderAfterSteppingDown() { LeadershipToken token = state.gainLeadership(0); assertThat(state.leader(0).isStillLeading(token)).isEqualTo(StillLeadingStatus.LEADING); assertThat(state.leader(0).stepDown()).isTrue(); LeadershipToken token2 = state.gainLeadership(1); assertThat(state.leader(0).isStillLeading(token)).isEqualTo(StillLeadingStatus.NOT_LEADING); assertThat(state.leader(1).isStillLeading(token2)).isEqualTo(StillLeadingStatus.LEADING); }
Source:
public void getAppConfigForUserReturnsOldestVersion() { Survey survey = Survey.create(); survey.setIdentifier("theIdentifier"); survey.setGuid(SURVEY_REF_LIST.get(0).getGuid()); survey.setCreatedOn(SURVEY_REF_LIST.get(0).getCreatedOn().getMillis()); CriteriaContext context = new CriteriaContext.Builder() .withClientInfo(ClientInfo.fromUserAgentCache("iPhone/6 (Motorola Flip-Phone; Android/14) BridgeJavaSDK/10")) .withStudyIdentifier(TEST_STUDY).build(); setupConfigsForUser(); AppConfig appConfig = service.getAppConfigForUser(context, true); assertEquals(EARLIER_TIMESTAMP, appConfig.getCreatedOn()); }

Target:
public void getAppConfigForUserReturnsOldestVersion() { Survey survey = Survey.create(); survey.setIdentifier("theIdentifier"); survey.setGuid(SURVEY_REF_LIST.get(0).getGuid()); survey.setCreatedOn(SURVEY_REF_LIST.get(0).getCreatedOn().getMillis()); when(mockSurveyService.getSurvey(TestConstants.TEST_STUDY, SURVEY_KEY, false, false)).thenReturn(survey); CriteriaContext context = new CriteriaContext.Builder() .withClientInfo(ClientInfo.fromUserAgentCache("iPhone/6 (Motorola Flip-Phone; Android/14) BridgeJavaSDK/10")) .withStudyIdentifier(TEST_STUDY).build(); setupConfigsForUser(); AppConfig appConfig = service.getAppConfigForUser(context, true); assertEquals(EARLIER_TIMESTAMP, appConfig.getCreatedOn()); assertEquals("theIdentifier", appConfig.getSurveyReferences().get(0).getIdentifier()); }
Source:
public ContextKey(final String contextKey) { if (contextKey == null) { throw new IllegalArgumentException("contextKey must not be null"); } final String arr[] = contextKey.split(":"); if (arr.length != 2) { throw new IllegalArgumentException("contextKey must be in the format 'context:key'"); } this.context = arr[0]; this.key = arr[1]; }

Target:
public ContextKey(final String contextKey) { Objects.requireNonNull(contextKey , "contextKey must not be null"); final String arr[] = contextKey.split(":"); if (arr.length != 2) { throw new IllegalArgumentException("contextKey '" + contextKey + "' must be in the format 'context:key'"); } this.context = arr[0]; this.key = arr[1]; }
Source:
private ValidationResult validateRequiredNetworksAvailable(VDS vds, VM vm, List<VmNetworkInterface> vmNICs, Network displayNetwork, Map<String, Network> networksByName, List<String> hostNetworks, VdsNetworkInterface displayNic) { List<String> missingIfs = new ArrayList<>(); boolean onlyRequiredNetworks = Config.<Boolean> getValue(ConfigValues.OnlyRequiredNetworksMandatoryForVdsSelection); for (final VmNetworkInterface vmIf : vmNICs) { boolean found = false; if (vmIf.getNetworkName() == null) { found = true; } else { for (String networkName : hostNetworks) { if (!networkRequiredOnVds(vmIf, networksByName, onlyRequiredNetworks) || StringUtils.equals(vmIf.getNetworkName(), networkName)) { found = true; break; } } } if (!found) { missingIfs.add(vmIf.getNetworkName()); } } if (!missingIfs.isEmpty()) { String nics = StringUtils.join(missingIfs, ", "); log.debug("host is missing networks required by VM nics {}", vds.getName(), nics); return new ValidationResult(VdcBllMessages.VAR__DETAIL__NETWORK_MISSING, String.format("$networkNames %1$s", nics)); } return validateDisplayNetworkAvailability(vds, onlyRequiredNetworks, displayNic, displayNetwork); }

Target:
private ValidationResult validateRequiredNetworksAvailable(VDS vds, VM vm, List<VmNetworkInterface> vmNICs, Network displayNetwork, Map<String, Network> networksByName, List<String> hostNetworks, VdsNetworkInterface displayNic) { List<String> missingIfs = new ArrayList<>(); boolean onlyRequiredNetworks = Config.<Boolean> getValue(ConfigValues.OnlyRequiredNetworksMandatoryForVdsSelection); for (final VmNetworkInterface vmIf : vmNICs) { boolean found = false; if (vmIf.getNetworkName() == null) { found = true; } else { for (String networkName : hostNetworks) { if (!networkRequiredOnVds(vmIf, networksByName, onlyRequiredNetworks) || StringUtils.equals(vmIf.getNetworkName(), networkName)) { found = true; break; } } } if (!found) { missingIfs.add(vmIf.getNetworkName()); } } if (!missingIfs.isEmpty()) { String nics = StringUtils.join(missingIfs, ", "); log.warn("host is missing networks required by VM nics {}", vds.getName(), nics); return new ValidationResult(VdcBllMessages.VAR__DETAIL__NETWORK_MISSING, String.format("$networkNames %1$s", nics)); } return validateDisplayNetworkAvailability(vds, onlyRequiredNetworks, displayNic, displayNetwork); }
Source:
private void validateConfigsForTaskModifications(String workflowName, String jobName, TaskConfig taskConfig) { WorkflowConfig workflowConfig = TaskUtil.getWorkflowConfig(_accessor, workflowName); String nameSpaceJobName = TaskUtil.getNamespacedJobName(workflowName, jobName); JobConfig jobConfig = TaskUtil.getJobConfig(_accessor, nameSpaceJobName); if (workflowConfig == null) { throw new IllegalArgumentException( String.format("Workflow config for workflow %s does not exist!", workflowName)); } if (jobConfig == null) { throw new IllegalArgumentException( String.format("Job config for job %s does not exist!", nameSpaceJobName)); } if (taskConfig == null) { throw new IllegalArgumentException("TaskConfig is null!"); } if (taskConfig.getId() == null) { throw new HelixException("Task cannot be added or deleted because taskID is null!"); } if (jobConfig.getTargetResource() != null) { throw new HelixException(String.format( "Job %s is a targeted job. New task cannot be added/deleted to/from this job!", nameSpaceJobName)); } if ((taskConfig.getCommand() == null) == (jobConfig.getCommand() == null)) { throw new HelixException(String .format("Command must exist in either job %s or task %s, not both!", jobName, taskConfig.getId())); } }

Target:
private void validateConfigsForTaskModifications(String workflowName, String jobName, TaskConfig taskConfig) { WorkflowConfig workflowConfig = TaskUtil.getWorkflowConfig(_accessor, workflowName); String nameSpaceJobName = TaskUtil.getNamespacedJobName(workflowName, jobName); JobConfig jobConfig = TaskUtil.getJobConfig(_accessor, nameSpaceJobName); if (workflowConfig == null) { throw new IllegalArgumentException( String.format("Workflow config for workflow %s does not exist!", workflowName)); } if (jobConfig == null) { throw new IllegalArgumentException( String.format("Job config for job %s does not exist!", nameSpaceJobName)); } if (taskConfig == null) { throw new IllegalArgumentException("TaskConfig is null!"); } if (taskConfig.getId() == null) { throw new HelixException("Task cannot be added or deleted because taskID is null!"); } if (jobConfig.getTargetResource() != null) { throw new HelixException(String.format( "Job %s is a targeted job. New task cannot be added/deleted to/from this job!", nameSpaceJobName)); } if ((taskConfig.getCommand() == null) == (jobConfig.getCommand() == null)) { throw new HelixException(String .format("Command must exist in either jobconfig (%s) or taskconfig (%s), not both!", jobName, taskConfig.getId())); } }
Source:
public void setUp() throws Exception { brickPosition = 1; ifBrick = new PhiroIfLogicBeginBrick(); IfLogicElseBrick ifLogicElseBrick = new IfLogicElseBrick(ifBrick); IfLogicEndBrick ifLogicEndBrick = new IfLogicEndBrick(ifLogicElseBrick, ifBrick); ifBrick.setIfElseBrick(ifLogicElseBrick); ifBrick.setIfEndBrick(ifLogicEndBrick); script = BrickTestUtils.createProjectAndGetStartScript("PhiroIfBrickTest"); script.addBrick(ifBrick); script.addBrick(ifLogicElseBrick); script.addBrick(ifLogicEndBrick); baseActivityTestRule.launchActivity(null); }

Target:
public void setUp() throws Exception { createProject(); baseActivityTestRule.launchActivity(null); }
Source:
public DataSet map(ResultSet r, StatementContext ctx) throws SQLException { return new DataSet( r.getInt("dataSetId"), r.getString("objectId"), r.getString("name"), r.getTimestamp("createdate"), r.getInt("create_user_id"), r.getTimestamp("update_date"), r.getInt("update_user_id"), r.getBoolean("active"), r.getInt("alias")); }

Target:
public DataSet map(ResultSet r, StatementContext ctx) throws SQLException { DataSet dataset = new DataSet(); dataset.setDataSetId(r.getInt("dataSetId")); dataset.setObjectId(r.getString("objectId")); dataset.setName(r.getString("name")); if (hasColumn(r, "createdate")) { dataset.setCreateDate(r.getDate("createdate")); } if (hasColumn(r, "create_user_id")) { int userId = r.getInt("create_user_id"); if (userId > 0) { dataset.setCreateUserId(userId); } } if (hasColumn(r, "update_date")) { dataset.setUpdateDate(r.getTimestamp("update_date")); } if (hasColumn(r, "update_user_id")) { int userId = r.getInt("update_user_id"); if (userId > 0) { dataset.setUpdateUserId(userId); } } dataset.setActive(r.getBoolean("active")); dataset.setAlias(r.getInt("alias")); return dataset; }
Source:
public RequestRepresentation unclaim( UserAuthenticationToken user, @PathVariable String id, @RequestBody RequestRepresentation request) { log.info("PUT /requests/" + id + "/unclaim"); Task task = requestService.getCurrentPalgaTaskByRequestId(id); taskService.unclaim(task.getId()); requestFormService.invalidateCacheEntry(id); HistoricProcessInstance instance = requestService.getProcessInstance(id); RequestRepresentation updatedRequest = new RequestRepresentation(); requestFormService.transferData(instance, updatedRequest, user.getUser()); return updatedRequest; }

Target:
public RequestRepresentation unclaim( UserAuthenticationToken user, @PathVariable String id, @RequestBody RequestRepresentation request) { log.info("PUT /requests/" + id + "/unclaim"); HistoricProcessInstance instance = requestService.getProcessInstance(id); Task task = requestService.getCurrentPalgaTaskByRequestId(id); taskService.unclaim(task.getId()); requestFormService.invalidateCacheEntry(id); instance = requestService.getProcessInstance(id); RequestRepresentation updatedRequest = new RequestRepresentation(); requestFormService.transferData(instance, updatedRequest, user.getUser()); return updatedRequest; }
Source:
private static void copyDirectory(final File source, final File target, CommandContext ctx, ASModuleHandler handler) throws CommandLineException { try { copyDirectory(source, target); } catch (IOException ex) { Exception removalException = null; try { handler.removeModule(ctx.getParsedCommandLine(), ctx); } catch (Exception ee) { removalException = ee; } String msg = "An error occured while copying directory " + source.getAbsolutePath() + " to " + target.getAbsolutePath() + " :" + ex; if (removalException == null) { msg = "Module not added. " + msg; } else { msg = msg + ". Attempt to remove the module has failed: " + removalException; } throw new CommandLineException(msg); } }

Target:
private static void copyDirectory(final File source, final File target, CommandContext ctx, ASModuleHandler handler) throws CommandLineException { try { copyDirectory(source, target); } catch (IOException ex) { Exception removalException = null; try { handler.removeModule(ctx.getParsedCommandLine(), ctx); } catch (Exception ee) { removalException = ee; } String msg = "An error occurred while copying directory " + source.getAbsolutePath() + " to " + target.getAbsolutePath() + " :" + ex; if (removalException == null) { msg = "Module not added. " + msg; } else { msg = msg + ". Attempt to remove the module has failed: " + removalException; } throw new CommandLineException(msg); } }
Source:
private void triggerOverwriteExistingFiles() { if (overwriteExistingFilesCheckBox.isSelected()) { requestConfirmation(); } onChangeOverwriteExistingFilesCallbacks.forEach(callback -> callback.accept(overwriteExistingFilesCheckBox.isSelected())); }

Target:
private void triggerOverwriteExistingFiles() { onChangeOverwriteExistingFilesCallbacks.forEach(callback -> callback.accept(overwriteFilesField.isSelected())); }
Source:
public void testGetValueInsertFactColumn() throws Exception { final ActionInsertFactCol52 column = new ActionInsertFactCol52(); column.setFactField(FIELD_NAME); column.setFactType(FACT_TYPE); column.setValueList("a,1,1.1, ,-1"); when(oracle.getFieldType(FACT_TYPE, FIELD_NAME)).thenReturn("Integer"); String[] valueList = utilities.getValueList(column); assertEquals(2, valueList.length); assertEquals("1", valueList[0]); assertEquals("-1", valueList[1]); }

Target:
public void testGetValueInsertFactColumn() throws Exception { final ActionInsertFactCol52 column = new ActionInsertFactCol52(); column.setFactField(FIELD_NAME); column.setFactType(FACT_TYPE); column.setValueList("a,1,1.1, ,-1"); when(oracle.getFieldType(FACT_TYPE, FIELD_NAME)).thenReturn(DataType.TYPE_NUMERIC_INTEGER); String[] valueList = utilities.getValueList(column); assertEquals(2, valueList.length); assertEquals("1", valueList[0]); assertEquals("-1", valueList[1]); }
Source:
final void setIsExtendedLifeTimeToken(final boolean isExtendedLifeTimeToken) { this.mIsExtendedLifeTimeToken = isExtendedLifeTimeToken; }

Target:
final void setIsExtendedLifeTimeToken(final boolean isExtendedLifeTimeToken) { mIsExtendedLifeTimeToken = isExtendedLifeTimeToken; }
Source:
private static void generateMaterialStatistics() { for (Material material : Material.values()) { String name = material.name().toLowerCase() .replace("spade", "shovel") .replace("wood", "wooden"); if (material != GOLD_INGOT && material != GOLD_NUGGET && material != GOLD_BLOCK && material != GOLD_ORE) { name = name.replace("gold", "golden"); } if (material.isBlock()) { set(MINE_BLOCK, material, "mineBlock.minecraft." + name); } if (material.isItem()) { set(USE_ITEM, material, "useItem.minecraft." + name); set(CRAFT_ITEM, material, "craftItem.minecraft." + name); if (material.getMaxDurability() != 0) { set(BREAK_ITEM, material, "breakItem.minecraft." + name); } } set(DROP, material, "drop.minecraft." + name); set(PICKUP, material, "pickup.minecraft." + name); } }

Target:
private static void generateMaterialStatistics() { for (Material material : Material.values()) { String name = ItemIds.getKeyName(material); if (material.isBlock()) { set(MINE_BLOCK, material, "mineBlock.minecraft." + name); } if (material.isItem()) { set(USE_ITEM, material, "useItem.minecraft." + name); set(CRAFT_ITEM, material, "craftItem.minecraft." + name); if (material.getMaxDurability() != 0) { set(BREAK_ITEM, material, "breakItem.minecraft." + name); } } set(DROP, material, "drop.minecraft." + name); set(PICKUP, material, "pickup.minecraft." + name); } }
Source:
@Test public void testSortExchangeFieldTrimmerWithEmptyCollation() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("EMP") .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO")) .sortExchange(RelDistributions.hash(Lists.newArrayList(1)), RelCollations.EMPTY) .project(builder.field("EMPNO"), builder.field("ENAME")) .build(); System.out.println(Util.toLinux(RelOptUtil.toString(root))); RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder); RelNode trimmed = fieldTrimmer.trim(root); final String expected = "" + "LogicalSortExchange(distribution=[hash[1]], collation=[[]])\n" + " LogicalProject(EMPNO=[$0], ENAME=[$1])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(trimmed, hasTree(expected)); }

Target:
@Test public void testSortExchangeFieldTrimmerWithEmptyCollation() { final RelBuilder builder = RelBuilder.create(config().build()); final RelNode root = builder.scan("EMP") .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO")) .sortExchange(RelDistributions.hash(Lists.newArrayList(1)), RelCollations.EMPTY) .project(builder.field("EMPNO"), builder.field("ENAME")) .build(); RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder); RelNode trimmed = fieldTrimmer.trim(root); final String expected = "" + "LogicalSortExchange(distribution=[hash[1]], collation=[[]])\n" + " LogicalProject(EMPNO=[$0], ENAME=[$1])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(trimmed, hasTree(expected)); }
Source:
protected void addCacheHeaders(HttpServletResponse response, RequestFilterConfig config) { if (config.isCached()) { String privateOrPublic = config.isPrivate() ? "private" : "public"; response.setHeader("Cache-Control", privateOrPublic + ", max-age=" + config.getCacheTime()); long expires = System.currentTimeMillis() + Long.parseLong(config.getCacheTime()) * 1000; response.setHeader("Expires", HTTP_EXPIRES_DATE_FORMAT.format(expires)); } else if (config.isPrivate()) { response.setHeader("Cache-Control", "private, no-cache, no-store"); } }

Target:
protected void addCacheHeaders(HttpServletResponse response, RequestFilterConfig config) { if (config.isCached()) { String privateOrPublic = config.isPrivate() ? "private" : "public"; response.setHeader("Cache-Control", privateOrPublic + ", max-age=" + config.getCacheTime()); long expires = System.currentTimeMillis() + Long.parseLong(config.getCacheTime()) * 1000; response.setHeader("Expires", HTTP_EXPIRES_DATE_FORMAT.format(expires)); } else if (config.isPrivate()) { response.setHeader("Cache-Control", "private, no-cache, no-store, must-revalidate"); } }
Source:
public long getRetainedSizeInBytes() { return INSTANCE_SIZE + sizeOf(offsetVector) + sizeOf(outputPositions) + sizeOf(data) + sizeOf(nulls); }

Target:
public long getRetainedSizeInBytes() { return INSTANCE_SIZE + sizeOf(offsets) + sizeOf(outputPositions) + sizeOf(data) + sizeOf(nulls) + sizeOf(lengthVector) + sizeOf(isNullVector); }
Source:
public ScanRuntimeProvider getScanRuntimeProvider(Context runtimeProviderContext) { DeserializationSchema<RowData> deserializationSchema = getDeserializationSchema(runtimeProviderContext); FlinkKafkaConsumerBase<RowData> kafkaConsumer = getKafkaConsumer(topic, properties, deserializationSchema); return SourceFunctionProvider.of(kafkaConsumer, true); }

Target:
public ScanRuntimeProvider getScanRuntimeProvider(Context runtimeProviderContext) { DeserializationSchema<RowData> deserializationSchema = this.scanFormat.createScanFormat(runtimeProviderContext, this.outputDataType); FlinkKafkaConsumerBase<RowData> kafkaConsumer = getKafkaConsumer(topic, properties, deserializationSchema); return SourceFunctionProvider.of(kafkaConsumer, false); }
Source:
public void unregisterQuery(KieServerConnectionInfo connectionInfo, String dataSetUUID) { Client client = ClientBuilder.newClient(); WebTarget target = requestForQueryDefinition(connectionInfo, dataSetUUID, client); target.request().delete(); }

Target:
public void unregisterQuery(KieServerConnectionInfo connectionInfo, String dataSetUUID) { Client client = ClientBuilder.newClient(); WebTarget target = requestForQueryDefinition(connectionInfo, dataSetUUID, client); target.request().delete(); client.close(); }
Source:
public void testUpdate() { try { var method = VariableStepGameLoop.class.getDeclaredMethod("update", Long.class); method.setAccessible(true); method.invoke(gameLoop, 20L); Assert.assertEquals(0.01f, gameLoop.controller.getBulletPosition(), 0); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { Assert.fail("Fail to modify field access."); } }

Target:
public void testUpdate() { gameLoop.update(20L); Assert.assertEquals(0.01f, gameLoop.controller.getBulletPosition(), 0); }
Source:
private File nodeDataAsFile( List<InputEntity> nodeData ) throws IOException { File file = directory.file( "nodes.csv" ); try ( Writer writer = fileSystemRule.get().openAsWriter( file, StandardCharsets.UTF_8, false ) ) { println( writer, "id:ID,name,point:Point{WGS-84},date:Date,time:Time,dateTime:DateTime,dateTime2:DateTime,localTime:LocalTime," + "localDateTime:LocalDateTime,duration:Duration,some-labels:LABEL" ); for ( InputEntity node : nodeData ) { String csvLabels = csvLabels( node.labels() ); StringBuilder sb = new StringBuilder( node.id() + "," ); for ( int i = 0; i < node.propertyCount(); i++ ) { sb.append( node.propertyValue( i ) + "," ); } sb.append( csvLabels != null && csvLabels.length() > 0 ? csvLabels : "" ); println( writer, sb.toString() ); } } return file; }

Target:
private File nodeDataAsFile( List<InputEntity> nodeData ) throws IOException { File file = directory.file( "nodes.csv" ); try ( Writer writer = fileSystemRule.get().openAsWriter( file, StandardCharsets.UTF_8, false ) ) { println( writer, "id:ID,name,pointA:Point{crs:WGS-84},pointB:Point,date:Date,time:Time,dateTime:DateTime,dateTime2:DateTime,localTime:LocalTime," + "localDateTime:LocalDateTime,duration:Duration,some-labels:LABEL" ); for ( InputEntity node : nodeData ) { String csvLabels = csvLabels( node.labels() ); StringBuilder sb = new StringBuilder( node.id() + "," ); for ( int i = 0; i < node.propertyCount(); i++ ) { sb.append( node.propertyValue( i ) + "," ); } sb.append( csvLabels != null && csvLabels.length() > 0 ? csvLabels : "" ); println( writer, sb.toString() ); } } return file; }
Source:
public final void removeSession(String sessionId) { Iterator<Entry<String, SessionInfo>> iterator = sessionInfoList.entrySet().iterator(); while (iterator.hasNext()) { if (iterator.next().getKey().equals(sessionId)) { iterator.remove(); break; } } }

Target:
public final void removeSession(String sessionId) { Iterator<Entry<String, SessionInfo>> iterator = sessionInfoMap.entrySet().iterator(); while (iterator.hasNext()) { if (iterator.next().getKey().equals(sessionId)) { iterator.remove(); break; } } }
Source:
@Override public void lockInterruptibly() throws InterruptedException { if (hasLocked.get()) return; threadCount.incrementAndGet(); try { lock.lockInterruptibly(); } catch (InterruptedException e) { releaseGlobalLock(); throw e; } if (!holdGlobalLockInterruptibly()) { threadCount.decrementAndGet(); lock.unlock(); throw new InterruptedException(); } hasLocked.set(true); }

Target:
@Override public void lockInterruptibly() throws InterruptedException { if (reentrantCnt.get() > 0) { reentrantCnt.increment(); return; } threadCnt.incrementAndGet(); try { lock.lockInterruptibly(); } catch (InterruptedException e) { threadCnt.decrementAndGet(); throw e; } if (closed) { reentrantCnt.decrement(); lock.unlock(); throw new IllegalStateException("Can't acquire a lock after a close operation."); } try { if (!isGloballyLocked) { globalSync.acquireInterruptibly(); isGloballyLocked = true; nextFinish = MAX_TIME + System.nanoTime(); } } catch (InterruptedException e) { threadCnt.decrementAndGet(); lock.unlock(); throw e; } reentrantCnt.increment(); }
Source:
public void topNQuery(Blackhole blackhole) { query = new TopNQueryBuilder() .dataSource(DATA_SOURCE) .intervals(basicSchemaIntervalSpec) .dimension(new DefaultDimensionSpec("dimUniform", null)) .aggregators(new LongSumAggregatorFactory("sumLongSequential", "sumLongSequential")) .granularity(Granularity.fromString(queryGranularity)) .metric("sumLongSequential") .threshold(20480) .build(); final List<Result<TopNResultValue>> results = runQuery(); for (Result<TopNResultValue> result : results) { blackhole.consume(result); } }

Target:
public void topNQuery(Blackhole blackhole) { query = new TopNQueryBuilder() .dataSource(DATA_SOURCE) .intervals(basicSchemaIntervalSpec) .dimension(new DefaultDimensionSpec("dimUniform", null)) .aggregators(new LongSumAggregatorFactory("sumLongSequential", "sumLongSequential")) .granularity(Granularity.fromString(queryGranularity)) .metric("sumLongSequential") .threshold(10_000) .build(); final List<Result<TopNResultValue>> results = runQuery(); for (Result<TopNResultValue> result : results) { blackhole.consume(result); } }
Source:
public void insertMetrics( Collection<IMetric> metrics ) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.CF_METRICS_FULL_NAME ); Map<Locator, ResultSetFuture> futures = new HashMap<Locator, ResultSetFuture>(); try { for( IMetric metric : metrics ) { if (!shouldPersist(metric)) { LOG.trace("Metric shouldn't be persisted, skipping insert", metric.getLocator().toString()); continue; } Locator locator = metric.getLocator(); if( !isLocatorCurrent( locator ) ) { setLocatorCurrent( locator ); if( !DataType.isStringOrBoolean( metric.getMetricValue() ) ) locatorIO.insertLocator( locator ); } futures.put( locator, rawIO.insertAsync( metric ) ); } for( Map.Entry<Locator, ResultSetFuture> f : futures.entrySet() ) { try { ResultSet result = f.getValue().getUninterruptibly(); LOG.trace( "result.size=" + result.all().size() ); } catch ( Exception e ) { Instrumentation.markWriteError(); LOG.error(String.format("error writing metric for locator %s", f.getKey()), e ); } } } finally { ctx.close(); } }

Target:
public void insertMetrics( Collection<IMetric> metrics ) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.CF_METRICS_FULL_NAME ); Map<Locator, ResultSetFuture> futures = new HashMap<Locator, ResultSetFuture>(); try { for( IMetric metric : metrics ) { if (!shouldPersist(metric)) { LOG.trace( String.format( "Metric %s shouldn't be persisted, skipping insert", metric.getLocator().toString() ) ); continue; } Locator locator = metric.getLocator(); if( !isLocatorCurrent( locator ) ) { setLocatorCurrent( locator ); if( !DataType.isStringOrBoolean( metric.getMetricValue() ) ) locatorIO.insertLocator( locator ); } futures.put( locator, rawIO.insertAsync( metric ) ); } for( Map.Entry<Locator, ResultSetFuture> f : futures.entrySet() ) { try { ResultSet result = f.getValue().getUninterruptibly(); LOG.trace( "result.size=" + result.all().size() ); Instrumentation.markFullResMetricWritten(); } catch ( Exception e ) { Instrumentation.markWriteError(); LOG.error(String.format("error writing metric for locator %s", f.getKey()), e ); } } } finally { ctx.stop(); } }
Source:
public <T> List<T> getItems(Class<T> type) { List<T> r = new ArrayList<>(); for (TopLevelItem i : getItems(type::isInstance)) r.add(type.cast(i)); return r; }

Target:
public <T> List<T> getItems(Class<T> type) { List<T> r = new ArrayList<>(); for (TopLevelItem i : getItems(type::isInstance)) { r.add(type.cast(i)); } return r; }
Source:
public List<UserDetailDto> getUsersByProjectUUID(final String projectUUID) { final List<UserDetailDto> result = new ArrayList<>(); final ModelMapper mapper = UserMapper.getInstance(); final List<UserDto> users = this.workbenchDataManager.getUsersByProjectUUID(projectUUID); for (final UserDto userDto : users) { final UserDetailDto userInfo = mapper.map(userDto, UserDetailDto.class); result.add(userInfo); } return result; }

Target:
public List<UserDetailDto> getUsersByProjectUUID(final String projectUUID) { final List<UserDetailDto> result = new ArrayList<>(); final ModelMapper mapper = UserMapper.getInstance(); Preconditions.checkNotNull(projectUUID, "The projectUUID must not be empty"); try { List<UserDto> users = this.workbenchDataManager.getUsersByProjectUuid(projectUUID); Preconditions.checkArgument(!users.isEmpty(), "don't exists users for this projectUUID"); for (final UserDto userDto : users) { final UserDetailDto userInfo = mapper.map(userDto, UserDetailDto.class); result.add(userInfo); } } catch (MiddlewareQueryException e) { LOG.info("Error on workbenchDataManager.getUsersByProjectUuid", e); Preconditions.checkState(false, "An internal error occurred while trying to get the users"); } return result; }
Source:
public void removeDeviceModel(@Identification final String organisationIdentification, @Valid final String manufacturer, final String modelCode) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.REMOVE_DEVICE_MODELS); final Manufacturer dbManufacturer = this.manufacturerRepository.findByManufacturerId(manufacturer); final DeviceModel removedDeviceModel = this.deviceModelRepository.findByManufacturerIdAndModelCode(dbManufacturer, modelCode); if (removedDeviceModel == null) { LOGGER.info("DeviceModel not found."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICEMODEL, ComponentType.WS_CORE, new ExistingEntityException(Manufacturer.class, modelCode)); } else { this.deviceModelRepository.delete(removedDeviceModel); } }

Target:
public void removeDeviceModel(@Identification final String organisationIdentification, @Valid final String manufacturer, final String modelCode) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.REMOVE_DEVICE_MODELS); final Manufacturer dataseManufacturer = this.manufacturerRepository.findByManufacturerId(manufacturer); final DeviceModel removedDeviceModel = this.deviceModelRepository.findByManufacturerIdAndModelCode(dataseManufacturer, modelCode); if (removedDeviceModel == null) { LOGGER.info("DeviceModel not found."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICEMODEL, ComponentType.WS_CORE, new ExistingEntityException(Manufacturer.class, modelCode)); } else { this.deviceModelRepository.delete(removedDeviceModel); } }
Source:
public void testMakeCellRenderContextOneRow() { final double headerRowsHeight = 100.0; final BaseGridRow row = new BaseGridRow(); final List<GridColumn<?>> allColumns = new ArrayList<>(); final List<Double> allRowHeights = new ArrayList<>(Collections.singletonList(row.getHeight())); final GridColumn<?> uiColumn1 = mockGridColumn(25.0); final GridColumn<?> uiColumn2 = mockGridColumn(60.0); final GridColumn<?> uiColumn3 = mockGridColumn(100.0); allColumns.add(uiColumn1); allColumns.add(uiColumn2); allColumns.add(uiColumn3); gridWidget.getModel().appendRow(row); doReturn(allColumns).when(ri).getAllColumns(); doReturn(headerRowsHeight).when(ri).getHeaderRowsHeight(); doReturn(allRowHeights).when(ri).getAllRowHeights(); doReturn(uiColumn2).when(ci).getColumn(); doReturn(25.0).when(ci).getOffsetX(); doReturn(1).when(ci).getUiColumnIndex(); final GridBodyCellEditContext context = CellContextUtilities.makeCellRenderContext(gridWidget, ri, ci, 0); assertNotNull(context); assertThat(context.getAbsoluteCellX()) .as("Should be column offset") .isEqualTo(25.0); assertThat(context.getAbsoluteCellY()) .as("Should be headers height") .isEqualTo(headerRowsHeight); }

Target:
public void testMakeCellRenderContextOneRow() { final double headerRowsHeight = 100.0; final BaseGridRow row = new BaseGridRow(); final List<GridColumn<?>> allColumns = new ArrayList<>(); final List<Double> allRowHeights = Collections.singletonList(row.getHeight()); final GridColumn<?> uiColumn1 = mockGridColumn(25.0); final GridColumn<?> uiColumn2 = mockGridColumn(60.0); final GridColumn<?> uiColumn3 = mockGridColumn(100.0); allColumns.add(uiColumn1); allColumns.add(uiColumn2); allColumns.add(uiColumn3); gridWidget.getModel().appendRow(row); doReturn(allColumns).when(ri).getAllColumns(); doReturn(headerRowsHeight).when(ri).getHeaderRowsHeight(); doReturn(allRowHeights).when(ri).getAllRowHeights(); doReturn(uiColumn2).when(ci).getColumn(); doReturn(25.0).when(ci).getOffsetX(); doReturn(1).when(ci).getUiColumnIndex(); final GridBodyCellEditContext context = CellContextUtilities.makeCellRenderContext(gridWidget, ri, ci, 0); assertNotNull(context); assertThat(context.getAbsoluteCellX()) .as("Should be column offset") .isEqualTo(25.0); assertThat(context.getAbsoluteCellY()) .as("Should be headers height") .isEqualTo(headerRowsHeight); }
Source:
protected void executeCommand() { if (!oldNumaNodeIds.isEmpty()) { getVmNumaNodeDao().massRemoveNumaNodeByNumaNodeId(oldNumaNodeIds); } List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); Guid vdsId = getVm().getDedicatedVmForVdsList().get(0); List<VdsNumaNode> vdsNumaNodes = new ArrayList<>(); if (vdsId != null) { vdsNumaNodes = getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vdsId); } List<VmNumaNode> nodes = new ArrayList<>(); for (VmNumaNode vmNumaNode : vmNumaNodes) { vmNumaNode.setId(Guid.newGuid()); for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { if (pair.getSecond() != null && pair.getSecond().getSecond() != null) { int index = pair.getSecond().getSecond(); if (pair.getSecond().getFirst()) { for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { pair.setFirst(vdsNumaNode.getId()); break; } } } } } nodes.add(vmNumaNode); } getVmNumaNodeDao().massSaveNumaNode(nodes, null, getVm().getId()); setSucceeded(true); }

Target:
protected void executeCommand() { if (!oldNumaNodeIds.isEmpty()) { getVmNumaNodeDao().massRemoveNumaNodeByNumaNodeId(oldNumaNodeIds); } List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); List<VdsNumaNode> vdsNumaNodes = getVdsNumaNodes(); List<VmNumaNode> nodes = new ArrayList<>(); for (VmNumaNode vmNumaNode : vmNumaNodes) { vmNumaNode.setId(Guid.newGuid()); for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { if (pair.getSecond() != null && pair.getSecond().getSecond() != null) { int index = pair.getSecond().getSecond(); if (pair.getSecond().getFirst()) { for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { pair.setFirst(vdsNumaNode.getId()); break; } } } } } nodes.add(vmNumaNode); } getVmNumaNodeDao().massSaveNumaNode(nodes, null, getVm().getId()); setSucceeded(true); }
Source:
public static ValidationResult setAndValidateCpuProfileForUser(VmBase vmBase, Version version, Guid userId) { if (!FeatureSupported.cpuQoS(version)) { return ValidationResult.VALID; } if (vmBase.getCpuProfileId() == null) { return assignAnyCpuProfile(vmBase); } Optional<CpuProfile> chosenCpuProfileWithPermissions = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId(), userId, true).stream() .filter( cp -> cp.getId().equals(vmBase.getCpuProfileId()) ).findFirst(); if (chosenCpuProfileWithPermissions.isPresent()) { vmBase.setCpuProfileId(chosenCpuProfileWithPermissions.get().getId()); return ValidationResult.VALID; } CpuProfile chosenCpuProfile = getCpuProfileDao().get(vmBase.getCpuProfileId()); if(chosenCpuProfile == null) { return new ValidationResult(EngineMessage.ACTION_TYPE_NO_CPU_PROFILE_WITH_THAT_ID, String.format("$cpuProfileId %s", vmBase.getCpuProfileId())); } return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, String.format("$cpuProfileId %s", vmBase.getCpuProfileId()), String.format("$cpuProfileName %s", chosenCpuProfile.getName())); }

Target:
public static ValidationResult setAndValidateCpuProfileForUser(VmBase vmBase, Version version, Guid userId) { if (!FeatureSupported.cpuQoS(version)) { return ValidationResult.VALID; } if (vmBase.getCpuProfileId() == null) { return assignFirstCpuProfile(vmBase); } Optional<CpuProfile> authorizedCpuProfile = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId(), userId, true).stream() .filter( cp -> cp.getId().equals(vmBase.getCpuProfileId()) ).findFirst(); if (authorizedCpuProfile.isPresent()) { vmBase.setCpuProfileId(authorizedCpuProfile.get().getId()); return ValidationResult.VALID; } CpuProfile chosenCpuProfile = getCpuProfileDao().get(vmBase.getCpuProfileId()); if(chosenCpuProfile == null) { return new ValidationResult(EngineMessage.ACTION_TYPE_NO_CPU_PROFILE_WITH_THAT_ID, String.format("$cpuProfileId %s", vmBase.getCpuProfileId())); } return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, String.format("$cpuProfileId %s", vmBase.getCpuProfileId()), String.format("$cpuProfileName %s", chosenCpuProfile.getName())); }
Source:
@Override public void savepoint(String name, boolean overwrite) throws IllegalArgumentException { if (implicit()) throw new IllegalStateException("Savepoints must be used inside explicit transactions."); enter(); try { tx.savepoint(name, overwrite); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { leave(); } }

Target:
@Override public void savepoint(String name, boolean overwrite) throws IllegalArgumentException { if (implicit()) throw new IllegalStateException("Savepoints can be used only inside explicit transactions."); if (name == null) throw new IllegalArgumentException("Savepoint name can't be null."); enter(); try { cctx.savepoint(tx, name, overwrite); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { leave(); } }
Source:
public String getValue(int id) { if (id < 0) { throw new IllegalArgumentException("id must be greater than or equal to 0"); } String retVal; final long start = Instant.now().getMillis(); do { retVal = falseIdsReverse.get(id); if(Instant.now().isAfter(start + MAXIMUM_FACTS_RETRY_TIME)){ throw Throwables.propagate(new TimeoutException("Timeout waiting for falseIds to populate")); } } while (null == retVal); return retVal; }

Target:
public String getValue(int id) { if (isClosed.get()) { return null; } Preconditions.checkArgument(id >= 0, "id must be greater than or equal to 0"); return falseIdsReverse.get(id); }
Source:
public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { Browser browser = new Browser(shell, SWT.NONE); browser.dispose(); browser = new Browser(shell, SWT.BORDER); browser.dispose(); browser = new Browser(null, SWT.NONE); fail("No exception thrown for parent == null"); }

Target:
public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { Browser browser = new Browser(shell, SWT.NONE); browser.dispose(); browser = new Browser(shell, SWT.BORDER); browser.dispose(); browser = new Browser(null, SWT.NONE); }
Source:
public CpuUsageXYViewer(Composite parent) { super(parent, Messages.CpuUsageXYViewer_Title, Messages.CpuUsageXYViewer_TimeXAxis, Messages.CpuUsageXYViewer_CpuYAxis); setResolution(RESOLUTION); getSwtChart().getTitle().setVisible(true); getSwtChart().getLegend().setVisible(false); }

Target:
public CpuUsageXYViewer(Composite parent) { super(parent, Messages.CpuUsageXYViewer_Title, Messages.CpuUsageXYViewer_TimeXAxis, Messages.CpuUsageXYViewer_CpuYAxis); setResolution(RESOLUTION); getSwtChart().getTitle().setVisible(false); getSwtChart().getLegend().setVisible(false); }
Source:
DecisionTableColumnPlugin findPluginByIdentifier(final String selectedItemText) { for (DecisionTableColumnPlugin plugin : this.pluginManagedInstance) { if (plugin.getIdentifier().equals(selectedItemText)) { return plugin; } } throw new UnsupportedOperationException("The plugin " + selectedItemText + " does not have an implementation."); }

Target:
DecisionTableColumnPlugin findPluginByIdentifier(final String selectedItemText) { for (DecisionTableColumnPlugin plugin : plugins()) { if (plugin.getIdentifier().equals(selectedItemText)) { return plugin; } } throw new UnsupportedOperationException("The plugin " + selectedItemText + " does not have an implementation."); }
Source:
public ImageSearchPage(final ImageSearchModel model) { super("ImageSearchPage", WizardMessages.getString("ImageSearchPage.title"), SWTImagesFactory.DESC_BANNER_REPOSITORY); setMessage(WizardMessages.getString("ImageSearchPage.title")); setPageComplete(true); this.model = model; }

Target:
public ImageSearchPage(final ImageSearchModel model) { super("ImageSearchPage", WizardMessages.getString("ImageSearchPage.title"), SWTImagesFactory.DESC_BANNER_REPOSITORY); setMessage(WizardMessages.getString("ImageSearchPage.title")); this.model = model; }
Source:
public String getNextPageToken() { if (hasNext) { return PaginationToken.pageMetadataToTokenString(nextPageMetadata); } return null; }

Target:
public String getNextPageToken() { if (hasNext) { return PaginationToken.tokenize(nextPageMetadata); } return null; }
Source:
private IServer getOpenShiftServer(final IResourceUIModel selectedResourceModel) { if (selectedResourceModel == null) { return null; } IResource resource = selectedResourceModel.getResource(); if (resource instanceof IService) { final IService selectedService = (IService) resource; final Connection connection = ConnectionsRegistryUtil.safeGetConnectionFor(selectedService); return openOrCreateServerAdapter(selectedService, null, connection); } else if (resource instanceof IRoute) { final IRoute selectedRoute = (IRoute) resource; final IService relatedService = (IService) selectedRoute.getProject().getResources(ResourceKind.SERVICE).stream() .filter(s -> ResourceFilters.areRelated(selectedRoute, (IService) s)).findFirst() .orElseGet(() -> null); if(relatedService != null) { final Connection connection = ConnectionsRegistryUtil.safeGetConnectionFor(selectedRoute); return openOrCreateServerAdapter(relatedService, selectedRoute, connection); } else { OpenShiftUIActivator.getDefault().getLogger().logWarning("Unable to locate the service '" + selectedRoute.getServiceName() + "' from route '" + selectedRoute.getName() + "'"); } } return null; }

Target:
private IServer getOpenShiftServer(final IResourceUIModel selectedResourceModel) { if (selectedResourceModel == null) { return null; } IResource resource = selectedResourceModel.getResource(); if (resource instanceof IService) { final IService selectedService = (IService) resource; final Connection connection = ConnectionsRegistryUtil.safeGetConnectionFor(selectedService); return openOrCreateServerAdapter(selectedService, null, connection); } else if (resource instanceof IRoute) { final IRoute selectedRoute = (IRoute) resource; final IService relatedService = (IService) selectedRoute.getProject().getResources(ResourceKind.SERVICE).stream() .filter(s -> ResourceUtils.areRelated(selectedRoute, (IService) s)) .findFirst() .orElseGet(() -> null); if(relatedService != null) { final Connection connection = ConnectionsRegistryUtil.safeGetConnectionFor(selectedRoute); return openOrCreateServerAdapter(relatedService, selectedRoute, connection); } else { OpenShiftUIActivator.getDefault().getLogger().logWarning("Unable to locate the service '" + selectedRoute.getServiceName() + "' from route '" + selectedRoute.getName() + "'"); } } return null; }
Source:
public void cleanUp() { assertEquals(true, ((PersonalComputerDatabaseStorage)propertyManager.permanentStore).obliterateStorage()); }

Target:
public void cleanUp() { assertEquals(true, ((OffRobotDatabaseStorage)propertyManager.permanentStore).obliterateStorage()); }
Source:
public static Block serializeObject(Type type, BlockBuilder builder, Object object) { if (ROW.equals(type.getTypeSignature().getBase())) { return serializeStruct(type, builder, object); } if (MAP.equals(type.getTypeSignature().getBase()) || ARRAY.equals(type.getTypeSignature().getBase())) { throw new IllegalArgumentException("Type not supported: " + type.getDisplayName()); } serializePrimitive(type, builder, object); return null; }

Target:
public static Block serializeObject(Type type, BlockBuilder builder, Object object) { if (ROW.equals(type.getTypeSignature().getBase())) { return serializeStruct(type, builder, object); } if (MAP.equals(type.getTypeSignature().getBase()) || ARRAY.equals(type.getTypeSignature().getBase())) { throw new IllegalArgumentException("Type not supported: " + type.getDisplayName()); } return serializePrimitive(type, builder, object); }
Source:
public void syntheticEventInvokedAndReturningSourceTest() { assertTrue(extension.timesInvoked() == 3); Map<Type, Extension> map = extension.getSources(); assertTrue(map.get(Peach.class) instanceof ProcessSyntheticObserverMethodObserver); assertTrue(map.get(Banana.class) instanceof ProcessSyntheticObserverMethodObserver); assertTrue(map.get(Melon.class) instanceof ProcessSyntheticObserverMethodObserver); }

Target:
public void syntheticEventInvokedAndReturningSourceTest() { assertEquals(extension.timesInvoked(), new Integer(3)); Map<Type, Extension> map = extension.getSources(); assertEquals(map.get(Peach.class).getClass(), ProcessSyntheticObserverMethodObserver.class); assertEquals(map.get(Banana.class).getClass(), ProcessSyntheticObserverMethodObserver.class); assertEquals(map.get(Melon.class).getClass(), ProcessSyntheticObserverMethodObserver.class); }
Source:
public String invoke(String id) { String interceptorInvocationCounterKey = id + "-COUNT"; log.info("Test Invoked"); String clientInterceptor = wasClientInterceptorInvoked(); log.info(String.format("clientInterceptorInvoked: %b %s", (clientInterceptor!=null), clientInterceptor)); context.getContextData().put("ClientInterceptorInvoked", clientInterceptor); return "" + context.getContextData().get(interceptorInvocationCounterKey); }

Target:
public int invoke(String id) { String interceptorInvocationCounterKey = id + "-COUNT"; String clientInterceptor = wasClientInterceptorInvoked(); context.getContextData().put("ClientInterceptorInvoked", clientInterceptor); return (Integer) context.getContextData().get(interceptorInvocationCounterKey); }
Source:
public AnnotationProcessorValidationTarget resolveValidationTarget(ExecutableElement element, AnnotationMirror annotation) { Set<AnnotationProcessorValidationTarget> allowedTargets = getSupportedValidationTargets( annotation.getAnnotationType() ); assert allowedTargets.size()>0; if(allowedTargets.size()==1) { return allowedTargets.toArray( new AnnotationProcessorValidationTarget[1] )[0]; } AnnotationProcessorConstraintTarget constrTarget = getConstraintTarget( annotation ); if(constrTarget==null) { return null; } switch(constrTarget) { case PARAMETERS: return AnnotationProcessorValidationTarget.PARAMETERS; case RETURN_VALUE: return AnnotationProcessorValidationTarget.ANNOTATED_ELEMENT; case IMPLICIT: default: return resolveImplicitValidationTarget( element ); } }

Target:
public AnnotationProcessorValidationTarget resolveValidationTarget(ExecutableElement element, AnnotationMirror annotation) { Set<AnnotationProcessorValidationTarget> allowedTargets = getSupportedValidationTargets( annotation.getAnnotationType() ); if(allowedTargets.size()==1) { return allowedTargets.toArray( new AnnotationProcessorValidationTarget[1] )[0]; } AnnotationProcessorConstraintTarget constrTarget = getConstraintTarget( annotation ); if(constrTarget==null) { return null; } switch(constrTarget) { case PARAMETERS: return AnnotationProcessorValidationTarget.PARAMETERS; case RETURN_VALUE: return AnnotationProcessorValidationTarget.ANNOTATED_ELEMENT; case IMPLICIT: default: return resolveImplicitValidationTarget( element ); } }