auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void cascadeConnectionState(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (oldValue != newValue) { boolean cascadedFurther = false; if (this instanceof OutputBlock) { OutputBlock oblock = (OutputBlock) this; for (Optional<? extends ConnectionAnchor> anchor : oblock.getOutputAnchor().getOppositeAnchors()) { if (anchor.isPresent()) { <START> anchor.get().getBlock().setConnectionState((int) newValue); <END> cascadedFurther = true; } } } if (!cascadedFurther) { try { this.getExpr().analyze(getPane().getEnvInstance()); getPane().setErrorOccurred(false); } catch (HaskellTypeError e) { int index = -1; if (e.getHaskellObject() instanceof Expr) { Expr errorExpr = (Expr) e.getHaskellObject(); while (errorExpr instanceof Apply) { errorExpr = ((Apply) errorExpr).getChildren().get(0); index++; } getPane().getExprToFunction(errorExpr).getInput(index).setErrorState(true); getPane().setErrorOccurred(true); } else { informUnkownHaskellException(); throw new TypeUnavailableException(); } } catch (HaskellException e) { informUnkownHaskellException(); throw new TypeUnavailableException(); } this.setVisualState((int) newValue); } } }</code><technical_language>Neater: newValue.intValue()</technical_language>

Target:
public void cascadeConnectionState(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (oldValue != newValue) { boolean cascadedFurther = false; if (this instanceof OutputBlock) { OutputBlock oblock = (OutputBlock) this; for (Optional<? extends ConnectionAnchor> anchor : oblock.getOutputAnchor().getOppositeAnchors()) { if (anchor.isPresent()) { anchor.get().getBlock().setConnectionState(newValue.intValue()); cascadedFurther = true; } } } if (!cascadedFurther) { try { this.getExpr().analyze(getPane().getEnvInstance()); getPane().setErrorOccurred(false); } catch (HaskellTypeError e) { int index = -1; if (e.getHaskellObject() instanceof Expr) { Expr errorExpr = (Expr) e.getHaskellObject(); while (errorExpr instanceof Apply) { errorExpr = ((Apply) errorExpr).getChildren().get(0); index++; } getPane().getExprToFunction(errorExpr).getInput(index).setErrorState(true); getPane().setErrorOccurred(true); } else { informUnkownHaskellException(); throw new TypeUnavailableException(); } } catch (HaskellException e) { informUnkownHaskellException(); throw new TypeUnavailableException(); } this.setVisualState((int) newValue); } } }
Source:
<code>protected Stream<WebElement> headerCells() { <START> return headerCells.stream().filter(WebElement::isDisplayed); <END> }</code><technical_language>is isDisplayed check for optimized version</technical_language>

Target:
protected Stream<WebElement> headerCells() { return headerCells.stream(); }
Source:
<code>public static String getWindowsEveryonePrincipalName() { Runtime rt = Runtime.getRuntime(); Process pr = null; try { pr = rt.exec("whoami /groups | find \"S-1-1-0\""); } catch (IOException e) { return "Everyone"; } try { pr.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } try ( InputStreamReader reader = new InputStreamReader(pr.getInputStream(), Charsets.UTF_8)) { return CharStreams.toString(reader).split(" ")[0]; } catch (IOException e) { return "Everyone"; <START> } <END> }</code><technical_language>explain this a bit? do need blocks here? this simplified block</technical_language>

