auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void updateEntityMementos(Collection<EntityMemento> mementos) { for (EntityMemento memento : mementos) { entities.put(memento.getId(), memento); <START> if (memento.getParent()==null) { <END> applicationIds.add(memento.getId()); } } }</code><technical_language>This previously - check entity application. deliberately relaxing constraint for "top-level entities"? reason important is risk of orphaned entities (e.g. deserialising, parent entity persisted; some other race management-node-failure persisting multiple files)</technical_language>

Target:
public void updateEntityMementos(Collection<EntityMemento> mementos) { for (EntityMemento memento : mementos) { entities.put(memento.getId(), memento); if (memento.isTopLevelApp()) { applicationIds.add(memento.getId()); } } }
Source:
<code>public void actsOnResponseHeaders() throws Exception { new FtRemote( new TkFixed( HELLO_WORLD ) ).exec( new FtRemote.Script() { @Override public void exec(final URI home) throws IOException { MatcherAssert.assertThat( new RsPrint( new TkProxy( String.format( FORMAT, home.getHost(), home.getPort() ) ).act(new RqFake()) ).print(), Matchers.allOf( Matchers.containsString(HELLO_WORLD), Matchers.containsString( <START> HEADER <END> ) ) ); } } ); }</code><technical_language>@aschworer HEADER is here, inline remove static field</technical_language>

Target:
public void actsOnResponseHeaders() throws Exception { final String testString = "TestRH"; new FtRemote( new TkFixed(testString) ).exec( new FtRemote.Script() { @Override public void exec(final URI home) throws IOException { MatcherAssert.assertThat( new RsPrint( new TkProxy( proxy(home) ).act(new RqFake()) ).print(), Matchers.allOf( Matchers.containsString(testString), Matchers.containsString( "X-Takes-TkProxy:" ) ) ); } } ); }
Source:
<code>String replaceUriParams(String path, MuleEvent event) { ParameterMap uriParamMap = resolveParams(event, HttpParamType.URI_PARAM); for (String uriParamName : uriParamMap.keySet()) { List<String> uriParamValues = uriParamMap.getAll(uriParamName); String uriParamValue = uriParamValues.get(uriParamValues.size() - 1); if (uriParamValue == null) { throw new NullPointerException(format("Expression {%s} evaluated to null.", uriParamName)); } <START> String value = quoteReplacement(uriParamValue); <END> Pattern pattern = compile("\\{" + uriParamName + "}"); path = pattern.matcher(path).replaceAll(value); } return path; }</code><technical_language>this necessary</technical_language>

Target:
public String replaceUriParams(String path, MuleEvent event) { ParameterMap uriParamMap = resolveParams(event, HttpParamType.URI_PARAM); for (String uriParamName : uriParamMap.keySet()) { List<String> uriParamValues = uriParamMap.getAll(uriParamName); String uriParamValue = uriParamValues.get(uriParamValues.size() - 1); if (uriParamValue == null) { throw new NullPointerException(format("Expression {%s} evaluated to null.", uriParamName)); } path = path.replaceAll(format("\\{%s\\}", uriParamName), quoteReplacement(uriParamValue)); } return path; }
Source:
<code>public Vector<Object> findPatientsByIdentifier(String[] identifiers) { Vector<Object> patientList = new Vector<>(); for (String identifier : identifiers) { try { List<Patient> patients = Context.getPatientService().getPatients(identifier, false, 0, 1); if(patients.size() > 0){ patientList.add(new PatientListItem(patients.get(0))); } } catch (Exception e) { <START> log.error("Error while searching for patients", e); <END> return new Vector<>(); } } return patientList; }</code><technical_language>wanna continue loop add more patients, in case a fail</technical_language>

Target:
public Vector<Object> findPatientsByIdentifier(String[] identifiers) { Vector<Object> patientList = new Vector<>(); for (String identifier : identifiers) { List<PatientIdentifier> patientIdentifiers = Context.getPatientService().getPatientIdentifiers(identifier, null, null, null, true); if(patientIdentifiers.size() > 0){ patientList.add(new PatientListItem(patientIdentifiers.get(0).getPatient())); } } return patientList; }
Source:
<code>private File createTmpFile(String name, String contents) throws Exception { <START> File tmpFile = File.createTempFile(name, ".txt"); <END> tmpFile.deleteOnExit(); Files.append(contents, tmpFile, Charset.forName("UTF-8")); return tmpFile; }</code><technical_language>java @Rule public TemporaryFolder tmp = new TemporaryFolder();</technical_language>

