auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,6,0),new UpgradeScriptFor260(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,1), new UpgradeScriptForModifySchemaPermissionAndDefaultRole(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1812), new UpgradeScriptToCleanSysRoutinePerms(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1817), new UpgradeScriptForSysTokens(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1840), new UpgradeScriptForDroppedConglomerates(sdd,tc)); }

Target:
public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,6,0),new UpgradeScriptFor260(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,1), new UpgradeScriptForModifySchemaPermissionAndDefaultRole(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1812), new UpgradeScriptToCleanSysRoutinePerms(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1817), new UpgradeScriptForSysTokens(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1842), new UpgradeScriptForDroppedConglomerates(sdd,tc)); }
Source:
public boolean changeAffiliations(HashMap<Jid, MUCLightAffiliation> affiliations) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations); StanzaFilter responseFilter = new IQReplyFilter(changeAffiliationsIQ, connection); IQ responseIq = connection.createPacketCollectorAndSend(responseFilter, changeAffiliationsIQ) .nextResultOrThrow(); return responseIq.getType().equals(IQ.Type.result); }

Target:
public void changeAffiliations(HashMap<Jid, MUCLightAffiliation> affiliations) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations); connection.createPacketCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow(); }
Source:
public void testEnableFail() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(enabledResponse().setResponseCode(404))); try { CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles"); CDNApi cdnApi = api.cdnApiInRegion("DFW"); URI enabledContainer = cdnApi.enable("container-1"); assertNull(enabledContainer); assertEquals(server.getRequestCount(), 2); assertAuthentication(server); assertRequest(server.takeRequest(), "PUT", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/container-1"); } finally { server.shutdown(); } }

Target:
public void testEnableFail() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(enabledResponse().setResponseCode(404))); try { CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles"); assertNull(api.cdnApiInRegion("DFW").enable("container-1")); assertEquals(server.getRequestCount(), 2); assertAuthentication(server); assertRequest(server.takeRequest(), "PUT", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/container-1"); } finally { server.shutdown(); } }
Source:
protected AccountAttributes authenticateAndGetNominalUser(UserType loggedInUserType) { String paramRequestedUserId = request.getParameter(Const.ParamsNames.USER_ID); AccountAttributes account = null; if (!isMasqueradeModeRequested(loggedInUser, paramRequestedUserId)) { account = loggedInUser; boolean isUserLoggedIn = (account.googleId != null); if (isPersistenceIssue() && isHomePage()) { } else if (doesUserNeedRegistration(account) && !loggedInUserType.isAdmin) { if (regkey != null && student != null) { String joinUrl = new Url(student.getRegistrationUrl()) .withParam(Const.ParamsNames.NEXT_URL, requestUrl) .toString(); setRedirectPage(joinUrl); return null; } throw new UnauthorizedAccessException("Unregistered user for a page that needs one"); } else if (isPageNotCourseJoinRelated() && doesRegkeyBelongToUnregisteredStudent() && isUserLoggedIn) { Url redirectUrl = new Url(student.getRegistrationUrl()) .withParam(Const.ParamsNames.STUDENT_NEW_COURSE, student.course) .withParam(Const.ParamsNames.NEXT_URL, requestUrl); setRedirectPage(redirectUrl.toString()); return null; } } else if (loggedInUserType.isAdmin) { account = logic.getAccount(paramRequestedUserId); if (account == null) { regkey = getRegkeyFromRequest(); if (regkey == null) { regkey = "any-non-null-value"; } account = new AccountAttributes(); account.googleId = paramRequestedUserId; } } else { throw new UnauthorizedAccessException("User " + loggedInUserType.id + " is trying to masquerade as " + paramRequestedUserId + " without admin permission."); } return account; }

Target:
protected AccountAttributes authenticateAndGetNominalUser(UserType loggedInUserType) { String paramRequestedUserId = request.getParameter(Const.ParamsNames.USER_ID); AccountAttributes account = null; if (!isMasqueradeModeRequested(loggedInUser, paramRequestedUserId)) { account = loggedInUser; boolean isUserLoggedIn = (account.googleId != null); if (isPersistenceIssue() && isHomePage()) { } else if (doesUserNeedRegistration(account) && !loggedInUserType.isAdmin) { if (regkey != null && student != null) { String joinUrl = new Url(student.getRegistrationUrl()) .withParam(Const.ParamsNames.NEXT_URL, requestUrl) .toString(); setRedirectPage(joinUrl); return null; } throw new UnauthorizedAccessException("Unregistered user for a page that needs one"); } else if (isPageNotCourseJoinRelated() && doesRegkeyBelongToUnregisteredStudent() && isUserLoggedIn) { Url redirectUrl = new Url(student.getRegistrationUrl()) .withParam(Const.ParamsNames.NEXT_URL, requestUrl); setRedirectPage(redirectUrl.toString()); return null; } } else if (loggedInUserType.isAdmin) { account = logic.getAccount(paramRequestedUserId); if (account == null) { regkey = getRegkeyFromRequest(); if (regkey == null) { regkey = "any-non-null-value"; } account = new AccountAttributes(); account.googleId = paramRequestedUserId; } } else { throw new UnauthorizedAccessException("User " + loggedInUserType.id + " is trying to masquerade as " + paramRequestedUserId + " without admin permission."); } return account; }
Source:
public String getEndpointsInfo() { final StringBuilder msg = new StringBuilder(1024); final Set<EndpointLogLine> endpointLogLines = Sets.newTreeSet(); msg.append("The following paths were found for the configured resources:"); msg.append(NEWLINE).append(NEWLINE); final Set<Class<?>> allResources = Sets.newHashSet(); for (Class<?> clazz : allClasses()) { if (!clazz.isInterface() && Resource.from(clazz) != null) { allResources.add(clazz); } } for (Class<?> klass : allResources) { new EndpointLogger(urlPattern, klass).populate(endpointLogLines); } if (!endpointLogLines.isEmpty()) { for (EndpointLogLine line : endpointLogLines) { msg.append(line).append(NEWLINE); } } else { msg.append(" NONE").append(NEWLINE); } return msg.toString(); }

