auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Roaring64NavigableMap getAddressesInRange(StreamAddressRange range) { Roaring64NavigableMap addressesInRange = new Roaring64NavigableMap(); LongIterator iterator = addressMap.getReverseLongIterator(); while (iterator.hasNext()) { long val = iterator.next(); if (val > range.getEnd() && val <= range.getStart()) { addressesInRange.add(val); } else if (val < range.getEnd()) { break; } } log.trace("getAddressesInRange[{}]: address map in range [{}-{}] has a total of addresses.", Utils.toReadableId(range.getStreamID()), range.getEnd(), range.getStart(), addressesInRange.getLongCardinality()); return addressesInRange; }

Target:
public Roaring64NavigableMap getAddressesInRange(StreamAddressRange range) { Roaring64NavigableMap addressesInRange = new Roaring64NavigableMap(); if (range.getStart() > range.getEnd()) { LongIterator iterator = getAddressMap().getReverseLongIterator(); while (iterator.hasNext()) { long curr = iterator.next(); if (curr > range.getEnd()) { addressesInRange.addLong(curr); } else if (curr > range.getStart()) { continue; } else { break; } } } log.trace("getAddressesInRange[{}]: address map in range [{}-{}] has a total of addresses.", Utils.toReadableId(range.getStreamID()), range.getEnd(), range.getStart(), addressesInRange.getLongCardinality()); return addressesInRange; }
Source:
private String extractIdentityStream() { Map beatsData = (Map)this.getData().get("beat"); if(beatsData != null) { String id = (String) beatsData.get("id"); String resourceId = (String) beatsData.get("resource_id"); if(id != null && resourceId != null) { return id + "-" + resourceId; } else { return beatsData.get("name") + "-" + beatsData.get("source"); } } return null; }

Target:
private String extractIdentityStream() { Map beatsData = (Map<String, String>)this.getData().get("beat"); if(beatsData != null) { String id = (String) beatsData.get("id"); String resourceId = (String) beatsData.get("resource_id"); if(id != null && resourceId != null) { return id + "-" + resourceId; } else { return beatsData.get("name") + "-" + beatsData.get("source"); } } return null; }
Source:
public void validateItemType(final Item item, final String bindingConfig) throws BindingConfigParseException { logger.trace("validateItemType({},{}) called.", item.getName(), bindingConfig); VeluxGenericBindingParser thisBinding = null; try { thisBinding = new VeluxGenericBindingParser(bindingConfig); } catch (IllegalArgumentException e) { logger.error("validateItemType() {}", e.getMessage()); throw new BindingConfigParseException(e.getMessage()); } VeluxItemType thisType = VeluxItemType.getByThingAndChannel(thisBinding.thingIdentifier, thisBinding.channelIdentifier); if (thisType == null) { String errorMessage = "Velux binding must contain a valid thing/channel combination (found thing '" + thisBinding.thingIdentifier + "', channel '" + thisBinding.channelIdentifier + "'; ignoring binding '" + bindingConfig + "')"; throw new BindingConfigParseException(errorMessage); } if (!thisType.getItemClass().getSimpleName().equals(item.getClass().getSimpleName())) { String errorMessage = "Velux binding: item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', '" + thisType.getItemClass().getSimpleName() + "' is allowed - please check your *.items configuration (ignoring binding '" + bindingConfig + "')"; throw new BindingConfigParseException(errorMessage); } else { logger.trace("found config '" + bindingConfig + "': " + "item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', which is allowed."); } logger.debug("validateItemType() returned w/o exception."); }

Target:
public void validateItemType(final Item item, final String bindingConfig) throws BindingConfigParseException { logger.trace("validateItemType({},{}) called.", item.getName(), bindingConfig); VeluxGenericBindingParser thisBinding = null; try { thisBinding = new VeluxGenericBindingParser(bindingConfig); } catch (IllegalArgumentException e) { throw new BindingConfigParseException(e.getMessage()); } VeluxItemType thisType = VeluxItemType.getByThingAndChannel(thisBinding.thingIdentifier, thisBinding.channelIdentifier); if (thisType == null) { String errorMessage = "Velux binding must contain a valid thing/channel combination (found thing '" + thisBinding.thingIdentifier + "', channel '" + thisBinding.channelIdentifier + "'; ignoring binding '" + bindingConfig + "')"; throw new BindingConfigParseException(errorMessage); } if (!thisType.getItemClass().getSimpleName().equals(item.getClass().getSimpleName())) { String errorMessage = "Velux binding: item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', '" + thisType.getItemClass().getSimpleName() + "' is allowed - please check your *.items configuration (ignoring binding '" + bindingConfig + "')"; throw new BindingConfigParseException(errorMessage); } else { logger.trace("found config '{}': Item is of type '{}', which is allowed.", bindingConfig, item.getName(), item.getClass().getSimpleName()); } logger.debug("validateItemType() returned w/o exception."); }
Source:
protected void executeIrsBrokerCommand() { log.info("-- executeIrsBrokerCommand: calling 'SPMGetVolumeInfo', parameters:"); log.info("++ spUUID={}", getParameters().getStoragePoolId()); log.info("++ sdUUID={}", getParameters().getStorageDomainId()); log.info("++ imageGroupGUID={}", getParameters().getImageGroupId()); log.info("++ volUUID={}", getParameters().getImageId()); GetVolumeInfoVDSCommandParameters params = new GetVolumeInfoVDSCommandParameters( getCurrentIrsProxyData().getCurrentVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId()); setVDSReturnValue(resourceManager.runVdsCommand(VDSCommandType.GetVolumeInfo, params)); }