Target:
private File createTmpFile(String name, String contents) throws Exception { File tmpFile = tmp.newFile(name); Files.append(contents, tmpFile, Charset.forName("UTF-8")); return tmpFile; }
Source:
<code>public LooseRef peel(ObjectIdRef newLeaf) { ObjectId peeledObjectId = newLeaf.getPeeledObjectId(); ObjectId objectId = getObjectId(); <START> assert objectId != null; <END> if (peeledObjectId != null) { return new LoosePeeledTag(snapShot, getName(), objectId, peeledObjectId); } else { return new LooseNonTag(snapShot, getName(), objectId); } }</code><technical_language>alternative phrase this ObjectIdRef.Unpeeled.getObjectId return non-null: @NonNull @Override public ObjectId getObjectId() { ObjectId id = super.getObjectId(); assert id != null; // checked in constructor return id; }</technical_language>

Target:
public LooseRef peel(ObjectIdRef newLeaf) { ObjectId peeledObjectId = newLeaf.getPeeledObjectId(); ObjectId objectId = getObjectId(); if (peeledObjectId != null) { return new LoosePeeledTag(snapShot, getName(), objectId, peeledObjectId); } else { return new LooseNonTag(snapShot, getName(), objectId); } }
Source:
<code>public static void main(String[] args) { if (args == null || args.length == 0) { usage(); <START> throw new IllegalStateException("No Arguments provided!"); <END> } if (args.length > 1 || DynamicConfigHelpers.isNullOrEmpty(args[0])) { usage(); throw new IllegalStateException("Expecting One non-empty argument only!"); } File file = new File(args[0]); String absoluteBasePath = DynamicConfigHelpers.formatFilePath(file.getAbsolutePath()); log.info("Absolute Path for Model Configs Directory: " + absoluteBasePath); if (!file.isDirectory()) { usage(); throw new IllegalStateException("Model Configs Directory doesn't exists"); } readVariableConfig(absoluteBasePath); if (readSecurityConfig(absoluteBasePath)) { validateRoleInSecurityConfig(elideSecurityConfig); } if (readTableConfig(absoluteBasePath)) { validateSqlInTableConfig(elideTableConfig); } log.info("Configs Validation Passed!"); }</code><technical_language>Please include java doc here</technical_language>

Target:
public static void main(String[] args) throws IOException, ParseException { Options options = prepareOptions(); CommandLine cli = new DefaultParser().parse(options, args); if (cli.hasOption("help")) { printHelp(options); return; } if (!cli.hasOption("configDir")) { printHelp(options); throw new MissingOptionException("Missing required option"); } String configDir = cli.getOptionValue("configDir"); File file = new File(configDir); String absoluteBasePath = file.getAbsolutePath(); log.info("Absolute Path for Model Configs Directory: " + absoluteBasePath); if (!file.isDirectory()) { throw new IllegalStateException("Model Configs Directory doesn't exists"); } DynamicConfigValidator dynamicConfigValidator = new DynamicConfigValidator(); dynamicConfigValidator.readAndValidateConfigs(absoluteBasePath); log.info("Configs Validation Passed!"); }
Source:
<code>public void readFromStream(final WritableColumn count, final WritableColumn result) throws DbException { DataInputStream dIn = pyWorker.getDataInputStream(); int c = 1; try { if (isMultiValued) { c = dIn.readInt(); count.appendInt(c); } else { if (count != null) { count.appendInt(1); } } for (int i = 0; i < c; i++) { int type = dIn.readInt(); if (type == MyriaConstants.PythonSpecialLengths.PYTHON_EXCEPTION.getVal()) { <START> int excepLength = dIn.readInt(); <END> byte[] excp = new byte[excepLength]; dIn.readFully(excp); throw new DbException(new String(excp, StandardCharsets.UTF_8)); } else { if (type == MyriaConstants.PythonType.DOUBLE.getVal()) { result.appendDouble(dIn.readDouble()); } else if (type == MyriaConstants.PythonType.FLOAT.getVal()) { result.appendFloat(dIn.readFloat()); } else if (type == MyriaConstants.PythonType.INT.getVal()) { result.appendInt(dIn.readInt()); } else if (type == MyriaConstants.PythonType.LONG.getVal()) { result.appendLong(dIn.readLong()); } else if (type == MyriaConstants.PythonType.BLOB.getVal()) { int l = dIn.readInt(); if (l > 0) { byte[] obj = new byte[l]; dIn.readFully(obj); result.appendBlob(ByteBuffer.wrap(obj)); } } else { throw new DbException("Type not supported by python"); } } } } catch (IOException e) { throw new DbException(e); } }</code><technical_language>A more consistency nice, excLen, exc</technical_language>

Target:
public void readFromStream(final WritableColumn count, final WritableColumn result) throws DbException { DataInputStream dIn = pyWorker.getDataInputStream(); int c = 1; try { if (isMultiValued) { c = dIn.readInt(); count.appendInt(c); } else { if (count != null) { count.appendInt(1); } } for (int i = 0; i < c; i++) { int type = dIn.readInt(); if (type == MyriaConstants.PythonSpecialLengths.PYTHON_EXCEPTION.getVal()) { int excLen = dIn.readInt(); byte[] excp = new byte[excLen]; dIn.readFully(excp); throw new DbException(new String(excp, StandardCharsets.UTF_8)); } else { if (type == MyriaConstants.PythonType.DOUBLE.getVal()) { result.appendDouble(dIn.readDouble()); } else if (type == MyriaConstants.PythonType.FLOAT.getVal()) { result.appendFloat(dIn.readFloat()); } else if (type == MyriaConstants.PythonType.INT.getVal()) { result.appendInt(dIn.readInt()); } else if (type == MyriaConstants.PythonType.LONG.getVal()) { result.appendLong(dIn.readLong()); } else if (type == MyriaConstants.PythonType.BLOB.getVal()) { int l = dIn.readInt(); if (l > 0) { byte[] obj = new byte[l]; dIn.readFully(obj); result.appendBlob(ByteBuffer.wrap(obj)); } } else { throw new DbException("Type not supported by python"); } } } } catch (IOException e) { throw new DbException(e); } }
Source:
<code>public void test_update_by_id_returning_id_with_outputname() throws Exception { execute("create table test (id int primary key, message string) clustered into 2 shards"); execute("insert into test values(1, 'msg');"); assertEquals(1, response.rowCount()); refresh(); execute("update test set message='msg' where id = 1 returning id as renamed"); assertThat((response.cols()[0]), is("renamed" )); <START> refresh(); <END> }</code><technical_language>suggestion</technical_language>

Target:
public void test_update_by_id_returning_id_with_outputname() throws Exception { execute("create table test (id int primary key, message string) clustered into 2 shards"); execute("insert into test values(1, 'msg');"); assertEquals(1, response.rowCount()); refresh(); execute("update test set message='msg' where id = 1 returning id as renamed"); assertThat((response.cols()[0]), is("renamed" )); assertThat(printedTable(response.rows()), is("1\n" )); }
Source:
<code><START> private List<VDS> createHosts() { <END> List<VDS> hosts = new LinkedList<>(); VDS vds = new VDS(); vds.setId(OTHER_HOST_ID_1); vds.setVdsGroupId(OTHER_CLUSTER_ID); vds.setStoragePoolId(OTHER_DATACENTER_ID); vds.setVdsGroupCompatibilityVersion(Version.v3_5); hosts.add(vds); vds = new VDS(); vds.setId(OTHER_HOST_ID_2); vds.setVdsGroupId(OTHER_CLUSTER_ID); vds.setStoragePoolId(FENCED_HOST_DATACENTER_ID); vds.setVdsGroupCompatibilityVersion(Version.v3_5); hosts.add(vds); return hosts; }</code><technical_language>I don's a reason for this method, please move content findProxyHost_ChooseByDCWhenNoClusterMatch()</technical_language>

Target:
private List<VDS> createHosts() { List<VDS> hosts = new LinkedList<>(); VDS vds = new VDS(); vds.setId(OTHER_HOST_ID_1); vds.setVdsGroupId(OTHER_CLUSTER_ID); vds.setStoragePoolId(OTHER_DATACENTER_ID); vds.setVdsGroupCompatibilityVersion(Version.v3_5); hosts.add(vds); vds = new VDS(); vds.setId(OTHER_HOST_ID_2); vds.setVdsGroupId(OTHER_CLUSTER_ID_2); vds.setStoragePoolId(FENCED_HOST_DATACENTER_ID); vds.setVdsGroupCompatibilityVersion(Version.v3_5); hosts.add(vds); return hosts; }
Source:
<code>public List<Object> toList() { List<Object> array = new ArrayList<>(); for (int i = 0; i < count(); i++) <START> array.add(getObject(i)); <END> return array; }</code><technical_language>toList() return JSON object. I understand getObject(i) return CBL Array() CBL Dictionary()</technical_language>

Target:
public List<Object> toList() { List<Object> array = new ArrayList<>(); for (int i = 0; i < count(); i++) { SharedKeys sk = rs.getQuery().getDatabase().getSharedKeys(); array.add(SharedKeys.valueToObject(fleeceValue(i), sk)); } return array; }
Source:
<code>public void dispatcherLogsWarningWhenAllThreadsArePotentiallyStuck() throws Throwable { @SuppressWarnings("unused") class DispatcherLogsWarning extends MultithreadedTestCase { public void threadDispatcher() throws InterruptedException { when(workflowInstances.pollNextWorkflowInstanceIds(anyInt())) <START> .thenAnswer(waitForTickAndAnswer(2, Collections.emptyList(), this)); <END> when(executorFactory.getPotentiallyStuckProcessors()).thenReturn(executor.getThreadCount()); dispatcher.run(); } public void threadShutdown() { waitForTick(1); dispatcher.shutdown(); } @Override public void finish() { verify(mockAppender, atLeast(1)).doAppend(loggingEventCaptor.capture()); for (ILoggingEvent event : loggingEventCaptor.getAllValues()) { if (event.getLevel().equals(Level.WARN) && event.getFormattedMessage() .equals("2 of 2 state processor threads are potentially stuck (processing longer than 60 seconds)")) { return; } } Assertions.fail("Expected warning was not logged"); } } runOnce(new DispatcherLogsWarning()); }</code><technical_language>static import</technical_language>

Target:
public void dispatcherLogsWarningWhenAllThreadsArePotentiallyStuck() throws Throwable { @SuppressWarnings("unused") class DispatcherLogsWarning extends MultithreadedTestCase { public void threadDispatcher() throws InterruptedException { when(workflowInstances.pollNextWorkflowInstanceIds(anyInt())) .thenAnswer(waitForTickAndAnswer(2, emptyList(), this)); when(executorFactory.getPotentiallyStuckProcessors()).thenReturn(executor.getThreadCount()); dispatcher.run(); } public void threadShutdown() { waitForTick(1); dispatcher.shutdown(); } @Override public void finish() { verify(mockAppender, atLeast(1)).doAppend(loggingEventCaptor.capture()); for (ILoggingEvent event : loggingEventCaptor.getAllValues()) { if (event.getLevel().equals(Level.WARN) && event.getFormattedMessage() .equals("2 of 2 state processor threads are potentially stuck (processing longer than 60 seconds)")) { return; } } Assertions.fail("Expected warning was not logged"); } } runOnce(new DispatcherLogsWarning()); }
Source:
<code>public void clickOnFirstEventButtonDetails() { <START> findFirst(".event").findFirst(".btn-see-event-info").click(); <END> }</code><technical_language>findFirst(".event .btn-see-event-info")</technical_language>

Target:
public void clickOnFirstEventButtonDetails() { findFirst(".event .btn-see-event-info").click(); }
Source:
<code>public CompletableFuture<Boolean> removeWithVersionAsync(K key, long version) { TransactionContext<K, V> txContext = getTransactionContext(); return txContext == null ? super.removeWithVersionAsync(key, version) : txContext.compute(key, entry -> removeEntryIfSameVersion(entry, version), <START> super::getWithMetadata); <END> }</code><technical_language>uncached method reference..</technical_language>

Target:
public CompletableFuture<Boolean> removeWithVersionAsync(K key, long version) { TransactionContext<K, V> txContext = getTransactionContext(); return txContext == null ? super.removeWithVersionAsync(key, version) : txContext.compute(key, entry -> removeEntryIfSameVersion(entry, version), remoteGet); }
Source:
<code>public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (JSONB_DISABLED) { return false; } ResteasyConfiguration context = ResteasyProviderFactory.getContextData(ResteasyConfiguration.class); if (context != null && Boolean.parseBoolean(context.getParameter("resteasy.jsonb.disable"))) { return false; } <START> if (context != null && Boolean.parseBoolean(context.getParameter("resteasy.jsonp.enable"))) <END> { return false; } if (annotations != null && hasJacksonJaxbAnnotation(annotations)) { return false; } Class<?> classType = getGenericClass(type, genericType); if (classType != null && isJaxbClass(classType) && isJaxbClass(classType)) { return false; } Annotation[] annos = this.getAllAnnotations(classType); if (hasJacksonJaxbAnnotation(annos)) { return false; } if (classType.getSuperclass() != Object.class) { Class<?> superClass = classType.getSuperclass(); while (superClass != null) { if (hasJacksonJaxbAnnotation(getAllAnnotations(superClass))) { return false; } superClass = superClass.getSuperclass(); } } return (isSupportedMediaType(mediaType)) && ((!isJaxbClass(type)) || (FindAnnotation.findJsonBindingAnnotations(annotations).length != 0)); }</code><technical_language>Boolean.parseBoolean(context.getParameter("resteasy.jsonp.enable") is twice, put property, similar JSONB_DISABLED</technical_language>

Target:
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { ResteasyConfiguration context = ResteasyProviderFactory.getContextData(ResteasyConfiguration.class); if (context != null && Boolean.parseBoolean(context.getParameter("resteasy.jsonb.disable"))) { return false; } if (JSONB_DISABLED) { return false; } if (context != null && Boolean.parseBoolean(context.getParameter("resteasy.jsonp.enable"))) { return false; } if (annotations != null && hasJacksonJaxbAnnotation(annotations)) { return false; } Class<?> classType = getGenericClass(type, genericType); if (classType != null && isJaxbClass(classType) && isJaxbClass(classType)) { return false; } Annotation[] annos = this.getAllAnnotations(classType); if (hasJacksonJaxbAnnotation(annos)) { return false; } if (classType.getSuperclass() != Object.class) { Class<?> superClass = classType.getSuperclass(); while (superClass != null) { if (hasJacksonJaxbAnnotation(getAllAnnotations(superClass))) { return false; } superClass = superClass.getSuperclass(); } } return (isSupportedMediaType(mediaType)) && ((!isJaxbClass(type)) || (FindAnnotation.findJsonBindingAnnotations(annotations).length != 0)); }
Source:
<code>private void parseFile(String filePath, String objectID) { <START> String[] pathParts = filePath.split("\\."); String fileType = pathParts[pathParts.length - 1]; <END> if (fileType.equals("xlsx") || fileType.equals("xls")) { getOpenedView().clearSelection(); parseExcelDocument(filePath, fileType, objectID); } else if (fileType.equals("docx") || fileType.equals("doc")) { getOpenedView().clearSelection(); parseWordDocument(filePath, fileType, objectID); } else { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Not an Excel or Word file."); } }</code><technical_language>is a method for file extension in File class</technical_language>

Target:
private void parseFile(String filePath, String objectID) { String fileType = Files.getFileExtension(filePath); if (fileType.equals(XLSX) || fileType.equals(XLS)) { getOpenedView().clearSelection(); parseExcelDocument(filePath, objectID); } else if (fileType.equals(DOCX)) { getOpenedView().clearSelection(); parseWordDocument(filePath, objectID); } else if (fileType.equals(DOC)) { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", ".doc file format not supported, use .docx"); } else { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Not an Excel or Word file."); } }
Source:
<code>public void Login_005_japaneseUserLogin() { SpecialUserLoginPageObject specialLogin = new SpecialUserLoginPageObject(driver); <START> specialLogin.loginAndVerify(credentials.userNameJapanese2, credentials.passwordJapanese2, "<LINK_0>"); <END> }</code><technical_language>do keeping "<LINK_0>" in class variable also</technical_language>

Target:
public void Login_005_japaneseUserLogin() { SpecialUserLoginPageObject specialLogin = new SpecialUserLoginPageObject(driver); specialLogin.loginAndVerify(credentials.userNameJapanese2, credentials.passwordJapanese2, wikiURL); }
Source:
<code>private RetryPolicy buildRetryPolicy() { RetryPolicy retryPolicy = new RetryPolicy().withMaxRetries(0); Properties userConfig = configurationGenerator.getUserConfig(); if ("true".equals((userConfig.getProperty(PARAM_RETRY_POLICY_ENABLED,"false")))) { int maxRetries = Integer.parseInt(userConfig.getProperty(PARAM_RETRY_POLICY_MAX_RETRIES, "20")); <START> int delay = Integer.parseInt(userConfig.getProperty(PARAM_RETRY_POLICY_DELAY_IN_MS, "5000")); <END> retryPolicy = retryPolicy.retryOn(ConfigurationException.class).withMaxRetries(maxRetries).withDelay(delay, TimeUnit.MILLISECONDS); } return retryPolicy; }</code><technical_language>"20" "5000" constants defined beginning of class too</technical_language>

Target:
protected RetryPolicy buildRetryPolicy() { RetryPolicy retryPolicy = new RetryPolicy().withMaxRetries(0); Properties userConfig = configurationGenerator.getUserConfig(); if (Boolean.parseBoolean((userConfig.getProperty(PARAM_RETRY_POLICY_ENABLED, "false")))) { int maxRetries = Integer.parseInt( userConfig.getProperty(PARAM_RETRY_POLICY_MAX_RETRIES, PARAM_RETRY_POLICY_DEFAULT_RETRIES)); int delay = Integer.parseInt( userConfig.getProperty(PARAM_RETRY_POLICY_DELAY_IN_MS, PARAM_POLICY_DEFAULT_DELAY_IN_MS)); retryPolicy = retryPolicy.retryOn(ConfigurationException.class).withMaxRetries(maxRetries).withDelay(delay, TimeUnit.MILLISECONDS); } return retryPolicy; }
Source:
<code>default T getValueOrThrow() { <START> return getValue().orElseThrow(() -> new NoSuchElementException()); <END> }</code><technical_language>able 0-argument variant of this method: <LINK_0></technical_language>

Target:
default T getValueOrThrow() { return getValue().orElseThrow(); }
Source:
<code><START> private void handleMidrowCode(byte cc1, byte cc2) { <END> boolean transparentOrUnderline = (cc2 & 0x1) != 0; int attribute = cc2 >> 1 & 0xF; if ((cc1 & 0x1) != 0) { captionStyles.put(getSpanStartIndex(), new BackgroundColorSpan(transparentOrUnderline ? COLOR_MAP[attribute] & TRANSPARENCY_MASK : COLOR_MAP[attribute])); } else { captionStyles.put(getSpanStartIndex(), new ForegroundColorSpan(COLOR_MAP[attribute])); if (transparentOrUnderline) { captionStyles.put(getSpanStartIndex(), new UnderlineSpan()); } } }</code><technical_language>Check implementation here: <LINK_0> Beware order of priorities</technical_language>

Target:
private void handleMidrowCode(byte cc1, byte cc2) { boolean transparentOrUnderline = (cc2 & 0x1) != 0; int attribute = cc2 >> 1 & 0xF; if ((cc1 & 0x1) == 0) { currentCue.setCharacterStyle(new BackgroundColorSpan(transparentOrUnderline ? COLOR_MAP[attribute] & TRANSPARENCY_MASK : COLOR_MAP[attribute])); } else { if (attribute < 7) { currentCue.setCharacterStyle(new ForegroundColorSpan(COLOR_MAP[attribute])); } else { currentCue.setCharacterStyle(new StyleSpan(STYLE_ITALIC)); } if (transparentOrUnderline) { currentCue.setCharacterStyle(new UnderlineSpan()); } } }
Source:
<code>public void startListening() { mData.getSnapshots().observeForever(mDataObserver); <START> mData.getLoadingState().observeForever(mStateObserver); <END> }</code><technical_language>This sense, observe(options.getOwner(), ...)</technical_language>

Target:
public void startListening() { mSnapshots.observeForever(mDataObserver); mLoadingState.observeForever(mStateObserver); }
Source:
<code>private static String getDefaultBrowser(Context context) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>")); PackageManager pm = context.getPackageManager(); <START> ResolveInfo resolveInfo = pm.resolveActivity(browserIntent,PackageManager.MATCH_DEFAULT_ONLY); <END> return resolveInfo.activityInfo.packageName; }</code><technical_language>is for this return null if matching Activity is found, e.g. if browsers install browsers set default (not if this happen). In case do a null check return null. put a space ,? Thanks</technical_language>

Target:
private static String getDefaultBrowser(Context context) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>")); PackageManager pm = context.getPackageManager(); ResolveInfo resolveInfo = pm.resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY); if (resolveInfo == null) { return null; } return resolveInfo.activityInfo.packageName; }
Source:
<code>public WheelchairFlagEncoder(PMap properties) { this((int) properties.getLong("speedBits", 4), <START> properties.getDouble("speedFactor", 1)); <END> this.properties = properties; this.setBlockFords(properties.getBool("block_fords", true)); }</code><technical_language>Sorry, is a bug in Foot HikeFlagEncoder: speed_bits speed_factor instead of camel case here</technical_language>

Target:
public WheelchairFlagEncoder(PMap properties) { this((int) properties.getLong("speed_bits", 4), properties.getDouble("speed_factor", 1)); this.setBlockFords(properties.getBool("block_fords", true)); }
Source:
<code>public void init() { super.init(); <START> getMutableEntityType().addEffector(EXECUTE_SCRIPT, new EffectorBody<String>() { <END> @Override public String call(ConfigBag parameters) { return executeScript((String)parameters.getStringKey("commands")); } }); Entities.checkRequiredUrl(this, getCassandraConfigTemplateUrl()); Entities.getRequiredUrlConfig(this, CASSANDRA_RACKDC_CONFIG_TEMPLATE_URL); }</code><technical_language>Is reason effector is added programmatically, defined interface</technical_language>

Target:
public void init() { super.init(); getMutableEntityType().addEffector(EXECUTE_SCRIPT, new EffectorBody<String>() { @Override public String call(ConfigBag parameters) { return executeScript((String)parameters.getStringKey("commands")); } }); Entities.checkRequiredUrl(this, getCassandraConfigTemplateUrl()); Entities.getRequiredUrlConfig(this, CASSANDRA_RACKDC_CONFIG_TEMPLATE_URL); connectEnrichers(); }
Source:
<code>protected Class<?> findClass(String name) throws ClassNotFoundException { InputStream resource = getResourceAsStream(name.replace('.', '/') + ".class"); if (resource == null) { throw new ClassNotFoundException(name); } try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); <START> while (true) { <END> int read = resource.read(); if (read == -1) { return defineClass(name, bout.toByteArray(), 0, bout.size()); } else { bout.write(read); } } } catch (IOException ex) { throw new ClassNotFoundException(name, ex); } finally { try { resource.close(); } catch (IOException ex) { } } }</code><technical_language>bout is closed (I matter findbugs that)</technical_language>

