auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response activate(Action action) { validateParameters(action, "bricks"); validateBrickNames(action); GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, VdcQueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), ""); if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) { return stopMigrate(action); } else { Fault fault = new Fault(); fault.setReason(localize(Messages.CANNOT_ACTIVATE_UNLESS_MIGRATION_COMPLETED)); throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST) .entity(fault) .build()); } }

Target:
public Response activate(Action action) { validateParameters(action, "bricks"); validateBrickNames(action); GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, VdcQueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), ""); if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) { return stopMigrate(action); } else { Fault fault = new Fault(); fault.setReason(localize(Messages.CANNOT_ACTIVATE_UNLESS_MIGRATION_COMPLETED)); throw new WebApplicationException(Response.status(Response.Status.CONFLICT) .entity(fault) .build()); } }
Source:
public void processRequest(final RequestContext context, final RequestSecurityProcessorChain processorChain) throws Exception { HttpServletRequest request = context.getRequest(); Authentication auth = SecurityUtils.getAuthentication(request); logger.debug("Checking headers from Mellon"); String username = request.getHeader(usernameHeaderName); String email = request.getHeader(emailHeaderName); HierarchicalConfiguration config = ConfigUtils.getCurrentConfig(); if (StringUtils.isNoneEmpty(username, email) && Objects.isNull(auth) && Objects.nonNull(config) && config.containsKey(SAML_TOKEN_CONFIG_KEY) && hasValidToken(request)) { logger.debug("Using standalone SAML authentication"); logger.debug("Creating authentication object for '{}'", username); Profile profile = new Profile(); profile.setUsername(username); profile.setEmail(email); addAttributes(profile, request, config); addRoles(profile, request, config); SecurityUtils.setAuthentication(request, new PreAuthenticatedProfile(profile)); processorChain.processRequest(context); } else { logger.debug("Using Crafter Profile SAML authentication"); super.processRequest(context, processorChain); } }

Target:
public void processRequest(final RequestContext context, final RequestSecurityProcessorChain processorChain) throws Exception { HttpServletRequest request = context.getRequest(); Authentication auth = SecurityUtils.getAuthentication(request); logger.debug("Checking authentication headers"); String username = request.getHeader(usernameHeaderName); String email = request.getHeader(emailHeaderName); HierarchicalConfiguration config = ConfigUtils.getCurrentConfig(); if (StringUtils.isNoneEmpty(username, email) && Objects.isNull(auth) && Objects.nonNull(config) && config.containsKey(SAML_TOKEN_CONFIG_KEY) && hasValidToken(request)) { logger.debug("Using standalone SAML authentication"); logger.debug("Creating authentication object for '{}'", username); Profile profile = new Profile(); profile.setUsername(username); profile.setEmail(email); addAttributes(profile, request, config); addRoles(profile, request, config); SecurityUtils.setAuthentication(request, new PreAuthenticatedProfile(profile)); processorChain.processRequest(context); } else { logger.debug("Using Crafter Profile SAML authentication"); super.processRequest(context, processorChain); } }
Source:
public void deserialize(Block block, int index, MultimapAggregationState state) { state.reset(); ColumnarRow columnarRow = toColumnarRow(arrayType.getObject(block, index)); Block keys = columnarRow.getField(1); Block values = columnarRow.getField(0); for (int i = 0; i < columnarRow.getPositionCount(); i++) { state.add(keys, values, i); } }

Target:
public void deserialize(Block block, int index, MultimapAggregationState state) { state.reset(); ColumnarRow columnarRow = toColumnarRow(arrayType.getObject(block, index)); Block keys = columnarRow.getField(KEY_CHANNEL); Block values = columnarRow.getField(VALUE_CHANNEL); for (int i = 0; i < columnarRow.getPositionCount(); i++) { state.add(keys, values, i); } }
Source:
private Map<String, String> buildResultTagMap(Result result) throws Exception { Map<String, String> resultTagsToApply = new TreeMap<String, String>(); for (ResultAttribute resultAttribute : resultAttributesToWriteAsTags) { Method m = result.getClass().getMethod(resultAttribute.getAccessorMethod()); resultTagsToApply.put(resultAttribute.getTagName(), (String) m.invoke(result)); } return resultTagsToApply; }

Target:
private Map<String, String> buildResultTagMap(Result result) throws Exception { Map<String, String> resultTagMap = new TreeMap<String, String>(); for (ResultAttribute resultAttribute : resultAttributesToWriteAsTags) { resultAttribute.addAttribute(resultTagMap, result); } return resultTagMap; }
Source:
public CatalogStorage(Cluster cluster, CatalogTable table) throws URISyntaxException { this(ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY).getEndpoint(), table); verifyAndUpdateConfiguration(getConf()); }

Target:
public CatalogStorage(Cluster cluster, CatalogTable table) throws URISyntaxException { this(ClusterHelper.getInterface(cluster, Interfacetype.REGISTRY).getEndpoint(), table); }
Source:
public static void init() { SWTBotUtils.failIfUIThread(); URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(COLUMN_TRACE_PATH), null); URI uri; try { uri = FileLocator.toFileURL(location).toURI(); fTestFile = new File(uri); } catch (URISyntaxException | IOException e) { fail(e.getMessage()); } assumeTrue(fTestFile.exists()); IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID); defaultPreferences.put(ITmfTimePreferencesConstants.DATIME, "MMM d HH:mm:ss"); defaultPreferences.put(ITmfTimePreferencesConstants.SUBSEC, ITmfTimePreferencesConstants.SUBSEC_NO_FMT); TmfTimestampFormat.updateDefaultFormats(); SWTBotPreferences.TIMEOUT = 20000; fLogger.removeAllAppenders(); fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("Welcome", fBot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); }

