auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() throws Exception { List<String> argsList = (List <String>)args.get("__other__"); String action = argsList.remove(0); <START> if(!actions.containsKey(action)) { <END> throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } actions.get(action).run(); }</code><technical_language>get action check if null, reason get</technical_language>

Target:
public void run() throws Exception { List<String> argsList = (List <String>)args.get("__other__"); Runnable action = actions.get(argsList.remove(0)); if(action == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } action.run(); }
Source:
<code>public Result doWork() { final boolean[] result = new boolean[1]; <START> String allergyUuid = getInputData().getString("allergy_uuid"); String patientUuid = getInputData().getString("patient_uuid"); <END> deleteAllergy(restApi, allergyUuid, patientUuid, new CustomApiCallback() { @Override public void onSuccess() { result[0] = true; } @Override public void onFailure() { result[0] = false; } }); if (result[0]) { return Result.success(); } else { return Result.retry(); } }</code><technical_language>key Application Constants</technical_language>

Target:
public Result doWork() { final boolean[] result = new boolean[1]; String allergyUuid = getInputData().getString(ALLERGY_UUID); String patientUuid = getInputData().getString(PATIENT_UUID); deleteAllergy(restApi, allergyUuid, patientUuid, new CustomApiCallback() { @Override public void onSuccess() { result[0] = true; } @Override public void onFailure() { result[0] = false; } }); if (result[0]) { return Result.success(); } else { return Result.retry(); } }
Source:
<code>public void visitToken(DetailAST ast) { final boolean isCommentEndOfLine = ast.getType() == TokenTypes.SINGLE_LINE_COMMENT || isBlockCommentEndOfLine(ast); final boolean isCommentOnOneLine = ast.getType() == TokenTypes.SINGLE_LINE_COMMENT || isBlockCommentOnOneLine(ast); final String commentContent = ast.getFirstChild().getText(); final boolean isCommentLegal = !isCommentEndOfLine <START> || isCommentOnOneLine && isCommentMatchLegalPattern(commentContent); <END> if (!isCommentLegal && !isBeforeCommentLegal(ast)) { log(ast, MSG_KEY); } }</code><technical_language>Boolean expressions a bit complicated</technical_language>

Target:
public void visitToken(DetailAST ast) { final boolean isCommentEndOfLine = ast.getType() == TokenTypes.SINGLE_LINE_COMMENT || isBlockCommentEndOfLine(ast); final boolean isCommentOnOneLine = ast.getType() == TokenTypes.SINGLE_LINE_COMMENT || isBlockCommentOnOneLine(ast); final String commentContent = ast.getFirstChild().getText(); final boolean isSingleLineAndMatchLegalPattern = isCommentOnOneLine && isCommentMatchLegalPattern(commentContent); final boolean isCommentLegal = !isCommentEndOfLine || isSingleLineAndMatchLegalPattern; if (!isCommentLegal && !isBeforeCommentLegal(ast)) { log(ast, MSG_KEY); } }
Source:
<code>@Test public void classNameFromClass() { assertThat(ClassName.get(Object.class).toString()) .isEqualTo("java.lang.Object"); assertThat(ClassName.get(OuterClass.InnerClass.class).toString()) .isEqualTo("com.squareup.javapoet.ClassNameTest.OuterClass.InnerClass"); try { assertThat((ClassName.get(new Object() {}.getClass())).toString()) .isEqualTo("com.squareup.javapoet.ClassNameTest$1"); } catch (IllegalArgumentException e) { <START> fail(); <END> } }</code><technical_language>remove try/catch. exception fail test</technical_language>

Target:
@Test public void classNameFromClass() { assertThat(ClassName.get(Object.class).toString()) .isEqualTo("java.lang.Object"); assertThat(ClassName.get(OuterClass.InnerClass.class).toString()) .isEqualTo("com.squareup.javapoet.ClassNameTest.OuterClass.InnerClass"); assertThat((ClassName.get(new Object() {}.getClass())).toString()) .isEqualTo("com.squareup.javapoet.ClassNameTest$1"); }
Source:
<code>public void stop() throws TException { <START> workerPool.shutdownNow(); <END> try { shutdown.put(new Object()); } catch (InterruptedException ignored) { } }</code><technical_language>shutdownNow attempt halt in-process tasks. Consider awaitTermination a timeout instead. This give a chance for tasks currently processed complete</technical_language>