Target:
public String getEndpointsInfo() { final StringBuilder msg = new StringBuilder(1024); final Set<EndpointLogLine> endpointLogLines = Sets.newTreeSet(new EndpointComparator()); msg.append("The following paths were found for the configured resources:"); msg.append(NEWLINE).append(NEWLINE); final Set<Class<?>> allResources = Sets.newHashSet(); for (Class<?> clazz : allClasses()) { if (!clazz.isInterface() && Resource.from(clazz) != null) { allResources.add(clazz); } } for (Class<?> klass : allResources) { new EndpointLogger(urlPattern, klass).populate(endpointLogLines); } if (!endpointLogLines.isEmpty()) { for (EndpointLogLine line : endpointLogLines) { msg.append(line).append(NEWLINE); } } else { msg.append(" NONE").append(NEWLINE); } return msg.toString(); }
Source:
private static String asString(Object v) { try { return new String((byte[]) v, "utf8"); } catch (UnsupportedEncodingException e) { throw new CacheException(e); } }

Target:
private static String asString(Object v) { return new String((byte[]) v, CHARSET_UTF8); }
Source:
public EC2HardwareBuilder virtualizationTypes(VirtualizationType ...virtualizationTypes) { Preconditions.checkArgument(virtualizationTypes.length > 0, "At least one virtualization type is required."); if (virtualizationTypes.length == 1) { this.virtualizationType = new RequiresVirtualizationType(virtualizationTypes[0]); } else { List<RequiresVirtualizationType> supportedVirtualizationTypes = Lists.newArrayList(); for (VirtualizationType virtualizationType : virtualizationTypes) { supportedVirtualizationTypes.add(new RequiresVirtualizationType(virtualizationType)); } this.virtualizationType = Predicates.or(supportedVirtualizationTypes); } return this; }

Target:
public EC2HardwareBuilder virtualizationTypes(VirtualizationType ...virtualizationTypes) { Preconditions.checkNotNull(virtualizationTypes, "virtualizationTypes"); Preconditions.checkArgument(virtualizationTypes.length > 0, "At least one virtualization type is required."); if (virtualizationTypes.length == 1) { this.virtualizationType = new RequiresVirtualizationType(virtualizationTypes[0]); } else { List<RequiresVirtualizationType> supportedVirtualizationTypes = Lists.newArrayList(); for (VirtualizationType virtualizationType : virtualizationTypes) { supportedVirtualizationTypes.add(new RequiresVirtualizationType( Preconditions.checkNotNull(virtualizationType, "virtualizationType"))); } this.virtualizationType = Predicates.or(supportedVirtualizationTypes); } return this; }
Source:
private static double calculateT(final TargetCollection<TargetCoverage> targets, final List<ModeledSegment> segments) { final List<ModeledSegment> copyNeutralSegments = segments.stream().filter(s -> s.getSegmentMean() < COPY_NEUTRAL_CUTOFF).collect(Collectors.toList()); final List<TargetCoverage> copyNeutralTargets = copyNeutralSegments.stream() .flatMap(s -> targets.targets(s).stream()).collect(Collectors.toList()); final double copyNeutralTargetsCopyRatio = copyNeutralTargets.stream().mapToDouble(TargetCoverage::getCoverage).toArray(); final double meanCopyNeutralTargets = new Mean().evaluate(copyNeutralTargetsCopyRatio); final double sigmaCopyNeutralTargets = new StandardDeviation().evaluate(copyNeutralTargetsCopyRatio); final double filteredCopyNeutralTargetsCopyRatio = Arrays.stream(copyNeutralTargetsCopyRatio) .filter(c -> Math.abs(c - meanCopyNeutralTargets) < sigmaCopyNeutralTargets * 2).toArray(); return new StandardDeviation().evaluate(filteredCopyNeutralTargetsCopyRatio); }

Target:
private static double calculateT(final TargetCollection<TargetCoverage> targets, final List<ModeledSegment> segments) { final List<ModeledSegment> copyNeutralSegments = segments.stream().filter(s -> s.getSegmentMean() < COPY_NEUTRAL_CUTOFF).collect(Collectors.toList()); final List<TargetCoverage> copyNeutralTargets = copyNeutralSegments.stream() .flatMap(s -> targets.targets(s).stream()).collect(Collectors.toList()); final double copyNeutralTargetsCopyRatio = copyNeutralTargets.stream().mapToDouble(TargetCoverage::getCoverage).toArray(); final double meanCopyNeutralTargets = new Mean().evaluate(copyNeutralTargetsCopyRatio); final double sigmaCopyNeutralTargets = new StandardDeviation().evaluate(copyNeutralTargetsCopyRatio); final double filteredCopyNeutralTargetsCopyRatio = Arrays.stream(copyNeutralTargetsCopyRatio) .filter(c -> Math.abs(c - meanCopyNeutralTargets) < sigmaCopyNeutralTargets * Z_THRESHOLD).toArray(); return new StandardDeviation().evaluate(filteredCopyNeutralTargetsCopyRatio); }
Source:
public void testCLIFsckDDbInternalParam() throws Exception { final int result = run(S3GuardTool.Fsck.NAME, "-"+Fsck.DDB_MS_CONSISTENCY_FLAG, "s3a://" + getFileSystem().getBucket()); LOG.info("This test serves the purpose to run fsck with the correct " + "parameters, so there will be no exception thrown. " + "The return value of the run: {}", result); }

