auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGettingImagesFromQuay() { final ApiClient webClient = getWebClient(USER_2_USERNAME, testingPostgres); WorkflowsApi workflowsApi = new WorkflowsApi(webClient); final io.dockstore.openapi.client.ApiClient openAPIClient = getOpenAPIWebClient(USER_2_USERNAME, testingPostgres); Ga4Ghv20Api ga4Ghv20Api = new Ga4Ghv20Api(openAPIClient); WorkflowVersion version = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/hello_world", "cwl", "/hello_world.cwl", "1.0.1"); assertEquals("Should only be one image in this workflow", 1, version.getImages().size()); verifyImageChecksumsAreSaved(version); List<ToolVersion> versions = ga4Ghv20Api.toolsIdVersionsGet("#workflow/github.com/dockstore-testing/hello_world"); verifyTRSImageConversion(versions, "1.0.1", 1); WorkflowVersion workflowVersionWithoutVersionedImage = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/tools-cwl-workflow-experiments", "cwl", "/cwl/workflow_docker.cwl", "1.0"); assertEquals("Should not have grabbed any images", 0, workflowVersionWithoutVersionedImage.getImages().size()); WorkflowVersion versionWithDuplicateImages = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/zhanghj-8555114", "cwl", "/main.cwl", "1.0"); assertEquals("Should have grabbed 3 images", 3, versionWithDuplicateImages.getImages().size()); verifyImageChecksumsAreSaved(versionWithDuplicateImages); versions = ga4Ghv20Api.toolsIdVersionsGet("#workflow/github.com/dockstore-testing/zhanghj-8555114"); verifyTRSImageConversion(versions, "1.0", 3); }

Target:
public void testGettingImagesFromQuay() { final ApiClient webClient = getWebClient(USER_2_USERNAME, testingPostgres); WorkflowsApi workflowsApi = new WorkflowsApi(webClient); final io.dockstore.openapi.client.ApiClient openAPIClient = getOpenAPIWebClient(USER_2_USERNAME, testingPostgres); Ga4Ghv20Api ga4Ghv20Api = new Ga4Ghv20Api(openAPIClient); WorkflowVersion version = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/hello_world", DescriptorType.CWL.toString(), "/hello_world.cwl", "1.0.1"); assertEquals("Should only be one image in this workflow", 1, version.getImages().size()); verifyImageChecksumsAreSaved(version); List<ToolVersion> versions = ga4Ghv20Api.toolsIdVersionsGet("#workflow/github.com/dockstore-testing/hello_world"); verifyTRSImageConversion(versions, "1.0.1", 1); WorkflowVersion workflowVersionWithoutVersionedImage = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/tools-cwl-workflow-experiments", DescriptorType.CWL.toString(), "/cwl/workflow_docker.cwl", "1.0"); assertEquals("Should not have grabbed any images", 0, workflowVersionWithoutVersionedImage.getImages().size()); WorkflowVersion versionWithDuplicateImages = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/zhanghj-8555114", DescriptorType.CWL.toString(), "/main.cwl", "1.0"); assertEquals("Should have grabbed 3 images", 3, versionWithDuplicateImages.getImages().size()); verifyImageChecksumsAreSaved(versionWithDuplicateImages); versions = ga4Ghv20Api.toolsIdVersionsGet("#workflow/github.com/dockstore-testing/zhanghj-8555114"); verifyTRSImageConversion(versions, "1.0", 3); }
Source:
public static String canonical(String path) { if (path == null || path.isEmpty()){ return path; } if(path.startsWith("/..")) { return null; } List<String> directories = new ArrayList<>(Arrays.asList(path.split("(?<=\\/)"))); directories.removeIf(dir-> dir.isEmpty() || dir.equals(".")); for(ListIterator<String> iterator = directories.listIterator(); iterator.hasNext();){ String currentDir = iterator.next(); if (currentDir.equals("./")){ if (iterator.nextIndex()>1) iterator.remove(); else if (iterator.hasNext()){ if(!iterator.next().equals("/")) { iterator.previous(); iterator.previous(); iterator.remove(); } } else { return ""; } } else if(currentDir.equals("../") || currentDir.equals("..")) { iterator.remove(); if (iterator.hasPrevious()) { iterator.previous(); iterator.remove(); if (directories.isEmpty() && path.startsWith("/")) return null; } else { return null; } } } return directories.stream().collect(Collectors.joining()); }

Target:
public static String canonical(String path) { if (path == null || path.isEmpty() || !path.contains(".")) return path; if(path.startsWith("/..")) return null; List<String> directories = new LinkedList<>(); Collections.addAll(directories, __PATH_SPLIT.split(path)); for(ListIterator<String> iterator = directories.listIterator(); iterator.hasNext();) { switch (iterator.next()) { case "./": case ".": if (iterator.hasNext() && directories.get(iterator.nextIndex()).equals("/")) break; iterator.remove(); break; case "../": case "..": if(iterator.previousIndex() == 0) return null; iterator.remove(); if(iterator.previous().equals("/") && iterator.nextIndex() == 0) return null; iterator.remove(); break; } } return String.join("", directories); }
Source:
private void pruneHardDeleteRecoveryRange() { StoreFindToken logFlushedTillToken = (StoreFindToken) startTokenSafeToPersist; if (logFlushedTillToken != null && !logFlushedTillToken.isUninitialized()) { if (logFlushedTillToken.equals(endToken)) { hardDeleteRecoveryRange.clear(); rangePrunedTillToken = logFlushedTillToken; } else if (logFlushedTillToken.getStoreKey() == null) { } else if (!logFlushedTillToken.equals(rangePrunedTillToken)) { Iterator<HardDeletePersistInfo> hardDeleteRecoveryRangeIterator = hardDeleteRecoveryRange.iterator(); while (hardDeleteRecoveryRangeIterator.hasNext()) { StoreKey key = hardDeleteRecoveryRangeIterator.next().getBlobReadOptions().getStoreKey(); if (logFlushedTillToken.getStoreKey().equals(key)) { break; } else { hardDeleteRecoveryRangeIterator.remove(); } } rangePrunedTillToken = logFlushedTillToken; } } }

Target:
protected void pruneHardDeleteRecoveryRange() { StoreFindToken logFlushedTillToken = (StoreFindToken) startTokenSafeToPersist; if (logFlushedTillToken != null && !logFlushedTillToken.isUninitialized()) { if (logFlushedTillToken.equals(endToken)) { hardDeleteRecoveryRange.clear(); } else if (logFlushedTillToken.getStoreKey() != null) { hardDeleteRecoveryRange.pruneTill(logFlushedTillToken.getStoreKey()); } } }
Source:
public ByteBuffer[] nioBuffers(int index, int length) { if (b1.nioBufferCount() == 1 && b2.nioBufferCount() == 1) { return new ByteBuffer[] { b1.nioBuffer(), b2.nioBuffer() }; } return ObjectArrays.concat(b1.nioBuffers(), b2.nioBuffers(), ByteBuffer.class); }

Target:
public ByteBuffer[] nioBuffers(int index, int length) { return new ByteBuffer[] { nioBuffer(index, length) }; }
Source:
public AutodetectResult(StreamInput in) throws IOException { if (in.readBoolean()) { this.bucket = new Bucket(in); } else { this.bucket = null; } if (in.readBoolean()) { this.records = in.readList(AnomalyRecord::new); } else { this.records = null; } if (in.readBoolean()) { this.influencers = in.readList(Influencer::new); } else { this.influencers = null; } if (in.readBoolean()) { this.quantiles = new Quantiles(in); } else { this.quantiles = null; } if (in.readBoolean()) { this.modelSnapshot = new ModelSnapshot(in); } else { this.modelSnapshot = null; } if (in.readBoolean()) { this.modelSizeStats = new ModelSizeStats(in); } else { this.modelSizeStats = null; } if (in.readBoolean()) { this.modelPlot = new ModelPlot(in); } else { this.modelPlot = null; } if (in.readBoolean()) { this.annotation = new Annotation(in); } else { this.annotation = null; } if (in.readBoolean()) { this.categoryDefinition = new CategoryDefinition(in); } else { this.categoryDefinition = null; } if (in.getVersion().onOrAfter(Version.V_8_0_0) && in.readBoolean()) { this.categorizerStats = new CategorizerStats(in); } else { this.categorizerStats = null; } if (in.readBoolean()) { this.flushAcknowledgement = new FlushAcknowledgement(in); } else { this.flushAcknowledgement = null; } if (in.readBoolean()) { this.forecast = new Forecast(in); } else { this.forecast = null; } if (in.readBoolean()) { this.forecastRequestStats = new ForecastRequestStats(in); } else { this.forecastRequestStats = null; } }

Target:
public AutodetectResult(StreamInput in) throws IOException { if (in.readBoolean()) { this.bucket = new Bucket(in); } else { this.bucket = null; } if (in.readBoolean()) { this.records = in.readList(AnomalyRecord::new); } else { this.records = null; } if (in.readBoolean()) { this.influencers = in.readList(Influencer::new); } else { this.influencers = null; } if (in.readBoolean()) { this.quantiles = new Quantiles(in); } else { this.quantiles = null; } if (in.readBoolean()) { this.modelSnapshot = new ModelSnapshot(in); } else { this.modelSnapshot = null; } if (in.readBoolean()) { this.modelSizeStats = new ModelSizeStats(in); } else { this.modelSizeStats = null; } if (in.readBoolean()) { this.modelPlot = new ModelPlot(in); } else { this.modelPlot = null; } if (in.readBoolean()) { this.annotation = new Annotation(in); } else { this.annotation = null; } if (in.readBoolean()) { this.categoryDefinition = new CategoryDefinition(in); } else { this.categoryDefinition = null; } if (in.getVersion().onOrAfter(Version.V_8_0_0)) { this.categorizerStats = in.readOptionalWriteable(CategorizerStats::new); } else { this.categorizerStats = null; } if (in.readBoolean()) { this.flushAcknowledgement = new FlushAcknowledgement(in); } else { this.flushAcknowledgement = null; } if (in.readBoolean()) { this.forecast = new Forecast(in); } else { this.forecast = null; } if (in.readBoolean()) { this.forecastRequestStats = new ForecastRequestStats(in); } else { this.forecastRequestStats = null; } }
Source:
public boolean equals(Object other) { if (!super.equals(other)) { return false; } if (other instanceof ExpressionStartsWith) { if (noOptimisation == ((ExpressionStartsWith)other).noOptimisation) { return true; } } return false; }

Target:
public boolean equals(Object other) { if (!super.equals(other)) { return false; } if (other instanceof ExpressionStartsWith) { if (noOptimization == ((ExpressionStartsWith)other).noOptimization) { return true; } } return false; }
Source:
public RichGroup getRichGroupByIdWithAttributesByNames(PerunSession sess, int groupId, List<String> attrNames)throws InternalErrorException, GroupNotExistsException{ Utils.checkPerunSession(sess); this.getGroupsManagerBl().checkGroupExists(sess, this.getGroupsManagerBl().getGroupById(sess, groupId)); return this.getGroupsManagerBl().getRichGroupByIdWithAttributesByNames(sess, groupId, attrNames); }

Target:
public RichGroup getRichGroupByIdWithAttributesByNames(PerunSession sess, int groupId, List<String> attrNames) throws InternalErrorException, GroupNotExistsException, VoNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); this.getGroupsManagerBl().checkGroupExists(sess, this.getGroupsManagerBl().getGroupById(sess, groupId)); Group group = groupsManagerBl.getGroupById(sess, groupId); Vo vo = perunBl.getVosManagerBl().getVoById(sess, group.getVoId()); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER, vo) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "getRichGroupByIdWithAttributesByNames"); } return getGroupsManagerBl().filterOnlyAllowedAttributes(sess, getGroupsManagerBl().getRichGroupByIdWithAttributesByNames(sess, groupId, attrNames)); }
Source:
public AuditAssociationQuery<? extends AuditAssociationQuery<Q>> traverseRelation( String associationName, JoinType joinType, String alias) { AbstractAuditAssociationQuery<AbstractAuditAssociationQuery<Q>> result = associationQueryMap.get( associationName ); if ( result == null ) { result = new RevisionsOfEntityAssociationQuery<>( enversService, auditReader, this, queryBuilder, associationName, joinType, aliasToEntityNameMap, this.alias, alias ); associationQueries.add( (RevisionsOfEntityAssociationQuery<Q>) result ); associationQueryMap.put( associationName, result ); } return result; }