Target:
protected Class<?> findClass(String name) throws ClassNotFoundException { InputStream resource = getResourceAsStream(name.replace('.', '/') + ".class"); if (resource == null) { throw new ClassNotFoundException(name); } try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { while (true) { int read = resource.read(); if (read == -1) { return defineClass(name, bout.toByteArray(), 0, bout.size()); } else { bout.write(read); } } } finally { bout.close(); } } catch (IOException ex) { throw new ClassNotFoundException(name, ex); } finally { try { resource.close(); } catch (IOException ex) { } } }
Source:
<code>private RetrievableStateHandle<T> get(String pathInZooKeeper, boolean lock) throws Exception { checkNotNull(pathInZooKeeper, "Path in ZooKeeper"); final String path = normalizePath(pathInZooKeeper); if (lock) { try { client.create().withMode(CreateMode.EPHEMERAL).forPath(getLockPath(path)); } catch (KeeperException.NodeExistsException ignored) { } catch (KeeperException.NoNodeException ex) { throw new StateHandleStore.NotExistException(ex.getMessage()); } } <START> boolean success = false; <END> try { byte[] data = client.getData().forPath(path); RetrievableStateHandle<T> retrievableStateHandle = InstantiationUtil.deserializeObject( data, Thread.currentThread().getContextClassLoader()); success = true; return retrievableStateHandle; } catch (KeeperException.NoNodeException ex) { throw new StateHandleStore.NotExistException(ex.getMessage()); } catch (IOException | ClassNotFoundException e) { throw new IOException("Failed to deserialize state handle from ZooKeeper data from " + path + '.', e); } finally { if (!success && lock) { release(path); } } }</code><technical_language>a NoNodeException thrown creating a new zNode</technical_language>