Target:
public void stop() throws TException { workerPool.shutdown(); try { if (!workerPool.awaitTermination(30, TimeUnit.SECONDS)) { workerPool.shutdownNow(); } } catch (InterruptedException e) { workerPool.shutdownNow(); Thread.currentThread().interrupt(); } try { shutdown.put(new Object()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
Source:
<code>public APIRequest(String name, String context, String visibility, String version, String resource, String tiersCollection, URL endpointUrl) { this.name = name; this.context = context; this.visibility = visibility; this.version = version; this.resource = resource; this.tiersCollection = tiersCollection; <START> try{ <END> this.endpoint = new JSONObject("{\"production_endpoints\":{\"url\":\"" + endpointUrl + "\",\"config\":null},\"endpoint_type\":\"" + "http" + "\"}"); }catch (JSONException e){} constructSwagger(); }</code><technical_language>Formatting issue</technical_language>

Target:
public APIRequest(String name, String context, String visibility, String version, String resource, String tiersCollection, URL endpointUrl) { this.name = name; this.context = context; this.visibility = visibility; this.version = version; this.resource = resource; this.tiersCollection = tiersCollection; try { this.endpoint = new JSONObject("{\"production_endpoints\":{\"url\":\"" + endpointUrl + "\",\"config\":null},\"endpoint_type\":\"" + "http" + "\"}"); } catch (JSONException e) { log.error("JSON construct error", e); } constructSwagger(); }
Source:
<code>public void commit() { if (!docs.isEmpty()) { QueryExpression combinedQuery; if (!queries.isEmpty()) { combinedQuery = Searches.combine(NaryLogicalOperator._or, queries); LOGGER.debug("Combined retrieval query:{}", combinedQuery); } else { combinedQuery = null; } List<ResultDocument> destResults = dest.getResultList(combinedQuery, ctx); int numSlots=0; for (DocAndQ parentDocAndQ : docs) { List<ChildSlot> slots=parentDocAndQ.doc.getSlots().get(aq.getReference()); if(slots!=null) numSlots+=slots.size(); } MemDocIndex docIndex=null; <START> if(aq.getQuery()!=null&&memoryIndexThreshold>=0&&numSlots>memoryIndexThreshold) { <END> KeySpec keySpec=aq.getIndexKeySpec(); LOGGER.debug("In-memory index key spec:{}",keySpec); if(keySpec!=null) { docIndex=new MemDocIndex(keySpec); for(ResultDocument child:destResults) { docIndex.add(child.getDoc()); } } } for (DocAndQ parentDocAndQ : docs) { associateDocs(parentDocAndQ.doc, destResults, aq,docIndex); } } docs = new ArrayList<>(); queries = new ArrayList<>(); }</code><technical_language>unnecessary >0 check</technical_language>

Target:
public void commit() { if (!docs.isEmpty()) { QueryExpression combinedQuery; if (!queries.isEmpty()) { combinedQuery = Searches.combine(NaryLogicalOperator._or, queries); LOGGER.debug("Combined retrieval query:{}", combinedQuery); } else { combinedQuery = null; } List<ResultDocument> destResults = dest.getResultList(combinedQuery, ctx); int numSlots=0; for (DocAndQ parentDocAndQ : docs) { List<ChildSlot> slots=parentDocAndQ.doc.getSlots().get(aq.getReference()); if(slots!=null) numSlots+=slots.size(); } MemDocIndex docIndex=null; if(aq.getQuery()!=null&&numSlots>memoryIndexThreshold) { KeySpec keySpec=aq.getIndexKeySpec(); LOGGER.debug("In-memory index key spec:{}",keySpec); if(keySpec!=null) { docIndex=new MemDocIndex(keySpec); for(ResultDocument child:destResults) { docIndex.add(child.getDoc()); } } } for (DocAndQ parentDocAndQ : docs) { associateDocs(parentDocAndQ.doc, destResults, aq,docIndex); } } docs = new ArrayList<>(); queries = new ArrayList<>(); }
Source:
<code>public ExtensionProxy activate(String extensionName) { ExtensionEntry entry = loadedEntries.get(extensionName); <START> if (entry != null && entry.enabled) { <END> entry.extension.getContext().put( TRACE_LOG_CONTEXT_KEY, LoggerFactory.getLogger( String.format( "%1$s.%2$s.%3$s", traceLog.getName(), entry.extension.getContext().get(Base.ContextKeys.EXTENSION_NAME), entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ) ) ); try { ExtMap output = entry.extension.invoke( new ExtMap().mput( Base.InvokeKeys.COMMAND, Base.InvokeCommands.INITIALIZE ) ); } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.name, ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error(ex.toString(), ex); } throw new RuntimeException(ex); } globalContext.<List<ExtMap>> get(Base.GlobalContextKeys.EXTENSIONS).add( new ExtMap().mput( Base.ExtensionRecord.INSTANCE_NAME, entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ).mput( Base.ExtensionRecord.PROVIDES, entry.extension.getContext().get(Base.ContextKeys.PROVIDES) ).mput( Base.ExtensionRecord.EXTENSION, entry.extension.getExtension() ).mput( Base.ExtensionRecord.CONTEXT, entry.extension.getContext() ) ); entry.activated = true; dumpConfig(entry.extension); setChanged(); notifyObservers(); } return entry != null ? entry.extension : null; }</code><technical_language>if raise exception? I syncrhonized? force single thread management</technical_language>

Target:
public ExtensionProxy activate(String extensionName) { ExtensionEntry entry = loadedEntries.get(extensionName); if (entry == null) { throw new RuntimeException(String.format("No extensioned with instance name %1$s could be found", extensionName)); } if (entry.enabled) { entry.extension.getContext().put( TRACE_LOG_CONTEXT_KEY, LogFactory.getLog( String.format( "%1$s.%2$s.%3$s", getTraceLog(), entry.extension.getContext().get(Base.ContextKeys.EXTENSION_NAME), entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ) ) ); try { ExtMap output = entry.extension.invoke( new ExtMap().mput( Base.InvokeKeys.COMMAND, Base.InvokeCommands.INITIALIZE ) ); } catch (Exception ex) { log.log(Level.SEVERE, String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.name, ex.getMessage() ) ); if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, ex.toString(), ex); } throw new RuntimeException(ex); } synchronized (globalContext) { globalContext.<List<ExtMap>> get(Base.GlobalContextKeys.EXTENSIONS).add( new ExtMap().mput( Base.ExtensionRecord.INSTANCE_NAME, entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ).mput( Base.ExtensionRecord.PROVIDES, entry.extension.getContext().get(Base.ContextKeys.PROVIDES) ).mput( Base.ExtensionRecord.EXTENSION, entry.extension.getExtension() ).mput( Base.ExtensionRecord.CONTEXT, entry.extension.getContext() ) ); } entry.activated = true; dumpConfig(entry.extension); setChanged(); notifyObservers(); } return entry != null ? entry.extension : null; }
Source:
<code>public ModuleClassLoader getModuleClassLoader() { ModuleClassLoader result = null; synchronized (classLoaderMonitor) { result = classloader; if (result != null) { return result; } } final List<ClassLoaderHook> hooks = container.getConfiguration().getHookRegistry().getClassLoaderHooks(); final Generation generation = (Generation) wiring.getRevision().getRevisionInfo(); if (System.getSecurityManager() == null) { result = createClassLoaderPrivledged(parent, generation.getBundleInfo().getStorage().getConfiguration(), this, generation, hooks); } else { final ClassLoader cl = parent; result = AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() { @Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } }); } synchronized <START> (classLoaderMonitor) { <END> if (classloader == null) { classloader = result; for (ClassLoaderHook hook : hooks) { hook.classLoaderCreated(result); } } else { result = classloader; if (debug.DEBUG_LOADER) { Debug.println("BundleLoader[" + this + "].getModuleClassLoader() - created duplicate classloader"); } } } return result; }</code><technical_language>this code reintroduce bug 496034? Some synchronization is inevitable if goal is preserve implicit contract of ClassLoaderHook classLoaderCreated method is called other method class loader. achieve this goal sufficient synchronize class loader itself: synchronized (result) { if (classloader.compareAndSet(null, result)) { ... } else { result = classloader.get(); synchronize (result) { // Empty synchronized block // hook.classLoaderCreated(result) calls // complete proceeding. } .. } }</technical_language>

Target:
public ModuleClassLoader getModuleClassLoader() { ModuleClassLoader result = classloader; if (result != null) { return result; } final List<ClassLoaderHook> hooks = container.getConfiguration().getHookRegistry().getClassLoaderHooks(); final Generation generation = (Generation) wiring.getRevision().getRevisionInfo(); if (System.getSecurityManager() == null) { result = createClassLoaderPrivledged(parent, generation.getBundleInfo().getStorage().getConfiguration(), this, generation, hooks); } else { final ClassLoader cl = parent; result = AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() { @Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } }); } synchronized (classLoaderCreatedMonitor) { if (classLoaderCreated == null) { classLoaderCreated = result; for (ClassLoaderHook hook : hooks) { hook.classLoaderCreated(result); } classloader = classLoaderCreated; } else { result = classLoaderCreated; if (debug.DEBUG_LOADER) { Debug.println("BundleLoader[" + this + "].getModuleClassLoader() - created duplicate classloader"); } } } return result; }
Source:
<code>public DebugQuickAccessProvider() { <START> super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode("debug")); <END> }</code><technical_language>org.eclipse.debug.core.ILaunchManager.DEBUG_MODE</technical_language>