Target:
public static void init() { SWTBotUtils.failIfUIThread(); URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(COLUMN_TRACE_PATH), null); URI uri; try { uri = FileLocator.toFileURL(location).toURI(); fTestFile = new File(uri); } catch (URISyntaxException | IOException e) { fail(e.getMessage()); } assumeTrue(fTestFile.exists()); SWTBotPreferences.TIMEOUT = 20000; fLogger.removeAllAppenders(); fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("Welcome", fBot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); }
Source:
public boolean write() throws IOException { Send send = networkSend.getPayload(); if (send == null) { throw new IllegalStateException("Registered for write interest but no response attached to key."); } long startTimeMs = SystemTime.getInstance().milliseconds(); long bytesWritten = send.writeTo(socketChannel); long writeTimeMs = SystemTime.getInstance().milliseconds() - startTimeMs; logger.trace("Bytes written to using key Time: {}", bytesWritten, socketChannel.socket().getRemoteSocketAddress(), getConnectionId(), writeTimeMs); if (bytesWritten > 0) { metrics.plaintextSendTimePerKB.update(writeTimeMs * 1024 / bytesWritten); metrics.plaintextSendTime.update(writeTimeMs); } return send.isSendComplete(); }

Target:
public boolean write() throws IOException { Send send = networkSend.getPayload(); if (send == null) { throw new IllegalStateException("Registered for write interest but no response attached to key."); } long startTimeMs = SystemTime.getInstance().milliseconds(); long bytesWritten = send.writeTo(socketChannel); long writeTimeMs = SystemTime.getInstance().milliseconds() - startTimeMs; logger.trace("Bytes written to using key Time: {}", bytesWritten, socketChannel.socket().getRemoteSocketAddress(), getConnectionId(), writeTimeMs); if (bytesWritten > 0) { metrics.plaintextSendTimeInUsPerKB.update(TimeUnit.MILLISECONDS.toMicros(writeTimeMs) * 1024 / bytesWritten); metrics.plaintextSendTime.update(writeTimeMs); } return send.isSendComplete(); }
Source:
private static boolean skip(String name) { return name.startsWith("refs/changes/") || name.startsWith("refs/cache-automerge/"); }

Target:
private static boolean skip(String name) { return name.startsWith("refs/changes/") || name.startsWith(GitRepositoryManager.REFS_CACHE_AUTOMERGE); }
Source:
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { argumentResolvers.add(repositoryInstanceMethodArgumentResolver()); }