Target:
private RetrievableStateHandle<T> get(String pathInZooKeeper, boolean lock) throws Exception { checkNotNull(pathInZooKeeper, "Path in ZooKeeper"); final String path = normalizePath(pathInZooKeeper); if (lock) { try { client.create().withMode(CreateMode.EPHEMERAL).forPath(getLockPath(path)); } catch (KeeperException.NodeExistsException ignored) { } catch (KeeperException.NoNodeException ex) { throw new NotExistException("ZooKeeper node " + path + " does not exist.", ex); } } boolean success = false; try { byte[] data = client.getData().forPath(path); RetrievableStateHandle<T> retrievableStateHandle = InstantiationUtil.deserializeObject( data, Thread.currentThread().getContextClassLoader()); success = true; return retrievableStateHandle; } catch (KeeperException.NoNodeException ex) { throw new NotExistException("ZooKeeper node " + path + " does not exist.", ex); } catch (IOException | ClassNotFoundException e) { throw new IOException("Failed to deserialize state handle from ZooKeeper data from " + path + '.', e); } finally { if (!success && lock) { release(path); } } }
Source:
<code>protected void resolveInputPriorityConflict(ExecNode<?, ?> node, int higherInput, int lowerInput) { throw new IllegalStateException( <START> "A conflict is detected. This is a bug. Please consider filing an issue.\n" + <END> "To work around this bug, please set " + OptimizerConfigOptions.TABLE_OPTIMIZER_MULTIPLE_INPUT_ENABLED.key() + " to false to disable multiple input operator."); }</code><technical_language>nit: Please consider filing issue. -> Please file issue</technical_language>

