auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void checkFlaskCorsCall(SubscriptionContext ctx) { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); Symbol calleeSymbol = callExpression.calleeSymbol(); if (!isSymbol(calleeSymbol, "flask_cors.CORS")) { return; } if (callExpression.arguments().size() == 1) { ctx.addIssue(callExpression, MESSAGE); return; } getArgument(callExpression.arguments(), ORIGINS).ifPresent(argument -> { if (originsToReport(argument)) { ctx.addIssue(callExpression, MESSAGE); } }); getArgument(callExpression.arguments(), "resources").ifPresent(argument -> { if (isString(argument, API_STAR)) { ctx.addIssue(callExpression, MESSAGE); } else { getSingleValueInDictionary(argument, API_STAR).ifPresent(value -> getSingleValueInDictionary(value, ORIGINS).ifPresent(origins -> { if (originsToReport(origins)) { ctx.addIssue(callExpression, MESSAGE); } }) ); } }); }

Target:
private static void checkFlaskCorsCall(SubscriptionContext ctx) { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); Symbol calleeSymbol = callExpression.calleeSymbol(); if (!isSymbol(calleeSymbol, "flask_cors.CORS")) { return; } if (callExpression.arguments().size() == 1) { ctx.addIssue(callExpression, MESSAGE); return; } Optional<Expression> originsArgument = getArgument(callExpression.arguments(), ORIGINS); originsArgument.ifPresent(argument -> { if (originsToReport(argument)) { ctx.addIssue(callExpression, MESSAGE); } }); Optional<Expression> resourcesArgumentOpt = getArgument(callExpression.arguments(), "resources"); if (!resourcesArgumentOpt.isPresent()) { return; } Expression resourcesArgument = resourcesArgumentOpt.get(); if (resourcesArgument.is(STRING_LITERAL) && !originsArgument.isPresent()) { ctx.addIssue(callExpression, MESSAGE); } else if (resourcesArgument.is(DICTIONARY_LITERAL)) { List<DictionaryLiteralElement> elements = ((DictionaryLiteral) resourcesArgument).elements(); for (DictionaryLiteralElement element : elements) { if (!element.is(KEY_VALUE_PAIR)) { continue; } Optional<Expression> originsValue = getValueInDictionary(((KeyValuePair) element).value(), ORIGINS); if (originsValue.isPresent() && originsToReport(originsValue.get())) { ctx.addIssue(callExpression, MESSAGE); return; } } } }
Source:
public void deleteFromRealm(int location) { realm.checkIfValid(); if (!isTablePresent()) { throw new IndexOutOfBoundsException("No results to be deleted."); } TableOrView table = getTable(); table.remove(location); }

Target:
public void deleteFromRealm(int location) { realm.checkIfValid(); TableOrView table = getTable(); table.remove(location); }
Source:
public static boolean keepsOrdering(TargetMapping mapping) { int prevTarget = -1; for (int i = 0; i < mapping.getSourceCount(); i++) { int target = mapping.getTargetOpt(i); if (target != -1 && target < prevTarget) { return false; } if (target != -1) { prevTarget = target; } } return true; }

Target:
public static boolean keepsOrdering(TargetMapping mapping) { int prevTarget = -1; for (int i = 0; i < mapping.getSourceCount(); i++) { int target = mapping.getTargetOpt(i); if (target != -1) { if (target < prevTarget) { return false; } prevTarget = target; } } return true; }
Source:
public void updateStatusLeaderAtStartupTest(){ spy.updateStatus(State.LEADER); verify(spy).updateStatus(State.LEADER); verify(spy, never()).updateOnRunningConsumer(State.LEADER); verify(spy, never()).askAndProcessSnapshotOnDemand(any(SnapshotInfos.class)); verify(spy, times(1)).enableConsumeAndStartLoop(State.LEADER); verify(spy, times(1)).setLastProcessedKey(); verify(spy, times(1)).assignAndStartConsume(); }

Target:
public void updateStatusLeaderAtStartupTest(){ spy.updateStatus(State.LEADER); verify(spy).updateStatus(State.LEADER); verify(spy, never()).updateOnRunningConsumer(any(State.class)); verify(spy, never()).askAndProcessSnapshotOnDemand(any(SnapshotInfos.class)); verify(spy, times(1)).enableConsumeAndStartLoop(eq(State.LEADER)); verify(spy, times(1)).setLastProcessedKey(); verify(spy, times(1)).assignAndStartConsume(); }
Source:
public HttpRequestIntent httpRequestIntent() { final String contentType; if (givenContentType != null) { contentType = givenContentType; } else if (body.getName().toLowerCase().endsWith(".jpeg") || body.getName().toLowerCase().endsWith(".jpg")) { contentType = "image/jpeg"; } else if (body.getName().toLowerCase().endsWith(".gif")) { contentType = "image/gif"; } else if (body.getName().toLowerCase().endsWith(".png")) { contentType = "image/png"; } else { contentType = "unknown"; new IllegalStateException("cannot determine content type for " + body.getName()); } final UrlQueryBuilder builder = UrlQueryBuilder.of(); if (!isEmpty(sku)) { builder.add("sku", sku); } if (!isEmpty(filename)) { builder.add("filename", filename); } if (null != variant) { builder.add("variant", "" + variant); } if (null != staged) { builder.add("staged", "" + staged); } final String path = String.format("/products/%s/images%s", productId, builder.toStringWithOptionalQuestionMark()); return HttpRequestIntent.of(HttpMethod.POST, path, body, contentType); }