Target:
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { argumentResolvers.add(repositoryMethodArgumentResolver()); }
Source:
public void loadApplicationsShouldRespondWithSingleElementArrayWhenThereIsOnlyOneApplication() throws Exception { given(statesHistoryService.getCandidateApplicationsByCandidateId(CANDIDATE_ID)) .willReturn(Collections.singletonList(developerApplicationDto)); mockMvc.perform( get(REQUEST_URL + CANDIDATE_ID.toString()).accept(MediaTypes.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaTypes.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$").isArray()) .andExpect(jsonPath("$[0]").exists()) .andExpect(jsonPath("$[0].lastStateId", equalTo(LAST_STATE_ID.intValue()))) .andExpect(jsonPath("$[0].applicationId", equalTo(APPLICATION_ID.intValue()))) .andExpect(jsonPath("$[0].positionName", equalTo(DEVELOPER_POSITION))) .andExpect(jsonPath("$[0].creationDate", equalTo(CREATION_DATE))) .andExpect(jsonPath("$[0].modificationDate", equalTo(MODIFICATION_DATE))) .andExpect(jsonPath("$[0].stateType", equalTo(LOCALIZED_STATE_TYPE))) .andExpect(jsonPath("$[1]").doesNotExist()); then(statesHistoryService).should().getCandidateApplicationsByCandidateId(CANDIDATE_ID); then(messageSource).should() .getMessage(eq(APPLICATION_STATE + RAW_STATE_TYPE), eq(new Object[]{RAW_STATE_TYPE}), any(Locale.class)); }

Target:
public void loadApplicationsShouldRespondWithSingleElementArrayWhenThereIsOnlyOneApplication() throws Exception { given(statesHistoryService.getCandidateApplicationsByCandidateId(CANDIDATE_ID)) .willReturn(Collections.singletonList(developerApplicationDto)); ResultActions resultActions = mockMvc.perform( get(REQUEST_URL + CANDIDATE_ID.toString()).accept(MediaTypes.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaTypes.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$").isArray()) .andExpect(jsonPath("$[0]").exists()) .andExpect(jsonPath("$[1]").doesNotExist()); assertApplicationResponse(resultActions, 0, developerApplicationDto); then(statesHistoryService).should().getCandidateApplicationsByCandidateId(CANDIDATE_ID); then(messageSource).should() .getMessage(eq(APPLICATION_STATE + RAW_STATE_TYPE), eq(new Object[]{RAW_STATE_TYPE}), any(Locale.class)); }
Source:
private void checkForMerge(final Master master) throws Exception { VolumeManager fs = master.getFileSystem(); final Path bulkDir = new Path(bulkInfo.sourceDir); try (LoadMappingIterator lmi = BulkSerialize.readLoadMapping(bulkDir.toString(), bulkInfo.tableId, p -> fs.open(p))) { Iterators.transform(lmi, entry -> entry.getKey()); TabletIterFactory tabletIterFactory = startRow -> TabletsMetadata.builder() .forTable(bulkInfo.tableId).overlapping(startRow, null).checkConsistency().fetchPrev() .build(master.getContext()).stream().map(TabletMetadata::getExtent).iterator(); checkForMerge(bulkInfo.tableId.canonicalID(), Iterators.transform(lmi, entry -> entry.getKey()), tabletIterFactory); } }

Target:
private void checkForMerge(final Master master) throws Exception { VolumeManager fs = master.getFileSystem(); final Path bulkDir = new Path(bulkInfo.sourceDir); try (LoadMappingIterator lmi = BulkSerialize.readLoadMapping(bulkDir.toString(), bulkInfo.tableId, p -> fs.open(p))) { TabletIterFactory tabletIterFactory = startRow -> TabletsMetadata.builder() .forTable(bulkInfo.tableId).overlapping(startRow, null).checkConsistency().fetchPrev() .build(master.getContext()).stream().map(TabletMetadata::getExtent).iterator(); checkForMerge(bulkInfo.tableId.canonicalID(), Iterators.transform(lmi, entry -> entry.getKey()), tabletIterFactory); } }
Source:
public void checkVolumeExists(String name, String path) { seleniumWebDriverHelper.waitVisibility(By.xpath(format(Locators.VOLUME_NAME_XPATH, name))); seleniumWebDriverHelper.waitVisibility(By.xpath(format(Locators.VOLUME_PATH_XPATH, name))); }

Target:
public Boolean checkVolumeExists(String name, String path) { return seleniumWebDriverHelper .waitVisibilityAndGetText(By.xpath(format(Locators.VOLUME_PATH_XPATH_PATTERN, name))) .equals(path); }
Source:
protected void recordLineage(BatchSinkContext context, String outputName, Schema tableSchema, String operationName, String description) { LineageRecorder lineageRecorder = new LineageRecorder(context, outputName); lineageRecorder.createExternalDataset(tableSchema); List<String> fieldNames = tableSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); if (!fieldNames.isEmpty()) { lineageRecorder.recordWrite(operationName, description, fieldNames); } }

Target:
protected void recordLineage(BatchSinkContext context, String outputName, Schema tableSchema, String operationName, String description) { if (tableSchema == null) { LOG.warn("Schema for output %s is null. Field-level lineage will not be recorded.", outputName); return; } if (tableSchema.getFields() == null) { LOG.warn("Schema fields for output %s is empty. Field-level lineage will not be recorded", outputName); return; } LineageRecorder lineageRecorder = new LineageRecorder(context, outputName); lineageRecorder.createExternalDataset(tableSchema); List<String> fieldNames = tableSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); if (!fieldNames.isEmpty()) { lineageRecorder.recordWrite(operationName, description, fieldNames); } }
Source:
public void localhostTest() throws Exception { LocalhostFilter filter = mockWithRemoteAddress("127.0.0.1"); ContainerRequestContext context = mockContainerRequestContext("test"); ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class); filter.filter(context); verify(context, never()).abortWith(captor.capture()); }

Target:
public void localhostTest() throws Exception { assertFilterDoesNotBlockAddress("127.0.0.1"); }
Source:
private boolean isRemoteCache(RemoteOptions options) { return options.diskCache != null && !options.diskCache.isEmpty(); }

Target:
private boolean isRemoteCache(RemoteOptions options) { return !isNullOrEmpty(options.remoteCache); }
Source:
private void registerGateway(Stack stack) { String knoxUrl = stack.getTunnel().useCcm() && entitlementService.ccmV2Enabled(getAccountId(stack)) ? knoxUrlForCcmV2(stack) : knoxUrl(stack); ConfigUpdateRequest request = new ConfigUpdateRequest(stack.getResourceCrn(), knoxUrl); clusterProxyRegistrationClient.updateConfig(request); }

Target:
private void registerGateway(Stack stack) { String knoxUrl = stack.getTunnel().useCcmV2() ? knoxUrlForCcmV2(stack) : knoxUrl(stack); ConfigUpdateRequest request = new ConfigUpdateRequest(stack.getResourceCrn(), knoxUrl); clusterProxyRegistrationClient.updateConfig(request); }
Source:
public void onAuthenticationChanged(OnAuthenticationChanged event) { if (event.isError()) { disconnectGoogleClient(); AppLog.e(T.API, "LoginEmailFragment.onAuthenticationChanged: " + event.error.type + " - " + event.error.message); AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_FAILED, event.getClass().getSimpleName(), event.error.type.toString(), event.error.message); } else if (mAccountStore.hasAccessToken()) { mDispatcher.dispatch(AccountActionBuilder.newFetchAccountAction()); NotificationsUpdateService.startService(getActivity().getApplicationContext()); } }

Target:
public void onAuthenticationChanged(OnAuthenticationChanged event) { if (event.isError()) { disconnectGoogleClient(); AppLog.e(T.API, "LoginEmailFragment.onAuthenticationChanged: " + event.error.type + " - " + event.error.message); AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_FAILED, event.getClass().getSimpleName(), event.error.type.toString(), event.error.message); } else { AppLog.i(T.NUX, "LoginEmailFragment.onAuthenticationChanged: " + event.toString()); doFinishLogin(); } }
Source:
public void close() { tx.commit(); }

Target:
public void close() { tx.close(); }
Source:
protected void setCPU( ICraftingCPU c ) { if( c == this.monitor ) { return; } if( this.monitor != null ) { this.monitor.removeListener( this ); } for( Object g : this.crafters ) { if( g instanceof EntityPlayer ) { try { NetworkHandler.instance.sendTo( new PacketValueConfig( "CraftingStatus", "Clear" ), (EntityPlayerMP) g ); } catch( IOException e ) { AELog.error( e ); } } } if( c instanceof CraftingCPUCluster ) { this.cpuName = c.getName(); this.monitor = (CraftingCPUCluster) c; if( this.monitor != null ) { this.list.resetStatus(); this.monitor.getListOfItem( this.list, CraftingItemList.ALL ); this.monitor.addListener( this, null ); this.eta = 0; } } else { this.monitor = null; this.cpuName = ""; } }

Target:
protected void setCPU( ICraftingCPU c ) { if( c == this.monitor ) { return; } if( this.monitor != null ) { this.monitor.removeListener( this ); } for( Object g : this.crafters ) { if( g instanceof EntityPlayer ) { try { NetworkHandler.instance.sendTo( new PacketValueConfig( "CraftingStatus", "Clear" ), (EntityPlayerMP) g ); } catch( IOException e ) { AELog.error( e ); } } } if( c instanceof CraftingCPUCluster ) { this.cpuName = c.getName(); this.monitor = (CraftingCPUCluster) c; this.list.resetStatus(); this.monitor.getListOfItem( this.list, CraftingItemList.ALL ); this.monitor.addListener( this, null ); this.eta = 0; } else { this.monitor = null; this.cpuName = ""; } }
Source:
private static Map<TopicPartition, Long> getTopicPartitionOffsetsMap(final List<String> changelogTopics, final List<Integer> topicsNumPartitions) { if (changelogTopics.size() != topicsNumPartitions.size()) { throw new IllegalStateException("Passed in " + changelogTopics.size() + " changelog topic names, but " + topicsNumPartitions.size() + " different numPartitions for the topics"); } final Map<TopicPartition, Long> changelogEndOffsets = new HashMap<>(); for (int i = 0; i < changelogTopics.size(); ++i) { final String topic = changelogTopics.get(i); final int numPartitions = topicsNumPartitions.get(i); for (int partition = 0; partition < numPartitions; ++partition) { changelogEndOffsets.put(new TopicPartition(topic, partition), 0L); } } return changelogEndOffsets; }

Target:
private static Map<TopicPartition, Long> getTopicPartitionOffsetsMap(final List<String> changelogTopics, final List<Integer> topicsNumPartitions) { if (changelogTopics.size() != topicsNumPartitions.size()) { throw new IllegalStateException("Passed in " + changelogTopics.size() + " changelog topic names, but " + topicsNumPartitions.size() + " different numPartitions for the topics"); } final Map<TopicPartition, Long> changelogEndOffsets = new HashMap<>(); for (int i = 0; i < changelogTopics.size(); ++i) { final String topic = changelogTopics.get(i); final int numPartitions = topicsNumPartitions.get(i); for (int partition = 0; partition < numPartitions; ++partition) { changelogEndOffsets.put(new TopicPartition(topic, partition), Long.MAX_VALUE); } } return changelogEndOffsets; }
Source:
private Observable<PersistentResource> getValueChecked(PersistentResource<?> resource, String fieldName, RequestScope requestScope) { EntityDictionary dictionary = resource.getDictionary(); requestScope.getPermissionExecutor().checkSpecificFieldPermissions(resource, null, ReadPermission.class, fieldName); Object entity = resource.getObject(); if (entity == null || resource.getDictionary() .getRelationshipType(getType(entity.getClass()), fieldName) == RelationshipType.NONE) { return Observable.empty(); } Relationship relationship = Relationship.builder() .name(fieldName) .alias(fieldName) .projection(EntityProjection.builder() .type(dictionary.getParameterizedType(resource.getResourceType(), fieldName)) .build()) .build(); return resource.getRelationChecked(relationship); }

Target:
private Observable<PersistentResource> getValueChecked(PersistentResource<?> resource, String fieldName, RequestScope requestScope) { EntityDictionary dictionary = resource.getDictionary(); requestScope.getPermissionExecutor().checkSpecificFieldPermissions(resource, null, ReadPermission.class, fieldName); Object entity = resource.getObject(); if (entity == null || resource.getDictionary() .getRelationshipType(resource.getResourceType(), fieldName) == RelationshipType.NONE) { return Observable.empty(); } Relationship relationship = Relationship.builder() .name(fieldName) .alias(fieldName) .projection(EntityProjection.builder() .type(dictionary.getParameterizedType(resource.getResourceType(), fieldName)) .build()) .build(); return resource.getRelationChecked(relationship); }
Source:
public Filter drop() { return new Filter(matchers).on(); }

Target:
public Filter drop() { return new Filter(from, to, verbs, matcher).on(); }
Source:
public void sendMail(String host, String reply, String to, String subject, String messageText) { Properties props = System.getProperties(); props.put("mail.smtp.host", host); Session session = Session.getDefaultInstance(props, null); try { MimeMessage msg = new MimeMessage(session); String[] recipientStrings = to.split(","); InternetAddress[] recipients = new InternetAddress[recipientStrings.length]; try { InternetAddress fromAddress=getSystemAddress(); fromAddress.setPersonal(fromAddress.getPersonal() + "on behalf of " + reply, charset); msg.setFrom(fromAddress); msg.setReplyTo(new Address[] {new InternetAddress(reply, charset)}); for (int i = 0; i < recipients.length; i++) { recipients[i] = new InternetAddress(recipientStrings[i], "", charset); } } catch (UnsupportedEncodingException ex) { logger.severe(ex.getMessage()); } msg.setRecipients(Message.RecipientType.TO, recipients); msg.setSubject(subject, charset); msg.setText(messageText, charset); Transport.send(msg, recipients); } catch (AddressException ae) { ae.printStackTrace(System.out); } catch (MessagingException me) { me.printStackTrace(System.out); } }

Target:
public void sendMail(String host, String reply, String to, String subject, String messageText) { Properties props = System.getProperties(); props.put("mail.smtp.host", host); Session session = Session.getDefaultInstance(props, null); try { MimeMessage msg = new MimeMessage(session); String[] recipientStrings = to.split(","); InternetAddress[] recipients = new InternetAddress[recipientStrings.length]; try { InternetAddress fromAddress=getSystemAddress(); fromAddress.setPersonal(BundleUtil.getStringFromBundle("contact.delegation", Arrays.asList( fromAddress.getPersonal(), reply)), charset); msg.setFrom(fromAddress); msg.setReplyTo(new Address[] {new InternetAddress(reply, charset)}); for (int i = 0; i < recipients.length; i++) { recipients[i] = new InternetAddress(recipientStrings[i], "", charset); } } catch (UnsupportedEncodingException ex) { logger.severe(ex.getMessage()); } msg.setRecipients(Message.RecipientType.TO, recipients); msg.setSubject(subject, charset); msg.setText(messageText, charset); Transport.send(msg, recipients); } catch (AddressException ae) { ae.printStackTrace(System.out); } catch (MessagingException me) { me.printStackTrace(System.out); } }
Source:
public void test() throws Exception { Schema schema = schemaManager.getSchema("dublincore"); Field title = schema.getField("title"); List<PathNode> titleNode = Arrays.asList(new PathNode(title)); ConstraintViolation violation1 = new ConstraintViolation(schema, titleNode, NotNullConstraint.get(), null); Field description = schema.getField("description"); List<PathNode> descNode = Arrays.asList(new PathNode(description)); ConstraintViolation violation2 = new ConstraintViolation(schema, descNode, new PatternConstraint(".*"), null); DocumentValidationReport report = new DocumentValidationReport(Arrays.asList(violation1, violation2)); JsonAssert json = jsonAssert(report); json.properties(4); json.has("entity-type").isEquals("validation_report"); json.has("has_error").isTrue(); json.has("number").isEquals(2); json = json.has("violations").length(2); json.has(0).properties(5).has("message").isText(); json.has(1).properties(5).has("message").isText(); json.childrenContains("invalid_value", null, null); json.childrenContains("constraint.entity-type", "validation_constraint", "validation_constraint"); json.childrenContains("constraint.name", "NotNullConstraint", "PatternConstraint"); json.childrenContains("path.field_name", "dc:title", "dc:description"); json.childrenContains("path.is_list_item", "false", "false"); }

Target:
public void test() throws Exception { Schema schema = schemaManager.getSchema("dublincore"); Field title = schema.getField("title"); List<PathNode> titleNode = Arrays.asList(new PathNode(title)); ConstraintViolation violation1 = new ConstraintViolation(schema, titleNode, NotNullConstraint.get(), null); Field description = schema.getField("description"); List<PathNode> descNode = Arrays.asList(new PathNode(description)); ConstraintViolation violation2 = new ConstraintViolation(schema, descNode, new PatternConstraint(".*"), null); DocumentValidationReport report = new DocumentValidationReport(Arrays.asList(violation1, violation2)); JsonAssert json = jsonAssert(report); json.properties(4); json.has("entity-type").isEquals("validation_report"); json.has("has_error").isTrue(); json.has("number").isEquals(2); json = json.has("violations").length(2); json.has(0).properties(5).has("message").isText(); json.has(1).properties(5).has("message").isText(); json.childrenContains("messageKey", "label.schema.constraint.violation.NotNullConstraint.dublincore.title", "label.schema.constraint.violation.PatternConstraint.dublincore.description"); json.childrenContains("invalid_value", null, null); json.childrenContains("constraint.entity-type", "validation_constraint", "validation_constraint"); json.childrenContains("constraint.name", "NotNullConstraint", "PatternConstraint"); json.childrenContains("path.field_name", "dc:title", "dc:description"); json.childrenContains("path.is_list_item", "false", "false"); }
Source:
public void eventMessageLogger(GlusterAsyncTask task, JobExecutionStatus oldStatus, VDSGroup cluster) { String vol = task.getTaskParameters().getVolumeName(); GlusterVolumeEntity volume = getVolumeDao().getByName(cluster.getId(), vol); if (JobExecutionStatus.ABORTED == task.getStatus() || JobExecutionStatus.FINISHED == task.getStatus() || JobExecutionStatus.FAILED == task.getStatus()){ if(oldStatus != task.getStatus()){ logMessage(volume.getClusterId(), volume , taskTypeStrMap.get(task.getType()), task.getStatus().name().toLowerCase(), taskTypeAuditMsg.get(task.getType())); } } }

Target:
public void eventMessageLogger(GlusterAsyncTask task, JobExecutionStatus oldStatus, VDSGroup cluster) { String vol = task.getTaskParameters().getVolumeName(); GlusterVolumeEntity volume = getVolumeDao().getByName(cluster.getId(), vol); if (JobExecutionStatus.ABORTED == task.getStatus() || JobExecutionStatus.FINISHED == task.getStatus() || JobExecutionStatus.FAILED == task.getStatus()){ if(oldStatus != task.getStatus()){ logMessage(cluster.getId(), volume , taskTypeStrMap.get(task.getType()), task.getStatus().name().toLowerCase(), taskTypeAuditMsg.get(task.getType())); } } }
Source:
public ResourceBundle merge(ResourceBundle other) { if (other instanceof ResourceBundleDescriptor) { boolean append = ((ResourceBundleDescriptor) other).isAppend(); List<String> res = other.getResources(); List<String> merged = new ArrayList<String>(); if (append && resources != null) { merged.addAll(resources); } if (res != null) { merged.addAll(res); } if (merged.removeAll(Arrays.asList("", null))) { log.error("Some resources references were null or blank while setting " + this.name + " and have been supressed. This probably happened because some <resource> tags were empty in the xml declaration. The correct form is <resource>resource name</resource>."); } resources = merged; } return this; }

Target:
public ResourceBundle merge(ResourceBundle other) { if (other instanceof ResourceBundleDescriptor) { boolean append = ((ResourceBundleDescriptor) other).isAppend(); List<String> res = other.getResources(); List<String> merged = new ArrayList<String>(); if (append && resources != null) { merged.addAll(resources); } if (res != null) { merged.addAll(res); } resources = merged; } return this; }
Source:
public WorkerConnectionInfoProto getProto() { builder.setId(id) .setHost(host) .setPeerRpcPort(peerRpcPort) .setPullServerPort(pullServerPort) .setClientPort(clientPort) .setHttpInfoPort(httpInfoPort) .setQueryMasterPort(queryMasterPort); return builder.build(); }

Target:
public WorkerConnectionInfoProto getProto() { WorkerConnectionInfoProto.Builder builder = WorkerConnectionInfoProto.newBuilder(); builder.setId(id) .setHost(host) .setPeerRpcPort(peerRpcPort) .setPullServerPort(pullServerPort) .setClientPort(clientPort) .setHttpInfoPort(httpInfoPort) .setQueryMasterPort(queryMasterPort); return builder.build(); }
Source:
public void TopWikipediaSessionsTest() { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); TopWikipediaSessions app = new TopWikipediaSessions(); try { lma.prepareDAG(app, conf); } catch (Exception e) { e.printStackTrace(); } LocalMode.Controller lc = lma.getController(); lc.run(50000); }