Target:
protected void resolveInputPriorityConflict(ExecNode<?, ?> node, int higherInput, int lowerInput) { throw new IllegalStateException( "A conflict is detected. This is a bug. Please file an issue.\n" + "To work around this bug, please set " + OptimizerConfigOptions.TABLE_OPTIMIZER_MULTIPLE_INPUT_ENABLED.key() + " to false to disable multiple input operator."); }
Source:
<code>public byte[] generateOutputFile(Collection<LicenseInfoParsingResult> projectLicenseInfoResults, String projectName, String projectVersion, String licenseInfoHeaderText) throws SW360Exception { ByteArrayOutputStream docxOutputStream = new ByteArrayOutputStream(); try { <START> byte[] docxTemplateFile = CommonUtils.loadResource(DocxGenerator.class, DOCX_TEMPLATE_FILE).orElse(null); <END> XWPFDocument xwpfDocument = new XWPFDocument(new ByteArrayInputStream(docxTemplateFile)); switch (getOutputVariant()) { case DISCLOSURE: fillDocument(xwpfDocument, projectLicenseInfoResults, projectName, projectVersion, licenseInfoHeaderText, false); break; case REPORT: fillDocument(xwpfDocument, projectLicenseInfoResults, projectName, projectVersion, licenseInfoHeaderText, true); break; default: throw new IllegalArgumentException("Unknown generator variant type: " + getOutputVariant()); } xwpfDocument.write(docxOutputStream); docxOutputStream.close(); } catch (XmlException e) { throw new SW360Exception("Got XmlException while generating docx document: " + e.getMessage()); } catch (IOException e) { throw new SW360Exception("Got IOException when generating docx document: " + e.getMessage()); } catch (TException e) { throw new SW360Exception("Error reading sw360 licenses: " + e.getMessage()); } return docxOutputStream.toByteArray(); }</code><technical_language>test if loadResource() find template? orElse(null) NPE next line. passing empty byte array better. produce empty output, fail outright. Logging a warning template beneficial, I imagine</technical_language>