Target:
public void testCLIFsckDDbInternalParam() throws Exception { describe("This test serves the purpose to run fsck with the correct " + "parameters, so there will be no exception thrown."); final int result = run(S3GuardTool.Fsck.NAME, "-" + Fsck.DDB_MS_CONSISTENCY_FLAG, "s3a://" + getFileSystem().getBucket()); LOG.info("The return value of the run: {}", result); }
Source:
public Tracker(Context context) { if (null == context) { return; } mContext = context; }

Target:
public Tracker(Context context) throws IllegalArgumentException { if (null == context) { throw new IllegalArgumentException("Tracker requires a not-null context"); } mContext = context; }
Source:
private ArrayList<JsonArrayEntry> lwM2mResourceToJsonArrayEntry(String resourcePath, Long timestamp, LwM2mResource resource) { ResourceModel rSpec = model.getResourceModel(objectId, resource.getId()); Type expectedType = rSpec != null ? rSpec.type : resource.getType(); ArrayList<JsonArrayEntry> resourcesList = new ArrayList<>(); if (resource.isMultiInstances()) { for (Entry<Integer, ?> entry : resource.getValues().entrySet()) { String resourceInstancePath; if (resourcePath == null || resourcePath.isEmpty()) { resourceInstancePath = Integer.toString(entry.getKey()); } else { resourceInstancePath = resourcePath + "/" + entry.getKey(); } JsonArrayEntry jsonArrayEntry = createJsonArrayEntry(resourceInstancePath, timestamp, resource.getType(), expectedType, entry.getValue()); resourcesList.add(jsonArrayEntry); } } else { JsonArrayEntry jsonArrayEntry = createJsonArrayEntry(resourcePath, timestamp, resource.getType(), expectedType, resource.getValue()); resourcesList.add(jsonArrayEntry); } return resourcesList; }

Target:
private ArrayList<JsonArrayEntry> lwM2mResourceToJsonArrayEntry(String resourcePath, Long timestamp, LwM2mResource resource) { ResourceModel rSpec = model.getResourceModel(objectId, resource.getId()); Type expectedType = rSpec != null ? rSpec.type : resource.getType(); ArrayList<JsonArrayEntry> resourcesList = new ArrayList<>(); if (resource.isMultiInstances()) { for (Entry<Integer, LwM2mResourceInstance> entry : resource.getInstances().entrySet()) { String resourceInstancePath; LwM2mResourceInstance instance = entry.getValue(); if (resourcePath == null || resourcePath.isEmpty()) { resourceInstancePath = Integer.toString(entry.getKey()); } else { resourceInstancePath = resourcePath + "/" + entry.getKey(); } JsonArrayEntry jsonArrayEntry = createJsonArrayEntry(resourceInstancePath, timestamp, resource.getType(), expectedType, instance.getValue()); resourcesList.add(jsonArrayEntry); } } else { JsonArrayEntry jsonArrayEntry = createJsonArrayEntry(resourcePath, timestamp, resource.getType(), expectedType, resource.getValue()); resourcesList.add(jsonArrayEntry); } return resourcesList; }
Source:
public Builder(DataSegment segment) { this.dataSource = segment.getDataSource(); this.interval = segment.getInterval(); this.version = segment.getVersion(); this.loadSpec = segment.getLoadSpec(); this.dimensions = segment.getDimensions(); this.metrics = segment.getMetrics(); this.shardSpec = segment.getShardSpec(); this.compactionPartitionsSpec = segment.compactionPartitionsSpec; this.binaryVersion = segment.getBinaryVersion(); this.size = segment.getSize(); }

Target:
public Builder(DataSegment segment) { this.dataSource = segment.getDataSource(); this.interval = segment.getInterval(); this.version = segment.getVersion(); this.loadSpec = segment.getLoadSpec(); this.dimensions = segment.getDimensions(); this.metrics = segment.getMetrics(); this.shardSpec = segment.getShardSpec(); this.lastCompactionState = segment.getLastCompactionState(); this.binaryVersion = segment.getBinaryVersion(); this.size = segment.getSize(); }
Source:
private void applyChanges() { final HashMap<String, String> params = generatePostParams(); if (params.size() > 0) { WordPress.getRestClientUtils().setGeneralSiteSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (params.containsKey("blogname")) { mBlog.setBlogName(params.get("blogname")); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if (mTaglinePreference != null) { mTaglinePreference.setEnabled(false); mTaglinePreference.setSummary("Failed to retrieve :("); } } }, params); } }