Target:
public AuditAssociationQuery<? extends AuditAssociationQuery<Q>> traverseRelation( String associationName, JoinType joinType, String alias) { return associationQueryMap.computeIfAbsent( associationName, name -> { AbstractAuditAssociationQuery<AbstractAuditAssociationQuery<Q>> query = new RevisionsOfEntityAssociationQuery<>( enversService, auditReader, this, queryBuilder, name, joinType, aliasToEntityNameMap, this.alias, alias ); associationQueries.add( query ); return query; } ); }
Source:
protected <K extends Comparable<K>, V> LinkedHashMultimap<K, V> mapOf(K key, V value) { switch (containerType) { case SEQ: return LinkedHashMultimap.withSeq().of(key, value); case SET: return LinkedHashMultimap.withSet().of(key, value); case SORTED_SET: return LinkedHashMultimap.withSortedSet(naturalComparator()).of(key, value); } throw new RuntimeException(); }

Target:
protected <K extends Comparable<K>, V> LinkedHashMultimap<K, V> mapOf(K key, V value) { switch (containerType) { case SEQ: return LinkedHashMultimap.withSeq().of(key, value); case SET: return LinkedHashMultimap.withSet().of(key, value); case SORTED_SET: return LinkedHashMultimap.withSortedSet(naturalComparator()).of(key, value); default: throw new RuntimeException(); } }
Source:
public void testFormName() throws Exception { Long pid = processClient.startProcess(CONTAINER_ID, HIRING_2_PROCESS_ID); assertNotNull(pid); assertTrue(pid.longValue() > 0); try { changeUser(USER_ADMINISTRATOR); List<TaskSummary> tasks = taskClient.findTasksAssignedAsBusinessAdministrator(USER_ADMINISTRATOR, 0, 10); assertNotNull(tasks); Long taskId = tasks.get(0).getId(); TaskInstance ti = taskClient.getTaskInstance(CONTAINER_ID, taskId); assertEquals("HRInterview2", ti.getFormName()); taskClient.startTask(CONTAINER_ID, taskId, USER_ADMINISTRATOR); taskClient.completeTask(CONTAINER_ID, taskId, USER_ADMINISTRATOR, new HashMap<>()); tasks = taskClient.findTasksAssignedAsBusinessAdministrator(USER_ADMINISTRATOR, 0, 10); assertNotNull(tasks); taskId = tasks.get(0).getId(); ti = taskClient.findTaskById(taskId); assertEquals("Tech Interview", ti.getName()); assertEquals("TechInterview", ti.getFormName()); taskClient.startTask(CONTAINER_ID, taskId, USER_ADMINISTRATOR); taskClient.completeTask(CONTAINER_ID, taskId, USER_ADMINISTRATOR, new HashMap<>()); tasks = taskClient.findTasksAssignedAsBusinessAdministrator(USER_ADMINISTRATOR, 0, 10); assertNotNull(tasks); ti = taskClient.findTaskByWorkItemId(tasks.get(0).getId()); assertEquals("Create Proposal", ti.getName()); assertEquals("CreateProposal", ti.getFormName()); } finally { changeUser(TestConfig.getUsername()); processClient.abortProcessInstance(CONTAINER_ID, pid); } }