Target:
public byte[] generateOutputFile(Collection<LicenseInfoParsingResult> projectLicenseInfoResults, String projectName, String projectVersion, String licenseInfoHeaderText) throws SW360Exception { ByteArrayOutputStream docxOutputStream = new ByteArrayOutputStream(); Optional<byte[]> docxTemplateFile = CommonUtils.loadResource(DocxGenerator.class, DOCX_TEMPLATE_FILE); if (docxTemplateFile.isPresent()) { try { XWPFDocument xwpfDocument = new XWPFDocument(new ByteArrayInputStream(docxTemplateFile.get())); switch (getOutputVariant()) { case DISCLOSURE: fillDocument(xwpfDocument, projectLicenseInfoResults, projectName, projectVersion, licenseInfoHeaderText, false); break; case REPORT: fillDocument(xwpfDocument, projectLicenseInfoResults, projectName, projectVersion, licenseInfoHeaderText, true); break; default: throw new IllegalArgumentException("Unknown generator variant type: " + getOutputVariant()); } xwpfDocument.write(docxOutputStream); docxOutputStream.close(); } catch (XmlException e) { throw new SW360Exception("Got XmlException while generating docx document: " + e.getMessage()); } catch (IOException e) { throw new SW360Exception("Got IOException when generating docx document: " + e.getMessage()); } catch (TException e) { throw new SW360Exception("Error reading sw360 licenses: " + e.getMessage()); } return docxOutputStream.toByteArray(); } else { throw new SW360Exception("Could not load the template for xwpf document: " + DOCX_TEMPLATE_FILE); } }
Source:
<code>private boolean isBalloonDeviceActiveOnVm(VmInternalData vmInternalData) { VM savedVm = _vmDict.get(vmInternalData.getVmDynamic().getId()); VmBalloonInfo balloonInfo = vmInternalData.getVmStatistics().getVmBalloonInfo(); return savedVm.getMinAllocatedMem() < savedVm.getMemSizeMb() <START> && savedVm.getMinAllocatedMem() < savedVm.getTotalMemorySizeInBytes() <END> && balloonInfo.isBalloonDeviceEnabled() && balloonInfo.getBalloonTargetMemory() != balloonInfo.getBalloonMaxMemory(); }</code><technical_language>do need test of above? notice is in MB ant other in Bytes</technical_language>

Target:
private boolean isBalloonDeviceActiveOnVm(VmInternalData vmInternalData) { VM savedVm = _vmDict.get(vmInternalData.getVmDynamic().getId()); if (savedVm != null) { VmBalloonInfo balloonInfo = vmInternalData.getVmStatistics().getVmBalloonInfo(); return savedVm.getMinAllocatedMem() < savedVm.getMemSizeMb() && balloonInfo.isBalloonDeviceEnabled() && balloonInfo.getBalloonTargetMemory().intValue() != balloonInfo.getBalloonMaxMemory().intValue(); } return false; }
Source:
<code>public void compileRoutes() { if (routes != null) { throw new IllegalStateException("Routes already compiled"); } List<Route> routesLocal = new ArrayList<>(); allRouteBuilders.forEach(routeBuilder -> { routesLocal.add(routeBuilder.buildRoute(injector)); }); this.routes = ImmutableList.copyOf(routesLocal); this.reverseRoutes = new HashMap<>(this.routes.size()); this.routes.forEach(route -> { Class<?> methodClass = route.getControllerClass(); String methodName = Optional.ofNullable(route.getControllerMethod()) .map(Method::getName) <START> .orElse(""); <END> MethodReference controllerMethodRef = new MethodReference(methodClass, methodName); if (this.reverseRoutes.containsKey(controllerMethodRef)) { } else { this.reverseRoutes.put(controllerMethodRef, route); } if (route.isHttpMethodWebSocket()) { if (this.webSockets == null) { throw new IllegalStateException( "WebSockets instance was null. Unable to configure route " + route.getUri() + "."); } if (!this.webSockets.isEnabled()) { throw new IllegalStateException( "WebSockets are not enabled. Unable to configure route " + route.getUri() + "." + " Using implementation " + this.webSockets.getClass().getCanonicalName()); } webSockets.compileRoute(route); } }); logRoutes(); }</code><technical_language>if this is super-clean... returning ""... I guess simply added this.reverseRoutes afaics... (I wrong though...)</technical_language>