Target:
public HttpRequestIntent httpRequestIntent() { final String contentType; if (givenContentType != null) { if (!ACCEPTABLE_IMAGE_FORMATS_MAP.values().contains(givenContentType)) { throw new IllegalStateException("Content Type " + givenContentType + " is not accepted."); } else { contentType = givenContentType; } } else { String extension = ""; int i = body.getName().lastIndexOf('.'); if (i > 0) { extension = body.getName().substring(i); } contentType = ACCEPTABLE_IMAGE_FORMATS_MAP.get(extension); if (contentType == null) { throw new IllegalStateException("cannot determine content type for " + body.getName()); } } final UrlQueryBuilder builder = UrlQueryBuilder.of(); if (!isEmpty(sku)) { builder.add("sku", sku); } if (!isEmpty(filename)) { builder.add("filename", filename); } if (null != variant) { builder.add("variant", "" + variant); } if (null != staged) { builder.add("staged", "" + staged); } final String path = String.format("/products/%s/images%s", productId, builder.toStringWithOptionalQuestionMark()); return HttpRequestIntent.of(HttpMethod.POST, path, body, contentType); }
Source:
private String getRangerUserSyncRoleName(ApiClient client, String clusterName) throws ApiException { RolesResourceApi rolesResourceApi = clouderaManagerApiFactory.getRolesResourceApi(client); List<ApiRole> apiRoleList = rolesResourceApi.readRoles(clusterName, RANGER_SERVICE_NAME, null, null) .getItems() .stream() .filter(apiRole -> apiRole.getType().equals(RANGER_USER_SYNC_ROLE_TYPE)) .collect(Collectors.toList()); return Iterables.getOnlyElement(apiRoleList).getName(); }

Target:
private String getRangerUserSyncRoleName(ApiClient client, String clusterName) throws ApiException { RolesResourceApi rolesResourceApi = clouderaManagerApiFactory.getRolesResourceApi(client); List<ApiRole> apiRoleList = rolesResourceApi.readRoles(clusterName, RANGER_SERVICE_NAME, null, null) .getItems() .stream() .filter(apiRole -> RANGER_USER_SYNC_ROLE_TYPE.equals(apiRole.getType())) .collect(Collectors.toList()); return Iterables.getOnlyElement(apiRoleList).getName(); }
Source:
private boolean canCoerceForStruct(HiveType fromHiveType, HiveType toHiveType) { if (!fromHiveType.getCategory().equals(Category.STRUCT) || !toHiveType.getCategory().equals(Category.STRUCT)) { return false; } List<String> fromFieldNames = getAllStructFieldNames(fromHiveType); List<String> toFieldNames = getAllStructFieldNames(toHiveType); List<HiveType> fromFieldTypes = getAllStructFieldTypeInfos(fromHiveType); List<HiveType> toFieldTypes = getAllStructFieldTypeInfos(toHiveType); for (int i = 0; i < Math.min(fromFieldTypes.size(), toFieldTypes.size()); i++) { if (!fromFieldNames.get(i).equals(toFieldNames.get(i)) || (!fromFieldTypes.get(i).equals(toFieldTypes.get(i)) && !canCoerce(fromFieldTypes.get(i), toFieldTypes.get(i)))) { return false; } } return true; }

Target:
private boolean canCoerceForStruct(HiveType fromHiveType, HiveType toHiveType) { if (!fromHiveType.getCategory().equals(Category.STRUCT) || !toHiveType.getCategory().equals(Category.STRUCT)) { return false; } List<String> fromFieldNames = ((StructTypeInfo) fromHiveType.getTypeInfo()).getAllStructFieldNames(); List<String> toFieldNames = ((StructTypeInfo) toHiveType.getTypeInfo()).getAllStructFieldNames(); List<HiveType> fromFieldTypes = extractStructFieldTypes(fromHiveType); List<HiveType> toFieldTypes = extractStructFieldTypes(toHiveType); for (int i = 0; i < min(fromFieldTypes.size(), toFieldTypes.size()); i++) { if (!fromFieldNames.get(i).equals(toFieldNames.get(i))) { return false; } if (!fromFieldTypes.get(i).equals(toFieldTypes.get(i)) && !canCoerce(fromFieldTypes.get(i), toFieldTypes.get(i))) { return false; } } return true; }
Source:
public String toString() { String string = null; switch (this) { case GET: string = "GET"; break; case POST: string = "POST"; break; case PUT: string = "PUT"; break; case DELETE: string = "DELETE"; break; default: break; } return string; }

Target:
public String toString() { String string; switch (this) { case GET: string = "GET"; break; case POST: string = "POST"; break; case PUT: string = "PUT"; break; case DELETE: string = "DELETE"; break; default: throw new IllegalArgumentException("Invalid http method: <" + this+ ">"); } return string; }
Source:
private List<Integer> generateBlockIdNotInLocalStore() { final List<Integer> blockIdsInLocalStore = operationRouter.getCurrentLocalBlockIds(); final List<Integer> blockIdList = new ArrayList<>(); final int minBlockId = MIN_BLOCK_ID; final int maxBlockId = MIN_BLOCK_ID + NUM_TOTAL_BLOCKS; for (int blockId = minBlockId; blockId < maxBlockId; blockId++) { if (blockIdList.contains(blockId) || blockIdsInLocalStore.contains(blockId)) { continue; } blockIdList.add(blockId); } return blockIdList; }

Target:
private List<Integer> generateBlockIdNotInLocalStore() { final List<Integer> blockIdsInLocalStore = operationRouter.getCurrentLocalBlockIds(); final List<Integer> blockIdList = new ArrayList<>(); final int minBlockId = MIN_BLOCK_ID; final int maxBlockId = MIN_BLOCK_ID + NUM_TOTAL_BLOCKS - 1; for (int blockId = minBlockId; blockId <= maxBlockId; blockId++) { if (blockIdsInLocalStore.contains(blockId)) { continue; } blockIdList.add(blockId); } return blockIdList; }
Source:
public TableScanNode tableScan(List<Symbol> symbols, Map<Symbol, ColumnHandle> assignments) { Expression originalConstraint = null; return new TableScanNode(idAllocator.getNextId(), new TableHandle( new ConnectorId("testConnector"), new TestingTableHandle()), symbols, assignments, Optional.empty(), TupleDomain.all(), originalConstraint); }

Target:
public TableScanNode tableScan(List<Symbol> symbols, Map<Symbol, ColumnHandle> assignments) { TableHandle tableHandle = new TableHandle(new ConnectorId("testConnector"), new TestingTableHandle()); return tableScan(tableHandle, symbols, assignments); }
Source:
public void evaluate_shouldReturnAllInSpecifiedCareSetting() throws Exception { cohortDefinition.setOnlyCurrentlyActive(true); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); System.out.println("Care Setting" + cohort.getMemberIds()); }