Target:
private void applyChanges() { final HashMap<String, String> params = generatePostParams(); if (params.size() > 0) { WordPress.getRestClientUtils().setGeneralSiteSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (params.containsKey("blogname")) { mBlog.setBlogName(params.get("blogname")); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error POSTing site settings changes: " + error); if (isAdded()) { ToastUtils.showToast(getActivity(), getString(R.string.error_post_remote_site_settings)); } } }, params); } }
Source:
public void runDemoMode() { PopulateDB.wipeSurveys(); PreferencesState.getInstance().saveStringPreference(R.string.org_unit, ""); PreferencesState.getInstance().reloadPreferences(); android.support.v7.app.ActionBar actionBar = mBaseActivity.getSupportActionBar(); LayoutUtils.setActionBarLogo(actionBar); LayoutUtils.setActionBarText(actionBar, PreferencesState.getInstance().getContext().getResources().getString( R.string.malaria_case_based_reporting), ""); loginDemoMode(); }

Target:
public void runDemoMode() { mLogoutUseCase.execute(new LogoutUseCase.Callback() { @Override public void onLogoutSuccess() { PreferencesState.getInstance().reloadPreferences(); updateActionBarTitleAfterLogout(); loginDemoMode(); } @Override public void onLogoutError(String message) { Log.e(TAG, message); } }); }
Source:
public ThriftMessageParser(SecorConfig config) { super(config); mDeserializer = new TDeserializer(); this.fieldName = config.getMessageTimestampName(); }

Target:
public ThriftMessageParser(SecorConfig config) { super(config); mDeserializer = new TDeserializer(); }
Source:
public void parsePaymentRequest_withReturnUrlAndLanguageAndDelayedCapture_shouldParseSuccessfully() throws Exception { String payload = "{\n" + " \"amount\": 1000,\n" + " \"reference\": \"Some reference\",\n" + " \"description\": \"Some description\",\n" + " \"return_url\": \"<LINK_0>\",\n" + " \"language\": \"en\",\n" + " \"delayed_capture\": false\n" + "}"; JsonNode jsonNode = objectMapper.readTree(payload); CreatePaymentRequest createPaymentRequest = parsePaymentRequest(jsonNode); assertThat(createPaymentRequest, is(notNullValue())); assertThat(createPaymentRequest.getAmount(), is(1000)); assertThat(createPaymentRequest.getReference(), is("Some reference")); assertThat(createPaymentRequest.getDescription(), is("Some description")); assertThat(createPaymentRequest.getReturnUrl(), is("<LINK_0>")); assertThat(createPaymentRequest.getLanguage(), is("en")); assertThat(createPaymentRequest.getDelayedCapture(), is(false)); }

Target:
public void parsePaymentRequest_withReturnUrlAndLanguageAndDelayedCapture_shouldParseSuccessfully() throws Exception { String payload = "{\n" + " \"amount\": 1000,\n" + " \"reference\": \"Some reference\",\n" + " \"description\": \"Some description\",\n" + " \"return_url\": \"<LINK_0>\",\n" + " \"language\": \"en\",\n" + " \"delayed_capture\": true\n" + "}"; JsonNode jsonNode = objectMapper.readTree(payload); CreatePaymentRequest createPaymentRequest = parsePaymentRequest(jsonNode); assertThat(createPaymentRequest, is(notNullValue())); assertThat(createPaymentRequest.getAmount(), is(1000)); assertThat(createPaymentRequest.getReference(), is("Some reference")); assertThat(createPaymentRequest.getDescription(), is("Some description")); assertThat(createPaymentRequest.getReturnUrl(), is("<LINK_0>")); assertThat(createPaymentRequest.getLanguage(), is("en")); assertThat(createPaymentRequest.getDelayedCapture(), is(true)); }
Source:
public void getPaths(GroupType schema, List<String> paths, String parent) { List<Type> fields = schema.getFields(); String prefix = (parent == null) ? "" : parent + "."; for (Type field : fields) { paths.add(prefix + field.getName()); if (field instanceof GroupType) { getPaths(field.asGroupType(), paths, prefix + field.getName()); } } }

Target:
private void getPaths(GroupType schema, List<String> paths, String parent) { List<Type> fields = schema.getFields(); String prefix = (parent == null) ? "" : parent + "."; for (Type field : fields) { paths.add(prefix + field.getName()); if (field instanceof GroupType) { getPaths(field.asGroupType(), paths, prefix + field.getName()); } } }
Source:
public Partition[] listPartitions() { getLog().info("fetching partitions information"); final List<String> zkPartitions; try { zkPartitions = getCurator().getChildren().forPath(getSubscriptionPath("/topics")); } catch (KeeperException.NoNodeException ex) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception e) { throw new NakadiRuntimeException(e); } try { final List<Partition> partitions = new ArrayList<>(); for (final String topic : zkPartitions) { for (final String partition : getCurator().getChildren().forPath(getSubscriptionPath("/topics/" + topic))) { partitions.add(deserializeNode( getTopicToEventType().get(topic), partition, getCurator().getData().forPath(getPartitionPath( new EventTypePartition(getTopicToEventType().get(topic), partition))))); } } return partitions.toArray(new Partition[partitions.size()]); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }

Target:
public Partition[] listPartitions() throws NakadiRuntimeException { getLog().info("fetching partitions information"); final List<String> zkPartitions; try { zkPartitions = getCurator().getChildren().forPath(getSubscriptionPath("/topics")); } catch (KeeperException.NoNodeException ex) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception e) { throw new NakadiRuntimeException(e); } try { final List<Partition> partitions = new ArrayList<>(); for (final String topic : zkPartitions) { for (final String partition : getCurator().getChildren().forPath(getSubscriptionPath("/topics/" + topic))) { partitions.add(deserializeNode( getTopicToEventType().get(topic), partition, getCurator().getData().forPath(getPartitionPath( new EventTypePartition(getTopicToEventType().get(topic), partition))))); } } return partitions.toArray(new Partition[partitions.size()]); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }
Source:
public static Edge of(Name name) { for (Edge e : values()) { if (e.name.equals(name)) { return e; } } throw new IllegalArgumentException("Invalid name " + name.toString()); }

Target:
public static Edge of(Name name) { Edge edge = nameEdgeMap.get(name); if (edge == null) { throw new IllegalArgumentException("Invalid name " + name.toString()); } return edge; }
Source:
Predicate<FiringUnitFilterData> getFiringUnits() { return firingUnits.and( firingUnitFilterData -> Matches.unitIsBeingTransported().negate().test(firingUnitFilterData.getFiringUnit())); }

Target:
public Predicate<FiringUnitFilterData> getFiringUnits() { return firingUnits.and(firingUnitFilterData -> notCargo(firingUnitFilterData.getFiringUnit())); }
Source:
public int compare(Object o1, Object o2) { int c = 0; if (o1 == null && o2 == null) { c = 0; } else if (o1 == null) { c = -1; } else if (o2 == null && o2 == null) { c = 1; } else if ((o1 instanceof String) && (o2 instanceof String)) { c = StringUtility.compareIgnoreCase(m_locale, (String) o1, (String) o2); } else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { c = ((Comparable) o1).compareTo(o2); } else { c = StringUtility.compareIgnoreCase(m_locale, o1.toString(), o2.toString()); } return c; }

Target:
public int compare(Object o1, Object o2) { int c = 0; if (o1 == null && o2 == null) { c = 0; } else if (o1 == null) { c = -1; } else if (o2 == null) { c = 1; } else if ((o1 instanceof String) && (o2 instanceof String)) { c = StringUtility.compareIgnoreCase(m_locale, (String) o1, (String) o2); } else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { c = ((Comparable) o1).compareTo(o2); } else { c = StringUtility.compareIgnoreCase(m_locale, o1.toString(), o2.toString()); } return c; }
Source:
public JobDeploymentsPath() { elements[JOBS] = Paths.JOBS; }

Target:
public JobDeploymentsPath() { elements[DEPLOYMENTS] = Paths.DEPLOYMENTS; elements[JOBS] = Paths.JOBS; }
Source:
public void initialize() { final Map<?, Vector> centroidsMap = memoryStore.getLocalStore().getAll(ClusteringPreCtrlTask.KEY_CENTROIDS); centroids.addAll(centroidsMap.values()); final int numClusters = centroids.size(); for (int clusterID = 0; clusterID < numClusters; clusterID++) { final Vector vector = centroids.get(clusterID); final int dimension = vector.size(); clusterSummaries.add(new ClusterSummary(1.0, vector, DiagonalMatrix.identity(dimension))); } }

Target:
public void initialize() { final Map<?, Vector> centroidsMap = memoryStore.getLocalStore().removeAll(ClusteringPreCtrlTask.KEY_CENTROIDS); centroids.addAll(centroidsMap.values()); final int numClusters = centroids.size(); for (int clusterID = 0; clusterID < numClusters; clusterID++) { final Vector vector = centroids.get(clusterID); final int dimension = vector.size(); clusterSummaries.add(new ClusterSummary(1.0, vector, DiagonalMatrix.identity(dimension))); } }
Source:
private void init() { setMaxLines(mMaxLines); setTextSize(TypedValue.COMPLEX_UNIT_SP, mTextSizeSp); mMinTextSizePx = getTextSize() / 1.3f; }

Target:
private void init() { setMaxLines(MAX_LINES); setTextSize(TypedValue.COMPLEX_UNIT_SP, TEXT_SIZE_SP); mMinTextSizePx = getTextSize() / MIN_TEXT_SIZE_FACTOR; }
Source:
private Set<String> sourceLocationsToCopy(Path externalTableInfo) throws IOException { Set<String> locationsToCopy = new HashSet<>(); FileSystem fileSystem = externalTableInfo.getFileSystem(hiveConf); if (!fileSystem.exists(externalTableInfo)) { return locationsToCopy; } int currentRetry = 0; BufferedReader reader = null; while (currentRetry < MAX_RETRIES) { try { reader = reader(fileSystem, externalTableInfo); for (String line = reader.readLine(); line != null; line = reader.readLine()) { String[] splits = line.split(FIELD_SEPARATOR); locationsToCopy .add(new String(Base64.getDecoder().decode(splits[1]), StandardCharsets.UTF_8)); } return locationsToCopy; } catch (IOException e) { if ((currentRetry + 1) < MAX_RETRIES) { closeQuietly(reader); LOG.warn("failed to read {}", externalTableInfo.toString(), e); currentRetry++; } else { LOG.error("failed to read {}", externalTableInfo.toString(), e); throw e; } } finally { closeQuietly(reader); } } throw new IllegalStateException("we should never reach this condition"); }

Target:
private Set<String> sourceLocationsToCopy(Path externalTableInfo) throws IOException { Set<String> locationsToCopy = new HashSet<>(); FileSystem fileSystem = externalTableInfo.getFileSystem(hiveConf); if (!fileSystem.exists(externalTableInfo)) { return locationsToCopy; } int currentRetry = 0; BufferedReader reader = null; while (currentRetry < MAX_RETRIES) { try { reader = reader(fileSystem, externalTableInfo); for (String line = reader.readLine(); line != null; line = reader.readLine()) { String[] splits = line.split(FIELD_SEPARATOR); locationsToCopy .add(new String(Base64.getDecoder().decode(splits[1]), StandardCharsets.UTF_8)); } return locationsToCopy; } catch (IOException e) { currentRetry++; if (currentRetry < MAX_RETRIES) { closeQuietly(reader); LOG.warn("failed to read {}", externalTableInfo.toString(), e); } else { LOG.error("failed to read {}", externalTableInfo.toString(), e); throw e; } } finally { closeQuietly(reader); } } throw new IllegalStateException("we should never reach this condition"); }
Source:
public List<String> getPathTokens() { return asList(path.substring(1).split("/")); }

Target:
public List<String> getPathTokens() { return Arrays.stream(path.split("/")).skip(1).collect(Collectors.toList()); }
Source:
public void log(LogLevel level, String category, Context context, Throwable throwable, String message) { Context actualContext = context == null ? ContextBuilder.emptyContext() : ContextBuilder.create(context).build(); try { backend.setNewContext(actualContext); this.backend.log(category, level, message, throwable); } finally { backend.resetContext(null); } }

Target:
public void log(LogLevel level, String category, Context context, Throwable throwable, String message) { Context actualContext = context == null ? ContextBuilder.emptyContext() : ContextBuilder.create(context).build(); Map<String, String> currentContext = backend.getCopyOfContextMap(); try { backend.setNewContext(actualContext); backend.log(category, level, message, throwable); } finally { backend.resetContext(currentContext); } }
Source:
public void waitErrorMessage(String message) { webDriverWaitFactory .get() .until( (ExpectedCondition<Boolean>) driver -> seleniumWebDriverHelper .waitVisibilityAndGetText(By.id(ERROR_MESSAGE)) .equals(message)); }

Target:
public void waitErrorMessage(String message) { seleniumWebDriverHelper.waitTextEqualsTo(By.id(ERROR_MESSAGE), message); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePointImpl other = (ReferencePointImpl) obj; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePointImpl other = (ReferencePointImpl) obj; if (!path.equals(other.path)) return false; return true; }
Source:
public void getMemberships_shouldNotGetMatchingMembershipsAsOfADate() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(1); CohortMembership newMember = new CohortMembership((new Patient(4))); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate = dateFormat.parse("2017-11-01 00:00:00"); newMember.setStartDate(startDate); service.addMembershipToCohort(cohort, newMember); Date dateToTest = dateFormat.parse("2016-11-01 00:00:00"); List<CohortMembership> membersAsOfDate = cohort.getMemberships(dateToTest); assertTrue(membersAsOfDate.isEmpty()); assertFalse(membersAsOfDate.stream().anyMatch(m -> m.getStartDate().equals(dateToTest))); }

Target:
public void getMemberships_shouldNotGetMatchingMembershipsAsOfADate() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(1); CohortMembership newMember = new CohortMembership(4); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate = dateFormat.parse("2017-11-01 00:00:00"); newMember.setStartDate(startDate); service.addMembershipToCohort(cohort, newMember); Date dateToTest = dateFormat.parse("2016-11-01 00:00:00"); List<CohortMembership> membersAsOfDate = cohort.getActiveMemberships(dateToTest); assertFalse(membersAsOfDate.stream().anyMatch(m -> m.getStartDate().equals(dateToTest))); }
Source:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { boolean skipRecord; synchronized (_sendFailureTopicPartitionExceptionMap) { skipRecord = _autoPausedSourcePartitions.containsKey(topicPartition) || _sendFailureTopicPartitionExceptionMap.containsKey(topicPartition); } if (skipRecord) { _logger.warn("Abort sending as is auto-paused or saw a send failure, rewind offset", topicPartition); seekToLastCheckpoint(Collections.singleton(topicPartition)); break; } else { DatastreamProducerRecord datastreamProducerRecord = translate(record, readTime); int numBytes = record.serializedKeySize() + record.serializedValueSize(); sendDatastreamProducerRecord(datastreamProducerRecord, topicPartition, numBytes, null); } } catch (Exception e) { _logger.warn(String.format("Got exception while sending record %s, exception: ", record), e); rewindAndPausePartitionOnException(topicPartition, e); break; } } } }