Target:
public DebugQuickAccessProvider() { super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode(ILaunchManager.DEBUG_MODE)); }
Source:
<code>public static DiscreteRandomProducer uniform(int numberOfValues, long seed) { <START> return new DiscreteRandomProducer(seed, IntStream.range(0, numberOfValues) <END> .mapToDouble(x -> 1.0 / numberOfValues) .toArray()); }</code><technical_language>Arrays.fill(...) in this case</technical_language>

Target:
public static DiscreteRandomProducer uniform(int numberOfValues, long seed) { double[] probs = new double[numberOfValues]; Arrays.fill(probs, 1.0 / numberOfValues); return new DiscreteRandomProducer(seed, probs); }
Source:
<code>protected void startRequest(@NonNull final String uri) { checkNotNull(uri); Log.v(TAG, "startRequest(" + uri + ")"); try { updateNetworkRequestStatus.accept(NetworkRequestStatus.ongoing(uri)); } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>printStackTrace instead of Log.e</technical_language>

Target:
protected void startRequest(@NonNull final String uri) { checkNotNull(uri); Log.v(TAG, "startRequest(" + uri + ")"); try { updateNetworkRequestStatus.accept(NetworkRequestStatus.ongoing(uri)); } catch (Exception e) { Log.e(TAG, e.getMessage()); } }
Source:
<code>public void testOperators() throws Exception { assertEquals( Operator.EQUALS, Operator.resolve( "==" ) ); assertEquals( Operator.GREATER_THAN, Operator.resolve( ">" ) ); assertEquals( Operator.LESS_THAN, Operator.resolve( "<" ) ); assertEquals( Operator.GREATER_THAN_OR_EQUALS, Operator.resolve( ">=" ) ); assertEquals( Operator.LESS_THAN_OR_EQUALS, Operator.resolve( "<=" ) ); assertEquals( Operator.NOT_EQUALS, Operator.resolve( "!=" ) ); assertEquals( Operator.IN, Operator.resolve( "in" ) ); <START> assertEquals( Operator.NOT_IN, Operator.resolve( "not in" ) ); <END> assertEquals( Operator.AFTER, Operator.resolve( "after" ) ); assertEquals( Operator.BEFORE, Operator.resolve( "before" ) ); assertEquals( Operator.COINCIDES, Operator.resolve( "coincides" ) ); assertEquals( Operator.MATCHES, Operator.resolve( "matches" ) ); assertEquals( Operator.SOUNDSLIKE, Operator.resolve( "soundslike" ) ); }</code><technical_language>a bunch more CEP operators 3 :(</technical_language>

Target:
public void testOperators() throws Exception { assertEquals( Operator.EQUALS, Operator.resolve( "==" ) ); assertEquals( Operator.GREATER_THAN, Operator.resolve( ">" ) ); assertEquals( Operator.LESS_THAN, Operator.resolve( "<" ) ); assertEquals( Operator.GREATER_OR_EQUAL, Operator.resolve( ">=" ) ); assertEquals( Operator.LESS_OR_EQUAL, Operator.resolve( "<=" ) ); assertEquals( Operator.NOT_EQUALS, Operator.resolve( "!=" ) ); assertEquals( Operator.IN, Operator.resolve( "in" ) ); assertEquals( Operator.NOT_IN, Operator.resolve( "not in" ) ); assertEquals( Operator.AFTER, Operator.resolve( "after" ) ); assertEquals( Operator.BEFORE, Operator.resolve( "before" ) ); assertEquals( Operator.COINCIDES, Operator.resolve( "coincides" ) ); assertEquals( Operator.MATCHES, Operator.resolve( "matches" ) ); assertEquals( Operator.SOUNDSLIKE, Operator.resolve( "soundslike" ) ); }
Source:
<code>ProjectHierarchyIterator(ProjectCache c, AllProjectsName all, ProjectState firstResult) { cache = c; allProjectsName = all; seen = Sets.newLinkedHashSet(); seen.add(firstResult.getProject().getParent()); <START> next = firstResult; <END> }</code><technical_language>Is this correct? parent of firstResult is marked seen, if start firstResult iteration stop parent seen</technical_language>

Target:
ProjectHierarchyIterator(ProjectCache c, AllProjectsName all, ProjectState firstResult) { cache = c; allProjectsName = all; seen = Sets.newLinkedHashSet(); seen.add(firstResult.getProject().getNameKey()); next = firstResult; }
Source:
<code><START> public Element getViewElement(String xmlTag) { <END> String id = fId; if (id == null) { return null; } Element viewElement = XmlUtils.getElementInFile(fFilePath, xmlTag, id); return viewElement; }</code><technical_language>for back-pedalling back-and-forth this... turns out auto-complete formats this way: public @Nullable Element getViewElement(...) which, tbh, I prefer putting line above. emphasizes fact Element is @Nullable (not method itself, @Override does). matches do for fields already. do think? update existing code if need touch it, for new code, this</technical_language>

Target:
public @Nullable Element getViewElement(String xmlTag) { String id = fId; if (id == null) { return null; } Element viewElement = XmlUtils.getElementInFile(fFilePath, xmlTag, id); return viewElement; }
Source:
<code>static private void checkAccessPermission(Class<?> declaringClass, final int modifiers, boolean isAccessible) { <START> final SecurityManager securityManager = System.getSecurityManager(); <END> if (isAccessible && securityManager != null) { if ((modifiers & Modifier.PRIVATE) != 0 || ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && packageCanNotBeAddedAnotherClass(declaringClass)) && !GroovyObject.class.isAssignableFrom(declaringClass)) { securityManager.checkPermission(REFLECT_PERMISSION); } else if ((modifiers & (Modifier.PROTECTED)) != 0 && declaringClass.equals(ClassLoader.class)){ securityManager.checkCreateClassLoader(); } } }</code><technical_language>good exit early if securityManager == null, wont check below. Also, good change order private static void ...</technical_language>

Target:
private static void checkAccessPermission(Class<?> declaringClass, final int modifiers, boolean isAccessible) { final SecurityManager securityManager = System.getSecurityManager(); if (securityManager != null && isAccessible) { if (((modifiers & Modifier.PRIVATE) != 0 || ((modifiers & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && packageCanNotBeAddedAnotherClass(declaringClass))) && !GroovyObject.class.isAssignableFrom(declaringClass)) { securityManager.checkPermission(REFLECT_PERMISSION); } else if ((modifiers & (Modifier.PROTECTED)) != 0 && declaringClass.equals(ClassLoader.class)){ securityManager.checkCreateClassLoader(); } } }
Source:
<code>public SessionId assertAuthenticatedSessionCorrespondsToNewRequest(SessionId session, String acrValuesStr) throws AcrChangedException { if (session != null && !session.getSessionAttributes().isEmpty() && session.getState() == SessionIdState.AUTHENTICATED) { final Map<String, String> sessionAttributes = session.getSessionAttributes(); String sessionAcr = getAcr(session); if (StringUtils.isBlank(sessionAcr)) { log.error("Failed to fetch acr from session, attributes: " + sessionAttributes); return session; } List<String> acrValuesList = acrValuesList(acrValuesStr); boolean isAcrChanged = !acrValuesList.isEmpty() && !acrValuesList.contains(sessionAcr); if (isAcrChanged) { Map<String, Integer> acrToLevel = externalAuthenticationService.acrToLevelMapping(); Integer sessionAcrLevel = acrToLevel.get(sessionAcr); for (String acrValue : acrValuesList) { Integer currentAcrLevel = acrToLevel.get(acrValue); log.info("Acr is changed. Session acr: " + sessionAcr + "(level: " + sessionAcrLevel + "), " + "current acr: " + acrValue + "(level: " + currentAcrLevel + ")"); if (currentAcrLevel == null) { AcrChangedException ex=new AcrChangedException(); ex.setMethodEnabled(false); <START> throw ex; <END> } if (sessionAcrLevel < currentAcrLevel) { throw new AcrChangedException(); } } return session; } reinitLogin(session, false); } return session; }</code><technical_language>code formatting</technical_language>

Target:
public SessionId assertAuthenticatedSessionCorrespondsToNewRequest(SessionId session, String acrValuesStr) throws AcrChangedException { if (session != null && !session.getSessionAttributes().isEmpty() && session.getState() == SessionIdState.AUTHENTICATED) { final Map<String, String> sessionAttributes = session.getSessionAttributes(); String sessionAcr = getAcr(session); if (StringUtils.isBlank(sessionAcr)) { log.error("Failed to fetch acr from session, attributes: " + sessionAttributes); return session; } List<String> acrValuesList = acrValuesList(acrValuesStr); boolean isAcrChanged = !acrValuesList.isEmpty() && !acrValuesList.contains(sessionAcr); if (isAcrChanged) { Map<String, Integer> acrToLevel = externalAuthenticationService.acrToLevelMapping(); Integer sessionAcrLevel = acrToLevel.get(sessionAcr); for (String acrValue : acrValuesList) { Integer currentAcrLevel = acrToLevel.get(acrValue); log.info("Acr is changed. Session acr: " + sessionAcr + "(level: " + sessionAcrLevel + "), " + "current acr: " + acrValue + "(level: " + currentAcrLevel + ")"); if (currentAcrLevel == null) { throw new AcrChangedException(false); } if (sessionAcrLevel < currentAcrLevel) { throw new AcrChangedException(); } } return session; } reinitLogin(session, false); } return session; }
Source:
<code>public static Long fromHumanReadable(String v) { Matcher m = p.matcher(v); if (m.matches()) { MatchResult mr = m.toMatchResult(); long min = Long.parseLong(mr.group(1)); long sec = Long.parseLong(mr.group(2)); long par = 0; if (mr.group(4) != null) { String parPad = mr.group(4) + "000"; par = Long.parseLong(parPad.substring(0, 3)); } return Long.valueOf(((sec + (min * 60)) * 1000) + par); } try { <START> return Long.valueOf(Long.parseLong(v)); <END> } catch (Exception e) { return null; } }</code><technical_language>valueOf() a String argument. I of other instances removed due autoboxing</technical_language>

Target:
public static Long fromHumanReadable(String v) { Matcher m = p.matcher(v); if (m.matches()) { MatchResult mr = m.toMatchResult(); long min = Long.parseLong(mr.group(1)); long sec = Long.parseLong(mr.group(2)); long par = 0; if (mr.group(4) != null) { String parPad = mr.group(4) + "000"; par = Long.parseLong(parPad.substring(0, 3)); } return ((sec + (min * 60)) * 1000) + par; } try { return Long.parseLong(v); } catch (Exception e) { return null; } }
Source:
<code><START> public int getPriority() { <END> return 100000; }</code><technical_language>change 10000 (and MapperRenderingProcessor 9999). interval in docs of getPriority()</technical_language>

Target:
public int getPriority() { return 10000; }
Source:
<code>public void truncate(long newTruncationPoint) { if (newTruncationPoint < getFirstDrId()) return; final Iterator<Range<Long>> iter = m_map.asRanges().iterator(); <START> synchronized(m_map) { <END> while (iter.hasNext()) { final Range<Long> next = iter.next(); if (end(next) < newTruncationPoint) { iter.remove(); } else if (next.contains(newTruncationPoint)) { iter.remove(); m_map.add(range(newTruncationPoint, end(next))); return; } else { break; } } m_map.add(range(newTruncationPoint, newTruncationPoint)); } }</code><technical_language>Stylish nitpick, put space synchronized left parenthese</technical_language>

Target:
public void truncate(long newTruncationPoint) { if (newTruncationPoint < getFirstDrId()) return; final Iterator<Range<Long>> iter = m_map.asRanges().iterator(); while (iter.hasNext()) { final Range<Long> next = iter.next(); if (end(next) < newTruncationPoint) { iter.remove(); } else if (next.contains(newTruncationPoint)) { iter.remove(); m_map.add(range(newTruncationPoint, end(next))); return; } else { break; } } m_map.add(range(newTruncationPoint, newTruncationPoint)); }
Source:
<code>private Item getItemFromRegistry(String itemName) { Item item = null; try { if (itemRegistry != null) { item = itemRegistry.getItem(itemName); } } catch (ItemNotFoundException e1) { <START> logger.error("Unable to get item type for {}", itemName); <END> item = null; } return item; }</code><technical_language>method is "getItemFromRegistry", "getItemTypeFromRegistry". error message read "Unable get item for item name {}"</technical_language>

Target:
private Item getItemFromRegistry(String itemName) { Item item = null; try { if (itemRegistry != null) { item = itemRegistry.getItem(itemName); } } catch (ItemNotFoundException e1) { logger.error("Unable to get item from registry", itemName); } return item; }
Source:
<code>public Task<Void> insertIptablesRules(final List<String> iptablesRules, final String installCommands, final SshMachineLocation machine) { <START> return DynamicTasks.queue("insert rules", new Callable<Void>() { <END> public Void call() { insertIptablesRulesImp(iptablesRules, installCommands, machine); return null; } }); }</code><technical_language>API create a task attach streams it, making in log in UI. SshTasks.newSshExecTaskFactory a machine (as in this case), SshEffectorTasks.ssh wish retrieve machine current context. helpers give some additional goodies like: SshTasks.newSshExecTaskFactory(machine, installCommands) .requiringExitCodeZero() // checks exit code, throwing if 0, if a task fails subsequent task executed .summary(...) // short description in logging this give a TaskAdaptable DynamicTasks.queue. --- new Callable<Void>() consider new Runnable() if API supports it</technical_language>

Target:
private Task<Void> insertIptablesRules(final List<String> iptablesRules, final String installCommands, final SshMachineLocation machine) { return DynamicTasks.queue("insert rules", new Runnable() { public void run() { insertIptablesRulesImpl(iptablesRules, installCommands, machine); } }); }
Source:
<code>private boolean updateControllerState(NotificationContext changeContext, PauseSignal signal, boolean statusFlag) { if (signal != null) { if (!statusFlag) { statusFlag = true; logger.info(String.format("controller is now %s", (signal instanceof MaintenanceSignal) ? "in maintenance mode" : "paused")); } } else { if (statusFlag) { statusFlag = false; logger.info("controller is now resumed from paused state"); String uid = UUID.randomUUID().toString().substring(0, 8); ClusterEvent event = new ClusterEvent(_clusterName, ClusterEventType.Resume, String.format("%s_%s", uid, Pipeline.Type.DEFAULT.name())); <START> HelixManager manager = changeContext.getManager(); <END> Optional<String> leaderSession = manager.getSessionIdIfLead(); if (!leaderSession.isPresent()) { logger.warn("Cluster manager is not leader for {}. Event is discarded.", manager.getInstanceName(), manager.getClusterName(), event); return false; } event.addAttribute(AttributeName.EVENT_SESSION.name(), leaderSession.get()); event.addAttribute(AttributeName.changeContext.name(), changeContext); event.addAttribute(AttributeName.helixmanager.name(), manager); event.addAttribute(AttributeName.AsyncFIFOWorkerPool.name(), _asyncFIFOWorkerPool); enqueueEvent(_eventQueue, event); enqueueEvent(_taskEventQueue, event.clone(String.format("%s_%s", uid, Pipeline.Type.TASK.name()))); } } return statusFlag; }</code><technical_language>multiple places check this event session ID matches. In pushEventToQueue, in HandleEvent(), in ForceRebalance(). Do need validate this everywhere? combine in place</technical_language>

Target:
private boolean updateControllerState(NotificationContext changeContext, PauseSignal signal, boolean statusFlag) { if (signal != null) { if (!statusFlag) { statusFlag = true; logger.info(String.format("controller is now %s", (signal instanceof MaintenanceSignal) ? "in maintenance mode" : "paused")); } } else { if (statusFlag) { statusFlag = false; logger.info("controller is now resumed from paused state"); String uid = UUID.randomUUID().toString().substring(0, 8); ClusterEvent event = new ClusterEvent(_clusterName, ClusterEventType.Resume, String.format("%s_%s", uid, Pipeline.Type.DEFAULT.name())); event.addAttribute(AttributeName.EVENT_SESSION.name(), changeContext.getManager().getSessionIdIfLead()); event.addAttribute(AttributeName.changeContext.name(), changeContext); event.addAttribute(AttributeName.helixmanager.name(), changeContext.getManager()); event.addAttribute(AttributeName.AsyncFIFOWorkerPool.name(), _asyncFIFOWorkerPool); enqueueEvent(_eventQueue, event); enqueueEvent(_taskEventQueue, event.clone(String.format("%s_%s", uid, Pipeline.Type.TASK.name()))); } } return statusFlag; }
Source:
<code>public void replayKafkaContentChanges( @RequestParam("since") String dateTimeString, HttpServletResponse response ) { if (this.replayBootstrapWorker != null) { response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } DateTime since = DateTime.parse(dateTimeString); <START> this.replayBootstrapWorker = replayConsumerFactory.apply( <END> message -> { DateTime messageTime = message.getTimestamp().toDateTimeUTC(); if (messageTime.isBefore(since)) { log.debug( "Message from is before threshold {}, skipping", messageTime, since ); return; } ResourceRef updated = message.getUpdatedResource(); Content legacy; try { log.debug("Resolving content for at {}", updated.getId(), messageTime); legacy = legacyResolver.resolveIds( ImmutableList.of(updated.getId()) ).get().getResources().first().orNull(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } if (legacy == null) { return; } try { log.info( "Bootstrapping Asty content for at {}", updated.getId(), messageTime ); astyanaxStore.writeContent(legacy); } catch (WriteException e) { throw new RuntimeException(e); } } ); replayBootstrapWorker.startAsync().awaitRunning(); response.setStatus(HttpStatus.ACCEPTED.value()); }</code><technical_language>A bit of a naming thing. call workers classes process messages. actual service call listeners</technical_language>

Target:
public void replayKafkaContentChanges( @RequestParam("since") String dateTimeString, HttpServletResponse response ) { if (this.replayBootstrapListener != null) { response.setStatus(HttpStatus.BAD_REQUEST.value()); return; } DateTime since = DateTime.parse(dateTimeString); this.replayBootstrapListener = replayConsumerFactory.apply( message -> { DateTime messageTime = message.getTimestamp().toDateTimeUTC(); if (messageTime.isBefore(since)) { log.debug( "Message from is before threshold {}, skipping", messageTime, since ); return; } ResourceRef updated = message.getUpdatedResource(); Content legacy; try { log.debug("Resolving content for at {}", updated.getId(), messageTime); legacy = legacyResolver.resolveIds( ImmutableList.of(updated.getId()) ).get().getResources().first().orNull(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } if (legacy == null) { return; } try { log.info( "Bootstrapping Asty content for at {}", updated.getId(), messageTime ); astyanaxStore.writeContent(legacy); } catch (WriteException e) { throw new RuntimeException(e); } } ); replayBootstrapListener.startAsync().awaitRunning(); response.setStatus(HttpStatus.ACCEPTED.value()); }
Source:
<code>public void clearExternalMusic() { synchronized (metadataMutex) { metadataList = getMyModifiableLibrary(); <START> metadataMap.clear(); <END> } new BroadcastIntent(ACTION_LIBRARY_UPDATED).send(this); }</code><technical_language>clear map...you need rebuild it. a updateLibrary for example</technical_language>

Target:
public void clearExternalMusic() { metadataList = getMyModifiableLibrary(); metadataMap.clear(); orderAlphabetically(); new BroadcastIntent(ACTION_LIBRARY_UPDATED).send(this); }
Source:
<code>public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_SMARTLOCK_HELPER_STATE, mSmartLockHelperState.name()); outState.putBoolean(KEY_SIGNUP_FROM_LOGIN_ENABLED, mIsSignupFromLoginEnabled); <START> outState.putBoolean(KEY_SIGNUP_FROM_LOGIN_ENABLED, mIsSignupFromLoginEnabled); <END> }</code><technical_language>This a copy/paste typo maybe</technical_language>

Target:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_SMARTLOCK_HELPER_STATE, mSmartLockHelperState.name()); outState.putBoolean(KEY_SIGNUP_FROM_LOGIN_ENABLED, mIsSignupFromLoginEnabled); }
Source:
<code>BufferAndBacklog pollBuffer() { synchronized (buffers) { if (isBlockedByCheckpoint) { return null; } Buffer buffer = null; if (buffers.isEmpty()) { flushRequested = false; } while (!buffers.isEmpty()) { BufferConsumerWithPartialRecordLength bufferConsumerWithPartialRecordLength = buffers.peek(); <START> BufferConsumer bufferConsumer = requireNonNull(bufferConsumerWithPartialRecordLength).getBufferConsumer(); <END> buffer = buildSliceBuffer(bufferConsumerWithPartialRecordLength); checkState(bufferConsumer.isFinished() || buffers.size() == 1, "When there are multiple buffers, an unfinished bufferConsumer can not be at the head of the buffers queue."); if (buffers.size() == 1) { flushRequested = false; } if (bufferConsumer.isFinished()) { requireNonNull(buffers.poll()).getBufferConsumer().close(); decreaseBuffersInBacklogUnsafe(bufferConsumer.isBuffer()); } if (buffer.readableBytes() > 0) { break; } buffer.recycleBuffer(); buffer = null; if (!bufferConsumer.isFinished()) { break; } } if (buffer == null) { return null; } if (buffer.getDataType().isBlockingUpstream()) { isBlockedByCheckpoint = true; } updateStatistics(buffer); return new BufferAndBacklog( buffer, getBuffersInBacklog(), isDataAvailableUnsafe() ? getNextBufferTypeUnsafe() : Buffer.DataType.NONE, sequenceNumber++); } }</code><technical_language>I is point in adding explicit requireNonNull dereferencing it</technical_language>