Target:
public void testFormName() throws Exception { Long pid = processClient.startProcess(CONTAINER_ID, HIRING_2_PROCESS_ID); assertNotNull(pid); assertTrue(pid.longValue() > 0); try { changeUser(USER_ADMINISTRATOR); List<TaskSummary> tasks = taskClient.findTasksAssignedAsBusinessAdministrator(USER_ADMINISTRATOR, 0, 10); assertNotNull(tasks); Long taskId = tasks.get(0).getId(); TaskInstance ti = taskClient.getTaskInstance(CONTAINER_ID, taskId); assertEquals("HRInterview2", ti.getFormName()); taskClient.startTask(CONTAINER_ID, taskId, USER_ADMINISTRATOR); taskClient.completeTask(CONTAINER_ID, taskId, USER_ADMINISTRATOR, Collections.emptyMap()); tasks = taskClient.findTasksAssignedAsBusinessAdministrator(USER_ADMINISTRATOR, 0, 10); assertNotNull(tasks); taskId = tasks.get(0).getId(); ti = taskClient.findTaskById(taskId); assertEquals("Tech Interview", ti.getName()); assertEquals("TechInterview", ti.getFormName()); taskClient.startTask(CONTAINER_ID, taskId, USER_ADMINISTRATOR); taskClient.completeTask(CONTAINER_ID, taskId, USER_ADMINISTRATOR, Collections.emptyMap()); List<WorkItemInstance> workItems = processClient.getWorkItemByProcessInstance(CONTAINER_ID, pid); assertNotNull(workItems); ti = taskClient.findTaskByWorkItemId(workItems.get(0).getId()); assertEquals("Create Proposal", ti.getName()); assertEquals("CreateProposal", ti.getFormName()); } finally { changeUser(TestConfig.getUsername()); processClient.abortProcessInstance(CONTAINER_ID, pid); } }
Source:
public MockChart(SimpleEditor editor) { super(editor, TYPE, images.image(), new MockChartLayout()); rootPanel.setStylePrimaryName("ode-SimpleMockComponent"); setTypeProperty("0"); initComponent(rootPanel); }

Target:
public MockChart(SimpleEditor editor) { super(editor, TYPE, images.chart(), new MockChartLayout()); rootPanel.setStylePrimaryName("ode-SimpleMockComponent"); setTypeProperty("0"); initComponent(rootPanel); }
Source:
public OnlineBackup incremental( String targetDirectory ) { outcome = new BackupService().doIncrementalBackup( hostNameOrIp, port, new File( targetDirectory ), getConsistencyCheck( true ), timeoutMillis, defaultConfig() ); return this; }

Target:
public OnlineBackup incremental( String targetDirectory ) { outcome = new BackupService().doIncrementalBackup( hostNameOrIp, port, new File( targetDirectory ), getConsistencyCheck( false ), timeoutMillis, defaultConfig() ); return this; }
Source:
public Configuration getDefaultConfiguration() { List<String> metadataProviders = MutableList.of( BrooklynToscaTypeProvider.class.getName(), DefaultToscaTypeProvider.class.getName()); return new Configuration("http://localhost:8081/", "brooklyn", "brooklyn", "localhost", metadataProviders); }

