auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOException { rpcServer.checkOperation(NameNode.OperationCategory.READ); final List<RemoteLocation> locations = rpcServer.getLocationsForPath(snapshotRoot, true, false); RemoteMethod remoteMethod = new RemoteMethod("getSnapshotListing", new Class<?>[]{String.class}, new RemoteParam()); if (rpcServer.isInvokeConcurrent(snapshotRoot)) { Map<RemoteLocation, SnapshotStatus[]> ret = rpcClient.invokeConcurrent( locations, remoteMethod, true, false, SnapshotStatus[].class); return ret.values().iterator().next(); } else { return rpcClient.invokeSequential( locations, remoteMethod, SnapshotStatus[].class, null); } }

Target:
public SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOException { rpcServer.checkOperation(NameNode.OperationCategory.READ); final List<RemoteLocation> locations = rpcServer.getLocationsForPath(snapshotRoot, true, false); RemoteMethod remoteMethod = new RemoteMethod("getSnapshotListing", new Class<?>[]{String.class}, new RemoteParam()); SnapshotStatus[] response; if (rpcServer.isInvokeConcurrent(snapshotRoot)) { Map<RemoteLocation, SnapshotStatus[]> ret = rpcClient.invokeConcurrent( locations, remoteMethod, true, false, SnapshotStatus[].class); response = ret.values().iterator().next(); String src = ret.keySet().iterator().next().getSrc(); String dst = ret.keySet().iterator().next().getDest(); for (SnapshotStatus s : response) { String mountPath = DFSUtil.bytes2String(s.getParentFullPath()). replaceFirst(src, dst); s.setParentFullPath(DFSUtil.string2Bytes(mountPath)); } } else { response = rpcClient.invokeSequential( locations, remoteMethod, SnapshotStatus[].class, null); RemoteLocation loc = locations.get(0); for (SnapshotStatus s : response) { String mountPath = DFSUtil.bytes2String(s.getParentFullPath()). replaceFirst(loc.getDest(), loc.getSrc()); s.setParentFullPath(DFSUtil.string2Bytes(mountPath)); } } return response; }
Source:
public static void check(Configuration cfg, List<String> subFilesList) throws Exception { File indexRoot = new File(cfg.getDataRoot(), IndexDatabase.INDEX_DIR); if (subFilesList.size() > 0) { for (String projectName : subFilesList) { checkDir(getDirectory(new File(indexRoot, projectName))); } } else { if (cfg.isProjectsEnabled()) { for (String projectName : cfg.getProjects().keySet()) { checkDir(getDirectory(new File(indexRoot, projectName))); } } else { checkDir(getDirectory(indexRoot)); } } }

Target:
public static void check(Configuration cfg, List<String> subFilesList) throws Exception { File indexRoot = new File(cfg.getDataRoot(), IndexDatabase.INDEX_DIR); if (!subFilesList.isEmpty()) { for (String projectName : subFilesList) { checkDir(getDirectory(new File(indexRoot, projectName))); } } else { if (cfg.isProjectsEnabled()) { for (String projectName : cfg.getProjects().keySet()) { checkDir(getDirectory(new File(indexRoot, projectName))); } } else { checkDir(getDirectory(indexRoot)); } } }
Source:
public boolean acquire(String lock) { if (this.template.update(this.updateQuery, new Date(), this.region, lock, this.id, new Date(System.currentTimeMillis() - this.ttl)) > 0) { return true; } try { return this.template.update(this.insertQuery, this.region, lock, this.id, new Date()) > 0; } catch (DuplicateKeyException e) { return false; } }

Target:
public boolean acquire(String lock) { if (this.template.update(this.updateQuery, this.id, new Date(), this.region, lock, this.id, new Date(System.currentTimeMillis() - this.ttl)) > 0) { return true; } try { return this.template.update(this.insertQuery, this.region, lock, this.id, new Date()) > 0; } catch (DuplicateKeyException e) { return false; } }
Source:
public void testAddPrefixToDs3ObjectsList() throws IOException, SignatureException { final List<Ds3Object> ds3ObjectList = Lists.newArrayList(new Ds3Object("foo"), new Ds3Object("bar")); final Ds3ClientHelpers helper = Ds3ClientHelpers.wrap(buildDs3ClientForBulk()); final Iterable<Ds3Object> modifiedDs3ObjectList = helper.addPrefixToDs3ObjectsList(ds3ObjectList, "baz/"); boolean foundBazFoo = false; boolean foundBazBar = false; for (Ds3Object obj : modifiedDs3ObjectList) { if (obj.getName().equals("baz/foo")) { foundBazFoo = true; } else if (obj.getName().equals("baz/bar")) { foundBazBar = true; } } assertTrue(foundBazFoo); assertTrue(foundBazBar); }

Target:
public void testAddPrefixToDs3ObjectsList() throws IOException, SignatureException { final List<Ds3Object> ds3ObjectList = Lists.newArrayList(new Ds3Object("foo"), new Ds3Object("bar")); final Ds3ClientHelpers helper = Ds3ClientHelpers.wrap(buildDs3ClientForBulk()); final Iterable<Ds3Object> modifiedDs3ObjectList = helper.addPrefixToDs3ObjectsList(ds3ObjectList, "baz/"); boolean foundBazFoo = false; boolean foundBazBar = false; for (final Ds3Object obj : modifiedDs3ObjectList) { if (obj.getName().equals("baz/foo")) { foundBazFoo = true; } else if (obj.getName().equals("baz/bar")) { foundBazBar = true; } } assertTrue(foundBazFoo); assertTrue(foundBazBar); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_health_thermometer, container, false); mEditTextTemperatureMeasurement = (EditText) view .findViewById(R.id.editText_temperatureMeasurementValue); mEditTextTemperatureMeasurement .setOnEditorActionListener(mOnEditorActionListenerTemperatureMeasurement); mEditTextMeasurementInterval = (EditText) view .findViewById(R.id.editText_measurementIntervalValue); mEditTextMeasurementInterval .setOnEditorActionListener(mOnEditorActionListenerMeasurementInterval); setDefaultMeasurementValues(INITIAL_TEMPERATURE_MEASUREMENT_VALUE, INITIAL_MEASUREMENT_INTERVAL); setTimer(INITIAL_MEASUREMENT_INTERVAL); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_health_thermometer, container, false); mEditTextTemperatureMeasurement = (EditText) view .findViewById(R.id.editText_temperatureMeasurementValue); mEditTextTemperatureMeasurement .setOnEditorActionListener(mOnEditorActionListenerTemperatureMeasurement); mEditTextMeasurementInterval = (EditText) view .findViewById(R.id.editText_measurementIntervalValue); mEditTextMeasurementInterval .setOnEditorActionListener(mOnEditorActionListenerMeasurementInterval); mEditTextTemperatureMeasurement.setText(Float.toString(INITIAL_TEMPERATURE_MEASUREMENT_VALUE)); setTemperatureMeasurementValue(INITIAL_TEMPERATURE_MEASUREMENT_VALUE); mMeasurementIntervalCharacteristic.setValue(INITIAL_MEASUREMENT_INTERVAL, MEASUREMENT_INTERVAL_FORMAT, 0); mEditTextMeasurementInterval.setText(Integer.toString(INITIAL_MEASUREMENT_INTERVAL)); mTextViewNotifications = (TextView) view.findViewById(R.id.textView_notifications); mTextViewNotifications.setText(R.string.notificationsNotEnabled); return view; }
Source:
protected boolean isReasoningAvailable(){ try { TBoxReasonerStatus status = ApplicationUtils.instance().getTBoxReasonerModule().getStatus(); return status.isConsistent() && !status.isInErrorState(); } catch (IllegalStateException e) { log.debug("Status of reasoner could not be determined.", e); return false; } }

