auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String format(LocalDate value) { if (value == null) return "NULL"; <START> return "'" + ISO_LOCAL_DATE.format(value) + "'"; <END> }</code><technical_language>PraseUtils.quote good for this</technical_language>

Target:
public String format(LocalDate value) { if (value == null) return "NULL"; return quote(ISO_LOCAL_DATE.format(value)); }
Source:
<code>private synchronized void createResults() { if (d_results.getNumberOfSamples() < 2) return; d_quantiles = new double[3]; d_quantiles[1] = RANDOM.nextDouble() * 4 - 2; d_quantiles[2] = d_quantiles[1] + RANDOM.nextDouble() * 1.5; <START> d_quantiles[0] = d_quantiles[2] - d_quantiles[1]; <END> d_defined = true; firePropertyChange(PROPERTY_DEFINED, null, d_defined); }</code><technical_language>I this d_quantiles[1] - (d_quantiles[2] - d_quantiles[1]);</technical_language>

Target:
private synchronized void createResults() { if (d_results.getNumberOfSamples() < 2) return; d_quantiles = new double[3]; d_quantiles[1] = RANDOM.nextDouble() * 4 - 2; d_quantiles[2] = d_quantiles[1] + RANDOM.nextDouble() * 1.5; d_quantiles[0] = d_quantiles[1] - (d_quantiles[2] - d_quantiles[1]); d_defined = true; firePropertyChange(PROPERTY_DEFINED, null, d_defined); }
Source:
<code>public void onCacheEvent(CacheEntryEvent<byte[], byte[]> event) { if (isSendEvent(event)) { long version; Metadata metadata; if ((metadata = event.getMetadata()) != null && metadata.version() != null) { version = ((NumericVersion) metadata.version()).getVersion(); } else { version = 0; } Object k = event.getKey(); Object v = event.getValue(); <START> if (keyDataConversion.isStorageFormatFilterable() && k != null) { <END> k = keyDataConversion.fromStorage(k); } if (valueDataConversion.isStorageFormatFilterable() && v != null) { v = valueDataConversion.fromStorage(v); } sendEvent((byte[]) k, (byte[]) v, version, event); } }</code><technical_language>is necessary test is null ? fromStorage checks</technical_language>

Target:
public void onCacheEvent(CacheEntryEvent<byte[], byte[]> event) { if (isSendEvent(event)) { long version; Metadata metadata; if ((metadata = event.getMetadata()) != null && metadata.version() != null) { version = ((NumericVersion) metadata.version()).getVersion(); } else { version = 0; } Object k = event.getKey(); Object v = event.getValue(); if (keyDataConversion.isStorageFormatFilterable()) { k = keyDataConversion.fromStorage(k); } if (valueDataConversion.isStorageFormatFilterable()) { v = valueDataConversion.fromStorage(v); } sendEvent((byte[]) k, (byte[]) v, version, event); } }
Source:
<code><START> public Tuple<Integer, String> getBonusType() { <END> return bonusType; }</code><technical_language>encourage lombok here, in case need update getter</technical_language>

Target:
public BonusType getBonusType() { return bonusType; }
Source:
<code>private AutoCompletionCandidates doAutoCompleteBranchesSpec(final Job<?, ?> job, @QueryParameter final String value) { String query = value.toLowerCase(); final AutoCompletionCandidates ac = new AutoCompletionCandidates(); List<String> values = ac.getValues(); try { List<String> branches = this.getProjectBranches(job); if (query.length() < 2){ values.addAll(branches); } else { for (String branch : branches){ if (branch.toLowerCase().indexOf(query) > -1){ values.add(branch); } } } } catch (final IllegalStateException ex) { <START> LOGGER.log(Level.FINEST, "Ka-Boom!", ex); <END> } catch (final IOException ex) { LOGGER.log(Level.FINEST, "Ka-Boom!", ex); } return ac; }</code><technical_language>put a more informative log message here? :)</technical_language>

Target:
private AutoCompletionCandidates doAutoCompleteBranchesSpec(final Job<?, ?> job, @QueryParameter final String value) { String query = value.toLowerCase(); final AutoCompletionCandidates ac = new AutoCompletionCandidates(); List<String> values = ac.getValues(); try { List<String> branches = this.getProjectBranches(job); if (query.length() < 2){ values.addAll(branches); } else { for (String branch : branches){ if (branch.toLowerCase().indexOf(query) > -1){ values.add(branch); } } } } catch (final IllegalStateException ex) { LOGGER.log(Level.FINEST, "Unexpected IllegalStateException. Please check the logs and your configuration.", ex); } catch (final IOException ex) { LOGGER.log(Level.FINEST, "Unexpected IllegalStateException. Please check the logs and your configuration.", ex); } return ac; }
Source:
<code><START> public static UdpOutboundChannelAdapterSpec outboundAdapter(String destinationExpression) { <END> return new UdpOutboundChannelAdapterSpec(destinationExpression); }</code><technical_language>UnicastSendingMessageHandler(String host, int port) variant factory? Expression Function variants well</technical_language>

Target:
public static UdpUnicastOutboundChannelAdapterSpec outboundAdapter(String destinationExpression) { return new UdpUnicastOutboundChannelAdapterSpec(destinationExpression); }
Source:
<code>private boolean shouldRunControl(ResultSetNode resultSet) throws StandardException { DataSetProcessorType type = getCompilerContext().getDataSetProcessorType(); if (type.isForced()) { return (!type.isSpark()); } <START> resultSet.getFromList().verifyProperties(getDataDictionary()); <END> CollectNodesVisitor cnv = new CollectNodesVisitor(FromTable.class); resultSet.accept(cnv); for (Object obj : cnv.getList()) { type = type.combine(((FromTable) obj).getDataSetProcessorType()); } getCompilerContext().setDataSetProcessorType(type); return !type.isSpark(); }</code><technical_language>I call verifyProperties() moved for loop line 203, call touches tables in top level Select, tables in nested SELECT nodes</technical_language>

