auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<OrderGroup> getOrderGroupsByEncounter(Encounter encounter) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(OrderGroup.class); if (encounter != null) { criteria.add(Restrictions.eq("encounter", encounter)); } else { criteria.add(Restrictions.isNull("encounter")); } return criteria.list(); }

Target:
public List<OrderGroup> getOrderGroupsByEncounter(Encounter encounter) throws APIException { if (encounter == null) { throw new APIException("Encounter cannot be null"); } Criteria criteria = sessionFactory.getCurrentSession().createCriteria(OrderGroup.class); criteria.add(Restrictions.eq("encounter", encounter)); return criteria.list(); }
Source:
public void trainModel(File pairFolder) throws Exception { String odsModel = this.getClass().getClassLoader().getResource("ODSTraining/ODSmodel.bin").getPath(); String trainingFile = this.getClass().getClassLoader().getResource("ODSTraining/Training-libsvm.txt").getPath(); DMatrix trainMat = new DMatrix(trainingFile); Map<String, Object> params = new HashMap<String, Object>() { { put("eta", 0.3); put("max_depth", 6); put("gamma", 1); put("objective", "binary:logistic"); put("eval_metric", "logloss"); } }; Map<String, DMatrix> watches = new HashMap<String, DMatrix>() { { put("train", trainMat); } }; int nround = 20; Booster booster = XGBoost.train(trainMat, params, nround, watches, null, null); booster.saveModel(odsModel); }

Target:
public void trainModel(File pairFolder) throws Exception { String odsModel = ComingProperties.getProperty("ODSmodel"); String trainingFile = ComingProperties.getProperty("ODSTrainingFile"); DMatrix trainMat = new DMatrix(trainingFile); Map<String, Object> params = new HashMap<String, Object>() { { put("eta", ComingProperties.getProperty("xgboost-training-eta")); put("max_depth", ComingProperties.getProperty("xgboost-training-max-depth")); put("gamma", ComingProperties.getProperty("xgboost-training-gamma")); put("objective", ComingProperties.getProperty("xgboost-training-objective")); put("eval_metric", ComingProperties.getProperty("xgboost-training-eval-metric")); } }; Map<String, DMatrix> watches = new HashMap<String, DMatrix>() { { put("train", trainMat); } }; int nround = Integer.parseInt(ComingProperties.getProperty("xgboost-training-nround")); Booster booster = XGBoost.train(trainMat, params, nround, watches, null, null); booster.saveModel(odsModel); }
Source:
public Converter getConverter() { return new BiDirectionalConverter() { @Override @SuppressWarnings("rawtypes") public Object convert(final Class type, final Object value) { final ExecutionCourseBean result = new ExecutionCourseBean(); result.setDestinationExecutionCourse((ExecutionCourse) new DomainObjectKeyConverter().convert(type, value)); return result; } @Override public String deserialize(final Object object) { String result = StringUtils.EMPTY; if (object != null && object instanceof ExecutionCourseBean) { final ExecutionCourseBean bean = (ExecutionCourseBean) object; if (bean.getDestinationExecutionCourse() != null) { result = bean.getDestinationExecutionCourse().toString(); } } return result; } }; }

Target:
public Converter getConverter() { return new BiDirectionalConverter() { @Override @SuppressWarnings("rawtypes") public Object convert(final Class type, final Object value) { final ExecutionCourseBean result = new ExecutionCourseBean(); result.setDestinationExecutionCourse((ExecutionCourse) new DomainObjectKeyConverter().convert(type, value)); return result; } @Override public String deserialize(final Object object) { String result = ""; if (object != null && object instanceof ExecutionCourseBean) { final ExecutionCourseBean bean = (ExecutionCourseBean) object; if (bean.getDestinationExecutionCourse() != null) { result = bean.getDestinationExecutionCourse().toString(); } } return result; } }; }
Source:
private void testWithIncludeAndExcludePattern(String path, String includePattern, String excludePattern, boolean expectedResult, int nonTraversableDepth) { Path p = Paths.get(path); if (includePattern != null) { fileSelector.setIncludes(includePattern); } if (excludePattern != null) { fileSelector.setExcludes(excludePattern); } boolean result = fileSelector.matches(p); assertEquals(expectedResult, result); if (expectedResult) { Path appendedPath = p.getRoot(); int depth = 0; for (Iterator<Path> it = p.iterator(); it.hasNext();) { Path name = it.next(); if (appendedPath == null) { appendedPath = name; } else { appendedPath = appendedPath.resolve(name); } if (depth == nonTraversableDepth) { assertFalse("Path " + appendedPath + " should be traversable", fileSelector.traverseDescendents(appendedPath)); } else { assertTrue("Path " + appendedPath + " should be traversable", fileSelector.traverseDescendents(appendedPath)); } } } }

Target:
private void testWithIncludeAndExcludePattern(String path, String includePattern, String excludePattern, boolean expectedResult, int nonTraversableDepth) { Path p = Paths.get(path); if (includePattern != null) { fileSelector.setIncludes(includePattern); } if (excludePattern != null) { fileSelector.setExcludes(excludePattern); } boolean result = fileSelector.matches(p); assertEquals(expectedResult, result); if (expectedResult) { Path appendedPath = p.getRoot(); int depth = 0; for (Iterator<Path> it = p.iterator(); it.hasNext();) { Path name = it.next(); if (appendedPath == null) { appendedPath = name; } else { appendedPath = appendedPath.resolve(name); } if (depth == nonTraversableDepth) { assertFalse("Path " + appendedPath + " should not be traversable", fileSelector.traverseDescendents(appendedPath)); } else { assertTrue("Path " + appendedPath + " should be traversable", fileSelector.traverseDescendents(appendedPath)); } } } }
Source:
public void setRecharged(Campaign campaign) { DateTime currentDate = Utilities.getDateTimeDay(campaign.getCalendar()); double neededRechargeTime = currentPlanet.getRechargeTime(currentDate); rechargeTime = neededRechargeTime; campaign.addReport("Jumpship drives fully charged"); }