Target:
protected void executeIrsBrokerCommand() { log.info("Executing GetVolumeInfo using the current SPM"); GetVolumeInfoVDSCommandParameters params = new GetVolumeInfoVDSCommandParameters( getCurrentIrsProxyData().getCurrentVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId()); setVDSReturnValue(resourceManager.runVdsCommand(VDSCommandType.GetVolumeInfo, params)); }
Source:
public Builder loadSource(File srcFile) throws IOException { return loadSource(srcFile, defaultCharset()); }

Target:
public Builder loadSource(File srcFile) throws IOException { return loadSource(srcFile, Charset.forName(AbstractAction.CHARSET)); }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); outSchema = config.getOutputSchema(collector); if (!this.config.containsMacro(INPUT) && pipelineConfigurer.getStageConfigurer().getInputSchema().getField(this.config.inputField) == null) { collector.addFailure(String.format("Input field '%s' must exist in input schema.", this.config.inputField), null) .withConfigProperty(INPUT); } try { validateXpathAndSchema(collector); } catch (UnsupportedEncodingException e) { collector.addFailure(String.format("Failed to parse XPath mappings: %s.", e.getMessage()), null) .withConfigProperty(XPATH_MAPPINGS); } pipelineConfigurer.getStageConfigurer().setOutputSchema(outSchema); }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); outSchema = config.getOutputSchema(collector); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (!this.config.containsMacro(Config.INPUT) && inputSchema != null && inputSchema.getField(this.config.inputField) == null) { collector.addFailure( String.format("Input field '%s' must exist in the input schema.", this.config.inputField), null) .withConfigProperty(Config.INPUT); } validateXpathAndSchema(collector); pipelineConfigurer.getStageConfigurer().setOutputSchema(outSchema); }
Source:
public static LinkedList<String> getGreatestCommonScopes(LinkedList<Configuration> configurationList){ LinkedList<Configuration> includeConfigList = getIncludeConfigurationList(configurationList); HashMap<String, LinkedList<Filter>> includeFiltersByDomain = getIncludeFiltersByDomain(includeConfigList); HashMap<String, Set<String>> parametersIntersectionByDomain = getCommonBeanKeysByDomain(includeFiltersByDomain); HashMap<String, LinkedHashMap<String, String>> commonBeanScopeByDomain = getCommonScopeByDomain(parametersIntersectionByDomain, includeFiltersByDomain); LinkedList<String> result = new LinkedList<String>(); Iterator<Entry<String, LinkedHashMap<String, String>>> commonBeanScopeItr = commonBeanScopeByDomain.entrySet().iterator(); while(commonBeanScopeItr.hasNext()){ Entry<String, LinkedHashMap<String, String>> beanScopeEntry = commonBeanScopeItr.next(); String domain = (String) beanScopeEntry.getKey(); LinkedHashMap<String, String> beanScope = (LinkedHashMap<String, String>) beanScopeEntry.getValue(); result.add(beanScopeToString(domain, beanScope)); } return result; }

Target:
public static LinkedList<String> getGreatestCommonScopes(LinkedList<Configuration> configurationList){ LinkedList<Configuration> includeConfigList = getIncludeConfigurationList(configurationList); HashMap<String, LinkedList<Filter>> includeFiltersByDomain = getIncludeFiltersByDomain(includeConfigList); HashMap<String, Set<String>> parametersIntersectionByDomain = getCommonBeanKeysByDomain(includeFiltersByDomain); HashMap<String, LinkedHashMap<String, String>> commonBeanScopeByDomain = getCommonScopeByDomain(parametersIntersectionByDomain, includeFiltersByDomain); LinkedList<String> result = new LinkedList<String>(); for (Entry<String, LinkedHashMap<String, String>> beanScopeEntry: commonBeanScopeByDomain.entrySet()) { String domain = beanScopeEntry.getKey(); LinkedHashMap<String, String> beanScope = beanScopeEntry.getValue(); result.add(beanScopeToString(domain, beanScope)); } return result; }
Source:
protected Column(Class<?> tableClass, String fieldName, AggregationDictionary dictionary) { this.tableName = dictionary.getJsonAliasFor(tableClass); this.id = tableName + "." + fieldName; this.name = fieldName; this.columnTags = new HashSet<>(); Meta meta = dictionary.getAttributeOrRelationAnnotation(tableClass, Meta.class, fieldName); if (meta != null) { this.longName = meta.longName(); this.description = meta.description(); } if (dictionary.isRelation(tableClass, fieldName)) { Class<?> relationshipClass = dictionary.getParameterizedType(tableClass, fieldName); String relationshipName = dictionary.getJsonAliasFor(relationshipClass); this.dataType = new RelationshipType( this.id + "." + relationshipClass.getSimpleName().toLowerCase(Locale.ENGLISH), relationshipName); } else { Class<?> fieldClass = dictionary.getType(tableClass, fieldName); if (dictionary.getIdFieldName(tableClass).equals(fieldName)) { this.dataType = new DataType(tableName + "." + fieldName, ValueType.ID); } else if (Date.class.isAssignableFrom(fieldClass)) { this.dataType = new DataType(fieldClass.getSimpleName().toLowerCase(Locale.ENGLISH), ValueType.DATE); } else { DataType dataType = DataType.getScalarType(fieldClass); if (dataType == null) { throw new IllegalArgumentException("Unknown data type for " + this.id); } this.dataType = dataType; } } }