Target:
public void compileRoutes() { if (routes != null) { throw new IllegalStateException("Routes already compiled"); } List<Route> routesLocal = new ArrayList<>(); allRouteBuilders.forEach(routeBuilder -> { routesLocal.add(routeBuilder.buildRoute(injector)); }); this.routes = ImmutableList.copyOf(routesLocal); this.reverseRoutes = new HashMap<>(this.routes.size()); this.routes.forEach(route -> { Class<?> methodClass = route.getControllerClass(); String methodName = route.getControllerMethod().getName(); MethodReference controllerMethodRef = new MethodReference(methodClass, methodName); if (this.reverseRoutes.containsKey(controllerMethodRef)) { } else { this.reverseRoutes.put(controllerMethodRef, route); } if (route.isHttpMethodWebSocket()) { if (this.webSockets == null) { throw new IllegalStateException( "WebSockets instance was null. Unable to configure route " + route.getUri() + "."); } if (!this.webSockets.isEnabled()) { throw new IllegalStateException( "WebSockets are not enabled. Unable to configure route " + route.getUri() + "." + " Using implementation " + this.webSockets.getClass().getCanonicalName()); } webSockets.compileRoute(route); } }); logRoutes(); }
Source:
<code>public ResponseEntity<List<GetCommitResponse>> listCommits(@PathVariable("projectId") Long projectId) { List<Commit> commits = getCommitsInProjectUseCase.get(projectId); int commitsSize = commits.size(); List<GetCommitResponse> responses = new ArrayList<>(commitsSize); <START> for(int i = 0; i < commitsSize; ++i){ <END> Commit commit = commits.get(i); responses.add(new GetCommitResponse() .setName(commit.getName()) .setAnalyzed(commit.isAnalyzed()) .setAuthor(commit.getAuthor()) .setComment(commit.getComment()) .setTimestamp(commit.getTimestamp())); } return new ResponseEntity<>(responses, HttpStatus.OK); }</code><technical_language>Is this noticeably faster a normal for-each loop</technical_language>

Target:
public ResponseEntity<List<GetCommitResponse>> listCommits(@PathVariable("projectId") Long projectId) { List<Commit> commits = getCommitsInProjectUseCase.get(projectId); List<GetCommitResponse> responses = new ArrayList<>(commits.size()); for (Commit commit : commits) { responses.add(new GetCommitResponse() .setName(commit.getName()) .setAnalyzed(commit.isAnalyzed()) .setAuthor(commit.getAuthor()) .setComment(commit.getComment()) .setTimestamp(commit.getTimestamp())); } return new ResponseEntity<>(responses, HttpStatus.OK); }
Source:
<code>public ImmutableList<? extends Step> getBuildSteps( BuildContext context, BuildableContext buildableContext) { buildableContext.recordArtifact(outputPath); ImmutableList.Builder<String> compilerCommand = ImmutableList.builder(); compilerCommand.addAll(swiftCompiler.getCommandPrefix(context.getSourcePathResolver())); compilerCommand.add( "-module-name", this.moduleName, "-module-name", <START> this.moduleName, <END> "-c", this.bitcodePath.toString(), "-o", this.outputPath.toString()); compilerCommand.addAll(Arg.stringify(compilerFlags, context.getSourcePathResolver())); compilerCommand.add("-disable-llvm-optzns"); ProjectFilesystem projectFilesystem = getProjectFilesystem(); return ImmutableList.of( MkdirStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), getProjectFilesystem(), outputPath.getParent())), new SwiftCompileStep( projectFilesystem.getRootPath(), ImmutableMap.of(), compilerCommand.build())); }</code><technical_language>this duplication intended</technical_language>

Target:
public ImmutableList<? extends Step> getBuildSteps( BuildContext context, BuildableContext buildableContext) { buildableContext.recordArtifact(outputPath); ImmutableList.Builder<String> compilerCommand = ImmutableList.builder(); compilerCommand.addAll(swiftCompiler.getCommandPrefix(context.getSourcePathResolver())); compilerCommand.add( "-module-name", this.moduleName, "-c", this.bitcodePath.toString(), "-o", this.outputPath.toString()); compilerCommand.addAll(Arg.stringify(compilerFlags, context.getSourcePathResolver())); compilerCommand.add("-disable-llvm-optzns"); ProjectFilesystem projectFilesystem = getProjectFilesystem(); return ImmutableList.of( MkdirStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), getProjectFilesystem(), outputPath.getParent())), new SwiftCompileStep( projectFilesystem.getRootPath(), ImmutableMap.of(), compilerCommand.build())); }
Source:
<code><START> public static Maybe<Map<Object,Object>> getAsYamlMap(Object planData) { <END> if (!(planData instanceof String)) return Maybe.absent("not a string"); Iterable<Object> result; try { result = Yamls.parseAll((String)planData); } catch (Exception e) { Exceptions.propagateIfFatal(e); return Maybe.absent(e); } Iterator<Object> ri = result.iterator(); if (!ri.hasNext()) return Maybe.absent("YAML has no elements in it"); Object r1 = ri.next(); if (ri.hasNext()) return Maybe.absent("YAML has multiple elements in it"); if (r1 instanceof Map) return Maybe.of((Map<Object,Object>)r1); return Maybe.absent("YAML does not contain a map"); }</code><technical_language>Return type Maybe<Map<?,?>> (it's a read-only container), callers supposed mutate it</technical_language>

Target:
public static Maybe<Map<?,?>> getAsYamlMap(Object planData) { if (!(planData instanceof String)) return Maybe.absent("not a string"); Iterable<Object> result; try { result = Yamls.parseAll((String)planData); } catch (Exception e) { Exceptions.propagateIfFatal(e); return Maybe.absent(e); } Iterator<Object> ri = result.iterator(); if (!ri.hasNext()) return Maybe.absent("YAML has no elements in it"); Object r1 = ri.next(); if (ri.hasNext()) return Maybe.absent("YAML has multiple elements in it"); if (r1 instanceof Map) return (Maybe<Map<?,?>>)(Maybe<?>) Maybe.of(r1); return Maybe.absent("YAML does not contain a map"); }
Source:
<code>public ElementOption withElement(WebElement element) { checkNotNull(element); checkArgument(true, "Element should be an instance of the class which " + "extends org.openqa.selenium.remote.RemoteWebElement", <START> (HasIdentity.class.isAssignableFrom(element.getClass()))); <END> elementId = HasIdentity.class.cast(element).getId(); return this; }</code><technical_language>instanceof</technical_language>

Target:
public ElementOption withElement(WebElement element) { checkNotNull(element); checkArgument(true, "Element should be an instance of the class which " + "implements org.openqa.selenium.internal.HasIdentity", element instanceof HasIdentity); elementId = ((HasIdentity) element).getId(); return this; }
Source:
<code><START> public static int getPort() { <END> if (instance != null) { return instance.port; } else { return -1; } }</code><technical_language>return Optional<Integer> instead, get rid of JMXServer#getInstance</technical_language>

Target:
int getPort() { return port; }
Source:
<code>protected boolean isOsSupported(VM vm) { <START> String[] oses = Config.<String> GetValue(ConfigValues.HotPlugSupportedOsList).split(","); <END> for (String os : oses) { if (os.equalsIgnoreCase(vm.getguest_os())) { return true; } } addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); return false; }</code><technical_language>static ? list is expected change run, need parse for command</technical_language>