Target:
public void setRecharged(Campaign campaign) { DateTime currentDate = Utilities.getDateTimeDay(campaign.getCalendar()); double neededRechargeTime = currentPlanet.getRechargeTime(currentDate); rechargeTime = neededRechargeTime; }
Source:
public void testNexus5704renderStorageFileItemWithMatchingCondition() throws Exception { try { final ResourceStoreRequest rsr = fileItem.getResourceStoreRequest(); rsr.setIfNoneMatch( "{SHA1{1234567890}}" ); when( attributes.containsKey( StorageFileItem.DIGEST_SHA1_KEY ) ).thenReturn( true ); when( attributes.get( StorageFileItem.DIGEST_SHA1_KEY ) ).thenReturn( "1234567890" ); underTest.renderStorageFileItem( request, fileItem ); assertThat( "ResourceException was expected to be thrown", false ); } catch ( ResourceException e ) { assertThat( e.getStatus(), equalTo( Status.REDIRECTION_NOT_MODIFIED ) ); } }

Target:
public void testNexus5704renderStorageFileItemWithMatchingCondition() throws Exception { try { final ResourceStoreRequest rsr = fileItem.getResourceStoreRequest(); rsr.setIfNoneMatch( "{SHA1{1234567890}}" ); when( attributes.containsKey( StorageFileItem.DIGEST_SHA1_KEY ) ).thenReturn( true ); when( attributes.get( StorageFileItem.DIGEST_SHA1_KEY ) ).thenReturn( "1234567890" ); underTest.renderStorageFileItem( request, fileItem ); fail( "ResourceException is expected to be thrown" ); } catch ( ResourceException e ) { assertThat( e.getStatus(), equalTo( Status.REDIRECTION_NOT_MODIFIED ) ); } }
Source:
public ReactExoplayerView(ThemedReactContext context, ReactExoplayerConfig config) { super(context); this.themedReactContext = context; this.eventEmitter = new VideoEventEmitter(context); this.config = config; this.bandwidthMeter = config.getBandwidthMeter(); createViews(); audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); themedReactContext.addLifecycleEventListener(this); audioBecomingNoisyReceiver = new AudioBecomingNoisyReceiver(themedReactContext); ReactExoplayerView self = this; BroadcastReceiver pipReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { boolean isInPictureInPictureMode = intent.getBooleanExtra("isInPictureInPictureMode", false); self.onPictureInPictureModeChanged(isInPictureInPictureMode); } }; BroadcastReceiver leaveReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { self.setPictureInPicture(true); self.onHostResume(); } }; Activity activity = themedReactContext.getCurrentActivity(); activity.registerReceiver(pipReceiver, new IntentFilter("onPictureInPictureModeChanged")); activity.registerReceiver(leaveReceiver, new IntentFilter("onUserLeaveHint")); initializePlayer(); }

Target:
public ReactExoplayerView(ThemedReactContext context, ReactExoplayerConfig config) { super(context); this.themedReactContext = context; this.eventEmitter = new VideoEventEmitter(context); this.config = config; this.bandwidthMeter = config.getBandwidthMeter(); createViews(); audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); themedReactContext.addLifecycleEventListener(this); audioBecomingNoisyReceiver = new AudioBecomingNoisyReceiver(themedReactContext); ReactExoplayerView self = this; pipReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { boolean isInPictureInPictureMode = intent.getBooleanExtra("isInPictureInPictureMode", false); self.onPictureInPictureModeChanged(isInPictureInPictureMode); } }; leaveReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (showPictureInPictureOnLeave) { self.setPictureInPicture(true); } } }; Activity activity = themedReactContext.getCurrentActivity(); activity.registerReceiver(pipReceiver, new IntentFilter("onPictureInPictureModeChanged")); activity.registerReceiver(leaveReceiver, new IntentFilter("onUserLeaveHint")); initializePlayer(); }
Source:
public Command teslaScenario(TeslaScenario scenario, Integer target) { if (scenario == null) return seq(); scenario = (TeslaScenario) EcoreUtil.copy(scenario); selectorParser = new TeslaSelectorParser(scenario); selectorParser.parse(); teslaCommands = scenario.getCommands(); pos = 0; script = new ArrayList<Command>(); while (target == null || pos < target) { if (pos >= teslaCommands.size()) { break; } Command newCommand = teslaCommand(); if (newCommand != null) { script.add(newCommand); } } Sequence seq = CoreFactory.eINSTANCE.createSequence(); List<Command> withified = EclRefactoring.withify(script, new Comparator<Command>() { public int compare(Command c1, Command c2) { if (c1 instanceof Selector && c2 instanceof Selector) { Selector s1 = (Selector) c1; Selector s2 = (Selector) c2; if (s1.getId() != null && s2.getId() != null) return s1.getId().compareTo(s2.getId()); } if (c1 instanceof GetItemImpl && c2 instanceof GetItemImpl) { GetItemImpl i1 = (GetItemImpl) c1; GetItemImpl i2 = (GetItemImpl) c2; if (i1.getPath() != null && i2.getPath() != null) return i1.getPath().compareTo(i2.getPath()); } return 1; } }); seq.getCommands().addAll(DiagramUtils.updateSelectors(withified)); return TeslaScriptletFactory.makeSeq(seq); }

Target:
public Command teslaScenario(TeslaScenario scenario, Integer target) { if (scenario == null) return seq(); scenario = (TeslaScenario) EcoreUtil.copy(scenario); selectorParser = new TeslaSelectorParser(scenario); selectorParser.parse(); teslaCommands = scenario.getCommands(); pos = 0; script = new ArrayList<Command>(); while (target == null || pos < target) { if (pos >= teslaCommands.size()) { break; } Command newCommand = teslaCommand(); if (newCommand != null) { script.add(newCommand); } } Sequence seq = CoreFactory.eINSTANCE.createSequence(); List<Command> withified = EclRefactoring.withify(script, new Comparator<Command>() { public int compare(Command c1, Command c2) { if (c1 instanceof Selector && c2 instanceof Selector) { Selector s1 = (Selector) c1; Selector s2 = (Selector) c2; if (s1.getId() != null && s2.getId() != null) { return s1.getId().compareTo(s2.getId()); } } if (c1 instanceof GetItemImpl && c2 instanceof GetItemImpl) { GetItemImpl i1 = (GetItemImpl) c1; GetItemImpl i2 = (GetItemImpl) c2; if (i1.getPath() != null && i2.getPath() != null) { return i1.getPath().compareTo(i2.getPath()); } } return 1; } }); seq.getCommands().addAll(DiagramUtils.updateSelectors(withified)); return TeslaScriptletFactory.makeSeq(seq); }
Source:
public AccessService getAccessService (double lat, double lon) { Point point = GeometryUtils.geometryFactory.createPoint(new Coordinate(lon, lat)); ModificationPolygon polygon = polygons.getWinningPolygon(point); double waitTimeMinutes = polygon == null ? polygons.defaultData : polygon.data; if (waitTimeMinutes == -1) { return NO_SERVICE_HERE; } int waitTimeSeconds = (int) waitTimeMinutes * 60; TIntSet stopsReachable = null; if (stopNumbersForZonePolygon != null) { stopsReachable = stopNumbersForZonePolygon.get(polygon); if (stopsReachable == null) { stopsReachable = new TIntHashSet(); } } return new AccessService(waitTimeSeconds, stopsReachable); }