Target:
protected Column(Class<?> tableClass, String fieldName, AggregationDictionary dictionary) { this.tableName = dictionary.getJsonAliasFor(tableClass); this.id = tableName + "." + fieldName; this.name = fieldName; this.columnTags = new HashSet<>(); Meta meta = dictionary.getAttributeOrRelationAnnotation(tableClass, Meta.class, fieldName); if (meta != null) { this.longName = meta.longName(); this.description = meta.description(); } if (dictionary.isRelation(tableClass, fieldName)) { Class<?> relationshipClass = dictionary.getParameterizedType(tableClass, fieldName); String relationshipName = dictionary.getJsonAliasFor(relationshipClass); this.dataType = new RelationshipType( this.id + "[" + relationshipClass.getSimpleName().toLowerCase(Locale.ENGLISH) + "]"); } else { Class<?> fieldClass = dictionary.getType(tableClass, fieldName); if (dictionary.getIdFieldName(tableClass).equals(fieldName)) { this.dataType = new DataType(tableName + "." + fieldName, ValueType.ID); } else if (Date.class.isAssignableFrom(fieldClass)) { this.dataType = new DataType(fieldClass.getSimpleName().toLowerCase(Locale.ENGLISH), ValueType.DATE); } else { DataType dataType = DataType.getScalarType(fieldClass); if (dataType == null) { throw new IllegalArgumentException("Unknown data type for " + this.id); } this.dataType = dataType; } } }
Source:
public void resume() { checkRealm(); pauseDepth--; if (pauseDepth < 0) { throw new IllegalStateException( "The resume() method was called more often than pause()."); } else if (pauseDepth == 0) { sideEffects.forEach(s -> s.resume()); } }

Target:
public void resume() { checkRealm(); pauseDepth--; if (pauseDepth < 0) { throw new IllegalStateException( "The resume() method was called more times than pause()."); } else if (pauseDepth == 0) { sideEffects.forEach(s -> s.resume()); } }
Source:
public ListParserValidator(String model) throws ModelSyntaxException { super(model); this.converter = new IdentityConverter(); String listRegexp = LIST_TYPE_REGEXP + "\\(([^)]+)\\)$"; String commaSeparatedValuesString = parseAndGetOneGroup(model, listRegexp); String[] stringValues = commaSeparatedValuesString.split(","); Set<String> valuesSet = new HashSet<>(); for (String value : stringValues) { valuesSet.add(value.trim()); } this.validator = new ListValidator(valuesSet); }

Target:
public ListParserValidator(String model) throws ModelSyntaxException { super(model); }
Source:
private ServerSocketChannel openServerSocket(String host, int port) throws IOException { InetSocketAddress address = null; if (host == null || host.trim().isEmpty()) { address = new InetSocketAddress(port); } else { address = new InetSocketAddress(host, port); } ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); serverChannel.socket().setReuseAddress(true); try { serverChannel.socket().bind(address); } catch (BindException e) { logger.error("Failed to bind to address " + address); throw e; } logger.info("Awaiting socket connections on {}:{}", address.getHostName(), port); return serverChannel; }

Target:
private ServerSocketChannel openServerSocket(String host, int port) throws IOException { InetSocketAddress address = null; if (host == null || host.trim().isEmpty()) { address = new InetSocketAddress(port); } else { address = new InetSocketAddress(host, port); } ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); serverChannel.socket().bind(address); logger.info("Awaiting socket connections on {}:{}", address.getHostName(), port); return serverChannel; }
Source:
public void readExternal(ObjectInput in) throws IOException { if (in.readBoolean()) { if (!in.readBoolean()) { precision = in.readUnsignedByte(); scale = in.readUnsignedByte(); value = null; rawData = null; isNull = evaluateNull(); } else { setCoreValue(null); } return; } value = null; rawScale = in.readUnsignedByte(); int size = in.readUnsignedByte(); if ((rawData == null) || size != rawData.length) { rawData = new byte[size]; } in.readFully(rawData); isNull = evaluateNull(); }

Target:
public void readExternal(ObjectInput in) throws IOException { if (in.readBoolean()) { precision = in.readByte(); scale = in.readByte(); setCoreValue(null); return; } value = null; rawScale = in.readUnsignedByte(); int size = in.readUnsignedByte(); if ((rawData == null) || size != rawData.length) { rawData = new byte[size]; } in.readFully(rawData); isNull = evaluateNull(); }
Source:
private static List<String> innerInitRange(int stopAfter, long startNum, long endNum) { if (startNum > endNum) { return Collections.emptyList(); } List<String> macAddresses = new ArrayList<>(stopAfter); for (long i = startNum; i <= endNum; i++) { if ((MAC_ADDRESS_MULTICAST_BIT & i) != 0) { continue; } macAddresses.add(macAddressIntToString(i)); if (stopAfter-- <= 0) { return macAddresses; } } return new ArrayList<>(macAddresses); }

Target:
private static List<String> innerInitRange(int stopAfter, long startNum, long endNum) { if (startNum > endNum) { return Collections.emptyList(); } List<String> macAddresses = new ArrayList<>(Math.min(stopAfter, (int)(endNum - startNum))); for (long i = startNum; i <= endNum; i++) { if ((MAC_ADDRESS_MULTICAST_BIT & i) != 0) { continue; } macAddresses.add(macAddressToString(i)); if (stopAfter-- <= 0) { return macAddresses; } } return new ArrayList<>(macAddresses); }
Source:
private static Client newHttpClient(Optional<SSLSocketFactory> sslSocketFactory, OkHttpClientOptions options, String userAgent) { OkHttpClient okClient = new OkHttpClient(); okClient.setConnectTimeout( options.getConnectTimeoutMs().or((long) okClient.getConnectTimeout()), TimeUnit.MILLISECONDS); okClient.setReadTimeout(options.getReadTimeoutMs().or((long) okClient.getReadTimeout()), TimeUnit.MILLISECONDS); okClient.setWriteTimeout( options.getWriteTimeoutMs().or((long) okClient.getWriteTimeout()), TimeUnit.MILLISECONDS); RetryInterceptor retryInterceptor = options.getMaxNumberRetries().isPresent() ? new RetryInterceptor(options.getMaxNumberRetries().get()) : new RetryInterceptor(); UserAgentInterceptor userAgentInterceptor = UserAgentInterceptor.of(userAgent); okClient.interceptors().add(retryInterceptor); okClient.interceptors().add(userAgentInterceptor); okClient.setSslSocketFactory(sslSocketFactory.orNull()); return new OkClient(okClient); }