Target:
public Configuration getDefaultConfiguration() { List<String> metadataProviders = MutableList.of( DefaultToscaTypeProvider.class.getName(), BrooklynToscaTypeProvider.class.getName()); return new Configuration("http://localhost:8081/", "brooklyn", "brooklyn", "localhost", metadataProviders); }
Source:
public void completeQuery(AsyncQuery query, User user, String apiVersion) { if (query.getQueryUpdateWorker() != null) { log.info("Task has not completed"); updater.execute(query.getQueryUpdateWorker()); } else { log.info("Task has completed"); } }

Target:
public void completeQuery(AsyncQuery query, User user, String apiVersion) { if (query.getQueryUpdateWorker() != null) { log.debug("Task has not completed"); updater.execute(query.getQueryUpdateWorker()); } else { log.debug("Task has completed"); } }
Source:
public Response delete(@PathParam("application") String application) { manager.destroyInBackground(application); return Response.status(Response.Status.ACCEPTED).build(); }

Target:
public Response delete(@PathParam("application") String application) { if (!manager.registry().containsKey(application)) throw notFound("Application '%s' not found.", application); manager.destroyInBackground(application); return Response.status(Response.Status.ACCEPTED).build(); }
Source:
private static JsonValue getDatasetDescription(String dsName) { try (TypedInputStream in = execHttpGet(urlRoot + "$/" + opDatasets + "/" + dsName)) { assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType()); JsonValue v = JSON.parse(in); return v; } }

Target:
private static JsonValue getDatasetDescription(String dsName) { try (TypedInputStream in = execHttpGet(ServerCtl.urlRoot() + "$/" + opDatasets + "/" + dsName)) { assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType()); JsonValue v = JSON.parse(in); return v; } }
Source:
public View getView(int position, View view, ViewGroup parent) { if (view == null) { view = LayoutInflater.from(context).inflate(R.layout.list_item_weapon, parent, false); } Weapon weapon = itemsList.get(position); ((TextView) view.findViewById(R.id.index)).setText(String.valueOf(position + 1)); ((ImageView)view.findViewById(R.id.weapon_image)).setImageResource(WeaponsImageMap.get(weapon.getUniqueName())); ((TextView) view.findViewById(R.id.service_star_count)).setText(String.valueOf(weapon.getServiceStarsCount())); ((TextView) view.findViewById(R.id.weapon_name)).setText(weapon.getName().toUpperCase()); ((TextView)view.findViewById(R.id.weapon_kills)).setText(String.valueOf(weapon.getKills())); if(weapon.getServiceStarsCount() > 0) { view.findViewById(R.id.weapon_progress).setVisibility(View.GONE); } else { ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.weapon_progress); progressBar.setVisibility(View.VISIBLE); progressBar.setProgress(weapon.getServiceStarsProgress()); } return view; }

Target:
public View getView(int position, View view, ViewGroup parent) { if (view == null) { view = LayoutInflater.from(context).inflate(R.layout.list_item_weapon, parent, false); } Weapon weapon = itemsList.get(position); ((TextView) view.findViewById(R.id.index)).setText(String.valueOf(position + 1)); ((ImageView) view.findViewById(R.id.weapon_image)).setImageResource(WeaponsImageMap.get(weapon.getUniqueName())); ((TextView) view.findViewById(R.id.service_star_count)).setText(String.valueOf(weapon.getServiceStarsCount())); ((TextView) view.findViewById(R.id.weapon_name)).setText(weapon.getName().toUpperCase()); ((TextView) view.findViewById(R.id.weapon_kills)).setText(String.valueOf(weapon.getKills())); ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.weapon_progress); progressBar.setVisibility(View.VISIBLE); progressBar.setProgress(weapon.getServiceStarsProgress()); return view; }
Source:
public void migrateMarkAsRead() { if (preferences.contains(MARK_AS_READ.key)) { if (!preferences.getBoolean(MARK_AS_READ.key, true)) { preferences.edit().putString(MARK_AS_READ_TYPES.key, "unread").commit(); } preferences.edit().remove(MARK_AS_READ.key).commit(); } }

Target:
public void migrateMarkAsRead() { if (preferences.contains(MARK_AS_READ.key)) { SharedPreferences.Editor editor = preferences.edit(); boolean markAsRead = preferences.getBoolean(MARK_AS_READ.key, true); editor.putString(MARK_AS_READ_TYPES.key, markAsRead ? MarkAsReadTypes.READ.name() : MarkAsReadTypes.UNREAD.name()); editor.remove(MARK_AS_READ.key); editor.commit(); } }
Source:
public void invalidateAll(String id) { synchronized (this) { latestSessionAttributes.remove(id); } super.invalidateAll(id); }

Target:
public void invalidateAll(String id) { Map sessionAttributes = latestSessionAttributes.remove(id); if (sessionAttributes != null) { super.invalidateAll(id); } }
Source:
private Map<String, Float> classify(Model model, Translator translator, File input) throws Exception { try { return classify(model, translator, ImageIO.read(input)); } catch (IOException e) { LOG.error("Couldn't transform input into a BufferedImage"); throw new Exception("Couldn't transform input into a BufferedImage", e); } }

Target:
private Map<String, Float> classify(Model model, Translator translator, File input) throws Exception { try { return classify(model, translator, ImageIO.read(input)); } catch (IOException e) { LOG.error("Couldn't transform input into a BufferedImage"); throw new RuntimeException("Couldn't transform input into a BufferedImage", e); } }
Source:
@Test public void malformedAnnotationRelativeUrlThrows() { class Example { @GET("ftp://example.org") Call<ResponseBody> get() { return null; } } try { buildRequest(Example.class); } catch (IllegalArgumentException e) { assertThat(e).hasMessage( "Malformed URL. Base: <LINK_0>, Relative: ftp://example.org"); } }