Target:
private boolean shouldRunControl(ResultSetNode resultSet) throws StandardException { DataSetProcessorType type = getCompilerContext().getDataSetProcessorType(); if (type.isForced()) { return (!type.isSpark()); } CollectNodesVisitor cnv = new CollectNodesVisitor(FromTable.class); resultSet.accept(cnv); for (Object obj : cnv.getList()) { FromTable ft = (FromTable) obj; ft.verifyProperties(getDataDictionary()); type = type.combine(ft.getDataSetProcessorType()); } getCompilerContext().setDataSetProcessorType(type); return !type.isSpark(); }
Source:
<code>private int writeBatch(final OutputStream outputStream, final Partition.PartitionKey partitionKey, final long offset, final List<byte[]> events, final Optional<String> metadata) throws IOException { final Timeline timeline = getContext().getTimelinesForTopics().get(partitionKey.getTopic()); final String token = getContext().getCursorTokenService().generateToken(); final SubscriptionCursor cursor = getContext().getCursorConverter().convert( partitionKey.createKafkaCursor(offset).toNakadiCursor(timeline), token); final String cursorSerialized = getContext().getObjectMapper().writeValueAsString(cursor); final CountingOutputStream countingOutputStream = new CountingOutputStream(outputStream) { @Override public void flush() throws IOException { } }; final Writer writer = new OutputStreamWriter(countingOutputStream); writer.write("{\"cursor\":"); writer.write(cursorSerialized); if (!events.isEmpty()) { writer.write(",\"events\":["); writer.flush(); boolean first = true; for (final byte[] event : events) { if (!first) { countingOutputStream.write(','); } countingOutputStream.write(event); first = false; } countingOutputStream.write(']'); } if (metadata.isPresent()) { writer.write(",\"info\":{\"debug\":\""); writer.write(metadata.get()); writer.write("\"}"); writer.flush(); } <START> writer.append("}").append(EventStream.BATCH_SEPARATOR); <END> writer.flush(); outputStream.flush(); return countingOutputStream.getCount(); }</code><technical_language>append write</technical_language>

Target:
private int writeBatch(final OutputStream outputStream, final Partition.PartitionKey partitionKey, final long offset, final List<byte[]> events, final Optional<String> metadata) throws IOException { final Timeline timeline = getContext().getTimelinesForTopics().get(partitionKey.getTopic()); final String token = getContext().getCursorTokenService().generateToken(); final SubscriptionCursor cursor = getContext().getCursorConverter().convert( partitionKey.createKafkaCursor(offset).toNakadiCursor(timeline), token); final String cursorSerialized = getContext().getObjectMapper().writeValueAsString(cursor); final CountingOutputStream countingOutputStream = new CountingOutputStream(outputStream) { @Override public void flush() throws IOException { } }; final Writer writer = new OutputStreamWriter(countingOutputStream, UTF_8); writer.write("{\"cursor\":"); writer.write(cursorSerialized); if (!events.isEmpty()) { writer.write(",\"events\":["); writer.flush(); boolean first = true; for (final byte[] event : events) { if (!first) { countingOutputStream.write(','); } countingOutputStream.write(event); first = false; } countingOutputStream.write(']'); } if (metadata.isPresent()) { writer.write(",\"info\":{\"debug\":\""); writer.write(metadata.get()); writer.write("\"}"); writer.flush(); } writer.append("}").append(EventStream.BATCH_SEPARATOR); writer.flush(); outputStream.flush(); return countingOutputStream.getCount(); }
Source:
<code>public boolean setAndValidateQuota() { if (Guid.isNullOrEmpty(getDestinationQuotaId())) { Guid quotaId = <START> getQuotaManager().getFirstQuotaForUser( <END> getImage().getQuotaId(), getStoragePoolId(), getCurrentUser() ); getParameters().setQuotaId(quotaId); } QuotaValidator validator = createQuotaValidator(getDestinationQuotaId()); return validate(validator.isValid()) && validate(validator.isDefinedForStorageDomain(getParameters().getStorageDomainId())); }</code><technical_language>I think, in this case, getDefaultQuotaIfNull() remain here. This method setAndValidateQuota() sets quota for new storage domain. depend user is moving disk. a user move a disk VM portal</technical_language>

Target:
public boolean setAndValidateQuota() { if (Guid.isNullOrEmpty(getDestinationQuotaId())) { Guid quotaId = getQuotaManager().getDefaultQuotaIfNull( getImage().getQuotaId(), getStoragePoolId() ); getParameters().setQuotaId(quotaId); } QuotaValidator validator = createQuotaValidator(getDestinationQuotaId()); return validate(validator.isValid()) && validate(validator.isDefinedForStorageDomain(getParameters().getStorageDomainId())); }
Source:
<code>private void handleTagDeleted(ContentTagDeletedEvent evt) { if (evt.getDeletedTagInfo() == null) { LOGGER.log(Level.SEVERE, "ContentTagDeletedEvent did not have valid content to provide a content id."); return; } try { Content content = Case.getCurrentCaseThrows().getSleuthkitCase().getContentById(evt.getDeletedTagInfo().getContentID()); if (content == null) { LOGGER.log(Level.WARNING, String.format("Unable to get content for item with content id: %d.", evt.getDeletedTagInfo().getContentID())); return; } handleTagChange(content); } catch (NoCurrentCaseException | TskCoreException ex) { <START> Long contentID = (evt != null && evt.getDeletedTagInfo() != null) ? evt.getDeletedTagInfo().getContentID() : null; <END> LOGGER.log(Level.WARNING, "Error updating non-file object: " + contentID, ex); } }</code><technical_language>Is this check necessary? evt.getDeletedTagInfo() is null, call getContentID() throw exception</technical_language>

Target:
private void handleTagDeleted(ContentTagDeletedEvent evt) { if (evt.getDeletedTagInfo() == null) { LOGGER.log(Level.SEVERE, "ContentTagDeletedEvent did not have valid content to provide a content id."); return; } try { Content content = Case.getCurrentCaseThrows().getSleuthkitCase().getContentById(evt.getDeletedTagInfo().getContentID()); if (content == null) { LOGGER.log(Level.WARNING, String.format("Unable to get content for item with content id: %d.", evt.getDeletedTagInfo().getContentID())); return; } handleTagChange(content); } catch (NoCurrentCaseException | TskCoreException ex) { LOGGER.log(Level.WARNING, "Error updating non-file object: " + evt.getDeletedTagInfo().getContentID(), ex); } }
Source:
<code>private void checkAuthorization(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { if (isAuthorized(request)) { chain.doFilter(request, response); } else { <START> LOG.warn("CapAssetInventoryApi unauthorized " + request.getMethod() + " " + request.getPathInfo()); <END> response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); response.getWriter().println(new Gson().toJson(CuCamsConstants.CapAssetApi.UNAUTHORIZED)); } }</code><technical_language>Method name is missing log message</technical_language>