Target:
private static Client newHttpClient(Optional<SSLSocketFactory> sslSocketFactory, OkHttpClientOptions options, String userAgent) { OkHttpClient okClient = new OkHttpClient(); okClient.setConnectTimeout( options.getConnectTimeoutMs().or((long) okClient.getConnectTimeout()), TimeUnit.MILLISECONDS); okClient.setReadTimeout(options.getReadTimeoutMs().or((long) okClient.getReadTimeout()), TimeUnit.MILLISECONDS); okClient.setWriteTimeout( options.getWriteTimeoutMs().or((long) okClient.getWriteTimeout()), TimeUnit.MILLISECONDS); RetryInterceptor retryInterceptor = options.getMaxNumberRetries().isPresent() ? new RetryInterceptor(options.getMaxNumberRetries().get()) : new RetryInterceptor(); okClient.interceptors().add(retryInterceptor); okClient.interceptors().add(UserAgentInterceptor.of(userAgent)); okClient.setSslSocketFactory(sslSocketFactory.orNull()); return new OkClient(okClient); }
Source:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); setSucceeded(true); if (vdsGroup.supportsVirtService()) { setSucceeded(initVirtResources()); } if (getSucceeded() && vdsGroup.supportsGlusterService()) { setSucceeded(initGlusterHost()); } }

Target:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); boolean initSucceeded = true; if (vdsGroup.supportsVirtService()) { initSucceeded = initVirtResources(); } if (initSucceeded && vdsGroup.supportsGlusterService()) { initSucceeded = initGlusterHost(); } setSucceeded(initSucceeded); }
Source:
private List<BuiltinCiphers> checkAndSetGitCiphers(String gitSshCiphers) { if (gitSshCiphers == null || gitSshCiphers.isEmpty()) { return managedCiphers; } else { List<BuiltinCiphers> ciphersHandled = new ArrayList<>(); List<String> ciphers = Arrays.asList(gitSshCiphers.split(",")); for (String cipherCode : ciphers) { BuiltinCiphers cipher = BuiltinCiphers.fromFactoryName(cipherCode.trim().toLowerCase()); if (cipher != null && managedCiphers.contains(cipher)) { ciphersHandled.add(cipher); LOG.info("Added Cipher to the git ssh configuration. ", cipher); }else{ LOG.info("Cipher not handled in git ssh configuration. ", cipher); } } return ciphersHandled; } }

Target:
private List<BuiltinCiphers> checkAndSetGitCiphers(String gitSshCiphers) { if (gitSshCiphers == null || gitSshCiphers.isEmpty()) { return managedCiphers; } else { List<BuiltinCiphers> ciphersHandled = new ArrayList<>(); List<String> ciphers = Arrays.asList(gitSshCiphers.split(",")); for (String cipherCode : ciphers) { BuiltinCiphers cipher = BuiltinCiphers.fromFactoryName(cipherCode.trim().toLowerCase()); if (cipher != null && managedCiphers.contains(cipher)) { ciphersHandled.add(cipher); LOG.info("Added Cipher to the git ssh configuration. ", cipher); } else { LOG.warn("Cipher not handled in git ssh configuration. ", cipher); } } return ciphersHandled; } }
Source:
public boolean handles(final Object columnElement, final Object rowElement) { boolean reult = false; Object row = AxisUtils.getRepresentedElement(rowElement); Object column = AxisUtils.getRepresentedElement(columnElement); if (row instanceof EObject && column instanceof EStructuralFeature) { if (UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) column) .getEType()) { reult = true; } } else if (row instanceof EStructuralFeature && column instanceof EObject) { if (UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) row) .getEType()) { reult = true; } } return reult; }

Target:
public boolean handles(final Object columnElement, final Object rowElement) { boolean result = false; Object row = AxisUtils.getRepresentedElement(rowElement); Object column = AxisUtils.getRepresentedElement(columnElement); if (column instanceof EStructuralFeature) { result = UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) column) .getEType(); } else if (row instanceof EStructuralFeature) { result = UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) row) .getEType(); } return result; }
Source:
public void testValidate() throws Exception { boolean hasException = false; try { orchestrator.validate(); } catch (Exception e) { hasException= true; } assertFalse(hasException); hasException = false; try { wrongOrchestrator.validate(); } catch (Exception e) { hasException= true; } assertTrue(hasException); }

Target:
public void testValidate() throws Exception { try { orchestrator.validate(); } catch (Exception e) { fail("Validate doesn't work on right formatted Dockerfile:"+e.getMessage()); } try { wrongOrchestrator.validate(); fail("Validate doesn't detect a wrong formatted Dockerfile"); } catch (Exception e) { assertEquals("Missing or misplaced FROM on line [1] of src/test/wrongDocker/Dockerfile, found WRONG wrong command", e.getMessage()); } }
Source:
public boolean hasTutorPrivileges() { return !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT) && isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS) && isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS) && isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS) && isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS); }

Target:
public boolean hasTutorPrivileges() { return hasSamePrivileges(tutorPrivileges); }
Source:
String readStringRaw() throws IOException { int len = readLength(); if (len == 0) return END; len -= 4; byte[] raw; if (len < lineBuffer.length) raw = lineBuffer; else raw = new byte[len]; IO.readFully(in, raw, 0, len); return RawParseUtils.decode(Constants.CHARSET, raw, 0, len); }