Target:
public AccessService getAccessService (double lat, double lon) { Point point = GeometryUtils.geometryFactory.createPoint(new Coordinate(lon, lat)); ModificationPolygon polygon = polygons.getWinningPolygon(point); double waitTimeMinutes = polygon == null ? polygons.defaultData : polygon.data; if (waitTimeMinutes == -1) { return NO_SERVICE_HERE; } int waitTimeSeconds = (int) (waitTimeMinutes * 60); TIntSet stopsReachable = null; if (stopNumbersForZonePolygon != null) { stopsReachable = stopNumbersForZonePolygon.get(polygon); if (stopsReachable == null) { stopsReachable = new TIntHashSet(); } } return new AccessService(waitTimeSeconds, stopsReachable); }
Source:
public Integration getIntegration(final Project project, final ConnectorType connectorType) { notNull(project, "project"); notNull(connectorType, "connector"); try { return restTemplate.getForObject(Integration.URL, Integration.class, project.getId(), connectorType.getName()); } catch (GoodDataRestException | RestClientException e) { throw new ConnectorException("Unable to get " + connectorType + " integration", e); } }

Target:
public Integration getIntegration(final Project project, final ConnectorType connectorType) { notNull(project, "project"); notNull(connectorType, "connector"); try { return restTemplate.getForObject(Integration.URL, Integration.class, project.getId(), connectorType.getName()); } catch (GoodDataRestException e) { if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) { throw new IntegrationNotFoundException(project, connectorType, e); } else { throw e; } } catch (RestClientException e) { throw new ConnectorException("Unable to get " + connectorType + " integration", e); } }
Source:
private static @Nullable BiPredicate<IElementResolver, Function<IElementResolver, Map<String, String>>> getPredicate(@Nullable String regex) { if (regex == null || regex.isEmpty()) { return null; } Pattern filterPattern = Pattern.compile(regex); BiPredicate<IElementResolver, Function<IElementResolver, Map<String, String>>> filterPredicate = (item, function) -> { Map<String, String> toTest = new HashMap<>(function.apply(item)); toTest.putAll(item.computeData()); return Iterables.any(toTest.entrySet(), entry -> filterPattern.matcher(entry.getValue()).find()); }; return filterPredicate; }

Target:
private static @Nullable Predicate<Map<String, String>> getPredicate(@Nullable String regex) { if (regex == null || regex.isEmpty()) { return null; } Pattern filterPattern = Pattern.compile(regex); Predicate<Map<String, String>> filterPredicate = (toTest) -> { return Iterables.any(toTest.entrySet(), entry -> filterPattern.matcher(entry.getValue()).find()); }; return filterPredicate; }
Source:
public static int getUsedMemoryMegaBytes() { return (int)getUsedMemoryBytes() / 1024 / 1024; }

Target:
public static int getUsedMemoryMegaBytes() { return (int)(getUsedMemoryBytes() / 1024 / 1024); }
Source:
public GapAwareTrackingToken withGapsTruncatedAt(long truncationPoint) { if (gaps.isEmpty() || gaps.first() > truncationPoint) { return this; } SortedSet<Long> gaps = new ConcurrentSkipListSet<>(this.gaps.tailSet(truncationPoint)); return new GapAwareTrackingToken(this.index, gaps, truncationPoint); }

Target:
public GapAwareTrackingToken withGapsTruncatedAt(long truncationPoint) { if (gaps.isEmpty() || gaps.first() > truncationPoint) { return this; } SortedSet<Long> truncatedGaps = new ConcurrentSkipListSet<>(this.gaps.tailSet(truncationPoint)); return new GapAwareTrackingToken(this.index, truncatedGaps, truncationPoint); }
Source:
public UserDetailsService myUserDetailsService() { ExtendedInMemoryUserDetailsManager extendedInMemoryUserDetailsManager = new ExtendedInMemoryUserDetailsManager(); List<GrantedAuthority> salaboyAuthorities = new ArrayList<>(); salaboyAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); salaboyAuthorities.add(new SimpleGrantedAuthority("GROUP_activitiTeam")); extendedInMemoryUserDetailsManager.createUser(new User("salaboy", "password", salaboyAuthorities)); salaboyAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); salaboyAuthorities.add(new SimpleGrantedAuthority("GROUP_activitiTeam")); extendedInMemoryUserDetailsManager.createUser(new User("user", "password", salaboyAuthorities)); List<GrantedAuthority> adminAuthorities = new ArrayList<>(); adminAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_ADMIN")); extendedInMemoryUserDetailsManager.createUser(new User("admin", "password", adminAuthorities)); List<GrantedAuthority> garthAuthorities = new ArrayList<>(); garthAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); garthAuthorities.add(new SimpleGrantedAuthority("GROUP_doctor")); extendedInMemoryUserDetailsManager.createUser(new User("garth", "password", garthAuthorities)); List<GrantedAuthority> deanAuthorities = new ArrayList<>(); deanAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); extendedInMemoryUserDetailsManager.createUser(new User("dean", "password", deanAuthorities)); return extendedInMemoryUserDetailsManager; }

