auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onCompletion(GetBlobResult result, Exception exception) { try { restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); if (exception == null && result != null) { setResponseHeaders(result.getBlobInfo()); mockBlobStorageService.handleResponse(restRequest, restResponseChannel, result.getBlobDataChannel(), null); } else { if (exception != null && exception instanceof RouterException) { exception = new RestServiceException(exception, RestServiceErrorCode.getRestServiceErrorCode(((RouterException) exception).getErrorCode())); } mockBlobStorageService.handleResponse(restRequest, restResponseChannel, null, exception); } } catch (Exception e) { exception = exception == null ? e : exception; <START> if (result != null && result.getBlobDataChannel() != null) { <END> try { result.getBlobDataChannel().close(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } } mockBlobStorageService.handleResponse(restRequest, restResponseChannel, null, exception); } }</code><technical_language>pass channel - need do this - RequestResponseHandler close eventually</technical_language>

Target:
public void onCompletion(GetBlobResult result, Exception exception) { try { restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); if (exception == null && result != null) { setResponseHeaders(result.getBlobInfo()); } else if (exception != null && exception instanceof RouterException) { exception = new RestServiceException(exception, RestServiceErrorCode.getRestServiceErrorCode(((RouterException) exception).getErrorCode())); } } catch (Exception e) { exception = exception == null ? e : exception; } finally { ReadableStreamChannel channel = result != null ? result.getBlobDataChannel() : null; mockBlobStorageService.handleResponse(restRequest, restResponseChannel, channel, exception); } }
Source:
<code>public static byte[] parseHexBytes(Map<String, ?> map, String key) { Object v = map.get(key); if (v == null) { return null; } <START> String s = (String)v; try { int length = s.length(); byte[] data = new byte[length / 2]; for(int i = 0; i < length; i += 2) { data[i / 2] = (byte)((hexValueOf(s.charAt(i)) << 4) | hexValueOf(s.charAt(i + 1))); } return data; } catch (NumberFormatException e) { throw newIllegalStateException(ERROR_FILE_CORRUPT, "Error parsing the value {0}", v, e); } <END> }</code><technical_language>StringUtils.convertHexToBytes()</technical_language>

Target:
public static byte[] parseHexBytes(Map<String, ?> map, String key) { Object v = map.get(key); if (v == null) { return null; } return StringUtils.convertHexToBytes((String)v); }
Source:
<code>private Integer eightBitUnsignedAtOffset(byte[] c, int offset) { <START> Integer lowerByte = c[offset] & 0xFF; <END> return lowerByte; }</code><technical_language>Immediately return</technical_language>

Target:
private Integer eightBitUnsignedAtOffset(byte[] c, int offset) { return c[offset] & 0xFF; }
Source:
<code>public void should_fail_if_neither_name_nor_version_is_changed() throws Exception { final MustUpdateValidator mustUpdateValidator = new MustUpdateValidator(aPool().withName("Pool").withVersion("1.0").build(), new WritableValue("Pool", <START> String.class), new WritableValue("1.0", <END> String.class)); final IStatus status = mustUpdateValidator.validate(); StatusAssert.assertThat(status).isNotOK(); }</code><technical_language>linebreak place is choice</technical_language>

Target:
public void should_fail_if_neither_name_nor_version_is_changed() throws Exception { final MustUpdateValidator mustUpdateValidator = new MustUpdateValidator(aPool().withName("Pool").withVersion("1.0").build(), new WritableValue("Pool", String.class), new WritableValue("1.0", String.class)); final IStatus status = mustUpdateValidator.validate(); assertThat(status).isNotOK(); }
Source:
<code>private URI getSolrUri(List<NameValuePair> params) { URI uri; try { uri = new URL(runtimeConfiguration.getSolrServer(), "?" + URLEncodedUtils.format(params, "UTF-8")).toURI(); <START> } catch (IllegalStateException | MalformedURLException | URISyntaxException e) { <END> throw new IllegalArgumentException("Solr server URI is null or malformed", e); } return uri; }</code><technical_language>confused -- circumstances IllegalStateException thrown? pretty distinct URL-syntax-related exceptions, belongs in try block. Or, better, if check for condition explicitly -- IllegalStateException is broad enough meaning of a catch block is pretty doomed unclear. long tweaking exception behavior, wondering if sense throw IllegalArgumentException. Throwing getSolrUri sense if argument getSolrUri(that is, List<NameValuePair> params) is illegal. this caused a bad runtimeConfiguration.getSolrServer()</technical_language>

Target:
private URI getSolrUri(List<NameValuePair> params) throws SolrUndefinedException { try { URL solrServer = runtimeConfiguration.getSolrServer() .orElseThrow(() -> new SolrUndefinedException("Solr server URI must be defined " + "in wombat.yaml in order to use solr features such as search, RSS, or " + "listing recent articles on the homepage.")); return new URL(solrServer, "?" + URLEncodedUtils.format(params, "UTF-8")).toURI(); } catch (MalformedURLException | URISyntaxException e) { throw new IllegalArgumentException(e); } }
Source:
<code>void scan(String prefix) { if (ALL.equals(prefix)) { scanOne(HEAD); <START> scanOne(Constants.FETCH_HEAD); <END> scanOne(Constants.MERGE_HEAD); scanTree(R_REFS, refsDir); if (newLoose == null && curIdx < curLoose.size()) newLoose = curLoose.copy(curIdx); } else if (prefix.startsWith(R_REFS) && prefix.endsWith("/")) { curIdx = -(curLoose.find(prefix) + 1); File dir = new File(refsDir, prefix.substring(R_REFS.length())); scanTree(prefix, dir); while (curIdx < curLoose.size()) { if (!curLoose.get(curIdx).getName().startsWith(prefix)) break; if (newLoose == null) newLoose = curLoose.copy(curIdx); curIdx++; } if (newLoose != null) { while (curIdx < curLoose.size()) newLoose.add(curLoose.get(curIdx++)); } } }</code><technical_language>NAK. show in protocol advertisements, etc. If application needs read them. Besides files *not* standard ref format. more ref. in FETCH_HEAD's case, URL data branch data. fact work a ref is a bug in C Git implementation 40 bytes of a "ref file" if is a SHA-1. In hindsight permitted files "ref like" a stricter ref file parser</technical_language>