Target:
public static final String getWindowsEveryonePrincipalName() { if (isWindows()) { try { Process process = new ProcessBuilder("whoami", "/groups").start(); try { String line; try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { while ((line = reader.readLine()) != null) { if (line.indexOf("S-1-1-0") != -1) { return line.split(" ")[0]; } } } } finally { process.destroy(); } } catch (IOException e) { } } return "Everyone"; }
Source:
<code>public void testUrlFromPath() throws MalformedURLException { <START> URL url = new URL("http://localhost:8080/my/path"); <END> BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.path"); ba.setValue(url.toString()); Span span = new Span(Arrays.asList(ba)); URL spanURL = span.url(); assertEquals(url, spanURL); }</code><technical_language>change this path, e.g. "/my/path" - ensure is returned a URL (even missing host port)</technical_language>

Target:
public void testUrlFromPath() throws MalformedURLException { URL url = new URL("http://localhost:8080/my/path"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.path"); ba.setValue(url.getPath()); Span span = new Span(Arrays.asList(ba)); URL spanURL = span.url(); assertEquals(url.getPath(), spanURL.getPath()); }
Source:
<code>private ColumnGetter newColumnGetter(JdbcInputConnection con, PluginTask task, JdbcColumn column, JdbcColumnOption option, String valueType) { Type toType = getToType(option); switch(valueType) { case "coalesce": return newColumnGetter(con, task, column, option, sqlTypeToValueType(column, column.getSqlType())); case "long": return new LongColumnGetter(to, toType); case "float": return new FloatColumnGetter(to, toType); case "double": return new DoubleColumnGetter(to, toType); case "boolean": return new BooleanColumnGetter(to, toType); case "string": return new StringColumnGetter(to, toType); case "json": return new JsonColumnGetter(to, toType); case "date": return new DateColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "time": return new TimeColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "timestamp": return new TimestampColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "decimal": return new BigDecimalColumnGetter(to, toType); <START> case "array": <END> return new ArrayColumnGetter(to, toType); default: throw new ConfigException(String.format(ENGLISH, "Unknown value_type '%s' for column '%s'", option.getValueType(), column.getName())); } }</code><technical_language>"array" type is specific for PostgreSQL, lines in PostgreSQLColumnGetterFactory class</technical_language>

Target:
private ColumnGetter newColumnGetter(JdbcInputConnection con, PluginTask task, JdbcColumn column, JdbcColumnOption option, String valueType) { Type toType = getToType(option); switch(valueType) { case "coalesce": return newColumnGetter(con, task, column, option, sqlTypeToValueType(column, column.getSqlType())); case "long": return new LongColumnGetter(to, toType); case "float": return new FloatColumnGetter(to, toType); case "double": return new DoubleColumnGetter(to, toType); case "boolean": return new BooleanColumnGetter(to, toType); case "string": return new StringColumnGetter(to, toType); case "json": return new JsonColumnGetter(to, toType); case "date": return new DateColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "time": return new TimeColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "timestamp": return new TimestampColumnGetter(to, toType, newTimestampFormatter(option, DateColumnGetter.DEFAULT_FORMAT)); case "decimal": return new BigDecimalColumnGetter(to, toType); default: throw new ConfigException(String.format(ENGLISH, "Unknown value_type '%s' for column '%s'", option.getValueType(), column.getName())); } }
Source:
<code>private boolean isExpired(Long issuedAt, Long lifetime) { <START> return lifetime != -1 && issuedAt + lifetime < System.currentTimeMillis() / 1000; <END> }</code><technical_language>Suggest parenthesis clarify order of operator evaluation</technical_language>

Target:
private boolean isExpired(Long issuedAt, Long lifetime) { return lifetime != -1 && ((issuedAt + lifetime) < (System.currentTimeMillis() / 1000)); }
Source:
<code>private static int getConfiguredNumberOfThreads() { if (CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.isSet()) { try { return CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.getValue(); } catch (Exception e) { logger.error("Invalid value for " + CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.getName(), e); return Runtime.getRuntime().availableProcessors() * 2 - 1; } } else { <START> return Runtime.getRuntime().availableProcessors() * 2 - 1; <END> } }</code><technical_language>merge return Runtime.getRuntime().availableProcessors() * 2 - 1; one</technical_language>

Target:
private static int getConfiguredNumberOfThreads() { if (CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.isSet()) { try { return CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.getValue(); } catch (Exception e) { logger.error("Invalid value for " + CentralPAPropertyRepository.PA_VFSPROVIDER_CLIENT_FIND_FILES_THREAD_NUMBER.getName(), e); return DEFAULT_NUMBER_OF_THREADS; } } else { return DEFAULT_NUMBER_OF_THREADS; } }
Source:
<code>private static SQLExecutor buildExecutor(ClusterService clusterService) throws IOException { return SQLExecutor.builder(clusterService, 2, RandomizedTest.getRandom()) <START> .enableDefaultTables() <END> .addPartitionedTable( TableDefinitions.PARTED_PKS_TABLE_DEFINITION, new PartitionName(new RelationName("doc", "parted_pks"), singletonList("1395874800000")).asIndexName(), new PartitionName(new RelationName("doc", "parted_pks"), singletonList("1395961200000")).asIndexName()) .addPartitionedTable(TableDefinitions.TEST_EMPTY_PARTITIONED_TABLE_DEFINITION) .build(); }</code><technical_language>limit this table is in tests. Wastes some CPU cycles more difficult overview schemas in in this file</technical_language>

Target:
private static SQLExecutor buildExecutor(ClusterService clusterService) throws IOException { return SQLExecutor.builder(clusterService, 2, RandomizedTest.getRandom()) .addTable(TableDefinitions.USER_TABLE_DEFINITION) .build(); }
Source:
<code>private void validateParams( final UUID id, final IPentahoSession session ) { <START> if ( id == null ) { <END> throw new NullPointerException( "uuid is null" ); } if ( session == null ) { throw new NullPointerException( "Session is null" ); } }</code><technical_language>safe some lines ArgumentNullException.validate(..) a nice standard message</technical_language>

Target:
private void validateParams( final UUID id, final IPentahoSession session ) { ArgumentNullException.validate( "uuid", id ); ArgumentNullException.validate( "session", session ); }
Source:
<code>protected void mapDynamicOutputData(Map<String, Object> results) { if (results != null && !results.isEmpty()) { VariableScope variableScope = (VariableScope) ((ContextContainer) getProcessInstance().getProcess()).getDefaultContext( VariableScope.VARIABLE_SCOPE ); <START> VariableScopeInstance variableScopeInstance = (VariableScopeInstance)(VariableScopeInstance)getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE);; <END> for (Entry<String, Object> result : results.entrySet()) { String variableName = result.getKey(); Variable variable = variableScope.findVariable(variableName); if (variable == null) { variableName = VariableScope.CASE_FILE_PREFIX + variableName; List<String> definedVariables = Arrays.asList(variableScope.getVariableNames()); if (definedVariables.contains(variableName)) { variable = variableScope.findVariable(variableName); } } if (variable != null) { variableScopeInstance.getVariableScope().validateVariable(getProcessInstance().getProcessName(), variableName, result.getValue()); variableScopeInstance.setVariable(variableName, result.getValue()); } } } }</code><technical_language>VariableScopeInstance casting is done twice. 2 semicolons in end of line</technical_language>

Target:
protected void mapDynamicOutputData(Map<String, Object> results) { if (results != null && !results.isEmpty()) { VariableScope variableScope = (VariableScope) ((ContextContainer) getProcessInstance().getProcess()).getDefaultContext( VariableScope.VARIABLE_SCOPE ); VariableScopeInstance variableScopeInstance = (VariableScopeInstance)getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE); for (Entry<String, Object> result : results.entrySet()) { String variableName = result.getKey(); Variable variable = variableScope.findVariable(variableName); if (variable == null) { variableName = VariableScope.CASE_FILE_PREFIX + variableName; List<String> definedVariables = Arrays.asList(variableScope.getVariableNames()); if (definedVariables.contains(variableName)) { variable = variableScope.findVariable(variableName); } } if (variable != null) { variableScopeInstance.getVariableScope().validateVariable(getProcessInstance().getProcessName(), variableName, result.getValue()); variableScopeInstance.setVariable(variableName, result.getValue()); } } } }
Source:
<code>public void scanFile() { file = new File("src/test/resources/org/sonar/plugins/python/highlighting.py"); DefaultInputFile inputFile = new DefaultInputFile("moduleKey", file.getName()) .initMetadata(new FileMetadata().readMetadata(file, Charsets.UTF_8)); <START> context = SensorContextTester.create(new File("src/test/resources/org/sonar/plugins/python").getAbsoluteFile()); <END> context.fileSystem().add(inputFile); PythonHighlighter pythonHighlighter = new PythonHighlighter(context); PythonAstScanner.scanSingleFile(file, pythonHighlighter); }</code><technical_language>@ivandalbosco extract path src/test/resources/org/sonar/plugins/python in this file</technical_language>

Target:
public void scanFile() { String dir = "src/test/resources/org/sonar/plugins/python"; file = new File(dir + "/pythonHighlighter.py"); DefaultInputFile inputFile = new DefaultInputFile("moduleKey", file.getName()) .initMetadata(new FileMetadata().readMetadata(file, Charsets.UTF_8)); context = SensorContextTester.create(new File(dir)); context.fileSystem().add(inputFile); PythonHighlighter pythonHighlighter = new PythonHighlighter(context); PythonAstScanner.scanSingleFile(file, pythonHighlighter); }
Source:
<code>public String toJSON() throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); g.writeObjectFieldStart("data"); for ( String key: this.data.keySet() ) { Object data = this.data.get(key); if ( data == null ) continue; if ( data instanceof List) { List<String> stringList = (List<String>) data; g.writeArrayFieldStart(key); for ( String s : stringList ) { g.writeString(s); } g.writeEndArray(); } else { g.writeObjectField(key, data); } } g.writeEndObject(); if ( !this.oldData.isEmpty()) { g.writeObjectFieldStart("old"); for (String key : this.oldData.keySet()) { Object data = this.oldData.get(key); if (data instanceof List) { List<String> stringList = (List<String>) data; g.writeArrayFieldStart(key); for (String s : stringList) { g.writeString(s); } g.writeEndArray(); } else { g.writeObjectField(key, data); } } g.writeEndObject(); <START> } <END> g.writeEndObject(); g.flush(); return jsonFromStream(); }</code><technical_language>more DRY stuff here, put this a writeMapToJSON() function</technical_language>