Target:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { boolean partitionPaused; boolean sendFailure; synchronized (_sendFailureTopicPartitionExceptionMap) { partitionPaused = _autoPausedSourcePartitions.containsKey(topicPartition); sendFailure = _sendFailureTopicPartitionExceptionMap.containsKey(topicPartition); } if (partitionPaused || sendFailure) { _logger.warn("Abort sending for {}, auto-paused: {}, send failure: {}, rewind offset", topicPartition, partitionPaused, sendFailure); seekToLastCheckpoint(Collections.singleton(topicPartition)); break; } else { DatastreamProducerRecord datastreamProducerRecord = translate(record, readTime); int numBytes = record.serializedKeySize() + record.serializedValueSize(); sendDatastreamProducerRecord(datastreamProducerRecord, topicPartition, numBytes, null); } } catch (Exception e) { _logger.warn(String.format("Got exception while sending record %s, exception: ", record), e); rewindAndPausePartitionOnException(topicPartition, e); break; } } } }
Source:
public X509Certificate createX509Certificate(Entitlement ent, Product product, Set<Product> products, List<org.candlepin.model.dto.Product> productModels, BigInteger serialNumber, KeyPair keyPair, boolean useContentPrefix) throws GeneralSecurityException, IOException { Set<X509ExtensionWrapper> extensions; Set<X509ByteExtensionWrapper> byteExtensions = new LinkedHashSet<X509ByteExtensionWrapper>(); products.add(product); Map<String, EnvironmentContent> promotedContent = getPromotedContent(ent); String contentPrefix = getContentPrefix(ent, useContentPrefix); if (shouldGenerateV3(ent)) { extensions = prepareV3Extensions(ent, contentPrefix, promotedContent); byteExtensions = prepareV3ByteExtensions(product, productModels, ent, contentPrefix, promotedContent); } else { extensions = prepareV1Extensions(products, ent, contentPrefix, promotedContent); } setupEntitlementEndDate(ent); Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, -1); Date startDate = ent.getStartDate().getTime() < cal.getTime().getTime() ? ent.getStartDate() : cal.getTime(); X509Certificate x509Cert = this.pki.createX509Certificate( createDN(ent), extensions, byteExtensions, startDate, ent.getEndDate(), keyPair, serialNumber, null); return x509Cert; }