Target:
public void TopWikipediaSessionsTest() throws Exception { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); lma.prepareDAG(new TopWikipediaSessions(), conf); LocalMode.Controller lc = lma.getController(); ((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return TopWikipediaSessions.SessionGen.getTupleCount() >= 250; } }); lc.run(30000); for (int i = 0; i < TopWikipediaSessions.Collector.getResult().size(); i++) { Assert.assertTrue(isInOrder(TopWikipediaSessions.Collector.getResult().get(i))); } }
Source:
public boolean delete(final PagedMessage[] messages) throws Exception { if (storageManager != null) { storageManager.pageDeleted(storeName, pageId); } if (logger.isDebugEnabled()) { logger.debug("Deleting pageNr=" + pageId + " on store " + storeName); } List<Long> largeMessageIds = new ArrayList<>(); if (messages != null) { for (PagedMessage msg : messages) { if (msg.getMessage() instanceof ICoreMessage && (msg.getMessage()).isLargeMessage()) { LargeServerMessage lmsg = (LargeServerMessage) msg.getMessage(); lmsg.decrementDelayDeletionCount(); largeMessageIds.add(lmsg.getMessageID()); } } } try { if (!storageManager.getContext().waitCompletion(5000)) { logger.info("Time out waiting for large messages" + largeMessageIds + ", may be not deleted if crashed"); } if (suspiciousRecords) { ActiveMQServerLogger.LOGGER.pageInvalid(file.getFileName(), file.getFileName()); file.renameTo(file.getFileName() + ".invalidPage"); } else { file.delete(); } return true; } catch (Exception e) { ActiveMQServerLogger.LOGGER.pageDeleteError(e); return false; } }