Target:
public void evaluate_shouldReturnAllInSpecifiedCareSetting() throws Exception { CareSetting careSetting = Context.getService(OrderService.class).getCareSetting(1); cohortDefinition.setCareSetting(careSetting); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(7)); Assert.assertTrue(cohort.contains(8)); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(5, cohort.size()); }
Source:
private ZipFile(final SeekableByteChannel channel, final String archiveName, final String encoding, final boolean useUnicodeExtraFields, final boolean closeOnError, final boolean ignoreLocalFileHeader) throws IOException { isSplitZipArchive = (channel instanceof ZipSplitReadOnlySeekableByteChannel); this.archiveName = archiveName; this.encoding = encoding; this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding); this.useUnicodeExtraFields = useUnicodeExtraFields; archive = channel; boolean success = false; try { final Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag = populateFromCentralDirectory(); if (!ignoreLocalFileHeader) { resolveLocalFileHeaderData(entriesWithoutUTF8Flag); } fillNameMap(); success = true; } catch (IOException e) { throw new IOException("Error on ZipFile " + archiveName + e.getMessage(), e); } finally { closed = !success; if (!success && closeOnError) { IOUtils.closeQuietly(archive); } } }

Target:
private ZipFile(final SeekableByteChannel channel, final String archiveName, final String encoding, final boolean useUnicodeExtraFields, final boolean closeOnError, final boolean ignoreLocalFileHeader) throws IOException { isSplitZipArchive = (channel instanceof ZipSplitReadOnlySeekableByteChannel); this.archiveName = archiveName; this.encoding = encoding; this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding); this.useUnicodeExtraFields = useUnicodeExtraFields; archive = channel; boolean success = false; try { final Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag = populateFromCentralDirectory(); if (!ignoreLocalFileHeader) { resolveLocalFileHeaderData(entriesWithoutUTF8Flag); } fillNameMap(); success = true; } catch (IOException e) { throw new IOException("Error on ZipFile " + archiveName, e); } finally { closed = !success; if (!success && closeOnError) { IOUtils.closeQuietly(archive); } } }
Source:
public void updateReviewItem(ChangeInfo task) { fReviewList.put(task.getChange_id(), task); }

Target:
public void updateReviewItem(ChangeInfo task) { fReviewList.put(task.getId(), task); }
Source:
public Response stopMigrate(Action action) { validateParameters(action, "bricks"); GlusterVolumeRemoveBricksParameters params = toParameters(action); return performAction(VdcActionType.StopRemoveGlusterVolumeBricks, params, action, false); }

Target:
public Response stopMigrate(Action action) { validateParameters(action, "bricks"); validateBrickNames(action); GlusterVolumeRemoveBricksParameters params = toParameters(action); return performAction(VdcActionType.StopRemoveGlusterVolumeBricks, params, action, false); }
Source:
private void checkNoExternalDependencyExposed(DetailAST methodDefToken) { final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); if (modifiersToken != null && (modifiersToken.branchContains(TokenTypes.LITERAL_PUBLIC) || modifiersToken.branchContains(TokenTypes.LITERAL_PROTECTED))) { checkReturnType(methodDefToken.findFirstToken(TokenTypes.TYPE)); checkParametersType(methodDefToken.findFirstToken(TokenTypes.PARAMETERS)); } }

Target:
private void checkNoExternalDependencyExposed(DetailAST methodDefToken) { final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); if (!accessModifier.equals(AccessModifier.PUBLIC) && !accessModifier.equals(AccessModifier.PROTECTED)) { return; } final DetailAST typeToken = methodDefToken.findFirstToken(TokenTypes.TYPE); if (typeToken != null) { getInvalidReturnTypes(typeToken).forEach( (token, returnTypeName) -> log(token, String.format(EXTERNAL_DEPENDENCY_ERROR, returnTypeName))); } final DetailAST parametersToken = methodDefToken.findFirstToken(TokenTypes.PARAMETERS); if (parametersToken != null) { getInvalidParameterTypes(parametersToken).forEach( (token, returnTypeName) -> log(token, String.format(EXTERNAL_DEPENDENCY_ERROR, returnTypeName))); } }
Source:
private String createIniFile(String commaSeparatedFilePaths, String commaSeparatedParentAccessions) { String iniPath = ""; Map<String, String> iniFileMap = new TreeMap<>(); Workflow wf = metadata.getWorkflow(Integer.getInteger(workflowAccession)); Set<WorkflowAttribute> wps = wf.getWorkflowAttributes(); Map<String,String> defaults = wf.getParameterDefaults(); wps.forEach((att) -> { String val=defaults.get(att.getTag()); if (val == null) { LOGGER.debug("Excluding null workflow ini property [" + att.getTag() + "]"); } else { iniFileMap.put(att.getTag(), val); } }); Map<String, String> iniParameters = modifyIniFile(commaSeparatedFilePaths, commaSeparatedParentAccessions); for (String param : iniParameters.keySet()) { iniFileMap.put(param, iniParameters.get(param)); } PrintWriter writer = null; File file = null; try { file = File.createTempFile("" + random.nextInt(), ".ini"); writer = new PrintWriter(new FileWriter(file), true); for (String key : iniFileMap.keySet()) { StringBuilder sb = new StringBuilder(); sb.append(key).append("=").append(iniFileMap.get(key)); writer.println(sb.toString()); } } catch (IOException ex) { LOGGER.error("BasicDecider.createIniFile IOException",ex); } finally { if (writer != null) { writer.close(); } } if (file != null) { iniPath = file.getAbsolutePath(); } return iniPath; }

Target:
private String createIniFile(String commaSeparatedFilePaths, String commaSeparatedParentAccessions) { String iniPath = ""; Workflow wf = metadata.getWorkflow(Integer.parseInt(workflowAccession)); Map<String, String> iniFileMap = new TreeMap<>(wf.getParameterDefaults()); iniFileMap.putAll(modifyIniFile(commaSeparatedFilePaths, commaSeparatedParentAccessions)); PrintWriter writer = null; File file = null; try { file = File.createTempFile("" + random.nextInt(), ".ini"); writer = new PrintWriter(new FileWriter(file), true); for (String key : iniFileMap.keySet()) { StringBuilder sb = new StringBuilder(); sb.append(key).append("=").append(iniFileMap.get(key)); writer.println(sb.toString()); } } catch (IOException ex) { LOGGER.error("BasicDecider.createIniFile IOException",ex); } finally { if (writer != null) { writer.close(); } } if (file != null) { iniPath = file.getAbsolutePath(); } return iniPath; }
Source:
protected void doInit() { super.doInit(); if (!this.evaluationContextSet) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } Assert.state(this.closeStreamAfterSend ? this.isSingleUse : true, "Single use connection needed with closeStreamAfterSend"); }