Target:
void scan(String prefix) { if (ALL.equals(prefix)) { scanOne(HEAD); scanTree(R_REFS, refsDir); if (newLoose == null && curIdx < curLoose.size()) newLoose = curLoose.copy(curIdx); } else if (prefix.startsWith(R_REFS) && prefix.endsWith("/")) { curIdx = -(curLoose.find(prefix) + 1); File dir = new File(refsDir, prefix.substring(R_REFS.length())); scanTree(prefix, dir); while (curIdx < curLoose.size()) { if (!curLoose.get(curIdx).getName().startsWith(prefix)) break; if (newLoose == null) newLoose = curLoose.copy(curIdx); curIdx++; } if (newLoose != null) { while (curIdx < curLoose.size()) newLoose.add(curLoose.get(curIdx++)); } } }
Source:
<code>public List<VmCheckpoint> getAllForVm(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_id", id); List<VmCheckpoint> checkpoints = getCallsHandler().executeReadList("GetVmCheckpointsByVmId", vmCheckpointRowMapper, parameterSource); <START> checkpoints.stream().sorted((o1, o2) -> { if (o1.getId() == o2.getId()) { return 0; } return o2.getParentId().equals(o1.getId()) ? -1 : 1; }); <END> return checkpoints; }</code><technical_language>sort fetching (in query is)</technical_language>

Target:
public List<VmCheckpoint> getAllForVm(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_id", id); return getCallsHandler().executeReadList("GetVmCheckpointsByVmId", vmCheckpointRowMapper, parameterSource); }
Source:
<code>public StreamClient getStreamClient() { String host = getRequiredProperty(this.key + "host"); int port = Integer.parseInt(getRequiredProperty(this.key + "port")); <START> Boolean ssl = Boolean.valueOf(getProperty(this.key + "ssl", DEFAULT_SSL)); <END> RestStreamClient.Builder builder = RestStreamClient.builder(host, port).ssl(ssl); String authClientClassPath = getProperty(this.key + "auth_client", DEFAULT_AUTH_CLIENT); String authClientPropertiesPath = getProperty(this.key + "auth_client_properties", DEFAULT_AUTH_CLIENT_PROPERTIES); try { AuthenticationClient authClient = (AuthenticationClient) Class.forName(authClientClassPath).getConstructor().newInstance(); authClient.setConnectionInfo(host, port, ssl); authClient.configure(new ConfigurationLoaderImpl().load(new File(authClientPropertiesPath)).getProperties()); builder.authClient(authClient); } catch (ReflectiveOperationException e) { LOG.error("Can not resolve class {}: {}", authClientClassPath, e.getMessage()); } catch (ConfigurationLoadingException e) { LOG.error("Can not load Authentication Client properties file {}: {}", authClientPropertiesPath, e.getMessage()); } String apiKey = getProperty(this.key + "apiKey"); if (apiKey != null && !apiKey.equals("")) { builder.apiKey(apiKey); } builder.writerPoolSize(Integer.parseInt(getProperty(this.key + "writerPoolSize", DEFAULT_WRITER_POOL_SIZE))); builder.version(getProperty(this.key + "version", DEFAULT_VERSION)); return builder.build(); }</code><technical_language>boxed type? primitive boolean call Boolean.parseBoolean</technical_language>

Target:
public StreamClient getStreamClient() { String host = getRequiredProperty(this.key + "host"); int port = Integer.parseInt(getRequiredProperty(this.key + "port")); boolean ssl = Boolean.valueOf(getProperty(this.key + "ssl", DEFAULT_SSL)); RestStreamClient.Builder builder = RestStreamClient.builder(host, port).ssl(ssl); String authClientClassPath = getProperty(this.key + "auth_client", DEFAULT_AUTH_CLIENT); String authClientPropertiesPath = getProperty(this.key + "auth_client_properties", DEFAULT_AUTH_CLIENT_PROPERTIES); try { AuthenticationClient authClient = (AuthenticationClient) Class.forName(authClientClassPath).getConstructor().newInstance(); authClient.setConnectionInfo(host, port, ssl); authClient.configure(new ConfigurationLoaderImpl().load(new File(authClientPropertiesPath)).getProperties()); builder.authClient(authClient); } catch (ReflectiveOperationException e) { LOG.error("Can not resolve class {}: {}", authClientClassPath, e.getMessage(), e); } catch (ConfigurationLoadingException e) { LOG.error("Can not load Authentication Client properties file {}: {}", authClientPropertiesPath, e.getMessage(), e); } String apiKey = getProperty(this.key + "apiKey"); if (apiKey != null && !apiKey.equals("")) { builder.apiKey(apiKey); } builder.writerPoolSize(Integer.parseInt(getProperty(this.key + "writerPoolSize", DEFAULT_WRITER_POOL_SIZE))); builder.version(getProperty(this.key + "version", DEFAULT_VERSION)); return builder.build(); }
Source:
<code>private CompletionStage<RestResponse> removeCache(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder().status(NO_CONTENT); String cacheName = request.variables().get("cacheName"); RestCacheManager<Object> restCacheManager = invocationHelper.getRestCacheManager(); Cache<?, ?> cache = restCacheManager.getCache(cacheName, request); if (cache == null) { responseBuilder.status(HttpResponseStatus.NOT_FOUND); return CompletableFuture.completedFuture(responseBuilder.build()); } return CompletableFuture.supplyAsync(() -> { <START> Subject.doAs(request.getSubject(), (PrivilegedAction<Void>) () -> { <END> restCacheManager.getCacheManagerAdmin(request).removeCache(cacheName); return null; }); responseBuilder.status(OK); return responseBuilder.build(); }, invocationHelper.getExecutor()); }</code><technical_language>RestCacheManager.getCacheManagerAdmin() return a privileged RemoteCacheAdmin remove Subject.doAs invocations</technical_language>

Target:
private CompletionStage<RestResponse> removeCache(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder().status(NO_CONTENT); String cacheName = request.variables().get("cacheName"); RestCacheManager<Object> restCacheManager = invocationHelper.getRestCacheManager(); Cache<?, ?> cache = restCacheManager.getCache(cacheName, request); if (cache == null) { responseBuilder.status(HttpResponseStatus.NOT_FOUND); return CompletableFuture.completedFuture(responseBuilder.build()); } return CompletableFuture.supplyAsync(() -> { restCacheManager.getCacheManagerAdmin(request).removeCache(cacheName); responseBuilder.status(OK); return responseBuilder.build(); }, invocationHelper.getExecutor()); }
Source:
<code>protected Server createServer(String serverName) { List<Hdd.CreateHdd> hdds = new ArrayList<Hdd.CreateHdd>(); Hdd.CreateHdd hdd = Hdd.CreateHdd.create(30, Boolean.TRUE); hdds.add(hdd); Hardware.CreateHardware hardware = Hardware.CreateHardware.create(4.0, 1.0, 2.0, hdds); return api.serverApi().create(Server.CreateServer.create(serverName, "testing with jclouds", hardware, "81504C620D98BCEBAA5202D145203B4B", "908DC2072407C94C8054610AD5A53B8C", <START> "Test123!", null, Boolean.TRUE, null, null, null, null) <END> ); }</code><technical_language>Consider a builder here</technical_language>

Target:
protected Server createServer(String serverName) { List<Hdd.CreateHdd> hdds = new ArrayList<Hdd.CreateHdd>(); Hdd.CreateHdd hdd = Hdd.CreateHdd.create(30, Boolean.TRUE); hdds.add(hdd); Hardware.CreateHardware hardware = Hardware.CreateHardware.create(4.0, 1.0, 2.0, hdds); return api.serverApi().create(Server.CreateServer.builder() .name(serverName) .description("testing with jclouds") .hardware(hardware) .applianceId("81504C620D98BCEBAA5202D145203B4B") .dataCenterId("908DC2072407C94C8054610AD5A53B8C") .password("Test123!") .powerOn(Boolean.TRUE).build()); }
Source:
<code>public void testRunStarted(Description description){ <START> Log.i("run started", description.getDisplayName()); <END> }</code><technical_language>Upper case R Run in log message</technical_language>

Target:
public void testRunStarted(Description description){ Log.i("Run started", description.getDisplayName()); }
Source:
<code>public static void setSelector(Service target, String key, String value) { ServiceSpec spec = target.getSpec(); if (spec == null) { <START> target.setSpec(spec = new ServiceSpec()); <END> } HashMap<String, String> selector = new HashMap<>(); selector.put(key, value); spec.setSelector(selector); }</code><technical_language>Is single saved line worth worsened readability</technical_language>

Target:
public static void setSelector(Service target, String key, String value) { ServiceSpec spec = target.getSpec(); if (spec == null) { spec = new ServiceSpec(); target.setSpec(spec); } HashMap<String, String> selector = new HashMap<>(); selector.put(key, value); spec.setSelector(selector); }
Source:
<code><START> public TokenStream testBadSetup() throws IOException { <END> Tokenizer tok = new StandardTokenizer(); TokenStream ts = new StopFilter(tok, FrenchAnalyzer.getDefaultStopSet()); ts = new ASCIIFoldingFilter(ts, false); ts = new PreserveOriginalFilter(ts); return ts; }</code><technical_language>A non-void @Test method? I is valid. intent is though..</technical_language>

Target:
public void testBadSetup() throws IOException { try (Analyzer a = new Analyzer() { @Override protected TokenStreamComponents createComponents(String fieldName) { Tokenizer tok = new StandardTokenizer(); TokenStream ts = new StopFilter(tok, FrenchAnalyzer.getDefaultStopSet()); ts = new ASCIIFoldingFilter(ts, false); ts = new PreserveOriginalFilter(ts); return new TokenStreamComponents(tok, ts); } }) { a.tokenStream("", ""); } }
Source:
<code>protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { try { if (ex instanceof IllegalArgumentException) { return handleIllegalArgument((IllegalArgumentException) ex, request, response, handler); } else if (ex instanceof ValidationException) { return handleValidation((ValidationException) ex, request, response, handler); } else if (ex instanceof NotFoundException) { return handleNotFound((NotFoundException) ex, request, response, handler); } else if (ex instanceof NotImplementedException) { return handleNotImplemented((NotImplementedException) ex, request, response, handler); } } catch (Exception handlerException) { <START> logger.warn("Handling of [" + ex.getClass().getName() + "] resulted in Exception", handlerException); <END> } return null; }</code><technical_language>exception while resolving exception (INCEPTION)? Is warn right log level? error</technical_language>

Target:
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { try { if (ex instanceof IllegalArgumentException) { return handleIllegalArgument((IllegalArgumentException) ex, request, response, handler); } else if (ex instanceof ValidationException) { return handleValidation((ValidationException) ex, request, response, handler); } else if (ex instanceof NotFoundException) { return handleNotFound((NotFoundException) ex, request, response, handler); } else if (ex instanceof NotImplementedException) { return handleNotImplemented((NotImplementedException) ex, request, response, handler); } } catch (Exception handlerException) { logger.error("Handling of [" + ex.getClass().getName() + "] resulted in Exception", handlerException); } return null; }
Source:
<code>public void transform(StructuredRecord input, Emitter<KeyValue<NullWritable, OrcStruct>> emitter) throws Exception { StringBuilder builder = new StringBuilder(); <START> HiveSchemaConverter.appendType(builder, input.getSchema()); <END> TypeDescription schema = TypeDescription.fromString(builder.toString()); OrcStruct pair = (OrcStruct) OrcStruct.createValue(schema); List<Schema.Field> fields = input.getSchema().getFields(); for (int i = 0; i < fields.size(); i++) { String fieldval = input.get(fields.get(i).getName()); pair.setFieldValue(fields.get(i).getName(), new Text(fieldval)); } emitter.emit(new KeyValue<NullWritable, OrcStruct>(NullWritable.get(), pair)); }</code><technical_language>this cheapest operation. In initialize method, calculate this, set a TypeDescription variable, re-use it</technical_language>

Target:
public void transform(StructuredRecord input, Emitter<KeyValue<NullWritable, OrcStruct>> emitter) throws Exception { emitter.emit(new KeyValue<>(NullWritable.get(), recordTransformer.transform(input, input.getSchema()))); }
Source:
<code>public void tearDown() { <START> if (artifact != null) { <END> artifact.purgeFromBranch(); } }</code><technical_language>purge takes long, delete</technical_language>

Target:
public void tearDown() { if (artifact != null) { artifact.delete(); } }
Source:
<code>private void loadChecksAndTestEntries(final List<StudyEntryDto> studyEntryDtoList, final List<StudyEntryDto> checkList, final List<StudyEntryDto> testEntryList) { <START> studyEntryDtoList.sort(Comparator.comparing(StudyEntryDto::getEntryNumber)); <END> for (final StudyEntryDto studyEntryDto : studyEntryDtoList) { final Optional<String> entryType = studyEntryDto.getStudyEntryPropertyValue(TermId.ENTRY_TYPE.getId()); if (entryType.isPresent()) { if (SystemDefinedEntryType.TEST_ENTRY.getEntryTypeCategoricalId() == Integer.valueOf(entryType.get())) { testEntryList.add(studyEntryDto); } else { checkList.add(studyEntryDto); } } } }</code><technical_language>I understand need perform sorting here. I expect StudyEntryServiceImpl#getStudyEntries return entries sorted entry number in fact I this code supposed do that: // Return ascending order of entry number. need perform cast uniquename stored string return this.getStudyEntries(studyId, null, new PageRequest(0, Integer.MAX_VALUE, new Sort(Sort.Direction.ASC, String.valueOf(TermId.ENTRY_NO.getId())))); Is that</technical_language>

Target:
void loadChecksAndTestEntries(final List<StudyEntryDto> studyEntryDtoList, final List<StudyEntryDto> checkList, final List<StudyEntryDto> testEntryList) { studyEntryDtoList.sort(Comparator.comparing(StudyEntryDto::getEntryNumber)); for (final StudyEntryDto studyEntryDto : studyEntryDtoList) { final Optional<String> entryType = studyEntryDto.getStudyEntryPropertyValue(TermId.ENTRY_TYPE.getId()); if (entryType.isPresent()) { if (SystemDefinedEntryType.TEST_ENTRY.getEntryTypeCategoricalId() == Integer.valueOf(entryType.get())) { testEntryList.add(studyEntryDto); } else { checkList.add(studyEntryDto); } } } }
Source:
<code><START> public static <T> RunnableFuture<T> wrap(RunnableFuture<T> rf) { <END> final Map<WeakReference<? extends ExecutorInheritableThreadLocal<?>>, Object> mapForNewThread = ExecutorInheritableThreadLocal.getMapForNewThread(); return new ForwardingRunnableFuture<T>(rf) { @Override public void run() { ConcurrentMap<WeakReference<? extends ExecutorInheritableThreadLocal<?>>, Object> oldMap = ExecutorInheritableThreadLocal.installMapOnThread(mapForNewThread); try { super.run(); } finally { ExecutorInheritableThreadLocal.uninstallMapOnThread(oldMap); } } }; }</code><technical_language>I this method, wrap safe</technical_language>

Target:
public static <T> RunnableFuture<T> wrap(RunnableFuture<T> rf) { Runnable wrappedRunnable = wrapRunnable(rf); return new ForwardingRunnableFuture<>(wrappedRunnable, rf); }
Source:
<code>public void actionPerformed(AnActionEvent e) { Project project = e.getProject(); if (project == null) { return; } SonarLintSubmitter submitter = SonarLintUtils.get(project, SonarLintSubmitter.class); VirtualFile selectedFile = SonarLintUtils.get(SonarLintAppUtils.class).getSelectedFile(project); if (selectedFile == null) { <START> SonarLintUtils.get(project, SonarLintConsole.class).error("No filesPerModule for analysis"); <END> return; } submitter.submitFiles(Collections.singleton(selectedFile), TriggerType.ACTION, executeBackground(e)); }</code><technical_language>oops ;-)</technical_language>

Target:
public void actionPerformed(AnActionEvent e) { Project project = e.getProject(); if (project == null) { return; } SonarLintSubmitter submitter = SonarLintUtils.get(project, SonarLintSubmitter.class); VirtualFile selectedFile = SonarLintUtils.get(SonarLintAppUtils.class).getSelectedFile(project); if (selectedFile == null) { SonarLintUtils.get(project, SonarLintConsole.class).error("No files for analysis"); return; } submitter.submitFiles(Collections.singleton(selectedFile), TriggerType.ACTION, executeBackground(e)); }
Source:
<code>public int compare(DSpaceObject dso1, DSpaceObject dso2) { if (dso1 == dso2){ return 0; }else if (dso1 == null){ return -1; }else if (dso2 == null){ return 1; }else { <START> return ObjectUtils.compare(dso1.getName(),dso2.getName()); <END> } }</code><technical_language>I suggest StringUtils.compareIgnoreCases(String, String) trim Strings convert small capital letters. Currently sorting community/collections ends in listing communities/collection A-Z starting capital letters listing communities/collection a-z starting small letters. I expect alphabetical sequence, two</technical_language>

Target:
public int compare(DSpaceObject dso1, DSpaceObject dso2) { if (dso1 == dso2){ return 0; }else if (dso1 == null){ return -1; }else if (dso2 == null){ return 1; }else { String name1 = StringUtils.trimToEmpty(dso1.getName()); String name2 = StringUtils.trimToEmpty(dso2.getName()); return name1.compareToIgnoreCase(name2); } }
Source:
<code>public HTMLNode getHTMLText() { HTMLNode content = new HTMLNode("div"); content.addChild("p", l10n("text")); content.addChild("p", frefFiles); HTMLNode form = content.addChild("form", new String[] {"action", "method"}, new String[] {"/friends/", "post"}); form.addChild("input", new String[] {"type", "name", "value"}, new String[] {"hidden", "formPassword", node.clientCore.formPassword}); form.addChild("input", new String[] {"type", "name", "value"}, new String[] {"hidden", "peers-offers-files", "true"}); <START> ConnectionsToadlet.drawPeerTrustInputForAddPeerBox(form); <END> ConnectionsToadlet.drawPeerVisibilityInputForAddPeerBox(form); form.addChild("input", new String[] {"type", "name", "value"}, new String[] {"submit", "add", "Connect"}); return content; }</code><technical_language>this method live in toadlet if well</technical_language>

Target:
public HTMLNode getHTMLText() { HTMLNode content = new HTMLNode("div"); content.addChild("p", l10n("text")); content.addChild("p", frefFiles); HTMLNode form = content.addChild("form", new String[] {"action", "method"}, new String[] {"/friends/", "post"}); form.addChild("input", new String[] {"type", "name", "value"}, new String[] {"hidden", "formPassword", node.clientCore.formPassword}); form.addChild("input", new String[] {"type", "name", "value"}, new String[] {"hidden", "peers-offers-files", "true"}); form.addChild(new PeerTrustInputForAddPeerBoxNode("DarknetConnectionsToadlet.")); form.addChild(new PeerVisibilityInputForAddPeerBoxNode("DarknetConnectionsToadlet.")); form.addChild("input", new String[] {"type", "name", "value"}, new String[] {"submit", "add", "Connect"}); return content; }
Source:
<code>private ArrayList<StorageType> getStorageTypesList(String storageTypesString) throws SQLException { List<String> splitTypes = split(storageTypesString); if (splitTypes == null) { return null; } ArrayList<StorageType> types = new ArrayList<>(splitTypes.size()); for (String typeStr : splitTypes) { try { types.add(StorageType.forValue(Integer.parseInt(typeStr))); } catch (NumberFormatException e) { <START> throw new SQLException("Could not parse disk image storage domain type " + typeStr); <END> } } return types; }</code><technical_language>add e argument</technical_language>

Target:
private ArrayList<StorageType> getStorageTypesList(String storageTypesString) throws SQLException { List<String> splitTypes = split(storageTypesString); if (splitTypes == null) { return null; } ArrayList<StorageType> types = new ArrayList<>(splitTypes.size()); for (String typeStr : splitTypes) { try { types.add(StorageType.forValue(Integer.parseInt(typeStr))); } catch (NumberFormatException e) { throw new SQLException("Could not parse disk image storage domain type " + typeStr, e); } } return types; }
Source:
<code>public VoltTable[] run( String targetStream, int pkey ) { if (targetStream.equals("S_ALLOW_NULLS_REPL")) { voltQueueSQL(i_insert_select_repl); } else if (targetStream.equals("S_ALLOW_NULLS")) { voltQueueSQL(i_insert_select_part); } else { assert(false); <START> throw new RuntimeException("Don't call this."); <END> } return voltExecuteSQL(); }</code><technical_language>Unreachable stmt</technical_language>

Target:
public VoltTable[] run( String targetStream, int pkey ) { if (targetStream.equals("S_ALLOW_NULLS_REPL")) { voltQueueSQL(i_insert_select_repl); } else if (targetStream.equals("S_ALLOW_NULLS")) { voltQueueSQL(i_insert_select_part); } else { throw new RuntimeException("Don't call this."); } return voltExecuteSQL(); }
Source:
<code>public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config == null) { return; } validateKeyPatternsInConfig(config); stick = setupStick(config); if (stick != null) { setupNonStickDevices(config); setProperlyConfigured(true); } else { <START> logger.error("Plugwise needs at least one Stick in order to operate"); <END> } }</code><technical_language>This a logger.warn, logger.error is reserved for messages affect system stability</technical_language>

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config == null) { return; } validateKeyPatternsInConfig(config); stick = setupStick(config); if (stick != null) { setupNonStickDevices(config); setProperlyConfigured(true); } else { logger.warn("Plugwise needs at least one Stick in order to operate"); } }
Source:
<code>public void handleGetMbusEncryptionKeyStatusByChannelResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetMbusEncryptionKeyStatusByChannelResponseDto getMbusEncryptionKeyStatusByChannelResponseDto) { LOGGER.info("handleGetMbusEncryptionKeyStatusByChannelResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); final EncryptionKeyStatusType encryptionKeyStatusType = EncryptionKeyStatusType .valueOf(getMbusEncryptionKeyStatusByChannelResponseDto.getEncryptionKeyStatus().name()); this.webServiceResponseMessageSender.send( <START> ResponseMessage.newResponseMessageBuilder() <END> .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()) .withResult(resultType).withOsgpException(exception).withDataObject(encryptionKeyStatusType) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
public void handleGetMbusEncryptionKeyStatusByChannelResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetMbusEncryptionKeyStatusByChannelResponseDto getMbusEncryptionKeyStatusByChannelResponseDto) { LOGGER.info("handleGetMbusEncryptionKeyStatusByChannelResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); final EncryptionKeyStatusType encryptionKeyStatusType = EncryptionKeyStatusType .valueOf(getMbusEncryptionKeyStatusByChannelResponseDto.getEncryptionKeyStatus().name()); ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()) .withResult(resultType).withOsgpException(exception).withDataObject(encryptionKeyStatusType) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send( responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
<code>@Test public void logSuccessfulRequestResponseOnDebugWhenResponseBodyPresent() throws Exception { final List<String> logMessages = new ArrayList<String>(); RestAdapter.Log log = new RestAdapter.Log() { public void log(String message) { logMessages.add(message); } }; Example example = new RestAdapter.Builder() .setClient(mockClient) .setExecutors(mockRequestExecutor, mockCallbackExecutor) .setServer("<LINK_1>") .setProfiler(mockProfiler) .setLog(log) .setDebug(true) .build() .create(Example.class); when(mockClient.execute(any(Request.class))) .thenReturn(new Response(200, "OK", NO_HEADERS, new TypedString("{}"))); example.something(); <START> assertThat(logMessages.size()).isEqualTo(5); <END> assertThat(logMessages.get(0)).isEqualTo("---> HTTP GET <LINK_0>"); assertThat(logMessages.get(1)).isEqualTo("---> END HTTP (0-byte body)"); assertThat(logMessages.get(2)).matches("<--- HTTP 200 <LINK_0> \\([0-9]+ms\\)"); assertThat(logMessages.get(3)).isEqualTo("{}"); assertThat(logMessages.get(4)).isEqualTo("<--- END HTTP (2-byte body)"); }</code><technical_language>hasSize(5)</technical_language>

Target:
@Test public void logSuccessfulRequestResponseOnDebugWhenResponseBodyPresent() throws Exception { final List<String> logMessages = new ArrayList<String>(); RestAdapter.Log log = new RestAdapter.Log() { public void log(String message) { logMessages.add(message); } }; Example example = new RestAdapter.Builder() .setClient(mockClient) .setExecutors(mockRequestExecutor, mockCallbackExecutor) .setServer("<LINK_1>") .setProfiler(mockProfiler) .setLog(log) .setDebug(true) .build() .create(Example.class); when(mockClient.execute(any(Request.class))) .thenReturn(new Response(200, "OK", NO_HEADERS, new TypedString("{}"))); example.something(); assertThat(logMessages).hasSize(5); assertThat(logMessages.get(0)).isEqualTo("---> HTTP GET <LINK_0>"); assertThat(logMessages.get(1)).isEqualTo("---> END HTTP (0-byte body)"); assertThat(logMessages.get(2)).matches("<--- HTTP 200 <LINK_0> \\([0-9]+ms\\)"); assertThat(logMessages.get(3)).isEqualTo("{}"); assertThat(logMessages.get(4)).isEqualTo("<--- END HTTP (2-byte body)"); }
Source:
<code>public BasicInvocationStage visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { updateTopologyId(command); if (ctx.isOriginLocal()) { <START> return invokeNext(ctx, command).compose(this::handleGeyKeysInGroupReturn); <END> } else { return invokeNext(ctx, command).thenAccept((rCtx, rCommand, rv) -> { GetKeysInGroupCommand cmd = (GetKeysInGroupCommand) rCommand; final int commandTopologyId = cmd.getTopologyId(); String groupName = cmd.getGroupName(); if (groupManager.isOwner(groupName) && currentTopologyId() != commandTopologyId) { throw new OutdatedTopologyException( "Cache topology changed while the command was executing: expected " + commandTopologyId + ", got " + currentTopologyId()); } }); } }</code><technical_language>I move if (ctx.isOriginLocal()) check handleGeyKeysInGroupReturn()</technical_language>

Target:
public BasicInvocationStage visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { updateTopologyId(command); if (ctx.isOriginLocal()) { return invokeNext(ctx, command).compose(this::handleLocalGetKeysInGroupReturn); } else { return invokeNext(ctx, command).thenAccept((rCtx, rCommand, rv) -> { GetKeysInGroupCommand cmd = (GetKeysInGroupCommand) rCommand; final int commandTopologyId = cmd.getTopologyId(); String groupName = cmd.getGroupName(); if (groupManager.isOwner(groupName) && currentTopologyId() != commandTopologyId) { throw new OutdatedTopologyException( "Cache topology changed while the command was executing: expected " + commandTopologyId + ", got " + currentTopologyId()); } }); } }
Source:
<code>private GroupAwareQueryManagerImpl(final ScheduledExecutorServiceWrapper schedulerWrapper, final QueryInfoStore planStore, final EventProcessorManager eventProcessorManager, final ConfigDagGenerator configDagGenerator, final MQTTResource mqttSharedResource, final KafkaSharedResource kafkaSharedResource, final NettySharedResource nettySharedResource, final DagGenerator dagGenerator, final GroupAllocationTableModifier groupAllocationTableModifier, final ApplicationMap applicationMap, final GroupMap groupMap, @Parameter(PeriodicCheckpointPeriod.class) final long checkpointPeriod) { this.scheduler = schedulerWrapper.getScheduler(); this.planStore = planStore; this.eventProcessorManager = eventProcessorManager; this.configDagGenerator = configDagGenerator; this.mqttSharedResource = mqttSharedResource; this.kafkaSharedResource = kafkaSharedResource; this.nettySharedResource = nettySharedResource; this.dagGenerator = dagGenerator; this.groupAllocationTableModifier = groupAllocationTableModifier; this.applicationMap = applicationMap; this.groupMap = groupMap; this.checkpointPeriod = checkpointPeriod; <START> if (checkpointPeriod == 0) { <END> LOG.log(Level.INFO, "checkpointing is not turned on"); } }</code><technical_language>adding this log message CheckpointManager</technical_language>

Target:
private GroupAwareQueryManagerImpl(final ScheduledExecutorServiceWrapper schedulerWrapper, final QueryInfoStore planStore, final EventProcessorManager eventProcessorManager, final ConfigDagGenerator configDagGenerator, final MQTTResource mqttSharedResource, final KafkaSharedResource kafkaSharedResource, final NettySharedResource nettySharedResource, final DagGenerator dagGenerator, final GroupAllocationTableModifier groupAllocationTableModifier, final ApplicationMap applicationMap, final GroupMap groupMap, @Parameter(PeriodicCheckpointPeriod.class) final long checkpointPeriod) { this.scheduler = schedulerWrapper.getScheduler(); this.planStore = planStore; this.eventProcessorManager = eventProcessorManager; this.configDagGenerator = configDagGenerator; this.mqttSharedResource = mqttSharedResource; this.kafkaSharedResource = kafkaSharedResource; this.nettySharedResource = nettySharedResource; this.dagGenerator = dagGenerator; this.groupAllocationTableModifier = groupAllocationTableModifier; this.applicationMap = applicationMap; this.groupMap = groupMap; this.checkpointPeriod = checkpointPeriod; }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getClusterId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (Guid.isNullOrEmpty(getParameters().getHookId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED); return false; <START> } <END> return true; }</code><technical_language>user enable a hook is enabled? if servers, command fail</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getClusterId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (Guid.isNullOrEmpty(getParameters().getHookId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED); return false; } List <VDS> servers = getAllUpServers(getParameters().getClusterId()); if (servers == null || servers.size() == 0) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_UP_SERVER_FOUND); return false; } return true; }
Source:
<code>public void setConf(final Configuration conf) { if (conf == null) { return; } final Lock readLock = configUpdateLock.readLock(); final Lock writeLock = configUpdateLock.writeLock(); writeLock.lock(); <START> readLock.lock(); <END> try { final boolean currentSplitEnabled = splitEnabled; final boolean currentMergeEnabled = mergeEnabled; final int currentMinRegionCount = minRegionCount; final Period currentMergeMinRegionAge = mergeMinRegionAge; final int currentMergeMinRegionSizeMb = mergeMinRegionSizeMb; this.conf = conf; splitEnabled = conf.getBoolean(SPLIT_ENABLED_KEY, DEFAULT_SPLIT_ENABLED); mergeEnabled = conf.getBoolean(MERGE_ENABLED_KEY, DEFAULT_MERGE_ENABLED); minRegionCount = parseMinRegionCount(conf); mergeMinRegionAge = parseMergeMinRegionAge(conf); mergeMinRegionSizeMb = parseMergeMinRegionSizeMb(conf); logConfigurationUpdated(SPLIT_ENABLED_KEY, currentSplitEnabled, splitEnabled); logConfigurationUpdated(MERGE_ENABLED_KEY, currentMergeEnabled, mergeEnabled); logConfigurationUpdated(MIN_REGION_COUNT_KEY, currentMinRegionCount, minRegionCount); logConfigurationUpdated( MERGE_MIN_REGION_AGE_DAYS_KEY, currentMergeMinRegionAge, mergeMinRegionAge); logConfigurationUpdated( MERGE_MIN_REGION_SIZE_MB_KEY, currentMergeMinRegionSizeMb, mergeMinRegionSizeMb); } finally { readLock.unlock(); writeLock.unlock(); } }</code><technical_language>is readLock.lock() called here? Thought writeLock is enough</technical_language>