Target:
protected boolean isReasoningAvailable(){ try { TBoxReasonerStatus status = ApplicationUtils.instance().getTBoxReasonerModule().getStatus(); return status.isConsistent() && !status.isInErrorState(); } catch (IllegalStateException e) { log.debug("Status of reasoner could not be determined. It is likely disabled.", e); return false; } }
Source:
public Response execute(ElasticsearchRequest request) throws IOException { Gson gson = gsonProvider.getGson(); HttpEntity entity = ElasticsearchClientUtils.toEntity( gson, request ); long start = System.currentTimeMillis(); try { return restClient.performRequest( request.getMethod(), request.getPath(), request.getParameters(), entity ); } catch (ResponseException e) { return e.getResponse(); } finally { long executionTime = System.currentTimeMillis() - start; requestLog.executedRequest( request.getPath(), request.getParameters(), executionTime ); } }

Target:
public Response execute(ElasticsearchRequest request) throws IOException { Gson gson = gsonProvider.getGson(); HttpEntity entity = ElasticsearchClientUtils.toEntity( gson, request ); long start = System.nanoTime(); try { return restClient.performRequest( request.getMethod(), request.getPath(), request.getParameters(), entity ); } catch (ResponseException e) { return e.getResponse(); } finally { long executionTime = System.nanoTime() - start; requestLog.executedRequest( request.getPath(), request.getParameters(), TimeUnit.NANOSECONDS.toMillis( executionTime ) ); } }
Source:
public boolean hasEntity(StudentProfileAttributes attributes) { if (getEntityQueryKeys(attributes).first().now() != null) { return true; } return getEntityQueryKeysForLegacyData(attributes).first().now() != null; }

Target:
public boolean hasEntity(StudentProfileAttributes attributes) { if (getEntityQueryKeys(attributes).first().now() == null) { return getEntityQueryKeysForLegacyData(attributes).first().now() != null; } return true; }
Source:
public static <T> T instanceFromClass(Class<T> targetSuperType, Class<?> classToLoad, String componentDescription) { checkClassType( classToLoad, componentDescription ); final Constructor<?> constructor = getNoArgConstructor( classToLoad, componentDescription ); final Object instance = untypedInstanceFromClass( classToLoad, componentDescription ); return verifySuperTypeCompatibility( targetSuperType, instance, classToLoad, componentDescription ); }

Target:
public static <T> T instanceFromClass(Class<T> targetSuperType, Class<?> classToLoad, String componentDescription) { checkClassType( classToLoad, componentDescription ); final Object instance = untypedInstanceFromClass( classToLoad, componentDescription ); return verifySuperTypeCompatibility( targetSuperType, instance, classToLoad, componentDescription ); }
Source:
TapTargetBase(LinearLayout tapTargetView, View fadeView, WelcomeActivity activity, int bottomBarResourceId) { this.targetView = tapTargetView; this.fadeView = fadeView; this.activity = activity; this.context = activity.getBaseContext(); final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); this.radius = calculateTapTargetRadius(targetView.getHeight(), metrics, RADIUS_OFFSET); bottomBarView = activity.findViewById(bottomBarResourceId); bottomScrollBar = bottomBarView.findViewById(R.id.pocketpaint_intro_bottom_bar_scroll_view); }

Target:
TapTargetBase(LinearLayout tapTargetView, View fadeView, WelcomeActivity activity, int bottomBarResourceId) { this.targetView = tapTargetView; this.fadeView = fadeView; this.activity = activity; this.context = activity.getBaseContext(); final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); this.radius = calculateTapTargetRadius(targetView.getHeight(), metrics, RADIUS_OFFSET); bottomBarView = activity.findViewById(bottomBarResourceId); bottomScrollBar = (BottomBarHorizontalScrollView) bottomBarView.findViewById(R.id.pocketpaint_intro_bottom_bar_scroll_view); }
Source:
public Map<String, Collection<String>> toMap() { Map<String, Collection<String>> params = new HashMap<String, Collection<String>>(); if (null != name) { ArrayList<String> valueList = new ArrayList<String>(); valueList.add(name); params.put("name", valueList); } if (null != resolution) { ArrayList<String> valueList = new ArrayList<String>(); valueList.add(resolution); params.put("resolution", valueList); } ArrayList<String> valueList = new ArrayList<String>(); valueList.add(Boolean.toString(hasAudio)); params.put("hasAudio", valueList); valueList = new ArrayList<String>(); valueList.add(Boolean.toString(hasVideo)); params.put("hasVideo", valueList); valueList = new ArrayList<String>(); valueList.add(outputMode.toString()); params.put("outputMode", valueList); valueList = new ArrayList<String>(); valueList.add(layout.toString()); params.put("layout", valueList); return params; }