Target:
protected void doInit() { super.doInit(); if (!this.evaluationContextSet) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } Assert.state(!this.closeStreamAfterSend || this.isSingleUse, "Single use connection needed with closeStreamAfterSend"); }
Source:
protected void doRun() throws Exception { checkEnteringPhase(1); Preconditions.checkState(readOnlyRebindCount.get()==Integer.MIN_VALUE, "Partial rebind in read-only mode not supported"); Preconditions.checkNotNull(objectsToRebindInitial, "Objects to rebind must be set"); LOG.debug("Partial rebind Rebinding ("+mode+") from "+rebindManager.getPersister().getBackingStoreDescription()+"..."); Builder mementoRawBuilder = BrooklynMementoRawData.builder(); objectsToRebindFinal = MutableSet.of(); while (objectsToRebindInitial.hasNext()) { BrooklynObject bo = objectsToRebindInitial.next(); objectsToRebindFinal.add(bo); if (bo instanceof Entity) { objectsToRebindFinal.addAll( ((EntityInternal)bo).getPolicies() ); objectsToRebindFinal.addAll( ((EntityInternal)bo).getEnrichers() ); objectsToRebindFinal.addAll( ((EntityInternal)bo).feeds().getFeeds() ); } } for (BrooklynObject bo: objectsToRebindFinal) { Memento m = ((BrooklynObjectInternal)bo).getRebindSupport().getMemento(); BrooklynMementoPersister p = rebindManager.getPersister(); String mr = ((BrooklynMementoPersisterToObjectStore)p).getMementoSerializer().toString(m); mementoRawBuilder.put(BrooklynObjectType.of(bo), bo.getId(), mr); } mementoRawData = mementoRawBuilder.build(); preprocessManifestFiles(); phase++; instantiateLocationsAndEntities(); instantiateMementos(); instantiateAdjuncts(instantiator); reconstructEverything(); associateAdjunctsWithEntities(); manageTheObjects(); finishingUp(); }

Target:
protected void doRun() throws Exception { Preconditions.checkState(rebindManager.getRebindMode()==ManagementNodeState.MASTER, "Partial rebind only supported in master mode, not "+rebindManager.getRebindMode()); Preconditions.checkState(readOnlyRebindCount.get()==Integer.MIN_VALUE, "Rebind count should be MIN when running in master mode"); Preconditions.checkNotNull(objectsToRebindInitial, "Objects to rebind must be set"); LOG.debug("Partial rebind Rebinding ("+mode+") from "+rebindManager.getPersister().getBackingStoreDescription()+"..."); super.doRun(); }
Source:
public void removeNotificationListener(ObjectName name, NotificationListener listener) { if(!isRunningInJmc() && !isRunningInJConsole() && !isRunningInJVisualVm()) { throw new UnsupportedOperationException("removeNotificationListener not supported for Jolokia"); } }

Target:
public void removeNotificationListener(ObjectName name, NotificationListener listener) { if(!isRunningInJmc() && !isRunningInJConsole() && !isRunningInJVisualVm()) { throw new UnsupportedOperationException("removeNotificationListener not supported by Jolokia"); } }
Source:
public ModelAndView displayMrrtReportTemplate(HttpServletRequest request, @RequestParam String templateId) { final ModelAndView modelAndView = new ModelAndView(MRRT_REPORT_TEMPLATE_FORM_VIEW); try { MrrtReportTemplate mrrtReportTemplate = mrrtReportTemplateService.getMrrtReportTemplateByUuid(templateId); String templateBody = mrrtReportTemplateService.getMrrtReportTemplateHtmlBody(mrrtReportTemplate); modelAndView.addObject("templateBody", templateBody); modelAndView.addObject("template", mrrtReportTemplate); } catch (IOException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Error occured while dispaying template => " + exception.getMessage()); return new ModelAndView("/module/radiology/radiologyDashboardForm"); } catch (IllegalArgumentException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Error occured while displaying template => " + exception.getMessage()); return new ModelAndView("/module/radiology/radiologyDashboardForm"); } return modelAndView; }