Target:
private void checkAuthorization(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { if (isAuthorized(request)) { chain.doFilter(request, response); } else { LOG.warn("CapAssetInventoryApi checkAuthorization unauthorized " + request.getMethod() + " " + request.getPathInfo()); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); response.getWriter().println(new Gson().toJson(CuCamsConstants.CapAssetApi.UNAUTHORIZED)); } }
Source:
<code>Object[][] TrueFalse() { return new Object[][]{ <START> new Object[]{true}, <END> new Object[]{false}, }; }</code><technical_language>unnecessary array new: {{true}, {false}} work</technical_language>

Target:
Object[][] TrueFalse() { return new Object[][]{ {true}, {false}, }; }
Source:
<code>private UrlSelectorImpl( ImmutableList<HttpUrl> baseUrls, boolean reshuffle, Duration failedUrlCooldown, Clock clock) { Preconditions.checkArgument(!baseUrls.isEmpty(), "Must specify at least one URL"); Preconditions.checkArgument(!failedUrlCooldown.isNegative(), "Cache expiration must be non-negative"); if (reshuffle) { Duration jitter = Duration.ofSeconds(ThreadLocalRandom.current().nextLong(-30, 30)); this.baseUrls = Suppliers.memoizeWithExpiration( () -> shuffle(baseUrls), RANDOMIZE.plus(jitter).toMillis(), TimeUnit.MILLISECONDS); } else { this.baseUrls = () -> baseUrls; } this.lastBaseUrl = new AtomicReference<>(baseUrls.get(0)); this.clock = clock; this.failedUrls = Caffeine.newBuilder() .executor(MoreExecutors.directExecutor()) .maximumSize(baseUrls.size()) <START> .build(key -> clock.instant().plus(failedUrlCooldown)); <END> this.useFailedUrlCache = !failedUrlCooldown.isNegative() && !failedUrlCooldown.isZero(); }</code><technical_language>This cache strange - I understand desirable a fixed expiry time for entry?? if a UrlSelectorImpl isntance lives for a long time</technical_language>

Target:
private UrlSelectorImpl( ImmutableList<HttpUrl> baseUrls, boolean reshuffle, Duration failedUrlCooldown, Clock clock) { Preconditions.checkArgument(!baseUrls.isEmpty(), "Must specify at least one URL"); Preconditions.checkArgument(!failedUrlCooldown.isNegative(), "Cache expiration must be non-negative"); if (reshuffle) { Duration jitter = Duration.ofSeconds(ThreadLocalRandom.current().nextLong(-30, 30)); this.baseUrls = Suppliers.memoizeWithExpiration( () -> shuffle(baseUrls), RANDOMIZE.plus(jitter).toMillis(), TimeUnit.MILLISECONDS); } else { this.baseUrls = () -> baseUrls; } this.lastBaseUrl = new AtomicReference<>(baseUrls.get(0)); this.clock = clock; this.failedUrlCooldown = failedUrlCooldown; this.failedUrls = new ConcurrentHashMap<>(baseUrls.size()); this.useFailedUrlCache = !failedUrlCooldown.isNegative() && !failedUrlCooldown.isZero(); }
Source:
<code>public void run() { connectionTimeout = config.getConnectionTimeout(); poolElf.setValidationTimeout(config.getValidationTimeout()); leakTask.updateLeakDetectionThreshold(config.getLeakDetectionThreshold()); final long now = clockSource.currentTime(); final long idleTimeout = config.getIdleTimeout(); if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); previous = now; softEvictConnections(); fillPool(); return; } else { previous = now; } logPoolState("Before cleanup "); final List<PoolBagEntry> bag = connectionBag.values(STATE_NOT_IN_USE); int removable = bag.size() - config.getMinimumIdle(); for (PoolBagEntry bagEntry : bag) { if (removable <= 0) { break; } if (connectionBag.reserve(bagEntry)) { if (idleTimeout > 0L && clockSource.elapsedMillis(bagEntry.lastAccess, now) > idleTimeout) { <START> closeConnection(bagEntry, "(connection passed idleTimeout)"); <END> removable--; } else { connectionBag.unreserve(bagEntry); } } } logPoolState("After cleanup "); fillPool(); }</code><technical_language>Ew, icky. Admitedly efficient ... bypassing reservation breaking loop. a microsecond of "spin" if pool 500 idle connections. Reads nicer: java for (PoolBagEntry bagEntry : bag) { if (removable > 0L && connectionBag.reserve(bagEntry)) { ... } }</technical_language>

Target:
public void run() { connectionTimeout = config.getConnectionTimeout(); poolElf.setValidationTimeout(config.getValidationTimeout()); leakTask.updateLeakDetectionThreshold(config.getLeakDetectionThreshold()); final long now = clockSource.currentTime(); final long idleTimeout = config.getIdleTimeout(); if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); previous = now; softEvictConnections(); fillPool(); return; } previous = now; logPoolState("Before cleanup\t"); final List<PoolBagEntry> bag = connectionBag.values(STATE_NOT_IN_USE); int removable = bag.size() - config.getMinimumIdle(); for (PoolBagEntry bagEntry : bag) { if (removable > 0 && idleTimeout > 0L && clockSource.elapsedMillis(bagEntry.lastAccess, now) > idleTimeout) { if (connectionBag.reserve(bagEntry)) { closeConnection(bagEntry, "(connection passed idleTimeout)"); removable--; } } } logPoolState("After cleanup\t"); fillPool(); }
Source:
<code>public void reset_shouldCleanupTempDirectories() { <START> ShadowEnvironment.getExternalStorageDirectory(); <END> ShadowEnvironment.getExternalStoragePublicDirectory(null); File c = ShadowEnvironment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); ShadowEnvironment.reset(); assertNull(ShadowEnvironment.EXTERNAL_CACHE_DIR); assertNull(ShadowEnvironment.EXTERNAL_FILES_DIR); assertThat(c).doesNotExist(); }</code><technical_language>Test Environment ShadowEnvironment</technical_language>