Target:
public X509Certificate createX509Certificate(Entitlement ent, Product product, Set<Product> products, List<org.candlepin.model.dto.Product> productModels, BigInteger serialNumber, KeyPair keyPair, boolean useContentPrefix) throws GeneralSecurityException, IOException { Set<X509ExtensionWrapper> extensions; Set<X509ByteExtensionWrapper> byteExtensions = new LinkedHashSet<X509ByteExtensionWrapper>(); products.add(product); Map<String, EnvironmentContent> promotedContent = getPromotedContent(ent); String contentPrefix = getContentPrefix(ent, useContentPrefix); if (shouldGenerateV3(ent)) { extensions = prepareV3Extensions(ent, contentPrefix, promotedContent); byteExtensions = prepareV3ByteExtensions(product, productModels, ent, contentPrefix, promotedContent); } else { extensions = prepareV1Extensions(products, ent, contentPrefix, promotedContent); } setupEntitlementEndDate(ent); Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, -1); Date startDate = ent.getStartDate().before(cal.getTime()) ? ent.getStartDate() : cal.getTime(); X509Certificate x509Cert = this.pki.createX509Certificate( createDN(ent), extensions, byteExtensions, startDate, ent.getEndDate(), keyPair, serialNumber, null); return x509Cert; }
Source:
private boolean downloadSingleFile(FTPClient ftpClient, String remoteFilePath, String savePath) throws IOException { getOut().println("About to download the file: " + remoteFilePath); File downloadFile = new File(savePath); File parentDir = downloadFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { parentDir.mkdirs(); } OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(downloadFile)); try { return ftpClient.retrieveFile(remoteFilePath, outputStream); } catch (IOException ex) { throw ex; } finally { if (outputStream != null) { outputStream.close(); } } }