Target:
public void setConf(final Configuration conf) { if (conf == null) { return; } normalizerConfiguration = new NormalizerConfiguration(conf, normalizerConfiguration); }
Source:
<code><START> public void shutdown() throws InterruptedException { <END> if (_zkClient != null) { _zkClient.close(); _reaper.shutdown(); } }</code><technical_language>return Promise symmetric start()..</technical_language>

Target:
public void shutdown() throws InterruptedException { if (_zkClient != null) { _zkClient.close(); } }
Source:
<code>public void contains() { final boolean result = U.contains(asList(1, 2, 3), 3); assertTrue(result); <START> final boolean resultObj = new U<>(asList(1, 2, 3)).contains(3); <END> assertTrue(resultObj); final boolean resultChain = U.chain(asList(1, 2, 3)).contains(3).item(); assertTrue(resultChain); final boolean result2 = U.contains(asList(1, 2, 3), 3, 1); assertTrue(result2); final boolean result3 = U.contains(asList(1, 2, 3), 1, 1); assertFalse(result3); final boolean result4 = U.contains(asList(1, 2, null), null); assertTrue(result4); final boolean result5 = U.containsAtLeast(asList(1, 2, 2), 2, 2); assertTrue(result5); final boolean result6 = U.containsAtLeast(asList(1, 2, 2), 3, 2); assertFalse(result6); final boolean result7 = U.containsAtMost(asList(1, 2, 2), 3, 2); assertTrue(result7); final boolean result8 = U.containsAtMost(asList(1, 2, 2), 1, 2); assertFalse(result8); final boolean result9 = new U<>(asList(1, 2, 2)).containsAtLeast(2, 2); assertTrue(result9); final boolean result10 = new U<>(asList(1, 2, 2)).containsAtLeast(3, 2); assertFalse(result10); final boolean result11 = new U<>(asList(1, 2, 2)).containsAtMost(2, 3); assertTrue(result11); final boolean result12 = new U<>(asList(1, 2, 2)).containsAtMost(1, 2); assertFalse(result12); }</code><technical_language>Source is java 6 compatible</technical_language>