Target:
public Map<String, Collection<String>> toMap() { Map<String, Collection<String>> params = new HashMap<String, Collection<String>>(); if (name != null) { ArrayList<String> valueList = new ArrayList<String>(); valueList.add(name); params.put("name", valueList); } if (resolution != null) { ArrayList<String> valueList = new ArrayList<String>(); valueList.add(resolution); params.put("resolution", valueList); } ArrayList<String> valueList = new ArrayList<String>(); valueList.add(Boolean.toString(hasAudio)); params.put("hasAudio", valueList); valueList = new ArrayList<String>(); valueList.add(Boolean.toString(hasVideo)); params.put("hasVideo", valueList); valueList = new ArrayList<String>(); valueList.add(outputMode.toString()); params.put("outputMode", valueList); valueList = new ArrayList<String>(); valueList.add(layout.toString()); params.put("layout", valueList); return params; }
Source:
public PlanNodeCostEstimate visitSpatialJoin(SpatialJoinNode node, Void context) { return calculateJoinCost( node, node.getLeft(), node.getRight(), Objects.equals(node.getDistributionType(), SpatialJoinNode.DistributionType.REPLICATED)); }

Target:
public PlanNodeCostEstimate visitSpatialJoin(SpatialJoinNode node, Void context) { return calculateJoinCost( node, node.getLeft(), node.getRight(), node.getDistributionType() == SpatialJoinNode.DistributionType.REPLICATED); }
Source:
private void validateName(Task task) { Long taskId = task.getId(); int tasksWithName = tasksDataService.findTasksByName(task.getName()).size(); if(taskId == null && tasksWithName > 0) { LOGGER.warn("Task with name: already exists", task.getName()); throw new TaskNameAlreadyExistsException(task.getName()); } else if (taskId != null && tasksWithName > 0) { if(!(tasksDataService.findTasksByName(task.getName()).get(0).getId().equals(taskId))) { LOGGER.warn("Task with name: already exists", task.getName()); throw new TaskNameAlreadyExistsException(task.getName()); } } }

Target:
private void validateName(Task task) { Long taskId = task.getId(); List<Task> tasksWithName = tasksDataService.findTasksByName(task.getName()); if(taskId == null && tasksWithName.size() > 0) { throw new TaskNameAlreadyExistsException(task.getName()); } else if (taskId != null && tasksWithName.size() > 0 && !tasksWithName.get(0).getId().equals(taskId)) { throw new TaskNameAlreadyExistsException(task.getName()); } }
Source:
protected byte[] idSubmodule(File directory, Entry e) { final String gitDirPath = e.getName() + "/" + Constants.DOT_GIT; final File submoduleGitDir = new File(directory, gitDirPath); if (!submoduleGitDir.isDirectory()) return zeroid; final Repository submoduleRepo; try { FS fs = repository != null ? repository.getFS() : FS.DETECTED; submoduleRepo = new RepositoryBuilder().setGitDir(submoduleGitDir) .setMustExist(true).setFS(fs).setMustExist(true).build(); } catch (IOException exception) { return zeroid; } final ObjectId head; try { head = submoduleRepo.resolve(Constants.HEAD); } catch (IOException exception) { return zeroid; } finally { submoduleRepo.close(); } if (head == null) return zeroid; final byte[] id = new byte[Constants.OBJECT_ID_LENGTH]; head.copyRawTo(id, 0); return id; }

Target:
protected byte[] idSubmodule(File directory, Entry e) { final String gitDirPath = e.getName() + "/" + Constants.DOT_GIT; final File submoduleGitDir = new File(directory, gitDirPath); if (!submoduleGitDir.isDirectory()) return zeroid; final Repository submoduleRepo; try { FS fs = repository != null ? repository.getFS() : FS.DETECTED; submoduleRepo = new RepositoryBuilder().setGitDir(submoduleGitDir) .setMustExist(true).setFS(fs).build(); } catch (IOException exception) { return zeroid; } final ObjectId head; try { head = submoduleRepo.resolve(Constants.HEAD); } catch (IOException exception) { return zeroid; } finally { submoduleRepo.close(); } if (head == null) return zeroid; final byte[] id = new byte[Constants.OBJECT_ID_LENGTH]; head.copyRawTo(id, 0); return id; }
Source:
private CompletableCallOnSubscribe(Call originalCall) { this.originalCall = originalCall; }

Target:
CompletableCallOnSubscribe(Call originalCall) { this.originalCall = originalCall; }
Source:
private Optional<TestDescriptor> discoverEngineRoot(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest) { UniqueId uniqueEngineId = UniqueId.forEngine(testEngine.getId()); try { TestDescriptor engineRoot = testEngine.discover(discoveryRequest, uniqueEngineId); Preconditions.notNull(engineRoot, () -> String.format( "The discover() method for TestEngine with ID '%s' must return a non-null root TestDescriptor.", testEngine.getId())); Preconditions.condition(isAcyclic(engineRoot), () -> String.format("The discover() method for TestEngine with ID '%s' returned a cyclic graph.", testEngine.getId())); return Optional.of(engineRoot); } catch (Throwable throwable) { handleThrowable(testEngine, "discover", throwable); return Optional.empty(); } }

Target:
private Optional<TestDescriptor> discoverEngineRoot(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest) { UniqueId uniqueEngineId = UniqueId.forEngine(testEngine.getId()); try { TestDescriptor engineRoot = testEngine.discover(discoveryRequest, uniqueEngineId); discoveryResultValidator.validate(testEngine, engineRoot); return Optional.of(engineRoot); } catch (Throwable throwable) { handleThrowable(testEngine, "discover", throwable); return Optional.empty(); } }
Source:
List<String> getMgrsCoordinateStrings(String query) { return coordinateStringsFromQuery(query); }