Target:
public ModelAndView displayMrrtReportTemplate(HttpServletRequest request, @RequestParam String templateId) { final ModelAndView modelAndView = new ModelAndView(MRRT_REPORT_TEMPLATE_FORM_VIEW); MrrtReportTemplate mrrtReportTemplate = mrrtReportTemplateService.getMrrtReportTemplateByUuid(templateId); if (mrrtReportTemplate == null) { throw new IllegalArgumentException("MrrtReportTemplate not found. templateId '" + templateId + "' unknown."); } try { String templateBody = mrrtReportTemplateService.getMrrtReportTemplateHtmlBody(mrrtReportTemplate); modelAndView.addObject("templateBody", templateBody); modelAndView.addObject("template", mrrtReportTemplate); } catch (IOException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Error occured while dispaying template => " + exception.getMessage()); return new ModelAndView("/module/radiology/radiologyDashboardForm"); } return modelAndView; }
Source:
public void clearForce(MonitoringBaseElement element) throws DeploymentException { String request = MessageFormat.format(FORECE_VALUE, this.id++, "*", element.getQualifiedString(), "false"); try { sendREQ(element.getResourceString(), request); } catch (IOException e) { throw new DeploymentException(MessageFormat.format(Messages.DeploymentExecutor_ClearForceFailed, element.getQualifiedString()), e); } }

Target:
public void clearForce(MonitoringBaseElement element) throws DeploymentException { String request = MessageFormat.format(FORCE_VALUE, this.id++, "*", element.getQualifiedString(), "false"); try { sendREQ(element.getResourceString(), request); } catch (IOException e) { throw new DeploymentException(MessageFormat.format(Messages.DeploymentExecutor_ClearForceFailed, element.getQualifiedString()), e); } }
Source:
public void setConfigData(ConfigData config) { this.cageWidth = config.getCageWidth(); this.cageHeight = config.getCageHeight(); this.zoneVisits = new HashMap<Zone, Integer>(config.getZones().size()); for (Zone z : config.getZones()) zoneVisits.put(z, 0); }

Target:
public void setConfigData(ConfigData config) { this.cageWidth = config.getCageWidth(); this.cageHeight = config.getCageHeight(); this.zoneVisits = new HashMap<Zone, Integer>(config.getZones().size()); for (Zone z : config.getZones()) { zoneVisits.put(z, 0); } }
Source:
private List<CascadingTypeParameter> getCascadingTypeParameters(TypeVariable<?>[] typeParameters, AnnotatedType annotatedType) { List<CascadingTypeParameter> cascadingTypeParameters = new ArrayList<>(); if ( annotatedType instanceof AnnotatedArrayType ) { AnnotatedArrayType annotatedArrayType = (AnnotatedArrayType) annotatedType; Type validatedType = annotatedArrayType.getAnnotatedGenericComponentType().getType(); List<CascadingTypeParameter> nestedCascadingTypeParameters; if ( validatedType instanceof ParameterizedType ) { nestedCascadingTypeParameters = getCascadingTypeParameters( ReflectionHelper.getClassFromType( validatedType ).getTypeParameters(), annotatedArrayType.getAnnotatedGenericComponentType() ); } else { nestedCascadingTypeParameters = Collections.emptyList(); } boolean isCascading = annotatedArrayType.isAnnotationPresent( Valid.class ); CascadingTypeParameter cascadingTypeParameter = new CascadingTypeParameter( validatedType, ArrayElement.INSTANCE, isCascading, nestedCascadingTypeParameters ); if ( isCascading || !nestedCascadingTypeParameters.isEmpty() ) { cascadingTypeParameters.add( cascadingTypeParameter ); } } else if ( annotatedType instanceof AnnotatedParameterizedType ) { AnnotatedParameterizedType annotatedParameterizedType = (AnnotatedParameterizedType) annotatedType; AnnotatedType[] annotatedTypeArguments = annotatedParameterizedType.getAnnotatedActualTypeArguments(); int i = 0; for ( AnnotatedType annotatedTypeArgument : annotatedTypeArguments ) { Type validatedType = annotatedTypeArgument.getType(); List<CascadingTypeParameter> nestedCascadingTypeParameters; if ( validatedType instanceof ParameterizedType ) { nestedCascadingTypeParameters = getCascadingTypeParameters( ReflectionHelper.getClassFromType( validatedType ).getTypeParameters(), annotatedTypeArgument ); } else { nestedCascadingTypeParameters = Collections.emptyList(); } boolean isCascading = annotatedTypeArgument.isAnnotationPresent( Valid.class ); if ( isCascading || !nestedCascadingTypeParameters.isEmpty() ) { CascadingTypeParameter cascadingTypeParameter = new CascadingTypeParameter( annotatedType.getType(), typeParameters[i], isCascading, nestedCascadingTypeParameters ); cascadingTypeParameters.add( cascadingTypeParameter ); } i++; } } return cascadingTypeParameters; }

Target:
private List<CascadingTypeParameter> getCascadingTypeParameters(TypeVariable<?>[] typeParameters, AnnotatedType annotatedType) { List<CascadingTypeParameter> cascadingTypeParameters = new ArrayList<>(); if ( annotatedType instanceof AnnotatedArrayType ) { addCascadingTypeParametersForArrayType( cascadingTypeParameters, (AnnotatedArrayType) annotatedType ); } else if ( annotatedType instanceof AnnotatedParameterizedType ) { addCascadingTypeParametersForParameterizedType( cascadingTypeParameters, (AnnotatedParameterizedType) annotatedType, typeParameters ); } return cascadingTypeParameters; }
Source:
private void drawCurvedUnderline(LineInfo line, LineStringCursor cursor, double startOrdinate, boolean drawingHalo) { LineComponent component = line.getComponents().get(0); LineMetrics metrics = computeLineMetricsIfNeeded(component); double endOrdinate = cursor.getCurrentOrdinate(); GlyphVector glyphVector = line.getComponents().get(0).getGlyphVector(); double advance = glyphVector.getGlyphMetrics(0).getAdvance() * 0.5f; LineString labelLineString = cursor.getSubLineString(startOrdinate - advance, endOrdinate - advance); LiteShape underlineLineString = computeCurvedUnderline(labelLineString, metrics); if (drawingHalo) { graphics.draw(underlineLineString); } else { Stroke oldStroke = graphics.getStroke(); try { graphics.setStroke(new BasicStroke(metrics.getUnderlineThickness() * 2)); graphics.draw(underlineLineString); } finally { graphics.setStroke(oldStroke); } } }

Target:
private void drawCurvedUnderline(LineInfo line, LineStringCursor cursor, double startOrdinate, boolean drawingHalo) { LineComponent component = line.getComponents().get(0); LineMetrics metrics = computeLineMetricsIfNeeded(component); double endOrdinate = cursor.getCurrentOrdinate(); GlyphVector glyphVector = line.getComponents().get(0).getGlyphVector(); double advance = glyphVector.getGlyphMetrics(0).getAdvance() * 0.5f; LineString labelLineString = cursor.getSubLineString(startOrdinate - advance, endOrdinate - advance); LiteShape underlineLineString = computeCurvedUnderline(labelLineString, metrics); if (drawingHalo) { graphics.draw(underlineLineString); } else { Stroke oldStroke = graphics.getStroke(); try { graphics.setStroke(new BasicStroke(metrics.getUnderlineThickness())); graphics.draw(underlineLineString); } finally { graphics.setStroke(oldStroke); } } }
Source:
public void testValidate() { IntegerRangeValidator validator = new IntegerRangeValidator(); when(integerRange.min()).thenReturn(1); when(integerRange.max()).thenReturn(15); validator.initialize(integerRange); assertTrue(validator.isValid("12", null)); }

Target:
public void testValidate() { IntegerRangeValidator validator = new IntegerRangeValidator(); int min = integer(DEFAULT_MIN, 0); int max = integer(0, DEFAULT_MAX); integerRange(min, max); validator.initialize(integerRange); assertTrue(validator.isValid(integer(min, max) + "", null)); }
Source:
public void testCaptcha() { PageTitle title = new PageTitle(null, "Test_page_for_app_testing/Captcha", TEST_WIKI_SITE); String wikitext = "== Section 2 ==\n\nEditing by inserting an external link https://" + System.currentTimeMillis(); service.edit(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new Edit.Callback() { @Override public void success(@NonNull EditingResult result) { validateCaptcha(result); } @Override public void failure(@NonNull Throwable caught) { throw new RuntimeException(caught); } }); }

Target:
public void testCaptcha() { PageTitle title = new PageTitle(null, "Test_page_for_app_testing/Captcha", TEST_WIKI_SITE); String wikitext = "== Section 2 ==\n\nEditing by inserting an external link https://" + System.currentTimeMillis(); final TestLatch latch = new TestLatch(); client.request(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new EditClient.Callback() { @Override public void success(@NonNull Call<Edit> call, @NonNull EditingResult result) { validateCaptcha(result); latch.countDown(); } @Override public void failure(@NonNull Call<Edit> call, @NonNull Throwable caught) { throw new RuntimeException(caught); } }); latch.await(); }
Source:
public String toString() { StringBuilder r = new StringBuilder(); r.append(getClass().getSimpleName()); r.append('['); for (int i = 0; i < commands.size(); i++) { ReceiveCommand cmd = commands.get(i); if (i != 0) { r.append(", "); } r.append(cmd); r.append(" ("); r.append(cmd.getResult()); r.append(')'); } r.append(']'); return r.toString(); }

Target:
public String toString() { StringBuilder r = new StringBuilder(); r.append(getClass().getSimpleName()).append('['); if (commands.isEmpty()) return r.append(']').toString(); r.append('\n'); for (ReceiveCommand cmd : commands) { r.append(" "); r.append(cmd); r.append(" (").append(cmd.getResult()).append(")\n"); } return r.append(']').toString(); }
Source:
public void githubProfileScraperUserTest() { GithubProfileScraper githubScraper = new GithubProfileScraper(); String url = "<LINK_1>"; BufferedReader br = null; githubScraper.termsList = new ArrayList<String>(); githubScraper.termsList.add("all"); try { ClientConnection connection = new ClientConnection(url); br = githubScraper.getHtml(connection); String profile = "djmgit"; String userName = "djmgit"; String fullName = "Deepjyoti Mondal"; String specialLink = "<LINK_0>"; String userId = "16368427"; Post fetchedProfile = githubScraper.scrapeGithub(profile, br); assertEquals(fetchedProfile.getString("user_name"), userName); assertEquals(fetchedProfile.getString("full_name"), fullName); assertEquals(fetchedProfile.getString("special_link"), specialLink); assertEquals(fetchedProfile.getString("user_id"), userId); } catch (IOException e) { DAO.log("GithubProfileScraperTest.githubProfileScraperUserTest() failed to connect to network. url:" + url); } }

Target:
public void githubProfileScraperUserTest() { GithubProfileScraper githubScraper = new GithubProfileScraper(); String url = "<LINK_1>"; BufferedReader br = null; githubScraper.termsList = new ArrayList<String>(); githubScraper.termsList.add("all"); String profile = "djmgit"; String userName = "djmgit"; String fullName = "Deepjyoti Mondal"; String specialLink = "<LINK_0>"; String userId = "16368427"; try { ClientConnection connection = new ClientConnection(url); br = githubScraper.getHtml(connection); } catch (IOException e) { DAO.log("GithubProfileScraperTest.githubProfileScraperUserTest() failed to connect to network. url:" + url); } Post fetchedProfile = githubScraper.scrapeGithub(profile, br); assertEquals(fetchedProfile.getString("user_name"), userName); assertEquals(fetchedProfile.getString("full_name"), fullName); assertEquals(fetchedProfile.getString("special_link"), specialLink); assertEquals(fetchedProfile.getString("user_id"), userId); }
Source:
public Fake(final Request req, final String... dispositions) throws IOException { this.fake = new RqMultipart.Base( new RqFake( RqMultipart.Fake.convert(req.head()), this.fakeBody(dispositions) ) ); }

Target:
public Fake(final Request req, final String... dispositions) throws IOException { this.fake = new RqMultipart.Base( new Request() { @Override public Iterable<String> head() throws IOException { return new RqWithHeader( req, "Content-Type", String.format( "multipart/form-data; boundary=%s", BOUNDARY ) ).head(); } @Override public InputStream body() throws IOException { return RqMultipart.Fake.fakeBody(dispositions); } } ); }
Source:
public void setRules(List<Rule> rules) { this.rules = rules; Set<String> streamIds = new HashSet<>(Collections2.transform(getOutputStreams(), new Function<Stream, String>() { @Nullable @Override public String apply(@Nullable Stream input) { return input.getId(); } })); for (Rule rule : rules) { for (Action action : rule.getActions()) { for (String stream : action.getOutputStreams()) { if(!streamIds.contains(stream)) { throw new RuntimeException("Action's stream: "+stream+" does nto exist in processor's output streams"); } } } } getConfig().setAny(CONFIG_KEY_RULES, rules); }

Target:
public void setRules(List<Rule> rules) { this.rules = rules; Set<String> streamIds = new HashSet<>(Collections2.transform(getOutputStreams(), new Function<Stream, String>() { @Nullable @Override public String apply(@Nullable Stream input) { return input.getId(); } })); for (Rule rule : rules) { for (Action action : rule.getActions()) { for (String stream : action.getOutputStreams()) { if(!streamIds.contains(stream)) { String errorMsg = String.format("Action [%s] stream [%s] does not exist in processor [%s]'s output streams [%s]", action, stream, getName(), streamIds); log.error(errorMsg); throw new IllegalArgumentException(errorMsg); } } } } getConfig().setAny(CONFIG_KEY_RULES, rules); }
Source:
public void sawOpcode(int seen){ if(seen == Const.INVOKEVIRTUAL && ( getNameConstantOperand().equals("getPackageName().equalsIgnoreCase") )) { bugReporter.reportBug(new BugInstance(this,ANDROID_CASE_INSENSITIVE_PACKAGE_NAME_COMPARISON_TYPE,Priorities.NORMAL_PRIORITY) .addClass(this).addMethod(this).addSourceLine(this)); } }

Target:
public void sawOpcode(int seen){ if(seen == Const.INVOKEVIRTUAL && ( getNameConstantOperand().equals("getPackageName") && getNameConstantOperand().equals("equalsIgnoreCase") )) { bugReporter.reportBug(new BugInstance(this,ANDROID_CASE_INSENSITIVE_PACKAGE_NAME_COMPARISON_TYPE,Priorities.NORMAL_PRIORITY) .addClass(this).addMethod(this).addSourceLine(this)); } }
Source:
public int getLightValue(IBlockAccess access, BlockPos pos) { Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); Optional<LightEmitter> opEmitter = blockInstance.components.getOp(LightEmitter.class); if (opEmitter.isPresent()) { return (int) Math.min(0, Math.max(Math.round(opEmitter.get().emittedLevel.getAsDouble() * 15), 15)); } else { return 0; } }

Target:
public int getLightValue(IBlockAccess access, BlockPos pos) { Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); Optional<LightEmitter> opEmitter = blockInstance.components.getOp(LightEmitter.class); if (opEmitter.isPresent()) { return (int) MathUtil.clamp(Math.round(opEmitter.get().emittedLevel.getAsDouble() * 15), 0, 15); } else { return 0; } }
Source:
public void onResponse(final List<T> data) { if (data.isEmpty()) { state.setValue(State.ENDED); } else { if (!isEmpty()) { data.addAll(0, this.data.getValue()); } this.data.setValue(data); state.setValue(State.FETCHED); } }