Target:
public void reset_shouldCleanupTempDirectories() { Environment.getExternalStorageDirectory(); Environment.getExternalStoragePublicDirectory(null); File c = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); ShadowEnvironment.reset(); assertNull(ShadowEnvironment.EXTERNAL_CACHE_DIR); assertNull(ShadowEnvironment.EXTERNAL_FILES_DIR); assertThat(c).doesNotExist(); }
Source:
<code>public void run(BrowserCommandWithAppRunner command) { try { this.app.start(); command.login(login()) .andThen((app, driver, wait) -> LOGGER.info("Test ===> {}.{}() has finished running.", Thread.currentThread().getStackTrace()[6].getClassName(), <START> Thread.currentThread().getStackTrace()[6].getMethodName())) <END> .run(this.app, this.driver, this.wait); } catch (Exception e) { throw new RuntimeException(e); } finally { if (this.driver != null) { this.driver.quit(); } if (this.app != null) { this.app.close(); } } }</code><technical_language>6 is good, if more methods in stack trace, change 7 8</technical_language>

Target:
public void run(BrowserCommandWithAppRunner command) { try { this.app.start(); command.login((app, driver) -> { WebDriverWait wait = new WebDriverWait(this.driver, 10); driver.get(app.root() + "oauth2/authorization/azure"); wait.until(presenceOfElementLocated(By.name("loginfmt"))) .sendKeys(this.username + Keys.ENTER); Thread.sleep(10000); driver.findElement(By.name("passwd")) .sendKeys(this.password + Keys.ENTER); Thread.sleep(10000); driver.findElement(By.cssSelector("input[type='submit']")).click(); Thread.sleep(10000); }).run(this.app, this.driver); } catch (Exception e) { throw new RuntimeException(e); } finally { if (this.driver != null) { this.driver.quit(); } if (this.app != null) { this.app.close(); } } }
Source:
<code>public JobIdData submitFromUrl(@HeaderParam("sessionid") String sessionId, @HeaderParam("link") String url, <START> @PathParam("path") PathSegment pathSegment, @Context UriInfo contextInfos) throws JobCreationRestException, <END> NotConnectedRestException, PermissionRestException, SubmissionClosedRestException, IOException { Scheduler s = checkAccess(sessionId, "jobs"); File tmpWorkflowFile = null; try { String jobXml = downloadWorkflowContent(sessionId, url); tmpWorkflowFile = File.createTempFile("job", "d"); JobId jobId; try (OutputStream outputStream = new FileOutputStream(tmpWorkflowFile)) { IOUtils.write(jobXml, outputStream, Charset.forName(FILE_ENCODING)); WorkflowSubmitter workflowSubmitter = new WorkflowSubmitter(s); Map genericInfos = null; if (contextInfos != null) genericInfos = getMapWithFirstValues(contextInfos.getQueryParameters()); jobId = workflowSubmitter.submit(tmpWorkflowFile, workflowVariablesTransformer.getWorkflowVariablesFromPathSegment(pathSegment), genericInfos); } return mapper.map(jobId, JobIdData.class); } catch (IOException e) { throw new IOException("Cannot save temporary job file on submission: " + e.getMessage(), e); } finally { FileUtils.deleteQuietly(tmpWorkflowFile); } }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove redundant '!unknownSymbol!' thrown exception declaration(s). [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public JobIdData submitFromUrl(@HeaderParam("sessionid") String sessionId, @HeaderParam("link") String url, @PathParam("path") PathSegment pathSegment, @Context UriInfo contextInfos) throws JobCreationRestException, NotConnectedRestException, PermissionRestException, SubmissionClosedRestException, IOException { Scheduler s = checkAccess(sessionId, "jobs"); File tmpWorkflowFile = null; try { String jobXml = downloadWorkflowContent(sessionId, url); tmpWorkflowFile = File.createTempFile("job", "d"); JobId jobId; try (OutputStream outputStream = new FileOutputStream(tmpWorkflowFile)) { IOUtils.write(jobXml, outputStream, Charset.forName(FILE_ENCODING)); Map<String, String> jobVariables = workflowVariablesTransformer.getWorkflowVariablesFromPathSegment(pathSegment); Map<String, String> genericInfos = null; if (contextInfos != null) genericInfos = getMapWithFirstValues(contextInfos.getQueryParameters()); WorkflowSubmitter workflowSubmitter = new WorkflowSubmitter(s); jobId = workflowSubmitter.submit(tmpWorkflowFile, jobVariables, genericInfos); } return mapper.map(jobId, JobIdData.class); } catch (IOException e) { throw new IOException("Cannot save temporary job file on submission: " + e.getMessage(), e); } finally { FileUtils.deleteQuietly(tmpWorkflowFile); } }
Source:
<code>public boolean isUnix() { <START> return File.pathSeparatorChar == ':'; <END> }</code><technical_language>Is this checking !Functions.isWindows()</technical_language>

Target:
public boolean isUnix() { return !Functions.isWindows(); }
Source:
<code>public FileLogSource(final File file) { this.file = file; try { <START> this.raf = new RandomAccessFile(file, "r"); <END> this.channel = this.raf.getChannel(); mapBuffer(0); } catch (IOException e) { throw new CantReadFromSourceException(e); } }</code><technical_language>some auto formatting basically adds "this." everywhere. it, for a noisy diff :-( This diff a 2 lines fix. need for incremental approach either, a trivial change. Making incremental PR delays acceptance</technical_language>

Target:
public FileLogSource(final File file) { this.file = file; try { raf = new RandomAccessFile(file, "r"); channel = raf.getChannel(); mapBuffer(0); } catch (IOException e) { throw new CantReadFromSourceException(e); } }
Source:
<code>public void addSecurityFilter(SecurityFilter filter) { if (filter == null) { throw new IllegalArgumentException("Cannot add null filter to chain."); } if (iterator != null) { throw new IllegalStateException("Cannot add filter to current running chain."); } <START> filters.add(0, filter); <END> LOGGER.debug("Added filter to filter chain.", filter.getClass().getName()); }</code><technical_language>filters.addFirst(filter) ? <LINK_0></technical_language>

Target:
public void addSecurityFilter(SecurityFilter filter) { if (filter == null) { throw new IllegalArgumentException("Cannot add null filter to chain."); } if (iterator != null) { throw new IllegalStateException("Cannot add filter to current running chain."); } filters.addFirst(filter); LOGGER.debug("Added filter to filter chain.", filter.getClass().getName()); }
Source:
<code>public RsXembly(final Node dom, final XeSource src) { super( <START> new RsOf( <END> () -> new RsWithType( new RsWithStatus( new RsEmpty(), HttpURLConnection.HTTP_OK ), "text/xml" ).head(), () -> RsXembly.render(dom, src) ) ); }</code><technical_language>@fanifieiev above</technical_language>

Target:
public RsXembly(final Node dom, final XeSource src) { super( new ResponseOf( () -> new RsWithType( new RsWithStatus( new RsEmpty(), HttpURLConnection.HTTP_OK ), "text/xml" ).head(), () -> RsXembly.render(dom, src) ) ); }
Source:
<code>public String getURL(){ int selectedPrefix = prefixURLSpinner.getSelectedItemPosition(); String url = profileLocation.getText().toString(); <START> if(url == null || url.length() == 0) return url; <END> if(selectedPrefix < prefixURLSpinner.getCount() - 1) { url = prefixURLSpinner.getSelectedItem() + "/" + url; } if(!url.startsWith("http")){ url = "http://" + url; } return url; }</code><technical_language>One-line conditional statements braces bug prone. Please wrap occurrences in braces</technical_language>

Target:
public String getURL(){ int selectedPrefix = prefixURLSpinner.getSelectedItemPosition(); String url = profileLocation.getText().toString(); if (url == null || url.length() == 0) { return url; } if(selectedPrefix < prefixURLSpinner.getCount() - 1) { url = prefixURLSpinner.getSelectedItem() + "/" + url; } if(!url.startsWith("http")){ url = "http://" + url; } return url; }
Source:
<code>private AsyncFuture<FetchData.Result> fetchBatch( final FetchQuotaWatcher watcher, final MetricType type, final List<PreparedQuery> prepared, final BigtableConnection c, final Consumer<MetricCollection> metricsConsumer ) { final BigtableDataClient client = c.dataClient(); final List<AsyncFuture<FetchData.Result>> fetches = new ArrayList<>(prepared.size()); for (final PreparedQuery p : prepared) { QueryTrace.NamedWatch fs = QueryTrace.watch(FETCH_SEGMENT); final AsyncFuture<List<FlatRow>> readRows = client.readRows(table, ReadRowsRequest .builder() .rowKey(p.request.getRowKey()) .filter(RowFilter.chain(Arrays.asList(RowFilter .newColumnRangeBuilder(p.request.getColumnFamily()) .startQualifierOpen(p.request.getStartQualifierOpen()) .endQualifierClosed(p.request.getEndQualifierClosed()) .build(), RowFilter.onlyLatestCell()))) .build()); final Function<FlatRow.Cell, Metric> transform = cell -> p.deserialize(cell.getQualifier(), cell.getValue()); fetches.add(readRows.directTransform(result -> { for (final FlatRow row : result) { watcher.readData(row.getCells().size()); final List<Metric> metrics = Lists.transform(row.getCells(), transform); metricsConsumer.accept(MetricCollection.build(type, metrics)); if (metrics.size() > 1) { <START> watcher.reportRowDensity(getDensity(metrics)); <END> } } return FetchData.result(fs.end()); })); } return async .collect(fetches, FetchData.collectResult(FETCH)) .onResolved(ignore -> watcher.accessedRows(prepared.size())); }</code><technical_language>Yeah, 1 well. desired goal values 'shift down' appropriately, replacing LONG.MAX_VALUE a way</technical_language>

Target:
private AsyncFuture<FetchData.Result> fetchBatch( final FetchQuotaWatcher watcher, final MetricType type, final List<PreparedQuery> prepared, final BigtableConnection c, final Consumer<MetricCollection> metricsConsumer ) { final BigtableDataClient client = c.dataClient(); final List<AsyncFuture<FetchData.Result>> fetches = new ArrayList<>(prepared.size()); for (final PreparedQuery p : prepared) { QueryTrace.NamedWatch fs = QueryTrace.watch(FETCH_SEGMENT); final AsyncFuture<List<FlatRow>> readRows = client.readRows(table, ReadRowsRequest .builder() .rowKey(p.request.getRowKey()) .filter(RowFilter.chain(Arrays.asList(RowFilter .newColumnRangeBuilder(p.request.getColumnFamily()) .startQualifierOpen(p.request.getStartQualifierOpen()) .endQualifierClosed(p.request.getEndQualifierClosed()) .build(), RowFilter.onlyLatestCell()))) .build()); final Function<FlatRow.Cell, Metric> transform = cell -> p.deserialize(cell.getQualifier(), cell.getValue()); fetches.add(readRows.directTransform(result -> { for (final FlatRow row : result) { watcher.readData(row.getCells().size()); final List<Metric> metrics = Lists.transform(row.getCells(), transform); metricsConsumer.accept(MetricCollection.build(type, metrics)); } return FetchData.result(fs.end()); })); } return async .collect(fetches, FetchData.collectResult(FETCH)) .onResolved(ignore -> watcher.accessedRows(prepared.size())); }
Source:
<code>public <K2, V2> LinkedHashMultimap<K2, V2> map(BiFunction<? super K, ? super V, Tuple2<K2, V2>> mapper) { <START> return null; END> }</code><technical_language>ah, ok, I multiple :)</technical_language>

Target:
public <K2, V2> LinkedHashMultimap<K2, V2> map(BiFunction<? super K, ? super V, Tuple2<K2, V2>> mapper) { return Multimaps.map(this, emptyInstance(), mapper); }
Source:
<code>private void logChangeStatusToConnecting(long timeoutToFence) { AuditLogableBase auditLogableBase = new AuditLogableBase(cachedVds.getId()); <START> AuditLogDirector.log(auditLogableBase, AuditLogType.VDS_HOST_RECONNECTING); <END> log.warn("Host '{}' is not responding. It will stay in Connecting state for a grace period " + "of seconds and after that an attempt to fence the host will be issued.", cachedVds.getName(), TimeUnit.MILLISECONDS.toSeconds(timeoutToFence)); AuditLogableBase logable = new AuditLogableBase(); logable.setVdsId(cachedVds.getId()); logable.addCustomValue("Seconds", Long.toString(TimeUnit.MILLISECONDS.toSeconds(timeoutToFence))); AuditLogDirector.log(logable, AuditLogType.VDS_HOST_NOT_RESPONDING_CONNECTING); }</code><technical_language>do add another audit log message VDS_HOST_NOT_RESPONDING_CONNECTING message in place</technical_language>

Target:
private void logChangeStatusToConnecting(long timeoutToFence) { AuditLogableBase auditLogableBase = new AuditLogableBase(cachedVds.getId()); AuditLogDirector.log(auditLogableBase, AuditLogType.VDS_HOST_RECONNECTING); log.warn("Host '{}' is not responding. It will stay in Connecting state for a grace period " + "of seconds and after that an attempt to fence the host will be issued.", cachedVds.getName(), TimeUnit.MILLISECONDS.toSeconds(timeoutToFence)); AuditLogableBase logable = new AuditLogableBase(); logable.setVdsId(cachedVds.getId()); logable.addCustomValue("Seconds", Long.toString(TimeUnit.MILLISECONDS.toSeconds(timeoutToFence))); auditLogDirector.log(logable, AuditLogType.VDS_HOST_NOT_RESPONDING_CONNECTING); }
Source:
<code>public void start(final ServiceProvider serviceProvider) { final ManagementRegistryService managementRegistry = serviceProvider.getService(ManagementRegistryService.class); final Context cmContext = managementRegistry.getConfiguration().getContext(); final CacheManager cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); <START> if (cacheManager instanceof ObservableCacheManager) { <END> final ObservableCacheManager observableCacheManager = (ObservableCacheManager)cacheManager; observableCacheManager.registerListener(new CacheManagerListener() { @Override public void cacheAdded(String alias, Cache<?, ?> cache) { } @Override public void cacheRemoved(String alias, Cache<?, ?> cache) { } @Override public void stateTransition(Status from, Status to) { switch (to) { case AVAILABLE: delegates.put(cmContext, managementRegistry); break; case UNINITIALIZED: delegates.remove(cmContext); observableCacheManager.deregisterListener(this); break; case MAINTENANCE: break; default: throw new AssertionError(to); } } }); } }</code><technical_language>above: if this evaluates false silently monitoring</technical_language>