Target:
String readStringRaw() throws IOException { int len = readLength(); if (len == 0) return END; len -= 4; byte[] raw; if (len <= lineBuffer.length) raw = lineBuffer; else raw = new byte[len]; IO.readFully(in, raw, 0, len); return RawParseUtils.decode(Constants.CHARSET, raw, 0, len); }
Source:
public Result execute(UIExecutionContext context) throws Exception { for (JavaClassSource klass : targets.getValue()) { UIContext uiContext = context.getUIContext(); Project project = getSelectedProject(uiContext); JavaSourceFacet javaSource = project.getFacet(JavaSourceFacet.class); if (!klass.hasMethodSignature("hashCode") || !klass.hasMethodSignature("equals", Object.class)) { if (generateEqualsAndHashCode.getValue()) { if (klass.getField("id") != null) { Refactory.createHashCodeAndEquals(klass, klass.getField("id")); } else { Refactory.createHashCodeAndEquals(klass, (FieldSource<?>[]) klass.getFields().toArray()); } javaSource.saveJavaSource(klass); } } } return null; }

Target:
public Result execute(UIExecutionContext context) throws Exception { for (JavaClassSource javaSource : targets.getValue()) { UIContext uiContext = context.getUIContext(); Project project = getSelectedProject(uiContext); JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class); if (!javaSource.hasMethodSignature("hashCode")) { if (generateEqualsAndHashCode.getValue()) { if (javaSource.getField("id") != null) { Refactory.createHashCode(javaSource, javaSource.getField("id")); } else { Refactory.createHashCode(javaSource, (FieldSource<?>[]) javaSource.getFields().toArray(new FieldSource[javaSource.getFields().size()])); } } } if(!javaSource.hasMethodSignature("equals", Object.class)) { if (generateEqualsAndHashCode.getValue()) { if (javaSource.getField("id") != null) { Refactory.createEquals(javaSource, javaSource.getField("id")); } else { Refactory.createEquals(javaSource, (FieldSource<?>[]) javaSource.getFields().toArray(new FieldSource[javaSource.getFields().size()])); } } } javaSourceFacet.saveJavaSource(javaSource); } return null; }
Source:
public static GlusterHookEntity map(GlusterHook hook, GlusterHookEntity entity) { GlusterHookEntity hookEntity = entity != null ? entity : new GlusterHookEntity(); if (hook.isSetId()) { hookEntity.setId(Guid.createGuidFromStringDefaultEmpty(hook.getId())); } if (hook.isSetName()) { hookEntity.setName(hook.getName()); } if (hook.isSetGlusterCommand()) { hookEntity.setGlusterCommand(hook.getGlusterCommand()); } if (hook.isSetChecksum()) { hookEntity.setChecksum(hook.getChecksum()); } if (hook.isSetContent()) { hookEntity.setContent(hook.getContent()); } return hookEntity; }