Target:
public void onResponse(final List<T> data) { if (data.isEmpty()) { state.setValue(State.COMPLETED); } else { List<T> newData = this.data.getValue(); newData.addAll(data); this.data.setValue(newData); state.setValue(State.FETCH_COMPLETE); } }
Source:
public void onAttach(@NotNull Context context) { super.onAttach(context); try { listener = (AdminPasswordDialogListener) getActivity(); } catch (ClassCastException e) { Timber.w(e); } }

Target:
public void onAttach(@NotNull Context context) { super.onAttach(context); if (context instanceof AdminPasswordDialogCallback) { callback = (AdminPasswordDialogCallback) context; } }
Source:
public void submit(String eventBody) throws IOException { Socket socket = null; PrintStream output = null; try { socket = attach(); output = new PrintStream(socket.getOutputStream()); output.print(eventBody + "\r\n"); output.flush(); output.close(); socket.close(); } finally { if (output != null) { output.close(); } if (socket != null) { socket.close(); } } }

Target:
public void submit(String eventBody) throws IOException { Socket socket = null; OutputStream output = null; try { socket = attach(); output = socket.getOutputStream(); output.write(eventBody.getBytes("UTF8")); output.flush(); output.close(); socket.close(); } finally { if (output != null) { output.close(); } if (socket != null) { socket.close(); } } }
Source:
public static Dimension getBrowserSize() { String size = getProp("browserSize"); if (StringUtils.isNotBlank(size) || "max".equals(size) || size.split("x").length == 2) { if ("max".equals(size)) { return null; } else { return new Dimension(Integer.valueOf(size.split("x")[0]), Integer.valueOf(size.split("x")[1])); } } else { throw new WebDriverException("browser size: " + size + " is not a proper value"); } }