Target:
public void start(final ServiceProvider serviceProvider) { final ManagementRegistryService managementRegistry = serviceProvider.getService(ManagementRegistryService.class); final Context cmContext = managementRegistry.getConfiguration().getContext(); final InternalCacheManager cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); cacheManager.registerListener(new CacheManagerListener() { @Override public void cacheAdded(String alias, Cache<?, ?> cache) { } @Override public void cacheRemoved(String alias, Cache<?, ?> cache) { } @Override public void stateTransition(Status from, Status to) { switch (to) { case AVAILABLE: delegates.put(cmContext, managementRegistry); break; case UNINITIALIZED: delegates.remove(cmContext); cacheManager.deregisterListener(this); break; case MAINTENANCE: break; default: throw new AssertionError(to); } } }); }
Source:
<code>private static String getExpression(EventPosition eventPosition) { final String isInclusiveFlag = eventPosition.isInclusive() ? "=" : ""; if (eventPosition.getOffset() != null) { return String.format( AmqpConstants.AMQP_ANNOTATION_FORMAT, OFFSET_ANNOTATION_NAME.getValue(), isInclusiveFlag, eventPosition.getOffset()); } if (eventPosition.getSequenceNumber() != null) { return String.format( AmqpConstants.AMQP_ANNOTATION_FORMAT, SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), isInclusiveFlag, eventPosition.getSequenceNumber()); } if (eventPosition.getEnqueuedDateTime() != null) { String ms; try { ms = Long.toString(eventPosition.getEnqueuedDateTime().toEpochMilli()); } catch (ArithmeticException ex) { <START> ms = Long.toString(Long.MAX_VALUE); <END> } return String.format( AmqpConstants.AMQP_ANNOTATION_FORMAT, ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue(), isInclusiveFlag, ms); } throw new IllegalArgumentException("No starting position was set."); }</code><technical_language>I if mask this exception. If user-provided event position is causing ArithmeticException fail create a consumer bubble exception. Thoughts</technical_language>