Target:
public void contains() { final boolean result = U.contains(asList(1, 2, 3), 3); assertTrue(result); final boolean resultObj = new U<Integer>(asList(1, 2, 3)).contains(3); assertTrue(resultObj); final boolean resultChain = U.chain(asList(1, 2, 3)).contains(3).item(); assertTrue(resultChain); final boolean result2 = U.contains(asList(1, 2, 3), 3, 1); assertTrue(result2); final boolean result3 = U.contains(asList(1, 2, 3), 1, 1); assertFalse(result3); final boolean result4 = U.contains(asList(1, 2, null), null); assertTrue(result4); }
Source:
<code>private void updateStatsIfDone(TaskState newState) { if (newState.isDone()) { DateTime now = DateTime.now(); long majorGcCount = gcMonitor.getMajorGcCount(); long majorGcTime = gcMonitor.getMajorGcTime().roundTo(NANOSECONDS); executionStartTime.compareAndSet(null, now); startNanos.compareAndSet(0, System.nanoTime()); startFullGcCount.compareAndSet(0, majorGcCount); startFullGcTimeNanos.compareAndSet(0, majorGcTime); lastExecutionStartTime.compareAndSet(null, now); executionEndTime.compareAndSet(null, now); endNanos.compareAndSet(0, System.nanoTime()); endFullGcCount.compareAndSet(0, majorGcCount); <START> endFullGcTimeNanos.compareAndSet(0, majorGcTime); <END> } }</code><technical_language>compareAndSet</technical_language>