Target:
List<String> getMgrsCoordinateStrings(String query) { final String terminatedQuery = query.concat(WHITESPACE); final Matcher matcher = PATTERN_MGRS_ANYPART.matcher(terminatedQuery); final List<String> mgrsStrings = new ArrayList<>(); final StringBuilder mgrsBuilder = new StringBuilder(); MgrsPartType previousType = MgrsPartType.NONE; while (matcher.find()) { final String mgrsPart = matcher.group().toUpperCase(); final MgrsPartType type = getPartType(mgrsPart); switch (type) { case ZONE: handleZoneWithPreviousType(mgrsPart, previousType, mgrsBuilder, mgrsStrings); break; case HUNDRED_KM: handleHundredKmWithPreviousType(mgrsPart, previousType, mgrsBuilder); break; case NUMERIC: handleNumericWithPreviousType(mgrsPart, previousType, mgrsBuilder, mgrsStrings); break; case NONE: throw new IllegalStateException( format("The provided mgrs part [ %s ] must map to a valid type", mgrsPart)); } LOGGER.debug( "MGRS strings [{}], builder state [{}], and types [{}|{}]", mgrsStrings, mgrsBuilder, previousType, type); previousType = type; } LOGGER.trace("Builder's final state [{}]", mgrsBuilder); if (previousType != MgrsPartType.NUMERIC && mgrsBuilder.length() > 0) { mgrsStrings.add(mgrsBuilder.toString()); } return mgrsStrings.stream().distinct().collect(Collectors.toList()); }
Source:
public List<PendingInstanceBean> getAllInstances(){ EntityManager entityManager = getEntityManager(); Query q = entityManager.createNamedQuery(PersistenceConstants.GET_ALL_PENDING_INSTANCES); List result = q.getResultList(); if (CollectionUtils.isEmpty(result)) { return null; } entityManager.close(); return result; }

Target:
public List<PendingInstanceBean> getAllInstances(){ EntityManager entityManager = getEntityManager(); Query q = entityManager.createNamedQuery(PersistenceConstants.GET_ALL_PENDING_INSTANCES); List result = q.getResultList(); try { if (CollectionUtils.isEmpty(result)) { return null; } } finally{ entityManager.close(); } return result; }
Source:
public void jumpToFrame(GraphName frame) { synchronized (mutex) { this.frame = frame; double scale = cameraToRosTransform.getScale(); resetTransform(); cameraToRosTransform = cameraToRosTransform.scale(scale / cameraToRosTransform.getScale()); } }

Target:
public void jumpToFrame(GraphName frame) { synchronized (mutex) { this.frame = frame; final double scale = cameraToRosTransform.getScale(); resetTransform(); cameraToRosTransform = cameraToRosTransform.scale(scale / cameraToRosTransform.getScale()); } }
Source:
public Response endPointsGet(String apiName, String label, String apiId, MessageContext messageContext) { InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer(); GatewayAPIDTO gatewayAPIDTO = inMemoryApiDeployer.getAPIArtifact(apiId, label); JSONObject responseObj = new JSONObject(); JSONArray endPointArray = new JSONArray(); if (gatewayAPIDTO != null) { if (gatewayAPIDTO.getEndpointEntriesToBeAdd() != null ) { EndpointAdminServiceProxy endpointAdminServiceProxy = new EndpointAdminServiceProxy (gatewayAPIDTO.getTenantDomain()); for (GatewayContentDTO gatewayEndpoint : gatewayAPIDTO.getEndpointEntriesToBeAdd()) { try { if (endpointAdminServiceProxy.isEndpointExist(gatewayEndpoint.getName())) { endPointArray.put(endpointAdminServiceProxy.getEndpoints(gatewayEndpoint.getName())); } else { log.error(gatewayEndpoint.getName() + " was not deployed in the gateway"); } } catch (EndpointAdminException e) { log.error("Error in fetching deployed Endpoints from Synapse Configuration." , e); } } } responseObj.put("Endpoints", endPointArray); String responseStringObj = String.valueOf(responseObj); return Response.ok().entity(responseStringObj).build(); } else { responseObj.put("Message", "Error"); String responseStringObj = String.valueOf(responseObj); return Response.serverError().entity(responseStringObj).build(); } }

Target:
public Response endPointsGet(String apiName, String label, String apiId, MessageContext messageContext) { InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer(); GatewayAPIDTO gatewayAPIDTO = inMemoryApiDeployer.getAPIArtifact(apiId, label); JSONObject responseObj = new JSONObject(); if (gatewayAPIDTO != null) { try { JSONArray endPointArray = new JSONArray(); JSONArray unDeployedEndPointArray = new JSONArray(); if (gatewayAPIDTO.getEndpointEntriesToBeAdd() != null) { EndpointAdminServiceProxy endpointAdminServiceProxy = new EndpointAdminServiceProxy (gatewayAPIDTO.getTenantDomain()); for (GatewayContentDTO gatewayEndpoint : gatewayAPIDTO.getEndpointEntriesToBeAdd()) { if (endpointAdminServiceProxy.isEndpointExist(gatewayEndpoint.getName())) { endPointArray.put(endpointAdminServiceProxy.getEndpoints(gatewayEndpoint.getName())); } else { log.error(gatewayEndpoint.getName() + " was not deployed in the gateway"); unDeployedEndPointArray.put(gatewayEndpoint.getContent()); } } } responseObj.put("Deployed Endpoints", endPointArray); responseObj.put("UnDeployed Endpoints", unDeployedEndPointArray); } catch (EndpointAdminException e) { String errorMessage = "Error in fetching deployed Endpoints from Synapse Configuration"; log.error(errorMessage, e); RestApiUtil.handleInternalServerError(errorMessage, e, log); } String responseStringObj = String.valueOf(responseObj); return Response.ok().entity(responseStringObj).build(); } else { responseObj.put("Message", "Error"); String responseStringObj = String.valueOf(responseObj); return Response.serverError().entity(responseStringObj).build(); } }
Source:
protected void onTimerDurationChange() { String oldValue = value; value = copy(oldValue); value = view.getTimeDuration(); notifyChange(oldValue, value); }

Target:
protected void onTimerDurationChange() { String oldValue = value; value = view.getTimeDuration(); if (view.isValid()) { notifyChange(oldValue, value); } }
Source:
private boolean holderListContains(V object) { return resourceHolderList.stream().filter(a -> a.getResource().equals(object)).findAny().isPresent(); }

Target:
private boolean holderListContains(V object) { return resourceHolderList.stream().anyMatch(a -> a.getResource().equals(object)); }
Source:
public Vector3d toVector3(double z) { return null; }

Target:
public Vector3d toVector3(double z) { return new SpongeVector3d(x, y, z); }
Source:
public Traversal.Admin<S, S> getRepeatTraversal() { if(null == this.repeatTraversal) throw new IllegalStateException("The repeat()-traversal was not defined: " + this); return this.repeatTraversal; }