Target:
private String getExpression(EventPosition eventPosition) { final String isInclusiveFlag = eventPosition.isInclusive() ? "=" : ""; if (eventPosition.getOffset() != null) { return String.format( AmqpConstants.AMQP_ANNOTATION_FORMAT, OFFSET_ANNOTATION_NAME.getValue(), isInclusiveFlag, eventPosition.getOffset()); } if (eventPosition.getSequenceNumber() != null) { return String.format( AmqpConstants.AMQP_ANNOTATION_FORMAT, SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), isInclusiveFlag, eventPosition.getSequenceNumber()); } if (eventPosition.getEnqueuedDateTime() != null) { String ms; try { ms = Long.toString(eventPosition.getEnqueuedDateTime().toEpochMilli()); } catch (ArithmeticException ex) { throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.ROOT, "Event position for enqueued DateTime could not be parsed. Value: '%s'", eventPosition.getEnqueuedDateTime()), ex)); } return String.format(AmqpConstants.AMQP_ANNOTATION_FORMAT, ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue(), isInclusiveFlag, ms); } throw logger.logExceptionAsError(new IllegalArgumentException("No starting position was set.")); }
Source:
<code>synchronized public void process(WatchedEvent event) { KeeperState state = event.getState(); if (state == KeeperState.SyncConnected) { connected = true; syncConnected = true; } else if (state == KeeperState.ConnectedReadOnly) { <START> connected = true; <END> } else { connected = false; syncConnected = false; } notifyAll(); if (connected) { clientConnected.countDown(); } }</code><technical_language>in setting syncConnected false here</technical_language>

Target:
synchronized public void process(WatchedEvent event) { KeeperState state = event.getState(); if (state == KeeperState.SyncConnected) { connected = true; syncConnected = true; } else if (state == KeeperState.ConnectedReadOnly) { connected = true; syncConnected = false; } else { connected = false; syncConnected = false; } notifyAll(); if (connected) { clientConnected.countDown(); } }
Source:
<code>public void test() { <START> connect(); <END> Assert.assertEquals(jq("$innerLabel").text(), "someValue"); }</code><technical_language>Assert.assertTrue(jq("$innerLabel").exists()); Assert.assertEquals(jq("$innerLabel").text(), "someValue");</technical_language>