Target:
public static Dimension getBrowserSize() { String size = getProp("browserSize"); if (StringUtils.isNotBlank(size) || "maximised".equals(size) || size.split("x").length == 2) { if ("maximised".equals(size)) { return null; } else { return new Dimension(Integer.valueOf(size.split("x")[0]), Integer.valueOf(size.split("x")[1])); } } else { throw new WebDriverException("browser size: " + size + " is not a proper value"); } }
Source:
public void verifyCommentDeleted(String comment) { if (commentTextList.isEmpty()) { PageObjectLogging.log("verifyCommentDeleted", "comment: " + comment + " was deleted as no comments were found on the article", true); } else { PageObjectLogging.log("verifyCommentDeleted", "comments were found on the article, next step will make sure if comment: " + comment + " is not among them", true); for (WebElement elem : commentTextList) { Assertion.assertTrue(!comment.equals(elem.getText())); } } }

Target:
public void verifyCommentDeleted(String comment) { if (!commentTextList.isEmpty()) { for (WebElement elem : commentTextList) { Assertion.assertTrue(!comment.equals(elem.getText())); } } PageObjectLogging.log("verifyCommentDeleted", "comment " + comment + " was deleted", true); }
Source:
public void run() { LOG.info("ForceWrite Thread started"); boolean shouldForceWrite = true; int numReqInLastForceWrite = 0; while (running) { ForceWriteRequest req = null; try { req = forceWriteRequests.take(); if (!req.isMarker) { if (shouldForceWrite) { if (enableGroupForceWrites) { forceWriteRequests.put(createForceWriteRequest(req.logFile, 0, 0, null, false, true)); } if (numReqInLastForceWrite > 0) { forceWriteGroupingCountStats.registerSuccessfulValue(numReqInLastForceWrite); numReqInLastForceWrite = 0; } } numReqInLastForceWrite += req.process(shouldForceWrite); } if (enableGroupForceWrites && !req.isMarker && !req.shouldClose) { shouldForceWrite = false; } else { shouldForceWrite = true; } } catch (IOException ioe) { LOG.error("I/O exception in ForceWrite thread", ioe); running = false; } catch (InterruptedException e) { LOG.error("ForceWrite thread interrupted", e); if (null != req) { req.shouldClose = true; req.closeFileIfNecessary(); } running = false; } finally { if (req != null) { req.recycle(); } } } threadToNotifyOnEx.interrupt(); }