Target:
BufferAndBacklog pollBuffer() { synchronized (buffers) { if (isBlockedByCheckpoint) { return null; } Buffer buffer = null; if (buffers.isEmpty()) { flushRequested = false; } while (!buffers.isEmpty()) { BufferConsumerWithPartialRecordLength bufferConsumerWithPartialRecordLength = buffers.peek(); BufferConsumer bufferConsumer = bufferConsumerWithPartialRecordLength.getBufferConsumer(); buffer = buildSliceBuffer(bufferConsumerWithPartialRecordLength); checkState(bufferConsumer.isFinished() || buffers.size() == 1, "When there are multiple buffers, an unfinished bufferConsumer can not be at the head of the buffers queue."); if (buffers.size() == 1) { flushRequested = false; } if (bufferConsumer.isFinished()) { requireNonNull(buffers.poll()).getBufferConsumer().close(); decreaseBuffersInBacklogUnsafe(bufferConsumer.isBuffer()); } if (buffer.readableBytes() > 0) { break; } buffer.recycleBuffer(); buffer = null; if (!bufferConsumer.isFinished()) { break; } } if (buffer == null) { return null; } if (buffer.getDataType().isBlockingUpstream()) { isBlockedByCheckpoint = true; } updateStatistics(buffer); return new BufferAndBacklog( buffer, getBuffersInBacklog(), isDataAvailableUnsafe() ? getNextBufferTypeUnsafe() : Buffer.DataType.NONE, sequenceNumber++); } }
Source:
<code>private boolean setKeyMaterial(ReferenceCountedOpenSslEngine engine, String alias) throws SSLException { OpenSslKeyMaterial keyMaterial = null; try { keyMaterial = provider.chooseKeyMaterial(engine.alloc, alias); if (keyMaterial != null) { return engine.setKeyMaterial(keyMaterial); } <START> return true; <END> } catch (SSLException e) { throw e; } catch (Exception e) { throw new SSLException(e); } finally { if (keyMaterial != null) { keyMaterial.release(); } } }</code><technical_language>true if key material is null</technical_language>