Target:
public UserDetailsService myUserDetailsService() { ExtendedInMemoryUserDetailsManager extendedInMemoryUserDetailsManager = new ExtendedInMemoryUserDetailsManager(); List<GrantedAuthority> salaboyAuthorities = new ArrayList<>(); salaboyAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); salaboyAuthorities.add(new SimpleGrantedAuthority("GROUP_activitiTeam")); extendedInMemoryUserDetailsManager.createUser(new User("salaboy", "password", salaboyAuthorities)); extendedInMemoryUserDetailsManager.createUser(new User("user", "password", salaboyAuthorities)); List<GrantedAuthority> adminAuthorities = new ArrayList<>(); adminAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_ADMIN")); extendedInMemoryUserDetailsManager.createUser(new User("admin", "password", adminAuthorities)); List<GrantedAuthority> garthAuthorities = new ArrayList<>(); garthAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); garthAuthorities.add(new SimpleGrantedAuthority("GROUP_doctor")); extendedInMemoryUserDetailsManager.createUser(new User("garth", "password", garthAuthorities)); List<GrantedAuthority> deanAuthorities = new ArrayList<>(); deanAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); extendedInMemoryUserDetailsManager.createUser(new User("dean", "password", deanAuthorities)); return extendedInMemoryUserDetailsManager; }
Source:
public static Tocd readObjectClassDefinition(Bundle bundle, String pid) throws IOException, Exception, XMLStreamException, FactoryConfigurationError { Tocd ocd = null; StringBuilder sbMetatypeXmlName = new StringBuilder(); sbMetatypeXmlName.append("OSGI-INF/metatype/").append(pid).append(".xml"); String metatypeXmlName = sbMetatypeXmlName.toString(); String metatypeXml = IOUtil.readResource(bundle, metatypeXmlName); if (metatypeXml != null) { Tmetadata metaData = unmarshalXml(metatypeXml, Tmetadata.class); if (metaData.getOCD() != null && metaData.getOCD().size() > 0) { ocd = (Tocd) metaData.getOCD().get(0); } } return ocd; }

Target:
public static Tocd readObjectClassDefinition(Bundle bundle, String pid) throws IOException, Exception, XMLStreamException, FactoryConfigurationError { Tocd ocd = null; StringBuilder sbMetatypeXmlName = new StringBuilder(); sbMetatypeXmlName.append("OSGI-INF/metatype/").append(pid).append(".xml"); String metatypeXmlName = sbMetatypeXmlName.toString(); String metatypeXml = IOUtil.readResource(bundle, metatypeXmlName); if (metatypeXml != null) { Tmetadata metaData = unmarshal(metatypeXml, Tmetadata.class); if (metaData.getOCD() != null && !metaData.getOCD().isEmpty()) { ocd = (Tocd) metaData.getOCD().get(0); } } return ocd; }
Source:
public MulePackageBuilder withClasses(File folder) { checkArgument(folder != null, "The folder must not be null"); checkArgument(folder.exists(), "The folder must must exists"); classesFolder = folder; return this; }

Target:
public MulePackageBuilder withClasses(File folder) { checkArgument(folder != null, "The folder must not be null"); checkArgument(folder.exists(), "The folder must exists"); classesFolder = folder; return this; }
Source:
private KeyStoreWatcher() { fileSystem = FileSystems.getDefault(); executor = Executors.newCachedThreadPool(); }