Target:
private boolean downloadSingleFile(FTPClient ftpClient, String remoteFilePath, String savePath) throws IOException { getOut().println("About to download the file: " + remoteFilePath); File downloadFile = new File(savePath); File parentDir = downloadFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { parentDir.mkdirs(); } OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(downloadFile)); try { return ftpClient.retrieveFile(remoteFilePath, outputStream); } catch (IOException ex) { throw ex; } finally { outputStream.close(); } }
Source:
public void releaseCursor( Cursor cursor ) { if ( cursorsInUse > 0 ) { if ( TRACK_CURSORS ) { cursorsOpenCloseCalls.remove( cursor ); } cursorsInUse--; } }

Target:
public void releaseCursor( Cursor cursor ) { cursorsOpenCloseCalls.remove( cursor ); }
Source:
public void partOpened(IWorkbenchPart part) { if (part instanceof ITextEditor) { ITextEditor editor = (ITextEditor) part; new EditorListener(editor); this.workbenchListener.editorCreated(editor); } }

Target:
public void partOpened(IWorkbenchPart part) { if (part instanceof ITextEditor) { ITextEditor editor = (ITextEditor) part; new EditorListener(editor); try { ResourceAndResourceDeltaVisitor visitor = new ResourceAndResourceDeltaVisitor(trackingEventManager, new HashMap<>(), true); WatchDogUtils.getFile(editor).accept(visitor); } catch (IllegalArgumentException | CoreException ignored) { } } }
Source:
public static LocalQueryRunner createLocalQueryRunner(File tempDir) { Session session = testSessionBuilder() .setCatalog("hive") .setSchema("tpch") .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(session); localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of()); File hiveDir = new File(tempDir, "hive_data"); ExtendedHiveMetastore metastore = createTestingFileHiveMetastore(hiveDir); metastore.createDatabase(Database.builder() .setDatabaseName("tpch") .setOwnerName("public") .setOwnerType(PrincipalType.ROLE) .build()); HiveConnectorFactory hiveConnectorFactory = new HiveConnectorFactory( "hive", HiveBenchmarkQueryRunner.class.getClassLoader(), Optional.of(metastore), new DefaultPathFilterProviderModule()); Map<String, String> hiveCatalogConfig = ImmutableMap.<String, String>builder() .put("hive.max-split-size", "10GB") .build(); localQueryRunner.createCatalog("hive", hiveConnectorFactory, hiveCatalogConfig); localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders"); localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem"); return localQueryRunner; }

Target:
public static LocalQueryRunner createLocalQueryRunner(File tempDir) { Session session = testSessionBuilder() .setCatalog("hive") .setSchema("tpch") .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(session); localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of()); File hiveDir = new File(tempDir, "hive_data"); ExtendedHiveMetastore metastore = createTestingFileHiveMetastore(hiveDir); metastore.createDatabase(Database.builder() .setDatabaseName("tpch") .setOwnerName("public") .setOwnerType(PrincipalType.ROLE) .build()); HiveConnectorFactory hiveConnectorFactory = new HiveConnectorFactory( "hive", HiveBenchmarkQueryRunner.class.getClassLoader(), Optional.of(metastore)); Map<String, String> hiveCatalogConfig = ImmutableMap.<String, String>builder() .put("hive.max-split-size", "10GB") .build(); localQueryRunner.createCatalog("hive", hiveConnectorFactory, hiveCatalogConfig); localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders"); localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem"); return localQueryRunner; }
Source:
private static void knownHosts(final JSch sch, FS fs) throws JSchException { final File home = fs.userHome(); if (home == null) return; final File known_hosts = new File(new File(home, ".ssh"), "known_hosts"); try { final FileInputStream in = new FileInputStream(known_hosts); try { sch.setKnownHosts(in); } finally { in.close(); } } catch (final FileNotFoundException none) { } catch (final IOException err) { } }

Target:
private static void knownHosts(final JSch sch, FS fs) throws JSchException { final File home = fs.userHome(); if (home == null) return; final File known_hosts = new File(new File(home, ".ssh"), "known_hosts"); try { final FileInputStream in = new FileInputStream(known_hosts); try { sch.setKnownHosts(in); } finally { in.close(); } } catch (FileNotFoundException none) { } catch (IOException err) { } }
Source:
private void raiseIssue(Tree operand, Tree... secondaryLocations) { Tree expression = ((JavaScriptTree) operand).getParent(); Symbol operandSymbol = null; if (operand.is(Kind.IDENTIFIER_REFERENCE)) { IdentifierTree identifier = (IdentifierTree) operand; operandSymbol = identifier.symbol(); } if (!expressionsWithIssues.contains(expression) && !symbolsWithIssues.contains(operandSymbol)) { PreciseIssue issue = addIssue(operand, MESSAGE); Arrays.asList(secondaryLocations).forEach(issue::secondary); expressionsWithIssues.add(expression); if (operandSymbol != null) { symbolsWithIssues.add(operandSymbol); } } }