Target:
public void test() { connect(); Assert.assertTrue(jq("$innerLabel").exists()); Assert.assertEquals(jq("$innerLabel").text(), "someValue"); }
Source:
<code>private boolean validateVmSnapshotStatus() { SnapshotsValidator snapshotsValidator = getSnapshotsValidator(); for (Pair<VM, VmDevice> pair : getVmsWithVmDeviceInfoForDiskId()) { VM vm = pair.getFirst(); if (!validate(snapshotsValidator.vmNotInPreview(vm.getId())) || !validate(snapshotsValidator.vmNotDuringSnapshot(vm.getId()))) { <START> return false; <END> } } return true; }</code><technical_language>check vm active volume is attached vms a snapshot of disk is attached to. in case disk snapshot is attached other vm is down, care if vm is in preview (for example)</technical_language>

Target:
private boolean validateVmSnapshotStatus() { SnapshotsValidator snapshotsValidator = getSnapshotsValidator(); for (Pair<VM, VmDevice> pair : getVmsWithVmDeviceInfoForDiskId()) { VmDevice vmDevice = pair.getSecond(); if (vmDevice.getSnapshotId() == null) { VM vm = pair.getFirst(); if (!validate(snapshotsValidator.vmNotInPreview(vm.getId())) || !validate(snapshotsValidator.vmNotDuringSnapshot(vm.getId()))) { return false; } } } return true; }
Source:
<code>public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { Iterator<Element> it = diagram.getGraph().nodes().iterator(); Map<String, String> dataObjectsMap = new HashMap<>(); List<DomainViolation> violations = new ArrayList<>(); while (it.hasNext()) { Element element = it.next(); if (element.getContent() instanceof View && ((View) element.getContent()).getDefinition() instanceof DataObject) { DataObject dataObject = (DataObject) ((View) element.getContent()).getDefinition(); String name = dataObject.getName().getValue(); String type = dataObject.getType().getValue().getType(); String containedType = dataObjectsMap.get(name); if (containedType != null && !type.equals(containedType)) { <START> BPMNViolation bpmnViolation = new BPMNViolation("Data Object Exists with Same Name and Different Type: " + name, Violation.Type.WARNING, element.getUUID()); <END> violations.add(bpmnViolation); } else { dataObjectsMap.put(name, type); } if (!name.matches(ALLOWED_CHARS)) { BPMNViolation bpmnViolation = new BPMNViolation("Data Object with Invalid Name Exists: " + name, Violation.Type.WARNING, element.getUUID()); violations.add(bpmnViolation); } } } resultConsumer.accept(violations); }</code><technical_language>Missing I18n</technical_language>

Target:
public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { Iterator<Element> it = diagram.getGraph().nodes().iterator(); Map<String, String> dataObjectsMap = new HashMap<>(); List<DomainViolation> violations = new ArrayList<>(); while (it.hasNext()) { Element element = it.next(); if (element.getContent() instanceof View && ((View) element.getContent()).getDefinition() instanceof DataObject) { DataObject dataObject = (DataObject) ((View) element.getContent()).getDefinition(); String name = dataObject.getName().getValue(); String type = dataObject.getType().getValue().getType(); String containedType = dataObjectsMap.get(name); if (containedType != null && !type.equals(containedType)) { BPMNViolation bpmnViolation = new BPMNViolation(translationService.getValue(StunnerWidgetsConstants.MarshallingResponsePopup_DataObjectsSameNameDifferentType) + " : " + name, Violation.Type.WARNING, element.getUUID()); violations.add(bpmnViolation); } else { dataObjectsMap.put(name, type); } if (name.matches(ILLEGAL_CHARS)) { BPMNViolation bpmnViolation = new BPMNViolation(translationService.getValue(StunnerWidgetsConstants.MarshallingResponsePopup_dataObjectWithName) + ": " + name + " " + translationService.getValue(StunnerWidgetsConstants.MarshallingResponsePopup_dataObjectWithIllegalCharacters), Violation.Type.WARNING, element.getUUID()); violations.add(bpmnViolation); } if (!name.matches(ALLOWED_CHARS)) { BPMNViolation bpmnViolation = new BPMNViolation(translationService.getValue(StunnerWidgetsConstants.MarshallingResponsePopup_dataObjectWithInvalidName) + " : " + name, Violation.Type.WARNING, element.getUUID()); violations.add(bpmnViolation); } } } resultConsumer.accept(violations); }
Source:
<code>public PriorityLevel getPriorityLevel() { String value = getPriority(); <START> return (value != null) ? PriorityLevel.fromString(value) : null; <END> }</code><technical_language>This delegate attribute mapper</technical_language>

Target:
public PriorityLevel getPriorityLevel() { String valueLabel = getPriority(); if (valueLabel != null && PriorityLevel.isValidPriority(valueLabel)) { return PriorityLevel.fromString(valueLabel); } TaskAttribute attribute = taskData.getRoot().getMappedAttribute(TaskAttribute.PRIORITY); if (attribute != null) { return getTaskData().getAttributeMapper().getPriorityLevel(attribute, attribute.getValue()); } return null; }
Source:
<code>public static void init() throws ServletException, LifecycleException, FileNotFoundException, IOException, DBException, InterruptedException { <START> String webappDirLocation = "WebContent/"; <END> while (!Utils.available(port)) { port++; } tomcat.setPort(Integer.valueOf(port)); Context context = tomcat.addWebapp("/webService", new File(webappDirLocation).getAbsolutePath()); Tomcat.addServlet(context, "jersey-container-servlet", resourceConfig()); context.addServletMapping("/rest/*", "jersey-container-servlet"); tomcat.start(); Thread.sleep(1000); }</code><technical_language>WebContent moved test/resources</technical_language>