Target:
public void run() { LOG.info("ForceWrite Thread started"); boolean shouldForceWrite = true; int numReqInLastForceWrite = 0; while (running) { ForceWriteRequest req = null; try { req = forceWriteRequests.take(); if (!req.isMarker) { if (shouldForceWrite) { if (enableGroupForceWrites) { forceWriteRequests.put(createForceWriteRequest(req.logFile, 0, 0, null, false, true)); } if (numReqInLastForceWrite > 0) { forceWriteGroupingCountStats.registerSuccessfulValue(numReqInLastForceWrite); numReqInLastForceWrite = 0; } } } numReqInLastForceWrite += req.process(shouldForceWrite); if (enableGroupForceWrites && !req.isMarker && !req.shouldClose) { shouldForceWrite = false; } else { shouldForceWrite = true; } } catch (IOException ioe) { LOG.error("I/O exception in ForceWrite thread", ioe); running = false; } catch (InterruptedException e) { LOG.error("ForceWrite thread interrupted", e); if (null != req) { req.shouldClose = true; req.closeFileIfNecessary(); } running = false; } finally { if (req != null) { req.recycle(); } } } threadToNotifyOnEx.interrupt(); }
Source:
void setUpTypeSpecificUIComponents() { promptTitle.setText( Localization.get("apk.reinstall.needed.title", getCurrentClientName())); actionButton.setText(Localization.get("apk.reinstall.action")); actionButton.setOnClickListener(v -> launchCurrentAppOnPlayStore()); imageCue.setVisibility(View.GONE); }

Target:
void setUpTypeSpecificUIComponents() { promptTitle.setText(StringUtils.getStringRobust(this, R.string.reinstall_prompt_title, getCurrentClientName())); actionButton.setText(Localization.get("apk.reinstall.action")); actionButton.setOnClickListener(v -> launchCurrentAppOnPlayStore()); imageCue.setVisibility(View.GONE); }
Source:
private StorageConnections mapCollection(List<StorageServerConnections> entities) { StorageConnections collection = new StorageConnections(); for (org.ovirt.engine.core.common.businessentities.StorageServerConnections entity : entities) { Storage connection = map(entity); if (connection != null) { collection.getStorageConnections().add(connection); } } return collection; }

Target:
private StorageConnections mapCollection(List<StorageServerConnections> entities) { StorageConnections collection = new StorageConnections(); for (org.ovirt.engine.core.common.businessentities.StorageServerConnections entity : entities) { Storage connection = map(entity); if (connection != null) { collection.getStorageConnections().add(addLinks(connection)); } } return collection; }
Source:
protected boolean validateSpaceRequirements() { if (!isStorageDomainSpaceWithinThresholds()) { return false; } getImage().getSnapshots().addAll(getAllImageSnapshots()); if (!doesStorageDomainHaveSpaceForRequest(Math.round(getImage().getActualDiskWithSnapshotsSize()))) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); return false; } return true; }

Target:
protected boolean validateSpaceRequirements() { if (!isStorageDomainSpaceWithinThresholds()) { return false; } getImage().getSnapshots().addAll(getAllImageSnapshots()); if (!isDomainHasStorageSpaceForRequest()) { return false; } return true; }
Source:
public Map<String,String> fetchVersionGET() { return Collections.singletonMap("version", "1.0"); }

Target:
public InfoServiceImpl.Version fetchVersionGET() { return infoService.getVersion(); }
Source:
private Process createProcess() { Process process; try { String command = "ps --no-headers -o rss " + getCurrentPid(); ProcessBuilder builder = new ProcessBuilder().command("bash", "-c", command); process = builder.start(); } catch (IOException e) { throw new IllegalStateException("Error when starting the process.", e); } return process; }

Target:
private Process createProcess() { try { return Runtime.getRuntime().exec("ps --no-headers -o rss " + Utils.getProcessID()); } catch (IOException e) { throw new IllegalStateException("Error when starting the process.", e); } }
Source:
public MachineTreeNode(@Assisted MachineTreeNode parent, @Assisted("data") Object data, @Assisted Collection<MachineTreeNode> children) { this.parent = parent; this.data = data; this.children = children; boolean isMachine = data instanceof Machine; id = isMachine ? ((Machine)data).getId() : ROOT; name = isMachine ? ((Machine)data).getConfig().getName() : ROOT; }

Target:
public MachineTreeNode(@Assisted MachineTreeNode parent, @Assisted("data") Object data, @Assisted Collection<MachineTreeNode> children) { this.parent = parent; this.data = data; this.children = children; if (data instanceof Machine) { Machine machine = (Machine)data; id = machine.getId(); name = machine.getConfig().getName(); } else { id = ROOT; name = ROOT; } }
Source:
void initializeWebrtc(boolean videoEnabled) { RCLogger.i(TAG, "initializeWebrtc "); Context context = RCClient.getContext(); iceConnected = false; signalingParameters = null; scalingType = VideoRendererGui.ScalingType.SCALE_ASPECT_FILL; for (String permission : MANDATORY_PERMISSIONS) { if (context.checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) { logAndToast("Permission " + permission + " is not granted"); listener.onPermissionNotGranted(this, permission); return; } } if (videoEnabled) { for (String permission : MANDATORY_PERMISSIONS_VIDEO) { if (context.checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) { logAndToast("Permission " + permission + " is not granted"); listener.onPermissionNotGranted(this, permission); return; } } } peerConnectionParameters = new PeerConnectionClient.PeerConnectionParameters( videoEnabled, false, 0, 0, 0, 0, "VP8", true, 0, "OPUS", false, true); createPeerConnectionFactory(); }

Target:
Status initializeWebrtc(boolean videoEnabled) { RCLogger.i(TAG, "initializeWebrtc "); Context context = RCClient.getContext(); iceConnected = false; signalingParameters = null; scalingType = VideoRendererGui.ScalingType.SCALE_ASPECT_FILL; for (String permission : MANDATORY_PERMISSIONS) { if (context.checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) { String errorText = "Permission " + permission + " is not granted"; logAndToast(errorText); listener.onDisconnected(this, RCClient.ErrorCodes.PERMISSION_NOT_GRANTED_ERROR.ordinal(), errorText); return Status.FAIL; } } if (videoEnabled) { for (String permission : MANDATORY_PERMISSIONS_VIDEO) { if (context.checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) { String errorText = "Permission " + permission + " is not granted"; logAndToast(errorText); listener.onDisconnected(this, RCClient.ErrorCodes.PERMISSION_NOT_GRANTED_ERROR.ordinal(), errorText); return Status.FAIL; } } } peerConnectionParameters = new PeerConnectionClient.PeerConnectionParameters( videoEnabled, false, 0, 0, 0, 0, "VP8", true, 0, "OPUS", false, true); createPeerConnectionFactory(); return Status.PASS; }