Target:
public String toJSON() throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); writeMapToJSON("data", this.data, false); if ( !this.oldData.isEmpty()) { writeMapToJSON("old", this.oldData, true); } g.writeEndObject(); g.flush(); return jsonFromStream(); }
Source:
<code>public void upgrade_movePasswordTwice_idemPotent() throws IllegalArgumentException, IllegalAccessException { String vpnPassword = "upgrade_movePasswordTwice_idemPotent"; vpnPasswordField.set(userPrivateField.get(richard), vpnPassword); UserDevice device = createDevice(); richard.addDevice(device); migrationStep.upgrade(richard); <START> assertThat(device.getVpnPassword(), equalTo(vpnPassword)); <END> assertThat(richard.takeVpnPassword(), equalTo(Optional.empty())); migrationStep.upgrade(richard); assertThat(device.getVpnPassword(), equalTo(vpnPassword)); assertThat(richard.takeVpnPassword(), equalTo(Optional.empty())); }</code><technical_language>I prefer a simple act: migrationStep.upgrade(richard); migrationStep.upgrade(richard); asserts superfluous in this test. convention separate arrange/act/assert newlines</technical_language>

Target:
public void upgrade_movePasswordTwice_idemPotent() throws IllegalArgumentException, IllegalAccessException { String vpnPassword = "upgrade_movePasswordTwice_idemPotent"; vpnPasswordField.set(userPrivateField.get(richard), vpnPassword); UserDevice device = createDevice(); richard.addDevice(device); migrationStep.upgrade(richard); migrationStep.upgrade(richard); assertThat(device.getVpnPassword(), equalTo(vpnPassword)); assertThat(richard.getAndClearVpnPassword(), equalTo(Optional.empty())); }
Source:
<code>public void loginViaSocialAccount(String email, String idToken, String service, boolean isPasswordRequired) { LoginEmailPasswordFragment loginEmailPasswordFragment = <START> LoginEmailPasswordFragment.newInstance(email, null, null, null, isPasswordRequired); <END> slideInFragment(loginEmailPasswordFragment, true, LoginEmailPasswordFragment.TAG); }</code><technical_language>sure, do pass null idToken new instance provided idToken parameter instead? I Scenario No1 fails complete account connection of this</technical_language>

Target:
public void loginViaSocialAccount(String email, String idToken, String service, boolean isPasswordRequired) { LoginEmailPasswordFragment loginEmailPasswordFragment = LoginEmailPasswordFragment.newInstance(email, null, idToken, service, isPasswordRequired); slideInFragment(loginEmailPasswordFragment, true, LoginEmailPasswordFragment.TAG); }
Source:
<code>public static Set<TaskStatus> taskStatuses(boolean pending, boolean running, boolean finished) { List<String> aggregatedStatuses = new LinkedList<>(); if (pending) { <START> aggregatedStatuses.add("Pending"); <END> } if (running) { aggregatedStatuses.add("Running"); } if (finished) { aggregatedStatuses.add("Finished"); } return TaskStatus.expandAggregatedStatusesToRealStatuses(aggregatedStatuses); }</code><technical_language>defined in some constant enum name</technical_language>