Target:
public boolean delete(final PagedMessage[] messages) throws Exception { if (storageManager != null) { storageManager.pageDeleted(storeName, pageId); } if (logger.isDebugEnabled()) { logger.debug("Deleting pageNr=" + pageId + " on store " + storeName); } List<Long> largeMessageIds = new ArrayList<>(); if (messages != null) { for (PagedMessage msg : messages) { if (msg.getMessage() instanceof ICoreMessage && (msg.getMessage()).isLargeMessage()) { LargeServerMessage lmsg = (LargeServerMessage) msg.getMessage(); lmsg.decrementDelayDeletionCount(); largeMessageIds.add(lmsg.getMessageID()); } } } try { if (!storageManager.waitOnOperations(5000)) { ActiveMQServerLogger.LOGGER.timedOutWaitingForLargeMessagesDeletion(largeMessageIds); } if (suspiciousRecords) { ActiveMQServerLogger.LOGGER.pageInvalid(file.getFileName(), file.getFileName()); file.renameTo(file.getFileName() + ".invalidPage"); } else { file.delete(); } return true; } catch (Exception e) { ActiveMQServerLogger.LOGGER.pageDeleteError(e); return false; } }
Source:
public void write(URL url) throws IllegalArgumentException, IOException { LockFile lockFile = new LockFile(file.toFile()); if (lockFile.lock()) { try { if (snapshot.isModified(file.toFile())) { LOG.debug( "Reading the underlying cookie file '{}' as it has been modified since the last access", file); Set<HttpCookie> cookiesFromFile = NetscapeCookieFile .read(file, creationDate); this.cookies = mergeCookies(cookiesFromFile, cookies); } write(file, cookies, url, creationDate); } finally { lockFile.unlock(); } } else { throw new IOException( "Some other process is holding the lock, please retry writing later"); } }