Target:
public Traversal.Admin<S, S> getRepeatTraversal() { return this.repeatTraversal; }
Source:
public GitProjectType(GitValueProviderFactory gitRepositoryValueProviderFactory) { super("git", "git"); addVariableDefinition(VCS_PROVIDER_NAME, "Is this git repo or not?", false, gitRepositoryValueProviderFactory); addVariableDefinition(CURRENT_BRANCH_NAME, "Name of current brunch", false, gitRepositoryValueProviderFactory); addVariableDefinition(REPOSITORY_REMOTES, "List of repository remote addresses", false, gitRepositoryValueProviderFactory); }

Target:
public GitProjectType(GitValueProviderFactory gitRepositoryValueProviderFactory) { super("git", "git"); addVariableDefinition(VCS_PROVIDER_NAME, "Is this git repo or not?", false, gitRepositoryValueProviderFactory); addVariableDefinition(GIT_CURRENT_BRANCH_NAME, "Name of current git branch", false, gitRepositoryValueProviderFactory); addVariableDefinition(GIT_REPOSITORY_REMOTES, "List of git repository remote addresses", false, gitRepositoryValueProviderFactory); }
Source:
private DataSegment createDescriptorFile(DataSegment segment, Path outDir, final FileSystem fs) throws IOException { final Path descriptorFile = new Path(outDir, "descriptor.json"); log.info("Creating descriptor file at[%s]", descriptorFile); final ByteSource byteSource = ByteSource.wrap(jsonMapper.writeValueAsBytes(segment)); byteSource.copyTo(new HdfsOutputStreamSupplier(fs, descriptorFile)); return segment; }

Target:
private DataSegment createDescriptorFile(DataSegment segment, Path outDir, final FileSystem fs) throws IOException { final Path descriptorFile = new Path(outDir, "descriptor.json"); log.info("Creating descriptor file at[%s]", descriptorFile); ByteSource .wrap(jsonMapper.writeValueAsBytes(segment)) .copyTo(new HdfsOutputStreamSupplier(fs, descriptorFile)); return segment; }
Source:
protected void prepareTestData() { testData = loadDataBundle("/StudentHomePageUiTest.json"); String student1GoogleId = TestProperties.TEST_STUDENT1_ACCOUNT; String student1Email = student1GoogleId + "@gmail.com"; testData.accounts.get("alice.tmms").googleId = student1GoogleId; testData.accounts.get("alice.tmms").email = student1Email; testData.students.get("alice.tmms@SHomeUiT.CS2104").googleId = student1GoogleId; testData.students.get("alice.tmms@SHomeUiT.CS2104").email = student1Email; testData.students.get("alice.tmms@SHomeUiT.CS1101").googleId = student1GoogleId; testData.students.get("alice.tmms@SHomeUiT.CS1101").email = student1Email; testData.students.get("alice.tmms@SHomeUiT.CS4215").googleId = student1GoogleId; testData.students.get("alice.tmms@SHomeUiT.CS4215").email = student1Email; testData.students.get("alice.tmms@SHomeUiT.CS4221").googleId = student1GoogleId; testData.students.get("alice.tmms@SHomeUiT.CS4221").email = student1Email; removeAndRestoreDataBundle(testData); FeedbackSessionAttributes gracedFeedbackSession = BackDoor.getFeedbackSession("SHomeUiT.CS2104", "Graced Feedback Session"); gracedFeedbackSession.setEndTime(Instant.now()); BackDoor.editFeedbackSession(gracedFeedbackSession); }

Target:
protected void prepareTestData() { testData = loadDataBundle("/StudentHomePageUiTest.json"); String student1GoogleId = TestProperties.TEST_STUDENT1_ACCOUNT; String student1Email = student1GoogleId + "@gmail.com"; testData.accounts.get("alice.tmms").googleId = student1GoogleId; testData.accounts.get("alice.tmms").email = student1Email; testData.students.get("alice.tmms@SHomeUiT.CS2104").email = student1Email; testData.students.get("alice.tmms@SHomeUiT.CS1101").googleId = student1GoogleId; testData.students.get("alice.tmms@SHomeUiT.CS1101").email = student1Email; testData.students.get("alice.tmms@SHomeUiT.CS4215").googleId = student1GoogleId; testData.students.get("alice.tmms@SHomeUiT.CS4215").email = student1Email; testData.students.get("alice.tmms@SHomeUiT.CS4221").googleId = student1GoogleId; testData.students.get("alice.tmms@SHomeUiT.CS4221").email = student1Email; removeAndRestoreDataBundle(testData); FeedbackSessionAttributes gracedFeedbackSession = BackDoor.getFeedbackSession("SHomeUiT.CS2104", "Graced Feedback Session"); gracedFeedbackSession.setEndTime(Instant.now()); BackDoor.editFeedbackSession(gracedFeedbackSession); }
Source:
public void testInitializeWithNoChroot() throws AlreadyInitializedException { config.setAllowReinitialize(true); config.setZookeepers("localhost"); FluoAdmin fluoAdmin = new FluoAdminImpl(config); try { fluoAdmin.initialize(); fail("This should have failed"); } catch (IllegalArgumentException e) { } }