Target:
private KeyStoreWatcher() { fileSystem = FileSystems.getDefault(); }
Source:
public String toString() { return String.format("%n %s @ %.1f%%", this.getName(), this.getRemainingCapacity() * 100d); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Name: ").append(getName()).append(", "); sb.append("Remaining Capacity: ").append(getRemainingCapacity() * 100d).append("%, "); sb.append("Time Remaining: ").append(getFormattedTimeRemaining()); return sb.toString(); }
Source:
public Builder addPoint(@NonNull MeteringPoint point, @MeteringMode int mode) { if (mode == (MeteringMode.AF | MeteringMode.AE | MeteringMode.AWB) || mode == (MeteringMode.AF | MeteringMode.AE) || mode == (MeteringMode.AF | MeteringMode.AWB) || mode == MeteringMode.AF) { mMeteringPointsAf.add(point); } if (mode == (MeteringMode.AF | MeteringMode.AE | MeteringMode.AWB) || mode == (MeteringMode.AF | MeteringMode.AE) || mode == (MeteringMode.AE | MeteringMode.AWB) || mode == MeteringMode.AE) { mMeteringPointsAe.add(point); } if (mode == (MeteringMode.AF | MeteringMode.AE | MeteringMode.AWB) || mode == (MeteringMode.AE | MeteringMode.AWB) || mode == (MeteringMode.AF | MeteringMode.AWB) || mode == MeteringMode.AWB) { mMeteringPointsAwb.add(point); } return this; }

Target:
public Builder addPoint(@NonNull MeteringPoint point, @MeteringMode int mode) { Preconditions.checkArgument( (mode >= MeteringMode.AF) && (mode <= (MeteringMode.AF | MeteringMode.AE | MeteringMode.AWB)), "Invalid metering mode " + mode); if ((mode & MeteringMode.AF) != 0) { mMeteringPointsAf.add(point); } if ((mode & MeteringMode.AE) != 0) { mMeteringPointsAe.add(point); } if ((mode & MeteringMode.AWB) != 0) { mMeteringPointsAwb.add(point); } return this; }
Source:
public void detectConflicts() { Match match = diff.getMatch(); EObject value = getRelatedModelElement(diff); if (value != null) { Collection<ReferenceChange> refChanges = index.getReferenceChangesByValue(value); for (ReferenceChange candidate : Iterables.filter(refChanges, possiblyConflictingWith(diff))) { if (candidate.getReference().isContainment()) { conflict(candidate, REAL); } else { if (value.eContainer() == null) { if (candidate.getKind() != DELETE) { conflict(candidate, REAL); } } } } } EList<Diff> diffsInSameMatch = diff.getMatch().getDifferences(); for (Diff candidate : Iterables.filter(diffsInSameMatch, and(possiblyConflictingWith(diff), instanceOf(ResourceAttachmentChange.class)))) { ConflictKind kind = REAL; if (candidate.getKind() == DELETE) { final Resource diffRes; final Resource candidateRes; diffRes = match.getOrigin().eResource(); candidateRes = match.getOrigin().eResource(); if (getMatchResource(diffRes) == getMatchResource(candidateRes)) { kind = ConflictKind.PSEUDO; } } conflict(candidate, kind); } EObject o = getRelatedModelElement(diff); if ((o == null || o.eContainer() == null) && (diff.getConflict() == null || diff.getConflict().getKind() != ConflictKind.PSEUDO)) { for (Diff extendedCandidate : Iterables.filter(match.getAllDifferences(), possiblyConflictingWith(diff))) { if (isDeleteOrUnsetDiff(extendedCandidate)) { conflict(extendedCandidate, ConflictKind.PSEUDO); } else { conflict(extendedCandidate, ConflictKind.REAL); } } } }

Target:
public void detectConflicts() { Match match = diff.getMatch(); EObject value = getRelatedModelElement(diff); if (value != null) { Collection<ReferenceChange> refChanges = index.getReferenceChangesByValue(value); for (ReferenceChange candidate : Iterables.filter(refChanges, possiblyConflictingWith(diff))) { if (candidate.getReference().isContainment()) { conflict(candidate, REAL); } else { if (value.eContainer() == null) { if (candidate.getKind() != DELETE) { conflict(candidate, REAL); } } } } } EList<Diff> diffsInSameMatch = diff.getMatch().getDifferences(); for (Diff candidate : Iterables.filter(diffsInSameMatch, and(possiblyConflictingWith(diff), instanceOf(ResourceAttachmentChange.class)))) { ConflictKind kind = REAL; if (candidate.getKind() == DELETE) { final Resource diffRes; final Resource candidateRes; diffRes = match.getOrigin().eResource(); candidateRes = match.getOrigin().eResource(); if (getMatchResource(diffRes) == getMatchResource(candidateRes)) { kind = PSEUDO; } } conflict(candidate, kind); } EObject o = getRelatedModelElement(diff); if ((o == null || o.eContainer() == null) && (diff.getConflict() == null || diff.getConflict().getKind() != PSEUDO)) { for (Diff extendedCandidate : Iterables.filter(match.getAllDifferences(), possiblyConflictingWith(diff))) { if (isDeleteOrUnsetDiff(extendedCandidate)) { conflict(extendedCandidate, PSEUDO); } else { conflict(extendedCandidate, REAL); } } } }
Source:
private void adjustDependencyRefSetMembers(Date effectiveTime) { final SnomedRegularRefSet moduleDependencyRefSet = getEditingContext().lookup(REFSET_MODULE_DEPENDENCY_TYPE, SnomedRegularRefSet.class); if (!incomingModuleDependencyRefSetMembers.isEmpty()) { removeDuplicateMembers(effectiveTime, moduleDependencyRefSet); incomingModuleDependencyRefSetMembers.forEach((k, v) -> { final SnomedModuleDependencyRefSetMember memberToAdd = SnomedRefSetFactory.eINSTANCE.createSnomedModuleDependencyRefSetMember(); memberToAdd.setUuid(v); memberToAdd.setActive(true); memberToAdd.setRefSet(moduleDependencyRefSet); memberToAdd.setModuleId(k.getFirst()); memberToAdd.setReferencedComponentId(k.getSecond()); adjustRelased(memberToAdd); adjustEffectiveTime(memberToAdd, effectiveTime); moduleDependencyRefSet.getMembers().add(memberToAdd); }); } }

Target:
private void adjustDependencyRefSetMembers(Date effectiveTime) { if (!moduleToReferenceComponentIds.isEmpty()) { final SnomedRegularRefSet moduleDependencyRefSet = getEditingContext().lookup(REFSET_MODULE_DEPENDENCY_TYPE, SnomedRegularRefSet.class); moduleToReferenceComponentIds.forEach(moduleToRefComp -> { final SnomedRefSetMember lastMember = moduleDependencyRefSet.getMembers() .stream() .filter(member -> moduleToRefComp.getFirst().equals(member.getModuleId()) && moduleToRefComp.getSecond().equals(member.getReferencedComponentId())) .sorted((o1, o2) -> { if (null == o1.getEffectiveTime() && null == o2.getEffectiveTime()) { return 0; } else if (null == o1.getEffectiveTime() && null != o2.getEffectiveTime()) { return 1; } else if (null != o1.getEffectiveTime() && null == o2.getEffectiveTime()) { return -1; } return o1.getEffectiveTime().compareTo(o2.getEffectiveTime()); }).reduce((first, second) -> second).orElse(null); if (lastMember instanceof SnomedModuleDependencyRefSetMember) { SnomedModuleDependencyRefSetMember dependencyRefSetMember = (SnomedModuleDependencyRefSetMember) lastMember; adjustReleased(dependencyRefSetMember); adjustEffectiveTime(dependencyRefSetMember, effectiveTime); } else { final SnomedModuleDependencyRefSetMember memberToAdd = SnomedRefSetFactory.eINSTANCE.createSnomedModuleDependencyRefSetMember(); memberToAdd.setUuid(UUID.randomUUID().toString()); memberToAdd.setActive(true); memberToAdd.setRefSet(moduleDependencyRefSet); memberToAdd.setModuleId(moduleToRefComp.getFirst()); memberToAdd.setReferencedComponentId(moduleToRefComp.getSecond()); adjustReleased(memberToAdd); adjustEffectiveTime(memberToAdd, effectiveTime); moduleDependencyRefSet.getMembers().add(memberToAdd); } }); } }
Source:
static IntervalFunction of(long intervalMillis, Function<Long, Long> backoffFunction) { checkInterval(intervalMillis); requireNonNull(backoffFunction); return (attempt) -> { checkAttempt(attempt); if (attempt == 1) { return intervalMillis; } else { long currentIntervalMillis = intervalMillis; for(int i = 1; i < attempt; i++) { currentIntervalMillis = backoffFunction.apply(currentIntervalMillis); } return currentIntervalMillis; } }; }

Target:
static IntervalFunction of(long intervalMillis, Function<Long, Long> backoffFunction) { checkInterval(intervalMillis); requireNonNull(backoffFunction); return (attempt) -> { checkAttempt(attempt); return LongStream.iterate(intervalMillis, n -> backoffFunction.apply(n)).skip(attempt - 1).findFirst().getAsLong(); }; }
Source:
public void changesUpdateAttribute() throws Exception { final Bout bout = new MkBase().randomBout(); final Messages messages = bout.messages(); final Long last = bout.updated().getTime(); messages.post("hi"); final Long pause = 100L; Thread.sleep(pause); MatcherAssert.assertThat( bout.updated().getTime(), Matchers.greaterThan(last) ); }

Target:
public void changesUpdateAttribute() throws Exception { final Bout bout = new MkBase().randomBout(); final Messages messages = bout.messages(); final Long last = bout.updated().getTime(); messages.post("hi"); Thread.sleep(Tv.HUNDRED); MatcherAssert.assertThat( bout.updated().getTime(), Matchers.greaterThan(last) ); }
Source:
@Override protected void finalize() { shutdown(true); }

Target:
@Override protected void finalize() { if (isStarted()) { log.warn("%s garbage-collected but shutdown() was never called. " + "Don't rely on finalizers to clean up background threads.", this.getClass().getSimpleName()); shutdown(); } }
Source:
public void testValidateDataStreamsNoConflicts() { Metadata metadata = createIndices(5, 10, "foo-datastream").metadata; try { validateDataStreams(metadata.getIndicesLookup(), (DataStreamMetadata) metadata.customs().get(DataStreamMetadata.TYPE)); } catch (Exception e) { fail("did not expect exception when validating a system without indices that would conflict with future backing indices: " + e.getMessage()); } }

Target:
public void testValidateDataStreamsNoConflicts() { Metadata metadata = createIndices(5, 10, "foo-datastream").metadata; validateDataStreams(metadata.getIndicesLookup(), (DataStreamMetadata) metadata.customs().get(DataStreamMetadata.TYPE)); }
Source:
public void close() throws IOException { logBuilders(); }

Target:
public void close() throws IOException { logBuilders(); this.graph = (Graph<DefinitionSet, Node>) factoryManager.newElement(UUID.uuid(), diagramDefinitionSetClass); if (null == graph.getContent().getBounds()) { graph.getContent().setBounds(new BoundsImpl( new BoundImpl(0d, 0d), new BoundImpl(BPMNGraphFactory.GRAPH_DEFAULT_WIDTH, BPMNGraphFactory.GRAPH_DEFAULT_HEIGHT) )); } builderContext .init(graph) .execute(builderContext.getCommandFactory().clearGraph()); NodeObjectBuilder diagramBuilder = getDiagramBuilder(builderContext); if (diagramBuilder == null) { throw new RuntimeException("No diagrams found!"); } Node<View<BPMNDefinition>, Edge> diagramNode = (Node<View<BPMNDefinition>, Edge>) diagramBuilder.build(builderContext); graph.addNode(diagramNode); this.isClosed = true; }
Source:
protected void init(Bundle savedInstanceState) { super.init(savedInstanceState); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); try { CoreConfigurationBuilder builder = AnkiDroidApp.getInstance().getAcraCoreConfigBuilder(); DialogConfiguration dialogConfig = (DialogConfiguration)builder.getPluginConfigurationBuilder((DialogConfigurationBuilder.class)).build(); dialogBuilder.setIcon(dialogConfig.resIcon()); dialogBuilder.setTitle(dialogConfig.title()); dialogBuilder.setPositiveButton(dialogConfig.positiveButtonText(), AnkiDroidCrashReportDialog.this); dialogBuilder.setNegativeButton(dialogConfig.negativeButtonText(), AnkiDroidCrashReportDialog.this); } catch (ACRAConfigurationException ace) { Timber.e(ace, "Unable to initialize ACRA while creating ACRA dialog?"); } dialogBuilder.setView(buildCustomView(savedInstanceState)); AlertDialog mDialog = dialogBuilder.create(); mDialog.setCanceledOnTouchOutside(false); mDialog.setOnDismissListener(this); mDialog.show(); }