Target:
public static Set<TaskStatus> taskStatuses(boolean pending, boolean running, boolean finished) { List<String> aggregatedStatuses = new LinkedList<>(); if (pending) { aggregatedStatuses.add(TaskStatus.SUBMITTED.name); aggregatedStatuses.add(TaskStatus.PENDING.name); } if (running) { aggregatedStatuses.add(TaskStatus.RUNNING.name); } if (finished) { aggregatedStatuses.add(TaskStatus.FINISHED.name); } return TaskStatus.expandAggregatedStatusesToRealStatuses(aggregatedStatuses); }
Source:
<code>public void testMmsRetrievingAll() { final ContentValues mmsValues = new <START> ContentValues(2); <END> mmsValues.put(Telephony.Mms.TEXT_ONLY, 1); mmsValues.put(Telephony.Mms.MESSAGE_TYPE, 128); mmsValues.put(Telephony.Mms.SUBJECT, mmsSubject); final Uri mmsUri = mContentResolver.insert(Telephony.Mms.CONTENT_URI, mmsValues); assertThat(mmsUri).isNotNull(); final long mmsId = ContentUris.parseId(mmsUri); mmsValues.put(Telephony.Mms.TEXT_ONLY, 1); mmsValues.put(Telephony.Mms.MESSAGE_TYPE, 128); mmsValues.put(Telephony.Mms.SUBJECT, mmsSubject); final Uri mmsUri1 = mContentResolver.insert(Telephony.Mms.CONTENT_URI, mmsValues); assertThat(mmsUri1).isNotNull(); final long mmsId1 = ContentUris.parseId(mmsUri1); Cursor cursor = mContentResolver.query(Telephony.Mms.CONTENT_URI, null, null, null); assertThat(cursor.getCount()).isEqualTo(2); }</code><technical_language>If set, match number of values put ContentValues</technical_language>

Target:
public void testMmsRetrievingAll() { cleanup(); Uri mmsUri1 = insertInToMmsTable(false, MMS_SUBJECT_ONE); assertThat(mmsUri1).isNotNull(); Uri mmsUri2 = insertInToMmsTable(true, MMS_SUBJECT_TWO); assertThat(mmsUri2).isNotNull(); Cursor cursor = mContentResolver.query(Telephony.Mms.CONTENT_URI, null, null, null); assertThat(cursor.getCount()).isEqualTo(2); assertThat(cursor.moveToFirst()).isEqualTo(true); assertThat(cursor.getString(cursor.getColumnIndex(Telephony.Mms.SUBJECT))).isEqualTo(MMS_SUBJECT_ONE); assertThat(cursor.moveToNext()).isEqualTo(true); assertThat(cursor.getString(cursor.getColumnIndex(Telephony.Mms.SUBJECT))).isEqualTo(MMS_SUBJECT_TWO); }
Source:
<code>protected Builder() { id("oneandone") .name("OneAndOne REST Compute") .apiMetadata(new OneAndOneApiMetadata()) .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) <START> .iso3166Codes("de", "us", "es", "gb") <END> .endpoint("<LINK_0>") .defaultProperties(OneAndOneProviderMetadata.defaultProperties()); }</code><technical_language>This iso codes, region id</technical_language>