Target:
public static void init() throws ServletException, LifecycleException, FileNotFoundException, IOException, DBException, InterruptedException { String webappDirLocation = IntegrationTest.class.getClassLoader().getResource("WebContent").getPath(); while (!Utils.available(port)) { port++; } tomcat = new Tomcat(); tomcat.setPort(Integer.valueOf(port)); Context context = tomcat.addWebapp("/webService", new File(webappDirLocation).getAbsolutePath()); Tomcat.addServlet(context, "jersey-container-servlet", resourceConfig()); context.addServletMapping("/rest/*", "jersey-container-servlet"); tomcat.start(); Thread.sleep(1000); }
Source:
<code>public static Ethertype forValue(String value) { if (value != null) { for (Ethertype s : Ethertype.values()) { if (s.name().equalsIgnoreCase(value)) { return s; } } } <START> return Ethertype.IPv4; <END> }</code><technical_language>return unrecognized in case determine</technical_language>

Target:
public static Ethertype forValue(String value) { if (value != null) { for (Ethertype s : Ethertype.values()) { if (s.name().equalsIgnoreCase(value)) { return s; } } } return UNRECOGNIZED; }
Source:
<code>private void validateUserFields(UserDTO userResource) { <START> if (userResource.getFirstName() == null || userResource.getFirstName().trim().length() == 0) <END> { throw new InvalidDataException("error.user.firstname"); } if (userResource.getLastName() == null || userResource.getLastName().trim().length() == 0) { throw new InvalidDataException("error.user.lastname"); } if (userResource.getEmailAddress() == null || userResource.getEmailAddress().trim().length() == 0) { throw new InvalidDataException("error.user.email.address"); } if (!EmailValidator.getInstance().isValid(userResource.getEmailAddress())) { throw new InvalidDataException("error.user.email.address.invalid", userResource.getEmailAddress()); } if (userResource.getMobileNumber() == null || userResource.getMobileNumber().trim().length() == 0) { throw new InvalidDataException("error.user.mobile.number"); } if (!REGEX_PHONE.matcher(userResource.getMobileNumber()).matches()) { throw new InvalidDataException("error.user.mobile.number.invalid"); } }</code><technical_language>StringUtils.isBlank(getFirstName())</technical_language>

Target:
private void validateUserFields(UserDTO userResource) { if (StringUtils.isBlank(userResource.getFirstName())) { throw new InvalidDataException("error.user.firstname"); } if (StringUtils.isBlank(userResource.getLastName())) { throw new InvalidDataException("error.user.lastname"); } if (StringUtils.isBlank(userResource.getEmailAddress())) { throw new InvalidDataException("error.user.email.address"); } if (!EmailValidator.getInstance().isValid(userResource.getEmailAddress())) { throw new InvalidDataException("error.user.email.address.invalid", userResource.getEmailAddress()); } if (StringUtils.isBlank(userResource.getMobileNumber())) { throw new InvalidDataException("error.user.mobile.number"); } if (!REGEX_PHONE.matcher(userResource.getMobileNumber()).matches()) { throw new InvalidDataException("error.user.mobile.number.invalid"); } }
Source:
<code>public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { try { manager.completeWorkItem(workItem.getId(), null); } catch(Throwable cause) { handleException(cause); <START> manager.abortWorkItem(workItem.getId()); <END> } }</code><technical_language>I call abortWorkItem work item failed execute</technical_language>

Target:
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { try { manager.completeWorkItem(workItem.getId(), null); } catch(Throwable cause) { handleException(cause); } }
Source:
<code>public static <T> T parse(Class<T> cls, String value) throws InstantiationException, IllegalAccessException, ParseException { if (cls.isEnum()) { final Map<Class<?>, Map<String, String>> member = SCHEMA_TO_ENUM_DICTIONARIES.getMember(); String val = value; final Map<String, String> stringToEnumDict = member.get(cls); if (stringToEnumDict != null) { final String strEnumName = stringToEnumDict.get(value); if (strEnumName != null) { val = strEnumName; } } for (T o : cls.getEnumConstants()) { if (o.toString().equals(val)) { return o; } } return null; } else if (cls.isAssignableFrom(Number.class)) { Integer o = Integer.parseInt(value); return (T) o; } else if (cls.isAssignableFrom(Date.class)) { DateFormat df = createDateFormat(XML_SCHEMA_DATE_TIME_FORMAT); return (T) df.parse(value); } else if (cls.isAssignableFrom(Boolean.class)) { Object o = Boolean.parseBoolean(value); return (T) o; } else if (cls.isAssignableFrom(String.class)) { return (T) value; } else if (cls.isAssignableFrom(Double.class)) { <START> Object o = Double.parseDouble(value); <END> return (T) o; } return null; }</code><technical_language>get rid of Double -> Object -> Object -> T</technical_language>

Target:
public static <T> T parse(Class<T> cls, String value) throws InstantiationException, IllegalAccessException, ParseException { if (cls.isEnum()) { final Map<Class<?>, Map<String, String>> member = SCHEMA_TO_ENUM_DICTIONARIES.getMember(); String val = value; final Map<String, String> stringToEnumDict = member.get(cls); if (stringToEnumDict != null) { final String strEnumName = stringToEnumDict.get(value); if (strEnumName != null) { val = strEnumName; } } for (T o : cls.getEnumConstants()) { if (o.toString().equals(val)) { return o; } } return null; } else if (cls.isAssignableFrom(Double.class)) { return (T) ((Double) Double.parseDouble(value)); } else if (cls.isAssignableFrom(Number.class)) { return (T) ((Integer) Integer.parseInt(value)); } else if (cls.isAssignableFrom(Date.class)) { DateFormat df = createDateFormat(XML_SCHEMA_DATE_TIME_FORMAT); return (T) df.parse(value); } else if (cls.isAssignableFrom(Boolean.class)) { return (T) ((Boolean) Boolean.parseBoolean(value)); } else if (cls.isAssignableFrom(String.class)) { return (T) value; } return null; }
Source:
<code>public TComplexProperty getPropertyAtIndex(int index) throws IllegalArgumentException { if (index < 0 || index >= this.getCount()) { <START> throw new IllegalArgumentException("parameter \'index\' : " + "index is out of range."); <END> } return this.items.get(index); }</code><technical_language>I this is embed current index message this result in a message index is printed. escaped ' useless</technical_language>

Target:
public TComplexProperty getPropertyAtIndex(int index) throws IllegalArgumentException { if (index < 0 || index >= this.getCount()) { throw new IllegalArgumentException( String.format("index %d is out of range [0..%d[.", index, this.getCount()) ); } return this.items.get(index); }