Target:
public void testInitializeWithNoChroot() throws AlreadyInitializedException { config.setAllowReinitialize(true); for (String host : new String[]{"localhost", "localhost/", "localhost:9999", "localhost:9999/"}) { config.setZookeepers(host); FluoAdmin fluoAdmin = new FluoAdminImpl(config); try { fluoAdmin.initialize(); fail("This should have failed"); } catch (IllegalArgumentException e) { } } }
Source:
public void start() { final SocketConnector connector = new SocketConnector(); connector.setPort(port); if (null != host && !host.equals("")) { connector.setHost(host); } server.setConnectors(new Connector[] { connector }); final ServletContextHandler idHandler = configureRestHandler(); final RequestLogHandler requestLogHandler = configureRequestLoggerIfDesired(); final HandlerCollection handlers = new HandlerCollection(); if (null == requestLogHandler) { handlers.setHandlers(new Handler[] { idHandler }); } else { handlers.setHandlers(new Handler[] { idHandler, requestLogHandler }); } server.setHandler(handlers); try { log.log(Level.INFO, "Starting " + serviceName + " server on port " + port + " ( <LINK_0>" + port + " )", new Object[] { serviceName, port, port }); server.start(); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public void start() { final SocketConnector connector = new SocketConnector(); connector.setPort(port); if (null != host && !host.equals("")) { connector.setHost(host); } server.setConnectors(new Connector[] { connector }); final ServletContextHandler idHandler = configureRestHandler(); final RequestLogHandler requestLogHandler = configureRequestLoggerIfDesired(); final HandlerCollection handlers = new HandlerCollection(); if (null == requestLogHandler) { handlers.setHandlers(new Handler[] { idHandler }); } else { handlers.setHandlers(new Handler[] { idHandler, requestLogHandler }); } server.setHandler(handlers); try { log.log(Level.INFO, "Starting " + serviceName + " server on port " + port + " ( <LINK_0>" + port + " )"); server.start(); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void updateIfNeeded(VdsDynamic vdsDynamic) { VdsDynamic dbData = get(vdsDynamic.getId()); if (!dbData.equals(vdsDynamic)) { dbData.setcpu_over_commit_time_stamp(vdsDynamic.getcpu_over_commit_time_stamp()); if (dbData.equals(vdsDynamic)) { updateCpuOverCommit(vdsDynamic.getId(), vdsDynamic.getcpu_over_commit_time_stamp()); } else { update(vdsDynamic); } } else { log.debug("Ignored an unneeded update of VdsDynamic"); } }

Target:
public void updateIfNeeded(VdsDynamic vdsDynamic) { VdsDynamic dbData = get(vdsDynamic.getId()); if (!dbData.equals(vdsDynamic)) { update(vdsDynamic); } else { log.debug("Ignored an unneeded update of VdsDynamic"); } }
Source:
protected String getRequestToken(final Request request) throws AuthException { final Configuration c = getConfiguration(); final Promise<Response> r = WS.url( c.getString(SettingKeys.REQUEST_TOKEN_URL)) .setHeader("Content-Type", "application/x-www-form-urlencoded") .post(getRequestTokenParams(request, c)); final Response response = r.get(); if (response.getStatus() > 400) { throw new AuthException(response.asJson() .get("meta") .get("errorDetail") .asText()); } else { String body = response.getBody(); if(body != null && !body.equals("") && body.indexOf("=") != -1) { return body.substring(body.indexOf("=") + 1); } else { throw new AuthException("No token could be found in body response"); } } }

Target:
protected String getRequestToken(final Request request) throws AuthException { final Configuration c = getConfiguration(); final List<NameValuePair> params = getRequestTokenParams(request, c); final Response r = WS.url(c.getString(SettingKeys.REQUEST_TOKEN_URL)) .setHeader("Content-Type", "application/json") .setHeader("X-Accept", "application/json") .post(encodeParamsAsJson(params)) .get(PlayAuthenticate.TIMEOUT); if (r.getStatus() >= 400) { throw new AuthException(r.asJson().asText()); } else { return r.asJson().get("code").asText(); } }
Source:
public View getView(int position, View convertView, ViewGroup parent) { if (DEBUG) { Log_OC.d(String.format("getView: %s, reused: %s", position, convertView == null)); } int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns; if (position < numHeadersAndPlaceholders) { View headerViewContainer = mHeaderViewInfos .get(position / mNumColumns).viewContainer; if (position % mNumColumns == 0) { return headerViewContainer; } else { if (convertView == null) { convertView = new View(parent.getContext()); } convertView.setVisibility(View.INVISIBLE); convertView.setMinimumHeight(headerViewContainer.getHeight()); return convertView; } } final int adjPosition = position - numHeadersAndPlaceholders; int adapterCount = 0; if (mAdapter != null) { adapterCount = getAdapterAndPlaceHolderCount(); if (adjPosition < adapterCount) { if (adjPosition < mAdapter.getCount()) { return mAdapter.getView(adjPosition, convertView, parent); } else { if (convertView == null) { convertView = new View(parent.getContext()); } convertView.setVisibility(View.INVISIBLE); convertView.setMinimumHeight(mRowHeight); return convertView; } } } final int footerPosition = adjPosition - adapterCount; if (footerPosition < getCount()) { View footViewContainer = mFooterViewInfos .get(footerPosition / mNumColumns).viewContainer; if (position % mNumColumns == 0) { return footViewContainer; } else { if (convertView == null) { convertView = new View(parent.getContext()); } convertView.setVisibility(View.INVISIBLE); convertView.setMinimumHeight(footViewContainer.getHeight()); return convertView; } } throw new ArrayIndexOutOfBoundsException(position); }

Target:
public View getView(int position, View convertView, ViewGroup parent) { int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns; if (position < numHeadersAndPlaceholders) { View headerViewContainer = mHeaderViewInfos .get(position / mNumColumns).viewContainer; if (position % mNumColumns == 0) { return headerViewContainer; } else { if (convertView == null) { convertView = new View(parent.getContext()); } convertView.setVisibility(View.INVISIBLE); convertView.setMinimumHeight(headerViewContainer.getHeight()); return convertView; } } final int adjPosition = position - numHeadersAndPlaceholders; int adapterCount = 0; if (mAdapter != null) { adapterCount = getAdapterAndPlaceHolderCount(); if (adjPosition < adapterCount) { if (adjPosition < mAdapter.getCount()) { return mAdapter.getView(adjPosition, convertView, parent); } else { if (convertView == null) { convertView = new View(parent.getContext()); } convertView.setVisibility(View.INVISIBLE); convertView.setMinimumHeight(mRowHeight); return convertView; } } } final int footerPosition = adjPosition - adapterCount; if (footerPosition < getCount()) { View footViewContainer = mFooterViewInfos .get(footerPosition / mNumColumns).viewContainer; if (position % mNumColumns == 0) { return footViewContainer; } else { if (convertView == null) { convertView = new View(parent.getContext()); } convertView.setVisibility(View.INVISIBLE); convertView.setMinimumHeight(footViewContainer.getHeight()); return convertView; } } throw new ArrayIndexOutOfBoundsException(position); }
Source:
public boolean containsKey(final K key) throws StoreAccessException { if(getInternal(key) == null) { return false; } else { return true; } }

Target:
public boolean containsKey(final K key) throws StoreAccessException { return getInternal(key) != null; }
Source:
public boolean configDnsSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException { if (_networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Dhcp, getProvider())) { return true; } else { return configureDhcpSupport(network, nic, vm, dest, Service.Dns); } }

Target:
public boolean configDnsSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException { if (_networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Dhcp, getProvider())) { return true; } return configureDhcpSupport(network, nic, vm, dest, Service.Dns); }
Source:
protected List<URL> getDriversFromMirror(URL driverUrl) throws IOException { if (mirrorLog) { log.info("Crawling driver list from mirror {}", driverUrl); mirrorLog = true; } else { log.trace("[Recursive call] Crawling driver list from mirror {}", driverUrl); } String driverStr = driverUrl.toString(); HttpResponse response = httpClient .execute(httpClient.createHttpGet(driverUrl)); try (InputStream in = response.getEntity().getContent()) { org.jsoup.nodes.Document doc = Jsoup.parse(in, null, driverStr); Iterator<org.jsoup.nodes.Element> iterator = doc.select("a") .iterator(); List<URL> urlList = new ArrayList<>(); while (iterator.hasNext()) { String link = iterator.next().attr("abs:href"); if (link.startsWith(driverStr) && link.endsWith(SLASH)) { urlList.addAll(getDriversFromMirror(new URL(link))); } else if (link.startsWith(driverStr) && !link.contains("icons") && (link.toLowerCase().endsWith(".bz2") || link.toLowerCase().endsWith(".zip") || link.toLowerCase().endsWith(".gz"))) { urlList.add(new URL(link)); } } return urlList; } }

Target:
protected List<URL> getDriversFromMirror(URL driverUrl) throws IOException { if (mirrorLog) { log.info("Crawling driver list from mirror {}", driverUrl); mirrorLog = true; } else { log.trace("[Recursive call] Crawling driver list from mirror {}", driverUrl); } String driverStr = driverUrl.toString(); HttpResponse response = httpClient .execute(httpClient.createHttpGet(driverUrl)); try (InputStream in = response.getEntity().getContent()) { org.jsoup.nodes.Document doc = Jsoup.parse(in, null, driverStr); Iterator<org.jsoup.nodes.Element> iterator = doc.select("a") .iterator(); List<URL> urlList = new ArrayList<>(); while (iterator.hasNext()) { String link = iterator.next().attr("abs:href"); if (link.startsWith(driverStr) && link.endsWith(SLASH)) { urlList.addAll(getDriversFromMirror(new URL(link))); } else if (link.startsWith(driverStr) && !link.contains("icons") && (link.toLowerCase().endsWith(".bz2") || link.toLowerCase().endsWith(".zip") || link.toLowerCase().endsWith(".msi") || link.toLowerCase().endsWith(".gz"))) { urlList.add(new URL(link)); } } return urlList; } }
Source:
public BuildStatusNotifierPlugin() { try { Properties properties = new Properties(); properties.load(getClass().getResourceAsStream("/defaults.properties")); Class<?> providerClass = Class.forName(properties.getProperty("provider")); Constructor<?> constructor = providerClass.getConstructor(); provider = (Provider) constructor.newInstance(); templateName = properties.getProperty("settings.template"); } catch (Exception e) { throw new RuntimeException("could not create provider", e); } }

Target:
public BuildStatusNotifierPlugin() { try { Properties properties = new Properties(); properties.load(getClass().getResourceAsStream("/defaults.properties")); Class<?> providerClass = Class.forName(properties.getProperty("provider")); Constructor<?> constructor = providerClass.getConstructor(); provider = (Provider) constructor.newInstance(); } catch (Exception e) { throw new RuntimeException("could not create provider", e); } }
Source:
public long lastModified() throws IOException { if (IoUtils.isFileUrl(url)) { return super.lastModified(); } else { URLConnection conn = null; try { conn = url.openConnection(); configureUrlConnection(conn); if (conn instanceof HttpURLConnection) { HttpURLConnection httpConn = (HttpURLConnection) conn; int responseCode = httpConn.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { return httpConn.getLastModified(); } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundException(getDescription() + " not found: " + "responseCode=" + responseCode + ", usingProxy=" + httpConn.usingProxy()); } else if (responseCode / 100 == 4) { throw new IOException(getDescription() + " is not accessible: " + "responseCode=" + responseCode + ", usingProxy=" + httpConn.usingProxy()); } else if (responseCode / 100 == 5) { throw new IOException(getDescription() + " is not available: " + "responseCode=" + responseCode + ", usingProxy=" + httpConn.usingProxy()); } else { return 0; } } else { return super.lastModified(); } } finally { IoUtils.closeQuietly(conn); } } }

Target:
public long lastModified() { if (IoUtils.isFileUrl(url)) { return super.lastModified(); } else { URLConnection conn = null; try { conn = url.openConnection(); configureUrlConnection(conn); if (conn instanceof HttpURLConnection) { HttpURLConnection httpConn = (HttpURLConnection) conn; int responseCode = httpConn.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { return httpConn.getLastModified(); } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundRuntimeException(getDescription() + " not found: " + "responseCode=" + responseCode + ", usingProxy=" + httpConn.usingProxy()); } else if ((responseCode / 100 == 2) || (responseCode / 100 == 3)) { long lastModified = httpConn.getLastModified(); if (logger.isLoggable(Level.FINER)) { logger.finer(getDescription() + " returned an unexpected '" + responseCode + " " + httpConn.getResponseMessage() + "'. lastModified=" + lastModified); } return lastModified; } else if (responseCode / 100 == 4) { throw new IoRuntimeException(getDescription() + " is not accessible: " + "responseCode=" + responseCode + ", usingProxy=" + httpConn.usingProxy()); } else if (responseCode / 100 == 5) { throw new IoRuntimeException(getDescription() + " is not available: " + "responseCode=" + responseCode + ", usingProxy=" + httpConn.usingProxy()); } else { throw new IoRuntimeException(getDescription() + "returned an unexpected " + responseCode + " " + httpConn.getResponseMessage()); } } else { return super.lastModified(); } } catch (IOException e) { throw IoRuntimeException.propagate(e); } finally { IoUtils.closeQuietly(conn); } } }
Source:
protected RowMapper<AffinityGroup> createEntityRowMapper() { return new RowMapper<AffinityGroup>() { @Override public AffinityGroup mapRow(ResultSet rs, int arg1) throws SQLException { AffinityGroup affinityGroup = new AffinityGroup(); affinityGroup.setId(getGuid(rs, "id")); affinityGroup.setName(rs.getString("name")); affinityGroup.setDescription(rs.getString("description")); affinityGroup.setClusterId(getGuid(rs, "cluster_id")); affinityGroup.setPolarity(AffinityPolarity.forValue(rs.getInt("polarity"))); affinityGroup.setEnforcementType(AffinityEnforcementType.forValue(rs.getInt("enforcement_type"))); affinityGroup.setVmIds(GuidUtils.getGuidListFromString(rs.getString("vm_ids"))); affinityGroup.setVmNames(split(rs.getString("vm_names"))); return affinityGroup; } }; }