Target:
@Test public void malformedAnnotationRelativeUrlThrows() { class Example { @GET("ftp://example.org") Call<ResponseBody> get() { return null; } } try { buildRequest(Example.class); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage( "Malformed URL. Base: <LINK_0>, Relative: ftp://example.org"); } }
Source:
public static RebalanceAlgorithm getInstance( Map<ClusterConfig.GlobalRebalancePreferenceKey, Integer> preferences) { List<HardConstraint> hardConstraints = ImmutableList.of(new FaultZoneAwareConstraint(), new NodeCapacityConstraint(), new ReplicaActivateConstraint(), new NodeMaxPartitionLimitConstraint(), new ValidGroupTagConstraint(), new SamePartitionOnInstanceConstraint()); int evennessPreference = preferences.getOrDefault(ClusterConfig.GlobalRebalancePreferenceKey.EVENNESS, 1); int movementPreference = preferences.getOrDefault(ClusterConfig.GlobalRebalancePreferenceKey.LESS_MOVEMENT, 1); float evennessRatio = (float) evennessPreference / (evennessPreference + movementPreference); float movementRatio = (float) movementPreference / (evennessPreference + movementPreference); Map<SoftConstraint, Float> softConstraints = ImmutableMap.<SoftConstraint, Float> builder() .put(new PartitionMovementConstraint(), movementRatio * 0.5f) .put(new InstancePartitionsCountConstraint(), 0.5f * evennessRatio) .put(new ResourcePartitionAntiAffinityConstraint(), 0.1f * evennessRatio) .put(new ResourceTopStateAntiAffinityConstraint(), 0.1f * evennessRatio) .put(new MaxCapacityUsageInstanceConstraint(), 0.25f * evennessRatio).build(); return new ConstraintBasedAlgorithm(hardConstraints, softConstraints); }

Target:
public static RebalanceAlgorithm getInstance( Map<ClusterConfig.GlobalRebalancePreferenceKey, Integer> preferences) { List<HardConstraint> hardConstraints = ImmutableList.of(new FaultZoneAwareConstraint(), new NodeCapacityConstraint(), new ReplicaActivateConstraint(), new NodeMaxPartitionLimitConstraint(), new ValidGroupTagConstraint(), new SamePartitionOnInstanceConstraint()); int evennessPreference = preferences.getOrDefault(ClusterConfig.GlobalRebalancePreferenceKey.EVENNESS, 1); int movementPreference = preferences.getOrDefault(ClusterConfig.GlobalRebalancePreferenceKey.LESS_MOVEMENT, 1); float evennessRatio = (float) evennessPreference / (evennessPreference + movementPreference); float movementRatio = (float) movementPreference / (evennessPreference + movementPreference); Map<SoftConstraint, Float> softConstraints = ImmutableMap.<SoftConstraint, Float> builder() .put(new PartitionMovementConstraint(), movementRatio) .put(new InstancePartitionsCountConstraint(), 0.3f * evennessRatio) .put(new ResourcePartitionAntiAffinityConstraint(), 0.1f * evennessRatio) .put(new ResourceTopStateAntiAffinityConstraint(), 0.1f * evennessRatio) .put(new MaxCapacityUsageInstanceConstraint(), 0.5f * evennessRatio).build(); return new ConstraintBasedAlgorithm(hardConstraints, softConstraints); }
Source:
public void testUpdateLastHeartbeatPollWhenCoordinatorUnknown() throws Exception { GroupRebalanceConfig rebalanceConfig = buildRebalanceConfig(Optional.empty()); ConsumerCoordinator coordinator = buildCoordinator(rebalanceConfig, new Metrics(), assignors, false); subscriptions.subscribe(singleton(topic1), rebalanceListener); client.prepareResponse(groupCoordinatorResponse(node, Errors.NONE)); coordinator.ensureCoordinatorReady(time.timer(Long.MAX_VALUE)); client.prepareResponse(joinGroupFollowerResponse(1, "consumer", "leader", Errors.NONE)); client.prepareResponse(syncGroupResponse(singletonList(t1p), Errors.NONE)); client.prepareResponse(heartbeatResponse(Errors.NOT_COORDINATOR)); coordinator.poll(time.timer(Long.MAX_VALUE)); time.sleep(heartbeatIntervalMs); TestUtils.waitForCondition(() -> !client.hasPendingResponses(), "Failed to observe expected heartbeat from background thread"); assertTrue(coordinator.coordinatorUnknown()); assertFalse(coordinator.poll(time.timer(0))); assertEquals(time.milliseconds(), coordinator.heartbeat().lastPollTime()); time.sleep(rebalanceTimeoutMs - 1); assertFalse(coordinator.heartbeat().pollTimeoutExpired(time.milliseconds())); }

Target:
public void testUpdateLastHeartbeatPollWhenCoordinatorUnknown() throws Exception { subscriptions.subscribe(singleton(topic1), rebalanceListener); client.prepareResponse(groupCoordinatorResponse(node, Errors.NONE)); coordinator.ensureCoordinatorReady(time.timer(Long.MAX_VALUE)); client.prepareResponse(joinGroupFollowerResponse(1, "consumer", "leader", Errors.NONE)); client.prepareResponse(syncGroupResponse(singletonList(t1p), Errors.NONE)); client.prepareResponse(heartbeatResponse(Errors.NOT_COORDINATOR)); coordinator.poll(time.timer(Long.MAX_VALUE)); time.sleep(heartbeatIntervalMs); TestUtils.waitForCondition(() -> !client.hasPendingResponses(), "Failed to observe expected heartbeat from background thread"); assertTrue(coordinator.coordinatorUnknown()); assertFalse(coordinator.poll(time.timer(0))); assertEquals(time.milliseconds(), coordinator.heartbeat().lastPollTime()); time.sleep(rebalanceTimeoutMs - 1); assertFalse(coordinator.heartbeat().pollTimeoutExpired(time.milliseconds())); }
Source:
public int hashCode() { int result = uri.hashCode(); result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); return result; }