Target:
protected void init(Bundle savedInstanceState) { super.init(savedInstanceState); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); try { CoreConfigurationBuilder builder = AnkiDroidApp.getInstance().getAcraCoreConfigBuilder(); DialogConfiguration dialogConfig = (DialogConfiguration)builder.getPluginConfigurationBuilder((DialogConfigurationBuilder.class)).build(); dialogBuilder.setIcon(dialogConfig.resIcon()); dialogBuilder.setTitle(dialogConfig.title()); dialogBuilder.setPositiveButton(dialogConfig.positiveButtonText(), AnkiDroidCrashReportDialog.this); dialogBuilder.setNegativeButton(dialogConfig.negativeButtonText(), AnkiDroidCrashReportDialog.this); } catch (ACRAConfigurationException ace) { Timber.e(ace, "Unable to initialize ACRA while creating ACRA dialog?"); } dialogBuilder.setView(buildCustomView(savedInstanceState)); AlertDialog dialog = dialogBuilder.create(); dialog.setCanceledOnTouchOutside(false); dialog.setOnDismissListener(this); dialog.show(); }
Source:
private static List<Unit> generateWorkload() { ImmutableList.Builder<Unit> builder = new ImmutableList.Builder<>(); for (int i = 0; i < 10; i++) { byte[] srcBytes = getAlphaNumericString(sourceLength).getBytes(); byte[] compressedBytes = new byte[sourceLength * 32]; int size = compressor.compress(srcBytes, 0, srcBytes.length, compressedBytes, 0, compressedBytes.length); builder.add(new Unit(srcBytes, sourceLength, compressedBytes, size)); } return builder.build(); }

Target:
private static List<Unit> generateWorkload() { ImmutableList.Builder<Unit> builder = new ImmutableList.Builder<>(); for (int i = 0; i < 10; i++) { byte[] sourceBytes = getAlphaNumericString(sourceLength).getBytes(); byte[] compressedBytes = new byte[sourceLength * 32]; int size = compressor.compress(sourceBytes, 0, sourceBytes.length, compressedBytes, 0, compressedBytes.length); builder.add(new Unit(sourceBytes, sourceLength, compressedBytes, size)); } return builder.build(); }
Source:
public BehaviorState modify(Actor oreon, BehaviorState result) { OreonAttributeComponent oreonAttributeComponent = oreon.getComponent(OreonAttributeComponent.class); if (oreonAttributeComponent.hunger > 50) { if (taskManagementSystem.assignAdvancedTaskToOreon(oreon, AssignedTaskType.Eat)) { return BehaviorState.SUCCESS; } else { String message = "We are hungry, build a diner!"; lastNotification = delayedNotificationSystem.sendNotification(message, notificationMessageEntity, lastNotification); oreonHealthSystem.reduceHealth(oreon, "hunger"); } } return BehaviorState.FAILURE; }