Target:
public static GlusterHookEntity map(GlusterHook hook, GlusterHookEntity entity) { GlusterHookEntity hookEntity = entity != null ? entity : new GlusterHookEntity(); if (hook.isSetId()) { hookEntity.setId(GuidUtils.asGuid(hook.getId())); } if (hook.isSetName()) { hookEntity.setName(hook.getName()); } if (hook.isSetGlusterCommand()) { hookEntity.setGlusterCommand(hook.getGlusterCommand()); } if (hook.isSetChecksum()) { hookEntity.setChecksum(hook.getChecksum()); } if (hook.isSetContent()) { hookEntity.setContent(hook.getContent()); } return hookEntity; }
Source:
public String name() { try { return new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/stand/name/text()") .get(0); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public String name() { try { return new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/stand/name/text()") .get(0); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
private void processHeaderLine(StringBuffer line) throws HttpException { int colonIndex = line.indexOf(":"); if (colonIndex == -1) { int i; for (i = 0; i < line.length(); i++) if (!Character.isWhitespace(line.charAt(i))) break; if (i == line.length()) return; throw new HttpException("No colon in header:" + line); } String key = line.substring(0, colonIndex); int valueStart = colonIndex + 1; while (valueStart < line.length()) { int c = line.charAt(valueStart); if (c != ' ' && c != '\t') break; valueStart++; } String value = line.substring(valueStart); headers.put(key.toLowerCase(), new String[] { value }); }

Target:
private void processHeaderLine(StringBuffer line) throws HttpException { int colonIndex = line.indexOf(":"); if (colonIndex == -1) { int i; for (i = 0; i < line.length(); i++) if (!Character.isWhitespace(line.charAt(i))) break; if (i == line.length()) return; throw new HttpException("No colon in header:" + line); } String key = line.substring(0, colonIndex); int valueStart = colonIndex + 1; while (valueStart < line.length()) { int c = line.charAt(valueStart); if (c != ' ' && c != '\t') break; valueStart++; } String value = line.substring(valueStart); headers.put(key.toLowerCase(Locale.ROOT), new String[] { value }); }
Source:
public boolean initializeUnityAds(Activity activity, String gameId) { if (!UnityAds.isSupported()) { Log.w(UnityAdapter.TAG, "The current device is not supported by Unity Ads."); return false; } if (UnityAds.isInitialized()) { return true; } MediationMetaData mediationMetaData = new MediationMetaData(activity); mediationMetaData.setName("AdMob"); mediationMetaData.setVersion(MobileAds.getVersionString()); mediationMetaData.set("adapter_version", BuildConfig.VERSION_NAME); mediationMetaData.commit(); UnitySingletonListener listener = unitySingletonInstance.getUnitySingletonListenerInstance(); UnityAds.addListener(listener); UnityAds.initialize(activity, gameId, false, true); return true; }

Target:
public boolean initializeUnityAds(Activity activity, String gameId) { if (!UnityAds.isSupported()) { Log.w(UnityAdapter.TAG, "The current device is not supported by Unity Ads."); return false; } if (UnityAds.isInitialized()) { return true; } MediationMetaData mediationMetaData = new MediationMetaData(activity); mediationMetaData.setName("AdMob"); mediationMetaData.setVersion(MobileAds.getVersionString()); mediationMetaData.set("adapter_version", BuildConfig.VERSION_NAME); mediationMetaData.commit(); UnitySingletonListener listener = unitySingletonInstance.getUnitySingletonListenerInstance(); UnityAds.initialize(activity, gameId, listener, false, true); return true; }
Source:
private void publishCircuitThresholdsExceededEvent(Result result, CircuitBreakerMetrics metrics) { if (Result.hasFailureRateExceededThreshold(result)) { publishCircuitFailureRateExceededEvent(getName(), metrics.getFailureRate()); } if (Result.hasSlowCallRateExceededThreshold(result)) { publishCircuitSlowCallRateExceededEvent(getName(), metrics.getFailureRate()); } }

Target:
private void publishCircuitThresholdsExceededEvent(Result result, CircuitBreakerMetrics metrics) { if (Result.hasFailureRateExceededThreshold(result)) { publishCircuitFailureRateExceededEvent(getName(), metrics.getFailureRate()); } if (Result.hasSlowCallRateExceededThreshold(result)) { publishCircuitSlowCallRateExceededEvent(getName(), metrics.getSlowCallRate()); } }
Source:
public void apply(ServiceContext context, Optional<BaragonService> maybeOldService, boolean revertOnFailure) throws InvalidConfigException, LbAdapterExecuteException, IOException, MissingTemplateException { final BaragonService service = context.getService(); final BaragonService oldService; if (maybeOldService.isPresent()) { oldService = maybeOldService.get(); } else { oldService = service; } LOG.info(String.format("Going to apply %s: %s", service.getServiceId(), Joiner.on(", ").join(context.getUpstreams()))); final boolean oldServiceExists = configsExist(oldService); final boolean previousConfigsExist = configsExist(service); Collection<BaragonConfigFile> newConfigs = configGenerator.generateConfigsForProject(context); if (newConfigs.equals(readConfigs(oldService))) { LOG.info(" Configs are unchanged, skipping apply"); return; } if (revertOnFailure) { backupConfigs(service); if (oldServiceExists) { backupConfigs(oldService); } } try { if (context.isPresent()) { writeConfigs(newConfigs); if (oldServiceExists && !oldService.getServiceId().equals(service.getServiceId())) { remove(oldService, false); } } else { remove(service, false); } adapter.checkConfigs(); } catch (Exception e) { LOG.error("Caught exception while writing configs for " + service.getServiceId() + ", reverting to backups!", e); if (revertOnFailure) { if (oldServiceExists) { restoreConfigs(oldService); } if (previousConfigsExist) { restoreConfigs(service); } else { remove(service, false); } } throw Throwables.propagate(e); } adapter.reloadConfigs(); removeBackupConfigs(oldService); }

Target:
public void apply(ServiceContext context, Optional<BaragonService> maybeOldService, boolean revertOnFailure) throws InvalidConfigException, LbAdapterExecuteException, IOException, MissingTemplateException { final BaragonService service = context.getService(); final BaragonService oldService = maybeOldService.or(service); LOG.info(String.format("Going to apply %s: %s", service.getServiceId(), Joiner.on(", ").join(context.getUpstreams()))); final boolean oldServiceExists = configsExist(oldService); final boolean previousConfigsExist = configsExist(service); Collection<BaragonConfigFile> newConfigs = configGenerator.generateConfigsForProject(context); if (newConfigs.equals(readConfigs(oldService))) { LOG.info(" Configs are unchanged, skipping apply"); return; } if (revertOnFailure) { backupConfigs(service); if (oldServiceExists) { backupConfigs(oldService); } } try { if (context.isPresent()) { writeConfigs(newConfigs); if (oldServiceExists && !oldService.getServiceId().equals(service.getServiceId())) { remove(oldService, false); } } else { remove(service, false); } adapter.checkConfigs(); } catch (Exception e) { LOG.error("Caught exception while writing configs for " + service.getServiceId() + ", reverting to backups!", e); if (revertOnFailure) { if (oldServiceExists && !oldService.equals(service)) { restoreConfigs(oldService); } if (previousConfigsExist) { restoreConfigs(service); } else { remove(service, false); } } throw Throwables.propagate(e); } adapter.reloadConfigs(); removeBackupConfigs(oldService); }
Source:
public AccountResource.SshKey parse(AccountResource rsrc, IdString id) throws ResourceNotFoundException, OrmException { try { int seq = Integer.parseInt(id.get()); AccountSshKey sshKey = dbProvider.get().accountSshKeys() .get(new AccountSshKey.Id(rsrc.getUser().getAccountId(), seq)); if (sshKey == null) { throw new ResourceNotFoundException(id); } return new AccountResource.SshKey(rsrc.getUser(), sshKey); } catch (NumberFormatException e) { throw new ResourceNotFoundException(id); } }

Target:
public AccountResource.SshKey parse(AccountResource rsrc, IdString id) throws ResourceNotFoundException, OrmException { if (self.get() != rsrc.getUser() && !self.get().getCapabilities().canAdministrateServer()) { throw new ResourceNotFoundException(); } try { int seq = Integer.parseInt(id.get(), 10); AccountSshKey sshKey = dbProvider.get().accountSshKeys() .get(new AccountSshKey.Id(rsrc.getUser().getAccountId(), seq)); if (sshKey == null) { throw new ResourceNotFoundException(id); } return new AccountResource.SshKey(rsrc.getUser(), sshKey); } catch (NumberFormatException e) { throw new ResourceNotFoundException(id); } }
Source:
private void sendPack() throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; if (sideband) { int bufsz = SideBandOutputStream.SMALL_BUF; if (options.contains(OPTION_SIDE_BAND_64K)) bufsz = SideBandOutputStream.MAX_BUF; packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!options.contains(OPTION_NO_PROGRESS)) pm = new SideBandProgressMonitor(new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut)); } PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); final PackWriter pw = new PackWriter(cfg, walk.getObjectReader()); try { pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA)); pw.setThin(options.contains(OPTION_THIN_PACK)); if(depth > 0) { pw.preparePack(pm, wantAll, depth); } else { pw.preparePack(pm, wantAll, commonBase); } if (options.contains(OPTION_INCLUDE_TAG)) { for (final Ref r : refs.values()) { final RevObject o; try { o = walk.parseAny(r.getObjectId()); } catch (IOException e) { continue; } if (o.has(WANT) || !(o instanceof RevTag)) continue; final RevTag t = (RevTag) o; if (!pw.willInclude(t) && pw.willInclude(t.getObject())) pw.addObject(t); } } pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut); } finally { pw.release(); } packOut.flush(); if (sideband) pckOut.end(); }