Target:
private boolean setKeyMaterial(ReferenceCountedOpenSslEngine engine, String alias) throws SSLException { OpenSslKeyMaterial keyMaterial = null; try { keyMaterial = provider.chooseKeyMaterial(engine.alloc, alias); return keyMaterial == null || engine.setKeyMaterial(keyMaterial); } catch (SSLException e) { throw e; } catch (Exception e) { throw new SSLException(e); } finally { if (keyMaterial != null) { keyMaterial.release(); } } }
Source:
<code>protected Expression createProducerExpression() { final Class<?> type; switch (configuration.getOperation()) { case NONE: type = configuration.getEntityType(); break; case EXECUTE: type = Query.class; break; case FETCH: type = ResultQuery.class; break; default: type = null; } boolean isSQLQuery = !ObjectHelper.isEmpty(configuration.getQuery()); <START> if (type == null || isSQLQuery) { <END> return new Expression() { @Override public <T> T evaluate(Exchange exchange, Class<T> type) { return exchange.getMessage().getBody(type); }; }; } else { return new Expression() { public Object evaluate(Exchange exchange, Class asType) { Object answer = exchange.getIn().getBody(type); if (answer == null) { Object defaultValue = exchange.getIn().getBody(); if (defaultValue != null) { throw RuntimeCamelException.wrapRuntimeCamelException(new NoTypeConversionAvailableException(defaultValue, type)); } answer = exchange.getContext().getInjector().newInstance(type); } return answer; } }; } }</code><technical_language>for null checking ObjectHelper class</technical_language>