Target:
public BehaviorState modify(Actor oreon, BehaviorState result) { OreonAttributeComponent oreonAttributeComponent = oreon.getComponent(OreonAttributeComponent.class); if (oreonAttributeComponent.hunger > 50) { if (taskManagementSystem.assignAdvancedTaskToOreon(oreon, AssignedTaskType.Eat)) { return BehaviorState.SUCCESS; } else { String message = "We are hungry. Build a diner!"; lastNotification = delayedNotificationSystem.sendNotification(message, notificationMessageEntity, lastNotification); oreonHealthSystem.reduceHealth(oreon, "hunger"); } } return BehaviorState.FAILURE; }
Source:
default void beforeDataProviderExecution(IDataProviderMethod dataProviderMethod, ITestNGMethod method, ITestContext iTestContext) { throw new UnsupportedOperationException("Method is not implemented"); }

Target:
default void beforeDataProviderExecution(IDataProviderMethod dataProviderMethod, ITestNGMethod method, ITestContext iTestContext) { }
Source:
public List<String> getValues() { return new ArrayList<>(fValues.keySet()); }

Target:
public Set<String> getValues() { synchronized (fValues) { return fValues.keySet(); } }
Source:
public void getPublicIPAddress() { final PublicIPAddressApi ipApi = api.getPublicIPAddressApi(resourcegroup); PublicIPAddress ip = ipApi.get(publicIpAddressName); while (ip.properties().provisioningState().equals("Updating")) { try { Thread.sleep(10 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } ip = ipApi.get(publicIpAddressName); } assertNotNull(ip); assertEquals(ip.name(), publicIpAddressName); assertEquals(ip.location(), LOCATION); assertEquals(ip.id(), String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/publicIPAddresses/%s", subscriptionid, resourcegroup, publicIpAddressName)); assertEquals(ip.tags().get("testkey"), "testvalue"); assertNotNull(ip.properties()); assertEquals(ip.properties().provisioningState(), "Succeeded"); assertNotNull(ip.properties().ipAddress()); assertEquals(ip.properties().publicIPAllocationMethod(), "Static"); assertEquals(ip.properties().idleTimeoutInMinutes().intValue(), 4); }

Target:
public void getPublicIPAddress() { final PublicIPAddressApi ipApi = api.getPublicIPAddressApi(resourcegroup); boolean jobDone = Predicates2.retry(new Predicate<String>() { @Override public boolean apply(String name) { return ipApi.get(name).properties().provisioningState().equals("Succeeded"); } }, 10 * 1000).apply(publicIpAddressName); assertTrue(jobDone, "get operation did not complete in the configured timeout"); PublicIPAddress ip = ipApi.get(publicIpAddressName); assertNotNull(ip); assertEquals(ip.name(), publicIpAddressName); assertEquals(ip.location(), LOCATION); assertEquals(ip.id(), String.format("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/publicIPAddresses/%s", subscriptionid, resourcegroup, publicIpAddressName)); assertEquals(ip.tags().get("testkey"), "testvalue"); assertNotNull(ip.properties()); assertEquals(ip.properties().provisioningState(), "Succeeded"); assertNotNull(ip.properties().ipAddress()); assertEquals(ip.properties().publicIPAllocationMethod(), "Static"); assertEquals(ip.properties().idleTimeoutInMinutes().intValue(), 4); }
Source:
public void beforeStageStarts() { Preferences prefs = Preferences.create(TestController.TEST_DIRECTORY, TestController.TEST_SESSION_CONFIG_FILENAME, TestController.TEST_USER_CONFIG_FILENAME); prefs.setLastLoginCredentials("test", "test"); prefs.setLastViewedRepository("dummy/dummy"); }

Target:
public void beforeStageStarts() { Preferences prefs = TestController.createTestPreferences(); prefs.setLastLoginCredentials("test", "test"); prefs.setLastViewedRepository("dummy/dummy"); }
Source:
public void runTest(List<Integer> ints) throws IOException { int[] inputArray = ints.stream().mapToInt(Integer::intValue).toArray(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); CramIntArray.write(inputArray, baos); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); int[] outputArray = CramIntArray.array(bais); Assert.assertEquals(inputArray, outputArray, "Arrays did not match"); baos.close(); bais.close(); }

Target:
public void runTest(List<Integer> ints) throws IOException { int[] inputArray = ints.stream().mapToInt(Integer::intValue).toArray(); try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { CramIntArray.write(inputArray, baos); try (ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray())) { int[] outputArray = CramIntArray.array(bais); Assert.assertEquals(inputArray, outputArray, "Arrays did not match"); } } }
Source:
private FilePath createWindowsGitSSH(FilePath key, String user) throws IOException, InterruptedException { FilePath ssh = workspace.createTempFile("ssh", ".bat"); FilePath sshexe = getSSHExecutable(); ssh.write("@echo off\n" + "\"" + sshexe.getRemote() + "\" -i \"" + key.getRemote() +"\" -l \"" + user + "\" -o StrictHostKeyChecking=no %* ", null); ssh.chmod(0700); return ssh; }

Target:
private FilePath createWindowsGitSSH(FilePath key, String user) throws IOException, InterruptedException { FilePath sshexe = getSSHExecutable(); FilePath ssh = workspace.createTextTempFile("ssh", ".bat", "@echo off\r\n" + "\"" + sshexe.getRemote() + "\" -i \"" + key.getRemote() +"\" -l \"" + user + "\" -o StrictHostKeyChecking=no %* ", false); return ssh; }
Source:
public ChatComponent setBold(boolean bold) { $lock.writeLock().lock(); if (this.bold == null) this.bold = new AtomicBoolean(bold); else this.bold.set(bold); $lock.writeLock().unlock(); return this; }

Target:
public ChatComponent setBold(boolean bold) { if (this.bold == null) this.bold = new AtomicBoolean(bold); else this.bold.set(bold); return this; }
Source:
private void receive(String msg, InetSocketAddress remoteAddress) { if (logger.isInfoEnabled()) { logger.info("Receive multicast message: " + msg + " from " + remoteAddress); } if (msg.startsWith(Constants.REGISTER)) { URL url = URL.valueOf(msg.substring(Constants.REGISTER.length()).trim()); registered(url); } else if (msg.startsWith(Constants.UNREGISTER)) { URL url = URL.valueOf(msg.substring(Constants.UNREGISTER.length()).trim()); unregistered(url); } else if (msg.startsWith(Constants.SUBSCRIBE)) { URL url = URL.valueOf(msg.substring(Constants.SUBSCRIBE.length()).trim()); Set<URL> urls = getRegistered(); if (CollectionUtils.isNotEmpty(urls)) { for (URL u : urls) { if (UrlUtils.isMatch(url, u)) { boolean isLocalhost = false; String host = null; if (remoteAddress != null && remoteAddress.getAddress() != null && NetUtils.getLocalHost().equals(remoteAddress.getAddress().getHostAddress())) { isLocalhost = true; host = remoteAddress.getAddress().getHostAddress(); } if (!isLocalhost && NetUtils.getLocalHost().equals(url.getIp())) { isLocalhost = true; host = url.getIp(); } if (url.getParameter("unicast", true) && !isLocalhost) { unicast(Constants.REGISTER + " " + u.toFullString(), host); } else { multicast(Constants.REGISTER + " " + u.toFullString()); } } } } } }

Target:
private void receive(String msg, InetSocketAddress remoteAddress) { if (logger.isInfoEnabled()) { logger.info("Receive multicast message: " + msg + " from " + remoteAddress); } if (msg.startsWith(Constants.REGISTER)) { URL url = URL.valueOf(msg.substring(Constants.REGISTER.length()).trim()); registered(url); } else if (msg.startsWith(Constants.UNREGISTER)) { URL url = URL.valueOf(msg.substring(Constants.UNREGISTER.length()).trim()); unregistered(url); } else if (msg.startsWith(Constants.SUBSCRIBE)) { URL url = URL.valueOf(msg.substring(Constants.SUBSCRIBE.length()).trim()); Set<URL> urls = getRegistered(); if (CollectionUtils.isNotEmpty(urls)) { for (URL u : urls) { if (UrlUtils.isMatch(url, u)) { boolean isLocalhost = false; if (remoteAddress != null && remoteAddress.getAddress() != null && NetUtils.getLocalHost().equals(remoteAddress.getAddress().getHostAddress())) { isLocalhost = true; } if (!isLocalhost && NetUtils.getLocalHost().equals(url.getIp())) { isLocalhost = true; } String host = remoteAddress != null && remoteAddress.getAddress() != null ? remoteAddress.getAddress().getHostAddress() : url.getIp(); if (url.getParameter("unicast", true) && !isLocalhost) { unicast(Constants.REGISTER + " " + u.toFullString(), host); } else { multicast(Constants.REGISTER + " " + u.toFullString()); } } } } } }
Source:
protected static void saveResponseToPage(Long page_id, Listing listing, Map<String,String> responses){ Page page = null; try { Logger.info("Try to find response page with page id: " + page_id); page = listing.getResponsePageByPageId(page_id); } catch (Exception e) { Logger.error(e.getMessage()); error(); } if(page == null){ Logger.info("Page does not exist, creating new page"); page = new Page(listing.id, page_id); saveResponseToNewPage(page, responses); } else { Logger.info("Page does exist, updating current page"); saveResponseToExistingPage(page, responses); } listing.addResponsePage(page, page_id, supplierDetailsFromCookie.get("supplierEmail")); }

Target:
protected static void saveResponseToPage(Long page_id, Listing listing, Map<String,String> responses){ Page page = null; try { page = listing.getResponsePageByPageId(page_id); } catch (Exception e) { Logger.error(e.getMessage()); error(); } if(page == null){ page = new Page(listing.id, page_id); saveResponseToNewPage(page, responses); } else { saveResponseToExistingPage(page, responses); } listing.addResponsePage(page, page_id, getEmail()); }
Source:
public String toString() { return throwable == null ? "Processed: " + processedCount + ", Active: " + activeCount + ", Put: " + putCount + ", TTL update count: " + ttlUpdateCount + ", Delete: " + deleteCount + ", Crafted ID count: " + craftedIdCount + ", Duplicate Puts: " + duplicatePuts + ", Put After Update: " + putAfterUpdates + ", Duplicate Delete: " + duplicateDeletes + ", Duplicate Update: " + duplicateUpdates + ", Update After Delete: " + updateAfterDeletes : "Exception Msg: " + throwable.getMessage(); }

Target:
public String toString() { return throwable == null ? "Processed: " + processedCount + ", Active: " + activeCount + ", Put: " + putCount + ", TTL update count: " + ttlUpdateCount + ", Delete: " + deleteCount + ", Crafted ID count: " + craftedIdCount + ", Duplicate Puts: " + duplicatePuts + ", Put After Update: " + putAfterUpdates + ", Duplicate Delete: " + duplicateDeletes + ", Duplicate Update: " + duplicateUpdates + ", Update After Delete: " + updateAfterDeletes + ", Duplicate Keys: " + duplicateKeys : "Exception Msg: " + throwable.getMessage(); }
Source:
public boolean isGatewayExist(AuthzToken authzToken, String gatewayId) throws TenantProfileServiceException, AuthorizationException, TException { try { Gateway gateway = tenantProfileRepository.getGateway(gatewayId); boolean checkStatus = gateway.getGatewayApprovalStatus().equals(GatewayApprovalStatus.APPROVED); return (gateway != null && checkStatus); } catch (Exception ex) { logger.error("Error checking if gateway-profile exists, reason: " + ex.getMessage(), ex); TenantProfileServiceException exception = new TenantProfileServiceException(); exception.setMessage("Error checking if gateway-profile exists, reason: " + ex.getMessage()); throw exception; } }

Target:
public boolean isGatewayExist(AuthzToken authzToken, String gatewayId) throws TenantProfileServiceException, AuthorizationException, TException { try { Gateway gateway = tenantProfileRepository.getGateway(gatewayId); return (gateway != null); } catch (Exception ex) { logger.error("Error checking if gateway-profile exists, reason: " + ex.getMessage(), ex); TenantProfileServiceException exception = new TenantProfileServiceException(); exception.setMessage("Error checking if gateway-profile exists, reason: " + ex.getMessage()); throw exception; } }