Target:
protected boolean isOsSupported(VM vm) { for (String os : oses) { if (os.equalsIgnoreCase(vm.getguest_os())) { return true; } } addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); return false; }
Source:
<code>public List<Project.NameKey> get() throws OrmException { final List<Project.NameKey> r = new ArrayList<Project.NameKey>(); for (Project.NameKey p : projectCache.all()) { try { final ProjectControl project = projectControlFactory.controlFor(p); final Project.NameKey parent = project.getProject().getParent(); if (parent != null) { ProjectControl c = projectControlFactory.controlFor(parent); if (c.isVisible() || c.isOwner()) { <START> if (!r.contains(parent)) { <END> r.add(parent); } } } } catch (NoSuchProjectException e) { continue; } } if (!r.contains(allProject)) { r.add(allProject); } Collections.sort(r); return r; }</code><technical_language>Excuse me, I want confirm "A suggestion for a follow change add permissions projects candidates if parents is sole purpose: parents." I understand "to add permissions projects candidates " delete Line 54</technical_language>

Target:
public List<Project.NameKey> get() throws OrmException, NoSuchProjectException { final List<Project.NameKey> result = new ArrayList<Project.NameKey>(); List<Project> pList = getParentCandidates(); for (Project p : pList) { result.add(p.getNameKey()); } return result; }
Source:
<code>public void invoke(ExtMap input, ExtMap output) { try { if (tasks != null) { tasks.execute(); } if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.LOAD)) { doLoad(input, output); } else if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.INITIALIZE)) { doInit(input, output); } else if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.TERMINATE)) { } else if ( (input.get(Base.InvokeKeys.COMMAND).equals(Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS)) || (input.get(Base.InvokeKeys.COMMAND).equals(Authn.InvokeCommands.CREDENTIALS_CHANGE)) ) { doAuth(input, output); } else { <START> output.put(Base.InvokeKeys.RESULT, Base.InvokeResult.UNSUPPORTED); <END> throw new IllegalArgumentException("unsupported:" + input.get(Base.InvokeKeys.COMMAND)); } } catch (Throwable e) { LOG.error( "Unexpected Exception invoking: {}", input.get(Base.InvokeKeys.COMMAND) ); LOG.debug( "Exception:", e ); output.mput(Base.InvokeKeys.RESULT, Base.InvokeResult.FAILED); } }</code><technical_language>interesting, line effect</technical_language>

Target:
public void invoke(ExtMap input, ExtMap output) { try { if (tasks != null) { tasks.execute(); } if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.LOAD)) { doLoad(input); } else if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.INITIALIZE)) { doInit(input); } else if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.TERMINATE)) { } else if ( (input.get(Base.InvokeKeys.COMMAND).equals(Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS)) || (input.get(Base.InvokeKeys.COMMAND).equals(Authn.InvokeCommands.CREDENTIALS_CHANGE)) ) { doAuth(input, output); } else { output.put(Base.InvokeKeys.RESULT, Base.InvokeResult.UNSUPPORTED); throw new IllegalArgumentException("unsupported:" + input.get(Base.InvokeKeys.COMMAND)); } output.mput(Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS); } catch (Throwable e) { LOG.error( "Unexpected Exception invoking: {}", input.get(Base.InvokeKeys.COMMAND) ); LOG.debug( "Exception:", e ); output.putIfAbsent(Base.InvokeKeys.RESULT, Base.InvokeResult.FAILED); output.put(Base.InvokeKeys.MESSAGE, e.getMessage()); } }
Source:
<code>private static void complete(AbstractFuture<?> future) { <START> boolean maskExecutorExceptions = future != null ? future.maskExecutorExceptions : true; <END> Listener next = null; outer: while (true) { future.releaseWaiters(); future.afterDone(); next = future.clearListeners(next); future = null; while (next != null) { Listener curr = next; next = next.next; Runnable task = curr.task; if (task instanceof AbstractFuture.SetFuture) { AbstractFuture.SetFuture<?> setFuture = (AbstractFuture.SetFuture) task; future = setFuture.owner; if (future.value == setFuture) { Object valueToSet = getFutureValue(setFuture.future); if (ATOMIC_HELPER.casValue(future, setFuture, valueToSet)) { continue outer; } } } else { executeListener(task, curr.executor, maskExecutorExceptions); } } break; } }</code><technical_language>null check is necessary. If future null hit a NPE line 788 this code assumes future null</technical_language>

Target:
private static void complete(AbstractFuture<?> future) { boolean maskExecutorExceptions = future.maskExecutorExceptions; Listener next = null; outer: while (true) { future.releaseWaiters(); future.afterDone(); next = future.clearListeners(next); future = null; while (next != null) { Listener curr = next; next = next.next; Runnable task = curr.task; if (task instanceof AbstractFuture.SetFuture) { AbstractFuture.SetFuture<?> setFuture = (AbstractFuture.SetFuture) task; future = setFuture.owner; if (future.value == setFuture) { Object valueToSet = getFutureValue(setFuture.future); if (ATOMIC_HELPER.casValue(future, setFuture, valueToSet)) { continue outer; } } } else { executeListener(task, curr.executor, maskExecutorExceptions); } } break; } }