Target:
public void write(URL url) throws IllegalArgumentException, IOException, InterruptedException { LockFile lockFile = new LockFile(file.toFile()); for (int retryCount = 0; retryCount < LOCK_ACQUIRE_MAX_RETRY_COUNT; retryCount++) { if (lockFile.lock()) { try { if (snapshot.isModified(file.toFile())) { LOG.debug( "Reading the underlying cookie file '{}' as it has been modified since the last access", file); Set<HttpCookie> cookiesFromFile = NetscapeCookieFile .read(file, creationDate); this.cookies = mergeCookies(cookiesFromFile, cookies); } write(file, cookies, url, creationDate); } finally { lockFile.unlock(); } return; } Thread.sleep(LOCK_ACQUIRE_RETRY_SLEEP); } throw new IOException( MessageFormat.format(JGitText.get().cannotLock, lockFile)); }
Source:
private synchronized static String generateScriptName() { return "Script" + (++counter) + ".groovy"; }

Target:
private static synchronized String generateScriptName() { return "Script" + (++counter) + ".groovy"; }
Source:
ByteArrayPoolCacheAdapter(ArrayPool<byte[]> pool) { this.pool = pool; }

Target:
ByteArrayPoolCacheAdapter(ArrayPool<byte[]> pool) { this.pool = requireNonNull(pool, "pool is null"); }
Source:
private String getMaterialName() { return materialName; }

Target:
public String getMaterialName() { return materialName; }
Source:
ServiceMap lookupDependenciesOf(ServiceMap resolved, Class<? extends Service> requested) throws DependencyException { for (Class<? extends Service> dependency : identifyImmediateDependenciesOf(requested)) { resolved = lookupService(resolved, dependency); } for (Class<? extends Service> dependency : identifyImmediateOptionalDependenciesOf(requested)) { try { resolved = lookupService(resolved, dependency); } catch (DependencyException de) { OptionalServiceDependencies optionalAnnotation = requested.getAnnotation(OptionalServiceDependencies.class); if (optionalAnnotation != null && Arrays.asList(optionalAnnotation.value()).contains(dependency.getName())) { LOGGER.debug("Skipping optional dependency of that cannot be looked up: {}", requested, dependency); continue; } throw de; } } return resolved; }

Target:
ServiceMap lookupDependenciesOf(ServiceMap resolved, Class<? extends Service> requested) throws DependencyException { for (Class<? extends Service> dependency : identifyImmediateDependenciesOf(requested)) { try { resolved = lookupService(resolved, dependency); } catch (DependencyException de) { OptionalServiceDependencies optionalAnnotation = requested.getAnnotation(OptionalServiceDependencies.class); if (optionalAnnotation != null && Arrays.asList(optionalAnnotation.value()).contains(dependency.getName())) { LOGGER.debug("Skipping optional dependency of that cannot be looked up: {}", requested, dependency); continue; } throw de; } } return resolved; }
Source:
private void capFingerprints(final Map<FingerprintIdDetails, Fingerprint> fpMap) { for (Map.Entry<FingerprintIdDetails, Fingerprint> fingerprintEntry : fpMap.entrySet()) { final Fingerprint cappedFp = new Fingerprint(fingerprintEntry.getValue().getSample(),fingerprintEntry.getValue().getSource(),fingerprintEntry.getValue().getInfo()); for (HaplotypeBlock haplotypeBlock : fingerprintEntry.getValue().keySet()) { HaplotypeProbabilities cappedHp = new CappedHaplotypeProbabilities(fingerprintEntry.getValue().get(haplotypeBlock),-MAX_EFFECT_OF_EACH_HAPLOTYPE_BLOCK); cappedFp.add(cappedHp); } fpMap.put(fingerprintEntry.getKey(), cappedFp); } }