Target:
private void updateStatsIfDone(TaskState newState) { if (newState.isDone()) { DateTime now = DateTime.now(); long majorGcCount = gcMonitor.getMajorGcCount(); long majorGcTime = gcMonitor.getMajorGcTime().roundTo(NANOSECONDS); executionStartTime.compareAndSet(null, now); startNanos.compareAndSet(0, System.nanoTime()); startFullGcCount.compareAndSet(-1, majorGcCount); startFullGcTimeNanos.compareAndSet(-1, majorGcTime); lastExecutionStartTime.compareAndSet(null, now); executionEndTime.compareAndSet(null, now); endNanos.compareAndSet(0, System.nanoTime()); endFullGcCount.compareAndSet(-1, majorGcCount); endFullGcTimeNanos.compareAndSet(-1, majorGcTime); } }
Source:
<code><START> public void run() throws IOException, SQLException, InstantiationException, IllegalAccessException { <END> DBManager dbManager = new DBManager(config); try { dbManager.ensureJDBCDriverIsAvailable(driverClass); try (Connection connection = getConnection()) { if (!config.enableAutoCommit) { connection.setAutoCommit(false); } try (Statement statement = connection.createStatement()) { statement.execute(config.query); if (!config.enableAutoCommit) { connection.commit(); } } } } finally { dbManager.destroy(); } }</code><technical_language>IOException is redundant</technical_language>