Target:
private void raiseIssue(Tree operand, Tree... secondaryLocations) { Symbol operandSymbol = null; if (operand.is(Kind.IDENTIFIER_REFERENCE)) { IdentifierTree identifier = (IdentifierTree) operand; operandSymbol = identifier.symbol(); } if (!symbolsWithIssues.contains(operandSymbol)) { PreciseIssue issue = addIssue(operand, MESSAGE); Arrays.asList(secondaryLocations).forEach(issue::secondary); if (operandSymbol != null) { symbolsWithIssues.add(operandSymbol); } } }
Source:
public static void stopPolling(Context context) { if (localNoticicationInvoked) { localNoticicationInvoked = false; Intent alarm = new Intent(context, AlarmReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(context, REQUEST_CODE, alarm, 0); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.cancel(sender); } }

Target:
public static void stopPolling(Context context) { if (localNoticicationInvoked) { localNoticicationInvoked = false; Intent alarm = new Intent(context, AlarmReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(context, REQUEST_CODE, alarm, DEFAULT_INDEX); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.cancel(sender); } }
Source:
private void updateBatchStats(Map<String,TabletServerMutations<Mutation>> binnedMutations) { tabletServersBatchSum.addAndGet(binnedMutations.size()); minTabletServersBatch.set(Math.min(minTabletServersBatch.get(), binnedMutations.size())); maxTabletServersBatch.set(Math.max(maxTabletServersBatch.get(), binnedMutations.size())); int numTablets = 0; for (Entry<String,TabletServerMutations<Mutation>> entry : binnedMutations.entrySet()) { TabletServerMutations<Mutation> tsm = entry.getValue(); numTablets += tsm.getMutations().size(); } tabletBatchSum.addAndGet(numTablets); minTabletBatch.set(Math.min(minTabletBatch.get(), numTablets)); maxTabletBatch.set(Math.max(maxTabletBatch.get(), numTablets)); numBatches.incrementAndGet(); }

Target:
private void updateBatchStats(Map<String,TabletServerMutations<Mutation>> binnedMutations) { tabletServersBatchSum.addAndGet(binnedMutations.size()); computeMin(minTabletServersBatch, binnedMutations.size()); computeMax(maxTabletServersBatch, binnedMutations.size()); int numTablets = 0; for (Entry<String,TabletServerMutations<Mutation>> entry : binnedMutations.entrySet()) { TabletServerMutations<Mutation> tsm = entry.getValue(); numTablets += tsm.getMutations().size(); } tabletBatchSum.addAndGet(numTablets); computeMin(minTabletBatch, numTablets); computeMax(maxTabletBatch, numTablets); numBatches.incrementAndGet(); }
Source:
public void sourceSubstituteAdded() throws Throwable { sourceMappingAddedHelper(false); }

Target:
public void sourceSubstituteAdded() throws Throwable { sourceMappingAddedHelper(true); }
Source:
public MappedServlet getMappedServlet(String target) { if (target.startsWith("/")) { if (_servletPathMap == null) return null; MappedResource<MappedServlet> match = _servletPathMap.getMatch(target); if (match == null) return null; return match.getResource(); } ServletHolder holder = _servletNameMap.get(target); if (holder == null) return null; return new MappedServlet(null, holder); }

Target:
public MappedServlet getMappedServlet(String target) { if (target.startsWith("/")) { if (_servletPathMap == null) return null; MappedResource<MappedServlet> match = _servletPathMap.getMatch(target); if (match == null) return null; return match.getResource(); } return _servletNameMap.get(target); }
Source:
public MongoPageHelper<E> addBooleanAggregation(Mapping field) { Objects.requireNonNull(ctx); Facet facet = new Facet(baseQuery.getDescriptor().findProperty(field.toString()).getLabel(), field.toString(), ctx.get(field.toString()).asString(), null); facet.addItem("true", NLS.get("NLS.yes"), -1); facet.addItem("false", NLS.get("NLS.no"), -1); baseQuery.addFacet(new MongoBooleanFacet(field).onComplete(mongoFacet -> { Iterator<FacetItem> iter = facet.getAllItems().iterator(); while (iter.hasNext()) { FacetItem item = iter.next(); int numberOfHits = Strings.areEqual(item.getKey(), "true") ? mongoFacet.getNumTrue() : mongoFacet.getNumFalse(); if (numberOfHits > 0 || item.isActive()) { item.setCount(numberOfHits); } else { iter.remove(); } } })); return addFacet(facet, (f, q) -> { Value filterValue = Value.of(f.getValue()); if (filterValue.isFilled()) { q.eq(Mapping.named(f.getName()), filterValue.asBoolean()); } }); }

Target:
public MongoPageHelper<E> addBooleanAggregation(Mapping field) { Facet facet = new Facet(baseQuery.getDescriptor().findProperty(field.toString()).getLabel(), field.toString(), null, null); return addFacet(facet, (f, q) -> { f.addItem("true", NLS.get("NLS.yes"), -1); f.addItem("false", NLS.get("NLS.no"), -1); Value filterValue = Value.of(f.getValue()); if (filterValue.isFilled()) { q.eq(Mapping.named(f.getName()), filterValue.asBoolean()); } q.addFacet(new MongoBooleanFacet(field).onComplete(mongoFacet -> { Iterator<FacetItem> iter = facet.getAllItems().iterator(); while (iter.hasNext()) { FacetItem item = iter.next(); int numberOfHits = Strings.areEqual(item.getKey(), "true") ? mongoFacet.getNumTrue() : mongoFacet.getNumFalse(); if (numberOfHits > 0 || item.isActive()) { item.setCount(numberOfHits); } else { iter.remove(); } } })); }); }
Source:
private TransactionManager getTransactionManager() { try { return com.arjuna.ats.jta.TransactionManager.transactionManager(new InitialContext()); } catch (NamingException ne) { throw new IllegalStateException("Not possible to find transaction manager, " + "failed to initialize intial context. Cause: " + ne.getMessage(), ne); } }

Target:
private TransactionManager getTransactionManager() throws NamingException { return com.arjuna.ats.jta.TransactionManager.transactionManager(new InitialContext()); }