Target:
private Map<FingerprintIdDetails, Fingerprint> capFingerprints(final Map<FingerprintIdDetails, Fingerprint> fpMap) { return fpMap.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> { final Fingerprint value = entry.getValue(); final Fingerprint cappedFp = new Fingerprint(value.getSample(), value.getSource(), value.getInfo()); value.values().stream() .map(probabilities -> new CappedHaplotypeProbabilities(probabilities, -MAX_EFFECT_OF_EACH_HAPLOTYPE_BLOCK)) .forEach(cappedFp::add); return cappedFp; })); }
Source:
public Response list(@Context final HttpServletRequest request, @QueryParam("contentInode") final String contentInode) throws DotDataException, DotSecurityException { Logger.debug(this, String.format("listing languages %s", request.getRequestURI())); final InitDataObject init = webResource.init(true, request, true); final User user = init.getUser(); final List<Language> languages = contentInode != null ? languageAPI.getAvailableContentPageLanguages(contentInode, user) : languageAPI.getLanguages(); return Response.ok(new ResponseEntityView(ImmutableList.copyOf(languages))).build(); }

Target:
public Response list(@Context final HttpServletRequest request, @QueryParam("contentInode") final String contentInode) throws DotDataException, DotSecurityException { Logger.debug(this, () -> String.format("listing languages %s", request.getRequestURI())); final InitDataObject init = webResource.init(true, request, true); final User user = init.getUser(); final List<Language> languages = contentInode != null ? languageAPI.getAvailableContentLanguages(contentInode, user) : languageAPI.getLanguages(); return Response.ok(new ResponseEntityView(ImmutableList.copyOf(languages))).build(); }
Source:
public void onRightClickCauldron(PlayerInteractEvent.RightClickBlock event) { World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); IBlockState state = world.getBlockState(event.getPos()); if (player.getHeldItem(event.getHand()).getItem() == Items.GLASS_BOTTLE && state.getBlock() instanceof BlockCauldron && SyncedConfig.getBooleanValue(GameplayOption.ENABLE_THIRST)) { BlockCauldron cauldron = (BlockCauldron)state.getBlock(); int level = ((Integer)state.getValue(BlockCauldron.LEVEL)); if (level > 0 && !world.isRemote) { if (!player.capabilities.isCreativeMode) { ItemStack waterBottle = new ItemStack(TANItems.water_bottle); player.addStat(StatList.CAULDRON_USED); player.getHeldItem(event.getHand()).setCount(player.getHeldItem(event.getHand()).getCount() - 1); if (player.getHeldItem(event.getHand()).isEmpty()) { player.setHeldItem(event.getHand(), waterBottle); } else if (!player.inventory.addItemStackToInventory(waterBottle)) { player.dropItem(waterBottle, false); } else if (player instanceof EntityPlayerMP) { ((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer); } } cauldron.setWaterLevel(world, event.getPos(), state, level - 1); event.setCanceled(true); } } }

Target:
public void onRightClickCauldron(PlayerInteractEvent.RightClickBlock event) { World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); IBlockState state = world.getBlockState(event.getPos()); if (state.getBlock() instanceof BlockCauldron && player.getHeldItem(event.getHand()).getItem() == Items.GLASS_BOTTLE && SyncedConfig.getBooleanValue(GameplayOption.ENABLE_THIRST)) { BlockCauldron cauldron = (BlockCauldron)state.getBlock(); int level = ((Integer)state.getValue(BlockCauldron.LEVEL)); if (level > 0 && !world.isRemote) { if (!player.capabilities.isCreativeMode) { ItemStack waterBottle = new ItemStack(TANItems.water_bottle); player.addStat(StatList.CAULDRON_USED); player.getHeldItem(event.getHand()).setCount(player.getHeldItem(event.getHand()).getCount() - 1); if (player.getHeldItem(event.getHand()).isEmpty()) { player.setHeldItem(event.getHand(), waterBottle); } else if (!player.inventory.addItemStackToInventory(waterBottle)) { player.dropItem(waterBottle, false); } else if (player instanceof EntityPlayerMP) { ((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer); } } cauldron.setWaterLevel(world, event.getPos(), state, level - 1); event.setCanceled(true); } } }
Source:
public String getProperty(String key) { return this.properties.get(key).toString(); }

Target:
public String getProperty(String key) { return String.valueOf(this.properties.get(key)); }
Source:
public void onWorkingTreeModified(WorkingTreeModifiedEvent event) { if (event.isEmpty()) { return; } Repository repo = event.getRepository(); if (repo == null || repo.isBare()) { return; } File gitDir = repo.getDirectory(); synchronized (repositoriesChanged) { ResourceRefreshHandler.WorkingTreeChanges changes = repositoriesChanged.get(gitDir); if (changes == null) { repositoriesChanged.put(gitDir, new WorkingTreeChanges(event)); } else { changes.merge(event); if (changes.isEmpty()) { repositoriesChanged.remove(gitDir); } } } if (GitTraceLocation.REFRESH.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REFRESH.getLocation(), "Triggered refresh"); } run(new NullProgressMonitor()); }

Target:
public void onWorkingTreeModified(WorkingTreeModifiedEvent event) { if (event.isEmpty()) { return; } Repository repo = event.getRepository(); if (repo == null || repo.isBare()) { return; } if (GitTraceLocation.REFRESH.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REFRESH.getLocation(), "Triggered refresh for repo: " + repo); } try { refreshRepository(new WorkingTreeChanges(event), new NullProgressMonitor()); } catch (OperationCanceledException oe) { return; } catch (CoreException e) { Activator.error(CoreText.Activator_refreshFailed, e); } }
Source:
public static boolean isOk( final Matcher matcher, final SharedPreferences prefs, final String prefix, final Network network ) { if ( ! isFilterOn( prefs, prefix ) ) { return true; } if ( matcher != null ) { try { final String ssid = network.getSsid(); if (null == ssid) { } matcher.reset(ssid); final boolean invert = prefs.getBoolean(prefix + ListFragment.PREF_MAPF_INVERT, false); final boolean matches = matcher.find(); if (!matches && !invert) { return false; } else if (matches && invert) { return false; } } catch (IllegalArgumentException iaex) { MainActivity.warn("Matcher: IllegalArgument: " + network.getSsid() + "pattern: " + matcher.pattern()); final boolean invert = prefs.getBoolean(prefix + ListFragment.PREF_MAPF_INVERT, false); return !invert; } } if ( NetworkType.WIFI.equals( network.getType() ) ) { switch ( network.getCrypto() ) { case Network.CRYPTO_NONE: if ( ! prefs.getBoolean( prefix + ListFragment.PREF_MAPF_OPEN, true ) ) { return false; } break; case Network.CRYPTO_WEP: if ( ! prefs.getBoolean( prefix + ListFragment.PREF_MAPF_WEP, true ) ) { return false; } break; case Network.CRYPTO_WPA: case Network.CRYPTO_WPA2: if ( ! prefs.getBoolean( prefix + ListFragment.PREF_MAPF_WPA, true ) ) { return false; } break; default: MainActivity.error( "unhandled crypto: " + network ); } } else if (!prefs.getBoolean(prefix + ListFragment.PREF_MAPF_CELL, true)) { return false; } return true; }