Target:
protected Builder() { id("oneandone") .name("OneAndOne REST Compute") .apiMetadata(new OneAndOneApiMetadata()) .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .endpoint("<LINK_0>") .defaultProperties(OneAndOneProviderMetadata.defaultProperties()); }
Source:
<code>private void notifyDirtyListeners() { if (listeners == null) { return; } <START> Display.getCurrent().asyncExec(new Runnable() { <END> public void run() { boolean dirty = isDirty(); for (IDirtyListener listener : listeners) { listener.dirtyChanged(dirty); } } }); }</code><technical_language>I -( I done this code is important</technical_language>

Target:
private void notifyDirtyListeners() { if (dirtyListeners == null) { return; } Display.getCurrent().asyncExec(new Runnable() { public void run() { boolean dirty = isDirty(); final Object[] listeners = dirtyListeners.getListeners(); for (int i = 0; i < listeners.length; i++) { IDirtyListener dirtyListener = (IDirtyListener) listeners[i]; dirtyListener.dirtyChanged(dirty); } } }); }
Source:
<code>public int compareTo(PrioritizedListenableFutureTask otherTask) { <START> return comparator.compare(this, otherTask); <END> }</code><technical_language>"comparator" field much, this refer PRIORITY_COMPARATOR</technical_language>

Target:
public int compareTo(PrioritizedListenableFutureTask otherTask) { return PRIORITY_COMPARATOR.compare(this, otherTask); }
Source:
<code>private void shareSnippet(@NonNull CharSequence input) { final String selectedText = StringUtil.sanitizeText(input.toString()); final PageTitle title = fragment.getTitle(); new ImageLicenseFetchClient().request(title.getWikiSite(), new <START> PageTitle("File:" <END> + fragment.getPage().getPageProperties().getLeadImageName(), title.getWikiSite()), new ImageLicenseFetchClient.Callback() { @Override public void success(@NonNull Call<MwQueryResponse<ImageLicenseFetchClient.QueryResult>> call, @NonNull List<MwQueryImageLicensePage> pages) { MwQueryImageLicensePage page = pages.get(0); ImageLicense leadImageLicense = new ImageLicense(page.imageLicense(), page.imageLicenseShortName(), page.imageLicenseUrl()); final Bitmap snippetBitmap = SnippetImage.getSnippetImage(fragment.getContext(), fragment.getLeadImageBitmap(), title.getDisplayText(), fragment.getPage().isMainPage() ? "" : StringUtils.capitalize(title.getDescription()), selectedText, leadImageLicense); fragment.showBottomSheet(new PreviewDialog(fragment, snippetBitmap, title, selectedText, funnel)); } @Override public void failure(@NonNull Call<MwQueryResponse<ImageLicenseFetchClient.QueryResult>> call, @NonNull Throwable caught) { L.d("Error fetching image license info for " + title.getDisplayText() + ": " + caught.getMessage(), caught); } }); }</code><technical_language>This is constructor deprecated (I'll follow that). use: new PageTitle(Namespace.FILE, fragment.getPage()...)</technical_language>

Target:
private void shareSnippet(@NonNull CharSequence input) { final String selectedText = StringUtil.sanitizeText(input.toString()); final PageTitle title = fragment.getTitle(); final String leadImageNameText = fragment.getPage().getPageProperties().getLeadImageName() != null ? fragment.getPage().getPageProperties().getLeadImageName() : ""; new ImageLicenseFetchClient().request(title.getWikiSite(), new PageTitle(Namespace.FILE.toLegacyString(), leadImageNameText, title.getWikiSite()), new ImageLicenseFetchClient.Callback() { @Override public void success(@NonNull Call<MwQueryResponse<ImageLicenseFetchClient.QueryResult>> call, @NonNull List<MwQueryImageLicensePage> pages) { MwQueryImageLicensePage page = pages.get(0); ImageLicense leadImageLicense = new ImageLicense(page.imageLicense(), page.imageLicenseShortName(), page.imageLicenseUrl()); final Bitmap snippetBitmap = SnippetImage.getSnippetImage(fragment.getContext(), fragment.getLeadImageBitmap(), title.getDisplayText(), fragment.getPage().isMainPage() ? "" : StringUtils.capitalize(title.getDescription()), selectedText, leadImageLicense); fragment.showBottomSheet(new PreviewDialog(fragment, snippetBitmap, title, selectedText, funnel)); } @Override public void failure(@NonNull Call<MwQueryResponse<ImageLicenseFetchClient.QueryResult>> call, @NonNull Throwable caught) { L.e("Error fetching image license info for " + title.getDisplayText(), caught); } }); }
Source:
<code>public CompletableFuture<Configuration> createCache(String cacheName, Configuration configuration, EnumSet<CacheContainerAdmin.AdminFlag> flags) { <START> return null; <END> }</code><technical_language>return a completed state prevent NPEs</technical_language>

Target:
public CompletableFuture<Configuration> createCache(String cacheName, Configuration configuration, EnumSet<CacheContainerAdmin.AdminFlag> flags) { return CompletableFutures.completedNull(); }
Source:
<code>public void patchPermanentGroupUnprocessable() throws Exception { context.turnOffAuthorisationSystem(); GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); final Group group = groupService.findByName(context, Group.ANONYMOUS); final String name = group.getName(); context.restoreAuthSystemState(); String token = getAuthToken(admin.getEmail(), password); String requestBody = " [\n" + " {\n" + " \"op\": \"replace\",\n" + " \"path\": \"/name\",\n" + " \"value\": \"new name\"\n" + " }\n" <START> + " ]"; <END> getClient(token) .perform(patch("/api/eperson/groups/" + group.getID()).content(requestBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(token) .perform(get("/api/eperson/groups/" + group.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( GroupMatcher.matchGroupEntry(group.getID(), name)) )); }</code><technical_language>here, need created hand</technical_language>

Target:
public void patchPermanentGroupUnprocessable() throws Exception { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); final Group group = groupService.findByName(context, Group.ANONYMOUS); final String name = group.getName(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<>(); ReplaceOperation replaceOperation = new ReplaceOperation("/name", "new name"); ops.add(replaceOperation); String requestBody = getPatchContent(ops); getClient(token) .perform(patch("/api/eperson/groups/" + group.getID()).content(requestBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnprocessableEntity()); getClient(token) .perform(get("/api/eperson/groups/" + group.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", Matchers.is( GroupMatcher.matchGroupEntry(group.getID(), name)) )); }
Source:
<code>public Object execute(final ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); final ISelection selection = HandlerUtil.getCurrentSelection(event); IResourceUIModel selectedResource = UIUtils.getFirstElement(selection, IResourceUIModel.class); if(selectedResource == null && (selection instanceof IStructuredSelection)) { final Object selected = ((IStructuredSelection)selection).getFirstElement(); if(selected instanceof IService || selected instanceof IRoute) { selectedResource = new IResourceUIModel() { @Override public Object getParent() { return null; } @Override public IResource getResource() { return (IResource)selected; } }; } } <START> final IServer openShiftServer = getOpenShiftServer(selectedResource); <END> if (openShiftServer != null) { openServersView(openShiftServer, workbenchWindow); } return null; }</code><technical_language>prefer changed getOpenShiftServer signature a IResource parameter instead of a IResourceUIModel</technical_language>

Target:
public Object execute(final ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); final ISelection selection = HandlerUtil.getCurrentSelection(event); IResourceUIModel selectedResourceModel = UIUtils.getFirstElement(selection, IResourceUIModel.class); IResource selectedResource = (selectedResourceModel != null) ? selectedResourceModel.getResource() : UIUtils.getFirstElement(selection, IResource.class); final IServer openShiftServer = getOpenShiftServer(selectedResource); if (openShiftServer != null) { openServersView(openShiftServer, workbenchWindow); } return null; }
Source:
<code>public void testTimerStateRestorable() throws Exception { Path path = new Path(folder.newFolder().toURI()); OperatorSubtaskState state; KeyedStateBootstrapOperator<Long, Long> bootstrapOperator = new KeyedStateBootstrapOperator<>(0L, path, new TimerBootstrapFunction()); try (KeyedOneInputStreamOperatorTestHarness<Long, Long, TaggedOperatorSubtaskState> harness = getHarness(bootstrapOperator)) { harness.open(); harness.processElement(1L, 0L); harness.processElement(2L, 0L); harness.processElement(3L, 0L); bootstrapOperator.endInput(); state = harness.extractOutputValues().get(0).state; } KeyedProcessOperator<Long, Long, Tuple3<Long, Long, TimeDomain>> procOperator = new KeyedProcessOperator<>(new SimpleProcessFunction()); try (KeyedOneInputStreamOperatorTestHarness<Long, Long, Tuple3<Long, Long, TimeDomain>> harness = getHarness(procOperator)) { harness.initializeState(state); harness.open(); harness.processWatermark(EVENT_TIMER); harness.setProcessingTime(PROC_TIMER); Assert.assertThat(harness.extractOutputValues(), Matchers.containsInAnyOrder( Tuple3.of(1L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(2L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(3L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(1L, PROC_TIMER, TimeDomain.PROCESSING_TIME), Tuple3.of(2L, PROC_TIMER, TimeDomain.PROCESSING_TIME), Tuple3.of(3L, PROC_TIMER, TimeDomain.PROCESSING_TIME))); <START> harness.snapshot(0L, 0L); <END> } }</code><technical_language>Is this necessary for test</technical_language>

Target:
public void testTimerStateRestorable() throws Exception { Path path = new Path(folder.newFolder().toURI()); OperatorSubtaskState state; KeyedStateBootstrapOperator<Long, Long> bootstrapOperator = new KeyedStateBootstrapOperator<>(0L, path, new TimerBootstrapFunction()); try (KeyedOneInputStreamOperatorTestHarness<Long, Long, TaggedOperatorSubtaskState> harness = getHarness(bootstrapOperator)) { processElements(harness, 1L, 2L, 3L); state = getState(bootstrapOperator, harness); } KeyedProcessOperator<Long, Long, Tuple3<Long, Long, TimeDomain>> procOperator = new KeyedProcessOperator<>(new SimpleProcessFunction()); try (KeyedOneInputStreamOperatorTestHarness<Long, Long, Tuple3<Long, Long, TimeDomain>> harness = getHarness(procOperator, state)) { harness.processWatermark(EVENT_TIMER); harness.setProcessingTime(PROC_TIMER); assertHarnessOutput(harness, Tuple3.of(1L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(2L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(3L, EVENT_TIMER, TimeDomain.EVENT_TIME), Tuple3.of(1L, PROC_TIMER, TimeDomain.PROCESSING_TIME), Tuple3.of(2L, PROC_TIMER, TimeDomain.PROCESSING_TIME), Tuple3.of(3L, PROC_TIMER, TimeDomain.PROCESSING_TIME)); } }
Source:
<code>private static synchronized Iterable<ISegmentGenerationListener> getListeners(ListenerList listenersList) { List<ISegmentGenerationListener> listeners = new ArrayList<>(); for (Object listener : listenersList.getListeners()) { <START> if (listener != null) { <END> listeners.add((ISegmentGenerationListener) listener); } } return listeners; }</code><technical_language>instead of != null here, do a instanceof ISegmentGenerationListener. ClassCastException, this way, avoid error</technical_language>

Target:
private static synchronized Iterable<ISegmentGenerationListener> getListeners(ListenerList listenersList) { List<ISegmentGenerationListener> listeners = new ArrayList<>(); for (Object listener : listenersList.getListeners()) { if (listener instanceof ISegmentGenerationListener) { listeners.add((ISegmentGenerationListener) listener); } } return listeners; }
Source:
<code><START> public HashMap<String, Comparison> getColumnPredicates() { <END> return columnPredicates; }</code><technical_language>Yeah, do need do then, a multimap? a multi-map work. > Sorry. I get this. I checking for equality predicate? I do additional special checks translator level try logically combine predicates</technical_language>

Target:
public Multimap<String, Comparison> getColumnPredicates() { return columnPredicates; }
Source:
<code>private static void updateTimeoutLogableObject(AuditLogableBase auditLogable, AuditLogType logType) { int duplicateEventsIntrvalValue = (auditLogable.isExternal()) ? Math.max(auditLogable.getEventFloodInSec(), 30) : logType.getDuplicateEventsIntervalValue(); if (duplicateEventsIntrvalValue > 0) { <START> auditLogable.setEndTime(System.currentTimeMillis() <END> + TimeUnit.SECONDS.toMillis(logType.getDuplicateEventsIntervalValue())); auditLogable.setTimeoutObjectId(composeObjectId(auditLogable, logType)); } }</code><technical_language>please change logType.getDuplicateEventsIntervalValue() duplicateEventsIntrvalValue</technical_language>

Target:
private static void updateTimeoutLogableObject(AuditLogableBase auditLogable, AuditLogType logType) { int duplicateEventsIntrvalValue = (auditLogable.isExternal()) ? Math.max(auditLogable.getEventFloodInSec(), 30) : logType.getDuplicateEventsIntervalValue(); if (duplicateEventsIntrvalValue > 0) { auditLogable.setEndTime(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(duplicateEventsIntrvalValue)); auditLogable.setTimeoutObjectId(composeObjectId(auditLogable, logType)); } }
Source:
<code>public synchronized void invokeCallbackMethods() { initCommandExecutor(); <START> for (Iterator<Guid> iterator = cmdCallBackMap.keySet().iterator(); iterator.hasNext();) { <END> Guid cmdId = iterator.next(); CommandCallBack callBack = cmdCallBackMap.get(cmdId); CommandStatus status = coco.getCommandStatus(cmdId); switch(status) { case FAILED: callBack.onFailed(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); break; case SUCCEEDED: callBack.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); break; case ACTIVE_SYNC: coco.retrieveCommand(cmdId).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; case ACTIVE: case ACTIVE_ASYNC: callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId)); break; default: break; } } }</code><technical_language>stupid coverity! concurrent hash map is problem do that</technical_language>

Target:
public synchronized void invokeCallbackMethods() { initCommandExecutor(); for (Iterator<Entry<Guid, CommandCallBack>> iterator = cmdCallBackMap.entrySet().iterator(); iterator.hasNext();) { Entry<Guid, CommandCallBack> entry = iterator.next(); Guid cmdId = entry.getKey(); CommandCallBack callBack = entry.getValue(); CommandStatus status = coco.getCommandStatus(cmdId); switch(status) { case FAILED: callBack.onFailed(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); break; case SUCCEEDED: callBack.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); break; case ACTIVE_SYNC: coco.retrieveCommand(cmdId).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; case ACTIVE: case ACTIVE_ASYNC: callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId)); break; default: break; } } }
Source:
<code>public Long[] cardIds() { Long[] cids; <START> if (mDid < 0) { <END> cids = Utils.list2ObjectArray(mCol.getDb().queryColumn(Long.class, "select id from cards", 0)); } else { cids = mCol.getDecks().cids(mDid, true); } mCount = cids.length; return cids; }</code><technical_language>checking if mDid == null, invoking comparison operator checking for null, crash NPE is null...? This is a place extra careful translating Python. please double check correct for branches</technical_language>

Target:
public Long[] cardIds() { Long[] cids; if (mDid == null) { cids = Utils.list2ObjectArray(mCol.getDb().queryColumn(Long.class, "select id from cards", 0)); } else { cids = mCol.getDecks().cids(mDid, true); } mCount = cids.length; return cids; }
Source:
<code>public void forceVaultRemoval() { Vault vault = api().getVault(vaultName); if (vault != null) { if ((vault.properties().enableSoftDelete() != null) && vault.properties().enableSoftDelete()) { api().deleteVault(vaultName); <START> Object[] args = { resourceGroupName, vaultName, true }; <END> checkState(deletedVaultStatus.create(resourceGroupName, true).apply(vaultName), "vault was not deleted before timeout"); } else { return; } } DeletedVault deletedVault = api().getDeletedVault(LOCATION, vaultName); if (deletedVault != null) { api().purgeVault(LOCATION, vaultName); Object[] args = { resourceGroupName, vaultName, true }; checkState(deletedVaultStatus.create(resourceGroupName, false).apply(vaultName), "vault was not purged before timeout"); } }</code><technical_language>Unused args</technical_language>

Target:
public void forceVaultRemoval() { Vault vault = api().getVault(vaultName); if (vault != null) { if ((vault.properties().enableSoftDelete() != null) && vault.properties().enableSoftDelete()) { api().deleteVault(vaultName); checkState(deletedVaultStatus.create(resourceGroupName, true).apply(vaultName), "vault was not deleted before timeout"); } else { return; } } DeletedVault deletedVault = api().getDeletedVault(LOCATION, vaultName); if (deletedVault != null) { api().purgeVault(LOCATION, vaultName); checkState(deletedVaultStatus.create(resourceGroupName, false).apply(vaultName), "vault was not purged before timeout"); } }
Source:
<code>private void fixFeedbackSession(FeedbackSession session) throws InvalidParametersException, EntityDoesNotExistException, EntityAlreadyExistsException { fixFeedbackQuestionsOfFeedbackSession(session); fixFeedbackResponsesOfFeedbackSession(session); fixFeedbackResponseCommentsOfFeedbackSession(session); FeedbackSessionAttributes sessionAttribute = new FeedbackSessionAttributes(session); feedbackSessionsDb.deleteEntity(sessionAttribute); sessionAttribute.feedbackSessionName = StringHelper.removeExtraSpace(sessionAttribute.getFeedbackSessionName()); <START> feedbackSessionsDb.createEntity(sessionAttribute); <END> }</code><technical_language>A consequence of this is links in emails for affected feedback session students longer work</technical_language>

Target:
private void fixFeedbackSession(FeedbackSession session) throws InvalidParametersException, EntityDoesNotExistException, EntityAlreadyExistsException { if (feedbackSessionsDb.getFeedbackSession(session.getCourseId(), StringHelper.removeExtraSpace(session.getFeedbackSessionName())) != null) { throw new EntityAlreadyExistsException( "Will be unable to rename session as a session with the extra-space-removed name exists"); } fixFeedbackQuestionsOfFeedbackSession(session); fixFeedbackResponsesOfFeedbackSession(session); fixFeedbackResponseCommentsOfFeedbackSession(session); FeedbackSessionAttributes sessionAttribute = new FeedbackSessionAttributes(session); feedbackSessionsDb.deleteEntity(sessionAttribute); sessionAttribute.setFeedbackSessionName( StringHelper.removeExtraSpace(sessionAttribute.getFeedbackSessionName())); feedbackSessionsDb.createEntity(sessionAttribute); }
Source:
<code>public void updateElement(UIElement element, Map parameters) { Repository repo = null; List<RepositoryTreeNode<?>> nodes = getSelectedNodes(); if (nodes.size() == 1) { repo = nodes.get(0).getRepository(); } element.setText( <START> SimpleConfigurePushDialog.getSimplePushCommandLabel(repo)); <END> }</code><technical_language>This shows wrong label menu is invoked a specific remote. getRemoteConfigCached() above. getSimplePushCommandLabel() RemoteConfig parameter, Repository</technical_language>

Target:
public void updateElement(UIElement element, Map parameters) { RemoteConfig config = null; List<RepositoryTreeNode<?>> nodes = getSelectedNodes(); if (nodes.size() == 1) { config = getRemoteConfigCached(nodes.get(0)); } element.setText( SimpleConfigurePushDialog.getSimplePushCommandLabel(config)); }
Source:
<code>protected Map<DropStrategy, List<Command>> findExtendedStrategies(Request request) { Map<DropStrategy, List<Command>> matchingStrategies = new LinkedHashMap<DropStrategy, List<Command>>(); for (DropStrategy strategy : DropStrategyManager.instance.getActiveStrategies()) { List<Command> selectedCommands = new ArrayList<Command>(); if(strategy instanceof TransactionalCommandsDropStrategy){ List<Command> cs = ((TransactionalCommandsDropStrategy)strategy).getCommands(request, getHost()); for(Command command : cs){ if (command != null && command.canExecute()) { selectedCommands.add(command); } } } else <START> if(strategy instanceof TransactionalDropStrategy){ <END> Command command = strategy.getCommand(request, getHost()); if (command != null && command.canExecute()) { selectedCommands.add(command); } } if(selectedCommands.size()>0){ matchingStrategies.put(strategy, selectedCommands); } } ArrayList<Command> selectedCommands = new ArrayList<Command>(); selectedCommands.add(defaultDropStrategy.getCommand(request, getHost())); matchingStrategies.put(defaultDropStrategy, selectedCommands); return matchingStrategies; }</code><technical_language>if is some other kind of DropStrategy? Is case handled else</technical_language>

Target:
protected Map<DropStrategy, List<Command>> findExtendedStrategies(Request request) { Map<DropStrategy, List<Command>> matchingStrategies = new LinkedHashMap<DropStrategy, List<Command>>(); for (DropStrategy strategy : DropStrategyManager.instance.getActiveStrategies()) { List<Command> selectedCommands = new ArrayList<Command>(); if(strategy instanceof TransactionalCommandsDropStrategy){ List<Command> cs = ((TransactionalCommandsDropStrategy)strategy).getCommands(request, getHost()); for(Command command : cs){ if (command != null && command.canExecute()) { selectedCommands.add(command); } } } else{ Command command = strategy.getCommand(request, getHost()); if (command != null && command.canExecute()) { selectedCommands.add(command); } } if(selectedCommands.size()>0){ matchingStrategies.put(strategy, selectedCommands); } } ArrayList<Command> selectedCommands = new ArrayList<Command>(); selectedCommands.add(defaultDropStrategy.getCommand(request, getHost())); matchingStrategies.put(defaultDropStrategy, selectedCommands); return matchingStrategies; }
Source:
<code>public Build execute() { try (ArtifactoryDependenciesClient dependenciesClient = (ArtifactoryDependenciesClient) clientBuilder.build()) { client = dependenciesClient; validateArtifactoryVersion(); validateNpmVersion(); validateRepoExists("Source repo must be specified"); NpmProject npmProject = new NpmProject(args, repo, workingDir); return buildInfoExtractor.extract(npmProject); } catch (Exception e) { <START> logger.error(ExceptionUtils.getStackTrace(e), e); <END> } return null; }</code><technical_language>argument for this method provides stacktrace, change line to: **logger.error("Failed NpmInstall", e);**</technical_language>

Target:
public Build execute() { try (ArtifactoryDependenciesClient dependenciesClient = (ArtifactoryDependenciesClient) clientBuilder.build()) { client = dependenciesClient; validateArtifactoryVersion(); validateNpmVersion(); validateRepoExists("Source repo must be specified"); NpmProject npmProject = new NpmProject(installArgs, repo, workingDir); return buildInfoExtractor.extract(npmProject); } catch (Exception e) { logger.error("Failed during NpmInstall", e); } return null; }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (volume.getAsyncTask() != null && <START> (volume.getAsyncTask().getType() == GlusterTaskType.REBALANCE || volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK)) { <END> addCanDoActionMessageVariable("asyncTask", volume.getAsyncTask().getType().name().toLowerCase()); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VOLUME_ASYNC_OPERATION_IN_PROGRESS); } if (!GlusterUtil.getInstance().isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } if (getDbFacade().getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), snapshot.getSnapshotName()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS); } List<GlusterBrickEntity> bricks = volume.getBricks(); for (GlusterBrickEntity brick : bricks) { if (!brick.isOnline()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_BRICKS_ARE_DOWN); } } for (GlusterGeoRepSession session : georepSessions) { if (session.getSlaveNodeUuid() == null || session.getSlaveVolumeId() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE); } } return true; }</code><technical_language>Do need consider task status well. If is a task volume task is completed stopped , snapshot create i think</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (volume.getAsyncTask() != null && (volume.getAsyncTask().getType() == GlusterTaskType.REBALANCE || volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK) && volume.getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { addCanDoActionMessageVariable("asyncTask", volume.getAsyncTask().getType().name().toLowerCase()); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VOLUME_ASYNC_OPERATION_IN_PROGRESS); } if (!GlusterUtil.getInstance().isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } if (getDbFacade().getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), snapshot.getSnapshotName()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS); } List<GlusterBrickEntity> bricks = volume.getBricks(); for (GlusterBrickEntity brick : bricks) { if (!brick.isOnline()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_ONE_OR_MORE_BRICKS_ARE_DOWN); } } for (GlusterGeoRepSession session : georepSessions) { if (session.getSlaveNodeUuid() == null || session.getSlaveVolumeId() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE); } } return true; }
Source:
<code>private Set<String> moduleNames() { Set<String> moduleNames= new HashSet<>(); if (fSourceJavaElements != null) { for (IJavaElement <START> fSourceJavaElement : <END> fSourceJavaElements) { if (fSourceJavaElement instanceof IPackageFragmentRoot) { IModuleDescription module= ((IPackageFragmentRoot) fSourceJavaElement).getModuleDescription(); if (module != null) { moduleNames.add(module.getElementName()); } } } } return moduleNames; }</code><technical_language>rename element</technical_language>

Target:
private Set<String> moduleNames() { Set<String> moduleNames= new HashSet<>(); if (fSourceJavaElements != null) { for (IJavaElement element : fSourceJavaElements) { if (element instanceof IPackageFragmentRoot) { IModuleDescription module= ((IPackageFragmentRoot) element).getModuleDescription(); if (module != null) { moduleNames.add(module.getElementName()); } } } } return moduleNames; }