Target:
protected Expression createProducerExpression() { final Class<?> type; switch (configuration.getOperation()) { case NONE: type = configuration.getEntityType(); break; case EXECUTE: type = Query.class; break; case FETCH: type = ResultQuery.class; break; default: throw new UnsupportedOperationException("Operation: " + configuration.getOperation()); } return new Expression() { public Object evaluate(Exchange exchange, Class asType) { Object answer = exchange.getIn().getBody(type); if (answer == null) { Object defaultValue = exchange.getIn().getBody(); if (defaultValue != null) { throw RuntimeCamelException.wrapRuntimeCamelException(new NoTypeConversionAvailableException(defaultValue, type)); } answer = exchange.getContext().getInjector().newInstance(type); } return answer; } }; }
Source:
<code>private byte[] addToCache(final String sequenceName, final byte[] bases) { for (int i = 0; i < bases.length; i++) { <START> bases[i] = StringUtil.toUpperCase(bases[i]); <END> } cacheW.put(sequenceName, new WeakReference<byte[]>(bases)); return bases; }</code><technical_language>confine this change calculation of MD5 itself</technical_language>

Target:
private byte[] addToCache(final String sequenceName, final byte[] bases) { cacheW.put(sequenceName, new WeakReference<byte[]>(bases)); return bases; }
Source:
<code>public double parRate(PricingEnvironment env, SwapProduct product) { ExpandedSwap swap = product.expand(); List<ExpandedSwapLeg> legs = swap.getLegs(); ExpandedSwapLeg fixedLeg = null; int fixedLegIndex = 0; for (int i = 0; i < legs.size(); i++) { if (legs.get(i).getType() == SwapLegType.FIXED) { fixedLeg = legs.get(i); fixedLegIndex = i; break; } <START> } <END> ArgChecker.notNull(fixedLeg, "no fixed leg found"); @SuppressWarnings("null") Currency ccyFixedLeg = fixedLeg.getCurrency(); ToDoubleBiFunction<PricingEnvironment, PaymentEvent> eventFn = paymentEventPricer::presentValue; double otherLegsConvertedPv = 0.0; for (int i = 0; i < legs.size(); i++) { if (i != fixedLegIndex) { double pvLocal = legValue(env, legs.get(i), paymentPeriodPricer::presentValue, paymentEventPricer::presentValue); otherLegsConvertedPv += (pvLocal * env.fxRate(legs.get(i).getCurrency(), ccyFixedLeg)); } } double fixedLegEventsPv = fixedLeg.getPaymentEvents().stream() .filter(p -> !p.getPaymentDate().isBefore(env.getValuationDate())) .mapToDouble(e -> eventFn.applyAsDouble(env, e)) .sum(); double pvbpFixedLeg = pvbp(env, fixedLeg); return -(otherLegsConvertedPv + fixedLegEventsPv) / pvbpFixedLeg; }</code><technical_language>getLegs(SwapLegType) leg index, check for leg != fixedLeg</technical_language>