Target:
public static boolean isOk( final Matcher matcher, final SharedPreferences prefs, final String prefix, final Network network ) { if ( ! isFilterOn( prefs, prefix ) ) { return true; } if ( matcher != null ) { try { final String ssid = network.getSsid(); matcher.reset(ssid); final boolean invert = prefs.getBoolean(prefix + ListFragment.PREF_MAPF_INVERT, false); final boolean matches = matcher.find(); if (!matches && !invert) { return false; } else if (matches && invert) { return false; } } catch (IllegalArgumentException iaex) { MainActivity.warn("Matcher: IllegalArgument: " + network.getSsid() + "pattern: " + matcher.pattern()); final boolean invert = prefs.getBoolean(prefix + ListFragment.PREF_MAPF_INVERT, false); return !invert; } } if ( NetworkType.WIFI.equals( network.getType() ) ) { switch ( network.getCrypto() ) { case Network.CRYPTO_NONE: if ( ! prefs.getBoolean( prefix + ListFragment.PREF_MAPF_OPEN, true ) ) { return false; } break; case Network.CRYPTO_WEP: if ( ! prefs.getBoolean( prefix + ListFragment.PREF_MAPF_WEP, true ) ) { return false; } break; case Network.CRYPTO_WPA: case Network.CRYPTO_WPA2: if ( ! prefs.getBoolean( prefix + ListFragment.PREF_MAPF_WPA, true ) ) { return false; } break; default: MainActivity.error( "unhandled crypto: " + network ); } } else if (!prefs.getBoolean(prefix + ListFragment.PREF_MAPF_CELL, true)) { return false; } return true; }
Source:
public String setLocale(String code) { locale = new Locale(code); return locale.toString(); }

Target:
public void setLocale(String code) { locale = new Locale(code); }
Source:
private boolean sendRequest(final URL queryUrl) throws IOException, JSONException { Logger.v(TAG, "Sending discovery request to:" + queryUrl); HashMap<String, String> headers = new HashMap<String, String>(); headers.put(WebRequestHandler.HEADER_ACCEPT, WebRequestHandler.HEADER_ACCEPT_JSON); if (mCorrelationId != null) { headers.put(AuthenticationConstants.AAD.CLIENT_REQUEST_ID, mCorrelationId.toString()); headers.put(AuthenticationConstants.AAD.RETURN_CLIENT_REQUEST_ID, "true"); } HttpWebResponse webResponse = null; String errorCodes = ""; try { ClientMetrics.INSTANCE.beginClientMetricsRecord(queryUrl, mCorrelationId, headers); try { webResponse = mWebrequestHandler.sendGet(queryUrl, headers); ClientMetrics.INSTANCE.setLastError(null); } catch (IOException e) { ClientMetrics.INSTANCE.setLastError(String.valueOf(webResponse.getStatusCode())); throw e; } HashMap<String, String> discoveryResponse = parseResponse(webResponse); if(discoveryResponse.containsKey(AuthenticationConstants.OAuth2.ERROR_CODES)) { errorCodes = discoveryResponse.get(AuthenticationConstants.OAuth2.ERROR_CODES); ClientMetrics.INSTANCE.setLastError(errorCodes); } return (discoveryResponse != null && discoveryResponse.containsKey(TENANT_DISCOVERY_ENDPOINT)); } finally { ClientMetrics.INSTANCE.endClientMetricsRecord(ClientMetricsEndpointType.INSTANCE_DISCOVERY, mCorrelationId); } }

Target:
private boolean sendRequest(final URL queryUrl) throws IOException, JSONException { Logger.v(TAG, "Sending discovery request to:" + queryUrl); Map<String, String> headers = new HashMap<String, String>(); headers.put(WebRequestHandler.HEADER_ACCEPT, WebRequestHandler.HEADER_ACCEPT_JSON); if (mCorrelationId != null) { headers.put(AuthenticationConstants.AAD.CLIENT_REQUEST_ID, mCorrelationId.toString()); headers.put(AuthenticationConstants.AAD.RETURN_CLIENT_REQUEST_ID, "true"); } HttpWebResponse webResponse = null; String errorCodes = ""; try { ClientMetrics.INSTANCE.beginClientMetricsRecord(queryUrl, mCorrelationId, headers); try { webResponse = mWebrequestHandler.sendGet(queryUrl, headers); ClientMetrics.INSTANCE.setLastError(null); } catch (IOException e) { ClientMetrics.INSTANCE.setLastError(String.valueOf(webResponse.getStatusCode())); throw e; } final Map<String, String> discoveryResponse = parseResponse(webResponse); if(discoveryResponse.containsKey(AuthenticationConstants.OAuth2.ERROR_CODES)) { errorCodes = discoveryResponse.get(AuthenticationConstants.OAuth2.ERROR_CODES); ClientMetrics.INSTANCE.setLastError(errorCodes); } return (discoveryResponse != null && discoveryResponse.containsKey(TENANT_DISCOVERY_ENDPOINT)); } finally { ClientMetrics.INSTANCE.endClientMetricsRecord(ClientMetricsEndpointType.INSTANCE_DISCOVERY, mCorrelationId); } }