Target:
private void sendPack() throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; if (sideband) { int bufsz = SideBandOutputStream.SMALL_BUF; if (options.contains(OPTION_SIDE_BAND_64K)) bufsz = SideBandOutputStream.MAX_BUF; packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!options.contains(OPTION_NO_PROGRESS)) pm = new SideBandProgressMonitor(new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut)); } PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); final PackWriter pw = new PackWriter(cfg, walk.getObjectReader()); try { pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA)); pw.setThin(options.contains(OPTION_THIN_PACK)); if(depth > 0) { pw.preparePack(pm, wantAll, commonBase, unshallowCommits, depth); } else { pw.preparePack(pm, wantAll, commonBase); } if (options.contains(OPTION_INCLUDE_TAG)) { for (final Ref r : refs.values()) { final RevObject o; try { o = walk.parseAny(r.getObjectId()); } catch (IOException e) { continue; } if (o.has(WANT) || !(o instanceof RevTag)) continue; final RevTag t = (RevTag) o; if (!pw.willInclude(t) && pw.willInclude(t.getObject())) pw.addObject(t); } } pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut); } finally { pw.release(); } packOut.flush(); if (sideband) pckOut.end(); }
Source:
public Status read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) { try { Boolean returnFields = false; String[] fieldList = null; if (fields != null) { returnFields = true; fieldList = fields.toArray(new String[fields.size()]); } SolrQuery query = new SolrQuery(); query.setQuery("id:" + key); if (returnFields) { query.setFields(fieldList); } final QueryResponse response = (cloudMode) ? cloudClient.query(table, query) : httpClient.query(table, query); if ((response.getResults() != null) && (response.getResults().getNumFound() > 0)) { for (String field : response.getResults().get(0).getFieldNames()) { result.put(field, new StringByteIterator( String.valueOf(response.getResults().get(0).getFirstValue(field)))); } return Status.OK; } return Status.NOT_FOUND; } catch (Exception e) { e.printStackTrace(); } return Status.ERROR; }

Target:
public Status read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) { try { Boolean returnFields = false; String[] fieldList = null; if (fields != null) { returnFields = true; fieldList = fields.toArray(new String[fields.size()]); } SolrQuery query = new SolrQuery(); query.setQuery("id:" + key); if (returnFields) { query.setFields(fieldList); } final QueryResponse response = client.query(table, query); SolrDocumentList results = response.getResults(); if ((results != null) && (results.getNumFound() > 0)) { for (String field : results.get(0).getFieldNames()) { result.put(field, new StringByteIterator(String.valueOf(results.get(0).getFirstValue(field)))); } } return checkStatus(response.getStatus()); } catch (IOException | SolrServerException e) { e.printStackTrace(); } return Status.ERROR; }
Source:
public void testSetscopedInstance_withAppBindings_andExternalExports() throws InterruptedException { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); Map<String,String> externalExports = new HashMap<> (); externalExports.put( "Lamp", "Toto" ); Map<String,Set<String>> applicationBindings = new HashMap<> (); applicationBindings.put( "Tpl1", new HashSet<>( Arrays.asList( "app1", "app3" ))); applicationBindings.put( "Tpl2", new HashSet<>( Arrays.asList( "app2" ))); Map<String,byte[]> scriptResources = new HashMap<> (); Message msg = new MsgCmdSetScopedInstance( app.getMySqlVm(), externalExports, applicationBindings, scriptResources ); Assert.assertNull( processor.scopedInstance ); Assert.assertEquals( 0, processor.applicationBindings.size()); processor.processMessage( msg ); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( 2, processor.applicationBindings.size()); Assert.assertEquals( new HashSet<>( Arrays.asList( "app2" )), processor.applicationBindings.get( "Tpl2" )); Assert.assertEquals( new HashSet<>( Arrays.asList( "app1", "app3" )), processor.applicationBindings.get( "Tpl1" )); }

Target:
public void testSetscopedInstance_withAppBindings_andExternalExports() { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); Map<String,String> externalExports = new HashMap<> (); externalExports.put( "Lamp", "Toto" ); Map<String,Set<String>> applicationBindings = new HashMap<> (); applicationBindings.put( "Tpl1", new HashSet<>( Arrays.asList( "app1", "app3" ))); applicationBindings.put( "Tpl2", new HashSet<>( Arrays.asList( "app2" ))); Map<String,byte[]> scriptResources = new HashMap<> (); Message msg = new MsgCmdSetScopedInstance( app.getMySqlVm(), externalExports, applicationBindings, scriptResources ); Assert.assertNull( processor.scopedInstance ); Assert.assertEquals( 0, processor.applicationBindings.size()); processor.processMessage( msg ); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( 2, processor.applicationBindings.size()); Assert.assertEquals( new HashSet<>( Arrays.asList( "app2" )), processor.applicationBindings.get( "Tpl2" )); Assert.assertEquals( new HashSet<>( Arrays.asList( "app1", "app3" )), processor.applicationBindings.get( "Tpl1" )); }
Source:
public URI createAdminUnit(URI path, Model model) { model = populateModelTypes(path, model, Arrays.asList(Cdr.AdminUnit, PcdmModels.Object)); return createContentContainerObject(path, model); }