Target:
protected RowMapper<AffinityGroup> createEntityRowMapper() { return AffinityGropupRowMapper.instance; }
Source:
public final void returnsVerboseIterator() throws Exception { final Iterator<Object> iterator = this.list.iterator(); MatcherAssert.assertThat( iterator, Matchers.instanceOf(VerboseIterator.class) ); }

Target:
public final void returnsVerboseIterator() throws Exception { MatcherAssert.assertThat( this.list.iterator(), Matchers.instanceOf(VerboseIterator.class) ); }
Source:
public Collection<DocumentFieldMetadata> getAllDocumentFieldMetadata() { if ( embeddedTypeMetadata.isEmpty() ) { return documentFieldMetadata; } else { Collection<DocumentFieldMetadata> allMetadata = new ArrayList<DocumentFieldMetadata>( documentFieldMetadata.size() ); for ( EmbeddedTypeMetadata element : embeddedTypeMetadata ) { allMetadata.addAll( element.getAllDocumentFieldMetadata() ); } allMetadata.addAll( documentFieldMetadata ); return allMetadata; } }

Target:
public Collection<DocumentFieldMetadata> getAllDocumentFieldMetadata() { if ( embeddedTypeMetadata.isEmpty() ) { return documentFieldMetadata; } else { Collection<DocumentFieldMetadata> allMetadata = new ArrayList<DocumentFieldMetadata>( documentFieldMetadata.size() ); for ( EmbeddedTypeMetadata element : embeddedTypeMetadata ) { allMetadata.addAll( element.getAllDocumentFieldMetadata() ); } allMetadata.addAll( documentFieldMetadata ); return Collections.unmodifiableCollection( allMetadata ); } }
Source:
private static void runTest(CtfTmfTestTrace testTrace, String testName, Map<String, Long> testCases) { assumeTrue(testTrace.exists()); Performance perf = Performance.getDefault(); PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName); perf.tagAsSummary(pm, "Statistics Analysis: " + testName, Dimension.CPU_TIME); if (testTrace == CtfTmfTestTrace.DJANGO_CLIENT || testTrace == CtfTmfTestTrace.DJANGO_HTTPD) { perf.tagAsGlobalSummary(pm, "Statistics Analysis: " + testName, Dimension.CPU_TIME); } for (int i = 0; i < LOOP_COUNT; i++) { TmfStatisticsModule module = null; try (LttngKernelTrace trace = new LttngKernelTrace()) { module = new TmfStatisticsModule(); module.setId("test"); trace.initTrace(null, testTrace.getPath(), CtfTmfEvent.class); module.setTrace(trace); pm.start(); TmfTestHelper.executeAnalysis(module); pm.stop(); ITmfStatistics stats = module.getStatistics(); if (stats == null) { throw new IllegalStateException(); } Map<String, Long> map = stats.getEventTypesTotal(); try { for (Entry<String, Long> entry : testCases.entrySet()) { Assert.assertTrue(map.get(entry.getKey()).equals(entry.getValue())); } } catch (NullPointerException e) { fail(e.getMessage()); } File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace)); for (File file : suppDir.listFiles()) { file.delete(); } } catch (TmfAnalysisException | TmfTraceException e) { fail(e.getMessage()); } finally { if (module != null) { module.dispose(); } } } pm.commit(); testTrace.dispose(); }