Target:
public void run() throws SQLException, InstantiationException, IllegalAccessException { DBManager dbManager = new DBManager(config); try { dbManager.ensureJDBCDriverIsAvailable(driverClass); try (Connection connection = getConnection()) { if (!config.enableAutoCommit) { connection.setAutoCommit(false); } try (Statement statement = connection.createStatement()) { statement.execute(config.query); if (!config.enableAutoCommit) { connection.commit(); } } } } finally { dbManager.destroy(); } }
Source:
<code>public List<Label> createLabel(SubmitRecord record, HashMap<String, AccountInfo> value, String status) { List<Label> list = new ArrayList<Label>(); for (String str : value.keySet()) { <START> for (AccountInfo info : value.values()) { <END> Label label = new Label(); label.setLabel(str); label.setStatus(status); label.setAppliedBy(info.getId()); list.add(label); } } return list; }</code><technical_language>creating a label for key-value pair instead of pairs in map</technical_language>

Target:
public List<Label> createLabel(SubmitRecord record, HashMap<String, AccountInfo> value, String status) { List<Label> list = new ArrayList<Label>(); for (Map.Entry<String, AccountInfo> info : value.entrySet()) { Label label = new Label(); label.setLabel(info.getKey()); label.setStatus(status); label.setAppliedBy(info.getValue().getId()); list.add(label); } return list; }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_page, container, false); webView = (ObservableWebView) rootView.findViewById(R.id.page_web_view); <START> webView.addOnUpOrCancelMotionEventListener(new ObservableWebView.OnUpOrCancelMotionEventListener() { <END> @Override public void onUpOrCancelMotionEvent() { setToCButtonFadedIn(false); } }); webView.setOnFastScrollListener(new ObservableWebView.OnFastScrollListener() { @Override public void onFastScroll() { setToCButtonFadedIn(true); if (webView.getScrollY() > 0) { setToCButtonFadedIn(false); } } }); webView.addOnScrollChangeListener(new ObservableWebView.OnScrollChangeListener() { @Override public void onScrollChanged(int oldScrollY, int scrollY) { if (scrollY == 0) { setToCButtonFadedIn(true); } } }); tocDrawer = (WikiDrawerLayout) rootView.findViewById(R.id.page_toc_drawer); tocDrawer.setDragEdgeWidth(getResources().getDimensionPixelSize(R.dimen.drawer_drag_margin)); tocButton = (FloatingActionButton) rootView.findViewById(R.id.floating_toc_button); tocButton.setOnClickListener(tocButtonOnClickListener); refreshView = (SwipeRefreshLayoutWithScroll) rootView .findViewById(R.id.page_refresh_container); int swipeOffset = Utils.getActionBarSize(getActivity()); refreshView.setProgressViewOffset(true, -swipeOffset, swipeOffset); refreshView.setSize(SwipeRefreshLayout.LARGE); refreshView.setScrollableChild(webView); refreshView.setOnRefreshListener(pageRefreshListener); errorView = (WikiErrorView)rootView.findViewById(R.id.page_error); return rootView; }</code><technical_language>This line count add in a large method. Consider pulling this out initWebView()</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_page, container, false); webView = (ObservableWebView) rootView.findViewById(R.id.page_web_view); initWebViewListeners(); tocDrawer = (WikiDrawerLayout) rootView.findViewById(R.id.page_toc_drawer); tocDrawer.setDragEdgeWidth(getResources().getDimensionPixelSize(R.dimen.drawer_drag_margin)); tocButton = (FloatingActionButton) rootView.findViewById(R.id.floating_toc_button); tocButton.setOnClickListener(tocButtonOnClickListener); refreshView = (SwipeRefreshLayoutWithScroll) rootView .findViewById(R.id.page_refresh_container); int swipeOffset = Utils.getActionBarSize(getActivity()); refreshView.setProgressViewOffset(true, -swipeOffset, swipeOffset); refreshView.setSize(SwipeRefreshLayout.LARGE); refreshView.setScrollableChild(webView); refreshView.setOnRefreshListener(pageRefreshListener); errorView = (WikiErrorView)rootView.findViewById(R.id.page_error); return rootView; }
Source:
<code>private List<TestResult> filterTests(List<? extends TestResult> failedTests, String regexPattern) { <START> List<TestResult> filteredTests = failedTests.stream().collect(Collectors.toList()); <END> if(regexPattern.length() != 0) { Pattern pattern = Pattern.compile(regexPattern); filteredTests = filteredTests.stream().filter(t -> pattern.matcher(t.getFullName()).matches()).collect(Collectors.toList()); } return filteredTests; }</code><technical_language>This I is unnecessary, input is a List</technical_language>

Target:
private List<? extends TestResult> filterTests(List<? extends TestResult> failedTests, String regexPattern) { if(regexPattern.length() != 0) { Pattern pattern = Pattern.compile(regexPattern); failedTests = failedTests.stream().filter(t -> pattern.matcher(t.getFullName()).matches()).collect(Collectors.toList()); } return failedTests; }