Target:
public int hashCode() { return new HashCodeBuilder().append(uri).append(title).append(description).build(); }
Source:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__MOVE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_DISK); }

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__IMPORT); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_DISK); }
Source:
public VDS clone() { VDS vds = new VDS( getvds_group_id(), getvds_group_name(), getvds_group_description(), getId(), getvds_name(), getManagmentIp(), gethost_name(), getport(), getstatus().getValue(), getcpu_cores(), getcpu_model(), getcpu_speed_mh(), getif_total_speed(), getkvm_enabled(), getphysical_mem_mb(), getcpu_idle(), getcpu_load(), getcpu_sys(), getcpu_user(), getmem_commited(), getvm_active(), getvm_count(), getvm_migrating(), getusage_mem_percent(), getusage_cpu_percent(), getusage_network_percent(), getreserved_mem(), getguest_overhead(), getprevious_status(), getsoftware_version(), getversion_name(), getbuild_name(), getmem_available(), getmem_shared(), getserver_SSL_enabled(), getvds_group_cpu_name(), "", getnet_config_dirty(), getpm_type(), getpm_user(), getpm_password(), getpm_port(), getpm_options(), getpm_enabled()); vds.setcpu_flags(getcpu_flags()); vds.setVdsSpmPriority(getVdsSpmPriority()); vds.setOtpValidity(getOtpValidity()); vds.setkernel_version(getkernel_version()); vds.setkvm_version(getkvm_version()); vds.setHooksStr(getHooksStr()); return vds; }

Target:
public VDS clone() { VDS vds = new VDS( Guid.createGuidFromString(getvds_group_id().toString()), getvds_group_name(), getvds_group_description(), Guid.createGuidFromString(getId().toString()), getvds_name(), getManagmentIp(), gethost_name(), getport(), getstatus().getValue(), getcpu_cores(), getcpu_model(), getcpu_speed_mh(), getif_total_speed(), getkvm_enabled(), getphysical_mem_mb(), getcpu_idle(), getcpu_load(), getcpu_sys(), getcpu_user(), getmem_commited(), getvm_active(), getvm_count(), getvm_migrating(), getusage_mem_percent(), getusage_cpu_percent(), getusage_network_percent(), getreserved_mem(), getguest_overhead(), getprevious_status(), getsoftware_version(), getversion_name(), getbuild_name(), getmem_available(), getmem_shared(), getserver_SSL_enabled(), getvds_group_cpu_name(), "", getnet_config_dirty(), getpm_type(), getpm_user(), getpm_password(), getpm_port(), getpm_options(), getpm_enabled()); vds.setcpu_flags(getcpu_flags()); vds.setVdsSpmPriority(getVdsSpmPriority()); vds.setOtpValidity(getOtpValidity()); vds.setkernel_version(getkernel_version()); vds.setkvm_version(getkvm_version()); vds.setHooksStr(getHooksStr()); return vds; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { RevCommit commit = (RevCommit) getSelection(getPage()).getFirstElement(); Repository repo = getRepository(event); final BranchOperationUI op; List<RefNode> nodes = getRefNodes(commit, repo, Constants.R_HEADS, Constants.R_REMOTES); if (nodes.isEmpty()) op = BranchOperationUI.checkout(repo, commit.name()); else if (nodes.size() == 1) op = BranchOperationUI.checkout(repo, nodes.get(0).getObject().getName()); else { BranchSelectionDialog<RefNode> dlg = new BranchSelectionDialog<RefNode>( HandlerUtil.getActiveShellChecked(event), nodes, UIText.CheckoutHandler_SelectBranchTitle, UIText.CheckoutHandler_SelectBranchMessage, SWT.SINGLE); if (dlg.open() == Window.OK) { op = BranchOperationUI.checkout(repo, dlg.getSelectedNode() .getObject().getName()); } else { op = null; } } if (op == null) return null; op.start(); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RevCommit commit = (RevCommit) getSelection(getPage()).getFirstElement(); Repository repo = getRepository(event); final BranchOperationUI op; List<RefNode> nodes = getRefNodes(commit, repo, Constants.R_HEADS, Constants.R_REMOTES); Collections.sort(nodes); if (nodes.isEmpty()) op = BranchOperationUI.checkout(repo, commit.name()); else if (nodes.size() == 1) op = BranchOperationUI.checkout(repo, nodes.get(0).getObject().getName()); else { BranchSelectionDialog<RefNode> dlg = new BranchSelectionDialog<RefNode>( HandlerUtil.getActiveShellChecked(event), nodes, UIText.CheckoutHandler_SelectBranchTitle, UIText.CheckoutHandler_SelectBranchMessage, SWT.SINGLE); if (dlg.open() == Window.OK) { op = BranchOperationUI.checkout(repo, dlg.getSelectedNode() .getObject().getName()); } else { op = null; } } if (op == null) return null; op.start(); return null; }
Source:
public OAuth2TokenValidatorResult validate(Jwt idToken) { Map<String, Object> invalidClaims = validateRequiredClaims(idToken); if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } if (!issuerMatchesMetadata(idToken)) { invalidClaims.put(IdTokenClaimNames.ISS, idToken.getIssuer()); } if (!idToken.getAudience().contains(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AUD, idToken.getAudience()); } String authorizedParty = idToken.getClaimAsString(IdTokenClaimNames.AZP); if (idToken.getAudience().size() > 1 && authorizedParty == null) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } if (authorizedParty != null && !authorizedParty.equals(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } Instant now = Instant.now(this.clock); if (now.minus(this.clockSkew).isAfter(idToken.getExpiresAt())) { invalidClaims.put(IdTokenClaimNames.EXP, idToken.getExpiresAt()); } if (now.plus(this.clockSkew).isBefore(idToken.getIssuedAt())) { invalidClaims.put(IdTokenClaimNames.IAT, idToken.getIssuedAt()); } if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } return OAuth2TokenValidatorResult.success(); }

Target:
public OAuth2TokenValidatorResult validate(Jwt idToken) { Map<String, Object> invalidClaims = validateRequiredClaims(idToken); if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } String metadataIssuer = (String) this.clientRegistration.getProviderDetails().getConfigurationMetadata() .get("issuer"); if (metadataIssuer != null && !Objects.equals(metadataIssuer, idToken.getIssuer().toExternalForm())) { invalidClaims.put(IdTokenClaimNames.ISS, idToken.getIssuer()); } if (!idToken.getAudience().contains(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AUD, idToken.getAudience()); } String authorizedParty = idToken.getClaimAsString(IdTokenClaimNames.AZP); if (idToken.getAudience().size() > 1 && authorizedParty == null) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } if (authorizedParty != null && !authorizedParty.equals(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } Instant now = Instant.now(this.clock); if (now.minus(this.clockSkew).isAfter(idToken.getExpiresAt())) { invalidClaims.put(IdTokenClaimNames.EXP, idToken.getExpiresAt()); } if (now.plus(this.clockSkew).isBefore(idToken.getIssuedAt())) { invalidClaims.put(IdTokenClaimNames.IAT, idToken.getIssuedAt()); } if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } return OAuth2TokenValidatorResult.success(); }
Source:
public void add(double element) { int index = getInsertIndex(); if (index >= 0) { putAtIndex(index, Double.valueOf(element)); } }