Target:
private static void runTest(CtfTmfTestTrace testTrace, String testName, Map<String, Long> testCases) { assumeTrue(testTrace.exists()); Performance perf = Performance.getDefault(); PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName); perf.tagAsSummary(pm, "Statistics Analysis: " + testName, Dimension.CPU_TIME); if (testTrace == CtfTmfTestTrace.DJANGO_CLIENT) { perf.tagAsGlobalSummary(pm, "Statistics Analysis: " + testName, Dimension.CPU_TIME); } for (int i = 0; i < LOOP_COUNT; i++) { TmfStatisticsModule module = null; try (LttngKernelTrace trace = new LttngKernelTrace()) { module = new TmfStatisticsModule(); module.setId("test"); trace.initTrace(null, testTrace.getPath(), CtfTmfEvent.class); module.setTrace(trace); pm.start(); TmfTestHelper.executeAnalysis(module); pm.stop(); ITmfStatistics stats = module.getStatistics(); if (stats == null) { throw new IllegalStateException(); } Map<String, Long> map = stats.getEventTypesTotal(); try { for (Entry<String, Long> entry : testCases.entrySet()) { Assert.assertTrue(map.get(entry.getKey()).equals(entry.getValue())); } } catch (NullPointerException e) { fail(e.getMessage()); } File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace)); for (File file : suppDir.listFiles()) { file.delete(); } } catch (TmfAnalysisException | TmfTraceException e) { fail(e.getMessage()); } finally { if (module != null) { module.dispose(); } } } pm.commit(); testTrace.dispose(); }
Source:
private Callable<Throwable> callable(final ProceedingJoinPoint point, final CountDownLatch start) { return new Callable<Throwable>() { @Override public Throwable call() { try { start.await(); point.proceed(); } catch (Throwable ex) { return ex; } return null; } }; }

Target:
private Callable<Throwable> callable(final ProceedingJoinPoint point, final CountDownLatch start) { return new Callable<Throwable>() { @Override public Throwable call() { Throwable result = null; try { start.await(); point.proceed(); } catch (Throwable ex) { result = ex; } return result; } }; }