Target:
public URI createAdminUnit(URI path, Model model) { model = populateModelTypes(path, model, Arrays.asList(Cdr.AdminUnit, PcdmModels.Collection)); return createContentContainerObject(path, model); }
Source:
public Function<Sequence<Row>, Sequence<Row>> build( List<DimensionSpec> dimensions, List<AggregatorFactory> aggs, List<PostAggregator> postAggs ) { boolean sortingNeeded = false; if (dimensions.size() < columns.size()) { sortingNeeded = true; } final Set<String> aggAndPostAggNames = Sets.newHashSet(); for (AggregatorFactory agg : aggs) { aggAndPostAggNames.add(agg.getName()); } for (PostAggregator postAgg : postAggs) { aggAndPostAggNames.add(postAgg.getName()); } if (!sortingNeeded) { for (int i = 0; i < columns.size(); i++) { final OrderByColumnSpec columnSpec = columns.get(i); if (aggAndPostAggNames.contains(columnSpec.getDimension())) { sortingNeeded = true; break; } final ValueType columnType = getOrderByType(columnSpec, dimensions); final StringComparator naturalComparator; if (columnType == ValueType.STRING) { naturalComparator = StringComparators.LEXICOGRAPHIC; } else { naturalComparator = StringComparators.NUMERIC; } if (columnSpec.getDirection() != OrderByColumnSpec.Direction.ASCENDING || !columnSpec.getDimensionComparator().equals(naturalComparator) || !columnSpec.getDimension().equals(dimensions.get(i).getOutputName())) { sortingNeeded = true; break; } } } if (!sortingNeeded) { return limit == Integer.MAX_VALUE ? Functions.<Sequence<Row>>identity() : new LimitingFn(limit); } final Ordering<Row> ordering = makeComparator(dimensions, aggs, postAggs); if (limit == Integer.MAX_VALUE) { return new SortingFn(ordering); } else { return new TopNFunction(ordering, limit); } }

Target:
public Function<Sequence<Row>, Sequence<Row>> build( List<DimensionSpec> dimensions, List<AggregatorFactory> aggs, List<PostAggregator> postAggs ) { boolean sortingNeeded = false; if (dimensions.size() < columns.size()) { sortingNeeded = true; } final Set<String> aggAndPostAggNames = Sets.newHashSet(); for (AggregatorFactory agg : aggs) { aggAndPostAggNames.add(agg.getName()); } for (PostAggregator postAgg : postAggs) { aggAndPostAggNames.add(postAgg.getName()); } if (!sortingNeeded) { for (int i = 0; i < columns.size(); i++) { final OrderByColumnSpec columnSpec = columns.get(i); if (aggAndPostAggNames.contains(columnSpec.getDimension())) { sortingNeeded = true; break; } final ValueType columnType = getOrderByType(columnSpec, dimensions); final StringComparator naturalComparator; if (columnType == ValueType.STRING) { naturalComparator = StringComparators.LEXICOGRAPHIC; } else if (columnType == ValueType.LONG || columnType == ValueType.FLOAT) { naturalComparator = StringComparators.NUMERIC; } else { sortingNeeded = true; break; } if (columnSpec.getDirection() != OrderByColumnSpec.Direction.ASCENDING || !columnSpec.getDimensionComparator().equals(naturalComparator) || !columnSpec.getDimension().equals(dimensions.get(i).getOutputName())) { sortingNeeded = true; break; } } } if (!sortingNeeded) { return limit == Integer.MAX_VALUE ? Functions.<Sequence<Row>>identity() : new LimitingFn(limit); } final Ordering<Row> ordering = makeComparator(dimensions, aggs, postAggs); if (limit == Integer.MAX_VALUE) { return new SortingFn(ordering); } else { return new TopNFunction(ordering, limit); } }
Source:
protected void onCreate(Bundle savedInstanceState) { QuranApplication quranApp = (QuranApplication) getApplication(); quranApp.getApplicationComponent().inject(this); quranApp.refreshLocale(this, false); super.onCreate(savedInstanceState); final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setTitle(R.string.audio_manager); ab.setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_surah_audio_manager); Intent intent = getIntent(); sheikhPosition = intent.getIntExtra("Sheikh", -1); recyclerView = findViewById(R.id.recycler_view); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setItemAnimator(new DefaultItemAnimator()); progressBar = findViewById(R.id.progress); qariItems = audioUtils.getQariList(this); basePath = quranFileUtils.getQuranAudioDirectory(this); surahAdapter = new SurahAdapter(qariItems); recyclerView.setAdapter(surahAdapter); getShuyookhData(); }

Target:
protected void onCreate(Bundle savedInstanceState) { QuranApplication quranApp = (QuranApplication) getApplication(); quranApp.getApplicationComponent().inject(this); quranApp.refreshLocale(this, false); super.onCreate(savedInstanceState); final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setTitle(R.string.audio_manager); ab.setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_surah_audio_manager); Intent intent = getIntent(); sheikhPosition = intent.getIntExtra(EXTRA_SHEIKH_POSITION, -1); recyclerView = findViewById(R.id.recycler_view); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setItemAnimator(new DefaultItemAnimator()); progressBar = findViewById(R.id.progress); qariItems = audioUtils.getQariList(this); basePath = quranFileUtils.getQuranAudioDirectory(this); surahAdapter = new SurahAdapter(qariItems, this); recyclerView.setAdapter(surahAdapter); getShuyookhData(); }