Target:
public void add(double element) { if (++count <= samples.length) { samples[count - 1] = element; return; } int index = ThreadLocalRandom.current().nextInt(0, count); if (index < samples.length) { samples[index] = element; } }
Source:
private static Map<String, String> readProperties() { try { File file = new File(AndroidLocation.getFolder(), PATH_FIRST_RUN_PROPERTIES); if (file.isFile()) { Map<String, String> properties = Maps.newHashMap(); try { final List<String> lines = Files.readLines(file, Charsets.UTF_16LE); for (String line : lines) { int keyValueSeparator = line.indexOf('='); final String key = line.substring(0, keyValueSeparator); final String value = line.substring(keyValueSeparator + 1); properties.put(key, value); } } catch (IOException e) { Logger.getInstance(InstallerData.class).error(e); } return properties; } } catch (AndroidLocation.AndroidLocationException e) { Logger.getInstance(InstallerData.class).error(e); } return null; }

Target:
private static Map<String, String> readProperties() { try { File file = new File(AndroidLocation.getFolder(), PATH_FIRST_RUN_PROPERTIES); if (file.isFile()) { Map<String, String> properties = Maps.newHashMap(); try { final List<String> lines = Files.readLines(file, Charsets.UTF_16LE); for (String line : lines) { int keyValueSeparator = line.indexOf('='); if (keyValueSeparator < 0) { continue; } final String key = line.substring(0, keyValueSeparator).trim(); final String value = line.substring(keyValueSeparator + 1).trim(); if (key == "") { continue; } properties.put(key, value); } } catch (IOException e) { Logger.getInstance(InstallerData.class).error(e); } return properties; } } catch (AndroidLocation.AndroidLocationException e) { Logger.getInstance(InstallerData.class).error(e); } return null; }
Source:
public void serialize(LocalDateTime date, JsonGenerator generator, SerializerProvider serializerProvider) throws IOException { dateTimeFormatter.withZone(ZoneId.of("Z")); generator.writeString(dateTimeFormatter.format(date)); }

Target:
public void serialize(LocalDateTime date, JsonGenerator generator, SerializerProvider serializerProvider) throws IOException { dateTimeFormatter.withZone(of("UTC")); generator.writeString(dateTimeFormatter.format(date)); }
Source:
public void disconnect() { Object lock = partitions != null ? partitions : new Object(); synchronized (lock) { document = null; partitions = null; try { inputStream.close(); } catch (IOException e) { } } }

Target:
public void disconnect() { Object lock = partitions != null ? partitions : new Object(); synchronized (lock) { document = null; partitions.clear(); try { inputStream.close(); } catch (IOException e) { } } }
Source:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Check logcat!"); setContentView(tv); printArgs("The", "Quick", "Brown", "Fox"); Log.i("Fibonacci", "fibonacci's 4th number is " + fibonacci(4)); Greeter greeter = new Greeter("Jake"); Log.d("Greeting", greeter.sayHello()); (new Annonymous() { @Override @DebugLog public String whoIsThis() { return "I'm a nobody!"; } }).whoIsThis(); }

Target:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Check logcat!"); setContentView(tv); printArgs("The", "Quick", "Brown", "Fox"); Log.i("Fibonacci", "fibonacci's 4th number is " + fibonacci(4)); Greeter greeter = new Greeter("Jake"); Log.d("Greeting", greeter.sayHello()); }
Source:
public int compareTo(PersonName other) { int ret = isVoided().compareTo(other.isVoided()); if (ret == 0) ret = other.isPreferred().compareTo(isPreferred()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getFamilyName(), other.getFamilyName()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getFamilyName2(), other.getFamilyName2()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getGivenName(), other.getGivenName()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getMiddleName(), other.getMiddleName()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getFamilyNamePrefix(), other.getFamilyNamePrefix()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getFamilyNameSuffix(), other.getFamilyNameSuffix()); if (ret == 0 && getDateCreated() != null) ret = OpenmrsUtil.compareWithNullAsLatest(getDateCreated(), other.getDateCreated()); if (ret == 0 && !equalsContent(other)) ret = 1; return ret; }

Target:
public int compareTo(PersonName other) { DefaultComparator pnDefaultComparator = new DefaultComparator(); return pnDefaultComparator.compare(this, other); }
Source:
public void init() { eventIpcManager.addEventListener(this); }

Target:
public void init() { eventIpcManager.addEventListener(this, UEI_LIST); }
Source:
public RequestStatus createResourcesAuthorized(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { Set<Resource> resources = new HashSet<>(); ResourceProvider userResourceProvider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.User, getManagementController()); ResourceProvider privilegeResourceProvider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.UserPrivilege, getManagementController()); ResourceProvider userAuthenticationSourceResourceProvider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.UserAuthenticationSource, getManagementController()); ResourceProvider activeWidgetLayoutResourceProvider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.ActiveWidgetLayout, getManagementController()); for (Map<String, Object> requestProperties : request.getProperties()) { if (userResourceProvider != null) { try { Predicate predicate = getPredicate(requestProperties, UserResourceProvider.USER_USERNAME_PROPERTY_ID); resources.addAll(userResourceProvider.getResources(request, predicate)); } catch (NoSuchResourceException e) { throw new SystemException("Error during users retrieving", e); } } if (privilegeResourceProvider != null) { try { Predicate predicate = getPredicate(requestProperties, UserPrivilegeResourceProvider.USER_NAME); resources.addAll(privilegeResourceProvider.getResources(request, predicate)); } catch (NoSuchResourceException e) { throw new SystemException("Error during privileges retrieving", e); } } if (userAuthenticationSourceResourceProvider != null) { try { Predicate predicate = getPredicate(requestProperties, UserAuthenticationSourceResourceProvider.AUTHENTICATION_USER_NAME_PROPERTY_ID); resources.addAll(userAuthenticationSourceResourceProvider.getResources(request, predicate)); } catch (NoSuchResourceException e) { throw new SystemException("Error during user authentication sources retrieving", e); } } if (activeWidgetLayoutResourceProvider != null) { try { Predicate predicate = getPredicate(requestProperties, ActiveWidgetLayoutResourceProvider.WIDGETLAYOUT_USERNAME_PROPERTY_ID); resources.addAll(activeWidgetLayoutResourceProvider.getResources(request, predicate)); } catch (NoSuchResourceException e) { throw new SystemException("Error during active widgets layouts retrieving", e); } } } return getRequestStatus(null, resources); }