Target:
public double parRate(PricingEnvironment env, SwapProduct product) { ExpandedSwap swap = product.expand(); List<ExpandedSwapLeg> legs = swap.getLegs(); ExpandedSwapLeg fixedLeg = null; for(ExpandedSwapLeg leg: legs) { if (leg.getType() == SwapLegType.FIXED) { fixedLeg = leg; break; } } ArgChecker.notNull(fixedLeg, "no fixed leg found"); @SuppressWarnings("null") Currency ccyFixedLeg = fixedLeg.getCurrency(); double otherLegsConvertedPv = 0.0; for (ExpandedSwapLeg leg: legs) { if (leg != fixedLeg) { double pvLocal = legValue(env, leg, paymentPeriodPricer::presentValue, paymentEventPricer::presentValue); otherLegsConvertedPv += (pvLocal * env.fxRate(leg.getCurrency(), ccyFixedLeg)); } } double fixedLegEventsPv = fixedLeg.getPaymentEvents().stream() .filter(p -> !p.getPaymentDate().isBefore(env.getValuationDate())) .mapToDouble(e -> paymentEventPricer.presentValue(env, e)) .sum(); double pvbpFixedLeg = pvbp(env, fixedLeg); return -(otherLegsConvertedPv + fixedLegEventsPv) / pvbpFixedLeg; }
Source:
<code>public Response getAllRefunds(UriInfo uriInfo, Long accountId, Long pageNumber, Long displaySize) { List<Pair<String, Long>> queryParams = ImmutableList.of( Pair.of("page", pageNumber), Pair.of("display_size", displaySize)); return validateQueryParams(queryParams) .map(ResponseUtil::badRequestResponse) .orElseGet(() -> { <START> ChargeSearchParams searchParams = new ChargeSearchParams() <END> .withGatewayAccountId(accountId) .withDisplaySize(displaySize != null ? displaySize : 0) .withPage(pageNumber != null ? pageNumber : 1); return search(searchParams, uriInfo); }); }</code><technical_language>ChargeSearchParams is related charge anymore. rename simply SearchParams lines</technical_language>

Target:
public Response getAllRefunds(UriInfo uriInfo, Long accountId, Long pageNumber, Long displaySize) { List<Pair<String, Long>> queryParams = ImmutableList.of( Pair.of("page", pageNumber), Pair.of("display_size", displaySize)); refundSearchStrategy = new RefundSearchStrategy(refundDao); List<String> errors = validateQueryParams(queryParams); if (errors.isEmpty()) { SearchParams searchParams = new SearchParams() .withGatewayAccountId(accountId) .withDisplaySize(calculateDisplaySize(displaySize)) .withPage(pageNumber != null ? pageNumber : 1); return refundSearchStrategy.search(searchParams, uriInfo); } else { return badRequestResponse(errors); } }
Source:
<code>public Deallocator allocate(final PublisherPackSlice slice) { if (loadedSlices.contains(slice)) throw new IllegalStateException("Slice " + slice + " already allocated"); size.addAndGet(slice.getSize()); for (PublisherPackSlice s : loadedSlices) { if (size.get() <= capacity) break; try { s.store(); } catch (IOException e) { <START> e.printStackTrace(); <END> } } loadedSlices.add(slice); return new Deallocator() { public void deallocate() { if (!loadedSlices.remove(slice)) throw new IllegalStateException("Slice " + slice + " already deallocated"); size.addAndGet(-slice.getSize()); } }; }</code><technical_language>need handle this</technical_language>

Target:
public Deallocator allocate(final PublisherPackSlice slice) throws PublisherException { if (loadedSlices.contains(slice)) throw new IllegalStateException("Slice " + slice + " already allocated"); size.addAndGet(slice.getSize()); synchronized (this) { for (PublisherPackSlice s : loadedSlices) { if (size.get() <= capacity) break; try { s.store(); } catch (IOException e) { throw new PublisherException( "Error deallocating pack slice " + slice, e); } } } loadedSlices.add(slice); return new Deallocator() { public void deallocate() throws PublisherException { if (!loadedSlices.remove(slice)) throw new PublisherException("Slice " + slice + " already deallocated"); size.addAndGet(-slice.getSize()); } }; }
Source:
<code>public boolean match(Event value) { if (null == value) { return false; } if (null == expression || expression.isEmpty()) { return true; } <START> String[] expressions = expression.split(","); <END> for (int i = 0; i < expressions.length; i++) { if (!processExpression(expressions[i], value)) { return false; } } return true; }</code><technical_language>clear jdoc "expression" field a comma-separated list of individual expression items. Also, a comma separator is a bit dangerous of string manipulations/operations allowed here. I easily a problem occurring a comma shows in a string for a pattern</technical_language>

Target:
public boolean match(Event value) { if (null == value) { return false; } if (null == expression || expression.isEmpty()) { return true; } List<String> expressions = new ArrayList<>(); int j = 0; for (int i = 0; i < expression.length(); i++) { if (expression.charAt(i) == ',' && (i == 0 || (i > 0 && expression.charAt(i - 1) != '\\'))) { expressions.add(cleanComma.matcher(expression.substring(j, i).trim()).replaceAll(",")); j = i + 1; } } expressions.add(cleanComma.matcher(expression.substring(j).trim()).replaceAll(",")); for (String expression : expressions) { if (!processExpression(expression, value)) { return false; } } return true; }
Source:
<code>private boolean handleHttpProxyPreferenceChange(Preference preference, String newValue) { if (newValue.equals("")) { preference.setSummary(getString(R.string.do_not_use_proxy) + " " + getString(R.string.generic_example) + ": " + getString(R.string.http_proxy_address_example)); return true; <START> } else if (newValue.matches("^http://" + <END> "(((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))|" + "((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])))" + ":(\\d{1,5})$")) { preference.setSummary(getString(R.string.use_proxy) + " " + newValue); return true; } else { Toast.makeText(getActivity(), R.string.toast_invalid_http_proxy_address, Toast.LENGTH_SHORT) .show(); return false; } }</code><technical_language>Also, I https proxy a https scheme, need a separate field I suspect this work</technical_language>

Target:
private boolean handleHttpProxyPreferenceChange(Preference preference, String newValue) { if (newValue.equals("")) { preference.setSummary(getString(R.string.do_not_use_proxy) + " " + getString(R.string.generic_example) + ": " + getString(R.string.http_proxy_address_example)); return true; } else if (newValue.matches("^http://.*:\\d{1,5}$")) { preference.setSummary(getString(R.string.use_proxy) + " " + newValue); return true; } else { Toast.makeText(getActivity(), R.string.toast_invalid_http_proxy_address, Toast.LENGTH_SHORT) .show(); return false; } }
Source:
<code><START> public void initializeSSLSocketFactory() <END> throws Exception { try { SSLFactory sslFactory = new SSLFactory(sslConfig); SSLContext sslContext = sslFactory.getSSLContext(); this.sslSocketFactory = sslContext.getSocketFactory(); this.sslSocketFactoryInitializationCount.inc(); } catch (Exception e) { this.sslSocketFactoryInitializationErrorCount.inc(); logger.error("SSLSocketFactory Initialization Error ", e); throw e; } }</code><technical_language>is this public</technical_language>

Target:
private void initializeSSLSocketFactory() throws Exception { try { SSLFactory sslFactory = new SSLFactory(sslConfig); SSLContext sslContext = sslFactory.getSSLContext(); this.sslSocketFactory = sslContext.getSocketFactory(); this.sslSocketFactoryInitializationCount.inc(); } catch (Exception e) { this.sslSocketFactoryInitializationErrorCount.inc(); logger.error("SSLSocketFactory Initialization Error ", e); throw e; } }