Target:
public RequestStatus createResourcesAuthorized(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { return getRequestStatus(null); }
Source:
public void canLoadPlugin() { System.out.println(TestPlugin.class.getCanonicalName()); config.setEnabledScheme("test-plugin"); final AuthenticationPlugin<?> plugin = AuthenticationPluginLoader.load(config); assertThat(plugin, instanceOf(TestPlugin.class)); }

Target:
public void canLoadPlugin() { config.setEnabledScheme("test-plugin"); final AuthenticationPlugin<?> plugin = AuthenticationPluginLoader.load(config); assertThat(plugin, instanceOf(TestPlugin.class)); }
Source:
protected double getColumnWidth(String expressionIdentifierName) { ExpressionIdentifier.NAME expressionName; try { expressionName = ExpressionIdentifier.NAME.valueOf(expressionIdentifierName); } catch (IllegalArgumentException e) { expressionName = ExpressionIdentifier.NAME.Other; } switch (expressionName) { case Index: return 70; case Description: return 300; default: return 114; } }

Target:
protected static double getColumnWidth(String expressionIdentifierName) { ExpressionIdentifier.NAME expressionName; try { expressionName = ExpressionIdentifier.NAME.valueOf(expressionIdentifierName); } catch (IllegalArgumentException e) { expressionName = ExpressionIdentifier.NAME.Other; } switch (expressionName) { case Index: return 70; case Description: return 300; default: return 114; } }
Source:
private boolean checkLDAPCredentials() { if (username == null || password == null || ldap_provider_url == null || ldap_provider_url.length() == 0) { return false; } boolean isAuthenticated = false; String localPrincipal = ldap_sec_principal; if (localPrincipal != null && localPrincipal.contains("<")) { localPrincipal = localPrincipal.replace("<uid>", username); } else if (localPrincipal != null && localPrincipal.contains("[")) { localPrincipal = localPrincipal.replace("[uid]", username); } try { ActiveDirectory ad = new ActiveDirectory(username, password, ldap_init_context_factory, ldap_provider_url, ldap_protocol, ldap_auth_meth, localPrincipal); if (ldap_domain != null && ldap_user_attribute_map != null && !ldap_user_attribute_map.isEmpty()) { NamingEnumeration<SearchResult> answer = ad.searchUser(username, ldap_domain, Util.keysToArray(ldap_user_attribute_map)); isAuthenticated = ad.doesMatchUserAttribute(answer, ldap_user_attribute_map); } else { isAuthenticated = true; } } catch (Exception e) { System.out.println("ERROR in checkLDAPCredentials: " + e); e.printStackTrace(); isAuthenticated = false; } return isAuthenticated; }

Target:
private boolean checkLDAPCredentials() { if (username == null || password == null || ldap_provider_url == null || ldap_provider_url.length() == 0) { return false; } boolean isAuthenticated = false; String localPrincipal = ldap_sec_principal; if (localPrincipal != null && localPrincipal.contains("<")) { localPrincipal = localPrincipal.replace("<uid>", username); } else if (localPrincipal != null && localPrincipal.contains("[")) { localPrincipal = localPrincipal.replace("[uid]", username); } try { ActiveDirectory ad = new ActiveDirectory(username, password, ldap_init_context_factory, ldap_provider_url, ldap_protocol, ldap_auth_meth, localPrincipal); if (ldap_domain != null && ldap_user_attribute_map != null && !ldap_user_attribute_map.isEmpty()) { NamingEnumeration<SearchResult> answer = ad.searchUser(username, ldap_domain, Util.keysToArray(ldap_user_attribute_map)); isAuthenticated = ad.doesMatchUserAttribute(answer, ldap_user_attribute_map); } else { isAuthenticated = true; } } catch (Exception e) { LOG.error("ERROR in checkLDAPCredentials: ", e); isAuthenticated = false; } return isAuthenticated; }
Source:
private boolean categorizeMutableRealmIntegerField(VariableElement field) { if (!field.getModifiers().contains(Modifier.FINAL)) { Utils.error(String.format(Locale.US, "Field \"%s\", a MutableRealmInteger, must be final.", field.getSimpleName().toString())); return false; } containsMutableRealmInteger = true; return true; }

Target:
private boolean categorizeMutableRealmIntegerField(VariableElement field) { if (field.getModifiers().contains(Modifier.FINAL)) { return true; } Utils.error(String.format(Locale.US, "Field \"%s\", a MutableRealmInteger, must be final.", field.getSimpleName().toString())); return false; }
Source:
public DatagramReader createRangeReader(int count) { if (0 < currentBitIndex) { throw new IllegalStateException(); } int available = byteStream.available(); if (available < count) { throw new IllegalArgumentException( "requested " + count + " bytes exceeds available " + available + " bytes."); } if (byteStream instanceof RangeInputStream) { RangeInputStream range = (RangeInputStream) byteStream; return new DatagramReader(range.range(count)); } else { byte[] range = new byte[count]; byteStream.read(range, 0, count); return new DatagramReader(new RangeInputStream(range)); } }

Target:
public DatagramReader createRangeReader(int count) { if (currentBitIndex > 0) { throw new IllegalStateException(currentBitIndex + " bits unread!"); } int available = byteStream.available(); if (available < count) { throw new IllegalArgumentException( "requested " + count + " bytes exceeds available " + available + " bytes."); } if (byteStream instanceof RangeInputStream) { RangeInputStream range = (RangeInputStream) byteStream; return new DatagramReader(range.range(count)); } else { byte[] range = new byte[count]; byteStream.read(range, 0, count); return new DatagramReader(new RangeInputStream(range)); } }