auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private String parseDescription(final String input, final String componentName) { String result = componentName; final String title = "== " + componentName; int titleIndex = input.indexOf(title); if (titleIndex != -1) { int descriptionEndIndex = input.indexOf("===", titleIndex); if (descriptionEndIndex < 0) { descriptionEndIndex = input.length(); } result = input.substring(titleIndex + title.length(), descriptionEndIndex); if (result.endsWith("|")) { result = result.substring(0, result.length() - 1); } <START> if (result.indexOf("== ") > 0) { <END> result = result.substring(0, result.indexOf("== ")); } if (result.length() > 200) { result = result.substring(0, 197) + "..."; } } result = result.trim(); if (result == null || result.isEmpty()) { result = componentName; } return result; }</code><technical_language>contains() instead</technical_language>

Target:
private String parseDescription(final String input, final String componentName) { String result = componentName; final String title = "== " + componentName; int titleIndex = input.indexOf(title); if (titleIndex != -1) { int descriptionEndIndex = input.indexOf("===", titleIndex); if (descriptionEndIndex < 0) { descriptionEndIndex = input.length(); } result = input.substring(titleIndex + title.length(), descriptionEndIndex); if (result.endsWith("|")) { result = result.substring(0, result.length() - 1); } int nextComponentIndex = result.indexOf("== "); if (nextComponentIndex > 0) { result = result.substring(0, nextComponentIndex); } if (result.length() > 200) { result = result.substring(0, 197) + "..."; } } result = result.trim(); if (result == null || result.isEmpty()) { result = componentName; } return result; }
Source:
<code>public URI recentChanges(Date startTime, JSONObject continueObject, int batchSize) { URIBuilder builder = apiBuilder(); builder.addParameter("action", "query"); builder.addParameter("list", "recentchanges"); builder.addParameter("rcdir", "newer"); builder.addParameter("rcprop", "title|ids|timestamp"); <START> builder.addParameter("rcnamespace", this.rcnamespace); <END> builder.addParameter("rclimit", Integer.toString(batchSize)); if (continueObject == null) { builder.addParameter("continue", ""); builder.addParameter("rcstart", outputDateFormat().format(startTime)); } else { builder.addParameter("continue", continueObject.get("continue").toString()); builder.addParameter("rccontinue", continueObject.get("rccontinue").toString()); } return build(builder); }</code><technical_language>prefer joined here. need leak info changes formats argument code</technical_language>

Target:
public URI recentChanges(Date startTime, JSONObject continueObject, int batchSize) { URIBuilder builder = apiBuilder(); builder.addParameter("action", "query"); builder.addParameter("list", "recentchanges"); builder.addParameter("rcdir", "newer"); builder.addParameter("rcprop", "title|ids|timestamp"); builder.addParameter("rcnamespace", String.join("|", this.entityNamespaces)); builder.addParameter("rclimit", Integer.toString(batchSize)); if (continueObject == null) { builder.addParameter("continue", ""); builder.addParameter("rcstart", outputDateFormat().format(startTime)); } else { builder.addParameter("continue", continueObject.get("continue").toString()); builder.addParameter("rccontinue", continueObject.get("rccontinue").toString()); } return build(builder); }
Source:
<code>public static FileReftableDatabase convertFrom(FileRepository repo, File refstackName, boolean writeLogs) throws IOException { FileReftableDatabase newDb = null; try { File reftableDir = new File(repo.getDirectory(), Constants.REFTABLE); if (!reftableDir.isDirectory()) { reftableDir.mkdir(); } <START> FileReftableStack stack = new FileReftableStack(refstackName, <END> reftableDir, null, () -> repo.getConfig()); stack.addReftable(rw -> writeConvertTable(repo, rw, writeLogs)); stack.close(); } catch (Exception e) { refstackName.delete(); throw e; } return newDb; }</code><technical_language>try resource</technical_language>

Target:
public static FileReftableDatabase convertFrom(FileRepository repo, File refstackName, boolean writeLogs) throws IOException { FileReftableDatabase newDb = null; try { File reftableDir = new File(repo.getDirectory(), Constants.REFTABLE); if (!reftableDir.isDirectory()) { reftableDir.mkdir(); } try (FileReftableStack stack = new FileReftableStack(refstackName, reftableDir, null, () -> repo.getConfig())) { stack.addReftable(rw -> writeConvertTable(repo, rw, writeLogs)); } } catch (Exception e) { refstackName.delete(); throw e; } return newDb; }
Source:
<code>public Response getSchemaForVersion(@PathParam("schemaName") String schemaName, @PathParam("version") String version, @Context SecurityContext securityContext) { try { LOG.info("Get schema:version {}", schemaName + ":" + version); SchemaVersionInfo schemaVersionInfo = schemaRegistryClient.getSchemaVersionInfo(new SchemaVersionKey(schemaName, Integer.parseInt (version))); if (schemaVersionInfo != null) { LOG.debug("######### Received schema version from schema registry: {}", schemaVersionInfo); <START> String schema = schemaVersionInfo != null ? schemaVersionInfo.getSchemaText() : null; <END> if (schema != null && !schema.isEmpty()) { schema = AvroStreamlineSchemaConverter.convertAvroSchemaToStreamlineSchema(schema); } LOG.debug("######### Converted schema: {}", schema); return WSUtils.respondEntity(schema, OK); } else { return WSUtils.respondEntity("", NOT_FOUND); } } catch (SchemaNotFoundException e) { LOG.error("Schema not found: [{}]", schemaName, e); throw EntityNotFoundException.byId(schemaName); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>need this check is done in enclosing if condition</technical_language>

Target:
public Response getSchemaForVersion(@PathParam("schemaName") String schemaName, @PathParam("version") String version, @Context SecurityContext securityContext) { try { LOG.info("Get schema:version {}", schemaName + ":" + version); SchemaVersionInfo schemaVersionInfo = schemaRegistryClient.getSchemaVersionInfo(new SchemaVersionKey(schemaName, Integer.parseInt (version))); if (schemaVersionInfo != null) { LOG.debug("######### Received schema version from schema registry: {}", schemaVersionInfo); String schema = schemaVersionInfo.getSchemaText(); if (schema != null && !schema.isEmpty()) { schema = AvroStreamlineSchemaConverter.convertAvroSchemaToStreamlineSchema(schema); } LOG.debug("######### Converted schema: {}", schema); return WSUtils.respondEntity(schema, OK); } else { throw new SchemaNotFoundException("Version " + version + " of schema " + schemaName + " not found "); } } catch (SchemaNotFoundException e) { LOG.error("Schema not found: [{}]", schemaName, e); throw EntityNotFoundException.byName(schemaName); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public void testQueryOnLookup() { <START> final QueryDataSource queryDataSource = new QueryDataSource( GroupByQuery.builder() .setDataSource(LOOKUP_LOOKYLOO) .setInterval(new MultipleIntervalSegmentSpec(Collections.singletonList(Intervals.of("2000/3000")))) .setGranularity(Granularities.ALL) .build() ); <END> final DataSourceAnalysis analysis = DataSourceAnalysis.forDataSource(queryDataSource); Assert.assertFalse(analysis.isConcreteBased()); Assert.assertFalse(analysis.isConcreteTableBased()); Assert.assertTrue(analysis.isGlobal()); Assert.assertTrue(analysis.isQuery()); Assert.assertEquals(queryDataSource, analysis.getDataSource()); Assert.assertEquals(LOOKUP_LOOKYLOO, analysis.getBaseDataSource()); Assert.assertEquals(Optional.empty(), analysis.getBaseTableDataSource()); Assert.assertEquals( Optional.of(new MultipleIntervalSegmentSpec(ImmutableList.of(Intervals.of("2000/3000")))), analysis.getBaseQuerySegmentSpec() ); Assert.assertEquals(Collections.emptyList(), analysis.getPreJoinableClauses()); }</code><technical_language>subquery(LOOKUP_LOOKYLOO) instead</technical_language>

Target:
public void testQueryOnLookup() { final QueryDataSource queryDataSource = subquery(LOOKUP_LOOKYLOO); final DataSourceAnalysis analysis = DataSourceAnalysis.forDataSource(queryDataSource); Assert.assertFalse(analysis.isConcreteBased()); Assert.assertFalse(analysis.isConcreteTableBased()); Assert.assertTrue(analysis.isGlobal()); Assert.assertTrue(analysis.isQuery()); Assert.assertEquals(queryDataSource, analysis.getDataSource()); Assert.assertEquals(LOOKUP_LOOKYLOO, analysis.getBaseDataSource()); Assert.assertEquals(Optional.empty(), analysis.getBaseTableDataSource()); Assert.assertEquals( Optional.of(new MultipleIntervalSegmentSpec(MILLENIUM_INTERVALS)), analysis.getBaseQuerySegmentSpec() ); Assert.assertEquals(Collections.emptyList(), analysis.getPreJoinableClauses()); }
Source:
<code>public void outputStatuses() { <START> LogKitten.wtf(CHECK_NAME + ": " + getStatusMessage(CHECK_NAME).exceptions); END> }</code><technical_language>do</technical_language>

Target:
public void outputStatuses() { if (getStatusMessage(CHECK_NAME).status == SystemStatus.PASS) { LogKitten.d(CHECK_NAME + ": PASS"); } else { LogKitten.e(CHECK_NAME + ": FAIL "); for (Exception e : getStatusMessage(CHECK_NAME).exceptions) { LogKitten.e(e); } } }
Source:
<code>public void checkPublishAPI(String state, String role) throws Exception { <START> if (state == APILifeCycleState.CREATED.toString()) { <END> apiPublisher.logout(); apiPublisher.login(testUser, password); publishAPI(apiName, developer, role); } else if (state == APILifeCycleState.PROTOTYPED.toString()) { HttpResponse publishAPI = changeAPILifeCycleStatus(apiName, developer, APILifeCycleState.PROTOTYPED); assertTrue(publishAPI.getData().contains("PROTOTYPED"), "API has not been prototyped"); apiPublisher.logout(); apiPublisher.login(testUser, password); publishAPI(apiName, developer, role); } else if (state == APILifeCycleState.BLOCKED.toString()) { publishAPI(apiName, developer, role); HttpResponse blockAPI = changeAPILifeCycleStatus(apiName, developer, APILifeCycleState.BLOCKED); assertTrue(blockAPI.getData().contains("BLOCKED"), "API has not been blocked"); apiPublisher.logout(); apiPublisher.login(testUser, password); rePublishAPI(apiName, developer, role); } }</code><technical_language>string.equals</technical_language>

Target:
public void checkPublishAPI(String state, String role) throws Exception { if (state.equals(APILifeCycleState.CREATED.toString())) { apiPublisher.logout(); apiPublisher.login(testUser, password); publishAPI(apiName, developer, role); } else if (state.equals(APILifeCycleState.PROTOTYPED.toString())) { HttpResponse prototypedAPI = changeAPILifeCycleStatus(apiName, developer, APILifeCycleState.PROTOTYPED); assertTrue(prototypedAPI.getData().contains("PROTOTYPED"), "API has not been prototyped"); apiPublisher.logout(); apiPublisher.login(testUser, password); publishAPI(apiName, developer, role); } else if (state.equals(APILifeCycleState.BLOCKED.toString())) { publishAPI(apiName, developer, role); HttpResponse blockAPI = changeAPILifeCycleStatus(apiName, developer, APILifeCycleState.BLOCKED); assertTrue(blockAPI.getData().contains("BLOCKED"), "API has not been blocked"); apiPublisher.logout(); apiPublisher.login(testUser, password); rePublishAPI(apiName, developer, role); } }
Source:
<code>public KafkaLogManager(String zkServers, String topicPrefix, Properties producerProperties, Properties consumerProperties) { this.prefix = (topicPrefix != null) ? topicPrefix : ""; this.kUtils = new KafkaUtils(zkServers); disableSubscribe = Boolean.valueOf(consumerProperties.getProperty(DISABLE_SUBSCRIBE_PROP, "false")); defaultReplicationFactor = Integer.valueOf(producerProperties.getProperty(DEFAULT_REPLICATION_FACTOR_PROP, "1")); this.producerProperties = normalizeProducerProperties(producerProperties); this.consumerProperties = normalizeConsumerProperties(consumerProperties); <START> } <END></code><technical_language>need for parentheses</technical_language>

Target:
public KafkaLogManager(String zkServers, String topicPrefix, Properties producerProperties, Properties consumerProperties) { this.prefix = (topicPrefix != null) ? topicPrefix : ""; this.kUtils = new KafkaUtils(zkServers); disableSubscribe = Boolean.valueOf(consumerProperties.getProperty(DISABLE_SUBSCRIBE_PROP, "false")); defaultReplicationFactor = Integer.parseInt( producerProperties.getProperty(DEFAULT_REPLICATION_FACTOR_PROP, "1")); this.producerProperties = normalizeProducerProperties(producerProperties); this.consumerProperties = normalizeConsumerProperties(consumerProperties); }
Source:
<code>public static synchronized void setupRetentionPolicyMgr(int numThreads) { if (s_retentionPolicyMgr == null) { s_retentionPolicyMgr = new RetentionPolicyMgr(numThreads); } else if (s_retentionPolicyMgr.getRetentionThreadPoolSize() != numThreads) { <START> s_retentionPolicyMgr.updateThreadPoolSize(numThreads); <END> } }</code><technical_language>call update update apply change if is ignore</technical_language>

Target:
public static synchronized void setupRetentionPolicyMgr(int numThreads) { if (s_retentionPolicyMgr == null) { s_retentionPolicyMgr = new RetentionPolicyMgr(numThreads); } else { s_retentionPolicyMgr.updateThreadPoolSize(numThreads); } }
Source:
<code>private BitSet getErrors() { lock.lock(); try { try { serial.write(new byte[] {START_BYTE, maestro, COMMAND_GET_ERRORS}); final ByteBuffer response = ByteBuffer.allocate(2).put(serial.read(), 0, 2); <START> return BitSet.valueOf(new byte[]{response.get(1), response.get(0)}); <END> } catch (final IOException e) { Logger.error(e); return BitSet.valueOf(new byte[]{0}); } } finally { lock.unlock(); } }</code><technical_language>weird</technical_language>

Target:
private BitSet getErrors() { lock.lock(); try { try { serial.write(new byte[] {START_BYTE, maestro, COMMAND_GET_ERRORS}); final ByteBuffer response = ByteBuffer.allocate(2).put(serial.read(2)); return BitSet.valueOf((byte[]) ByteBuffer.allocate(2).put(serial.read(2)).flip().array()); } catch (final IOException e) { Logger.error(e); return BitSet.valueOf(new byte[]{0}); } } finally { lock.unlock(); } }
Source:
<code>public void botVSPlayer() { int size = tiles.size(); int pairs = size / 2; int mode = (int) Math.sqrt(size); ModeBotOrNot.setPairs(pairs); ModeBotOrNot.setBot(0); for (int i = 0; i < mode; i++) { for (int j = 0; j < mode; j++) { int n = i; int m = j; massiveTiles[i][j].setOnMouseClicked(event -> { if (ModeBotOrNot.isBot() == 0) { <START> if (massiveTiles[n][m].isSelected() || event.getClickCount() > 1 || !event.isStillSincePress()) { <END> return; } if (firstselected == null) { firstselected = massiveTiles[n][m]; massiveTiles[n][m].open(() -> { }); } else { massiveTiles[n][m].open(() -> { if (!massiveTiles[n][m].hasSameValue(firstselected)) { firstselected.close(); massiveTiles[n][m].close(); } else { firstselected.setOpen(); massiveTiles[n][m].setOpen(); } ModeBotOrNot.setBot(1); BotHod(); firstselected = null; secondselected = null; }); } } }); } } }</code><technical_language>out of dashed line</technical_language>

Target:
public void botVSPlayer() { int size = tiles.size(); int pairs = size / 2; int mode = (int) Math.sqrt(size); BotMode.setPairs(pairs); BotMode.setBotMode(0); for (int i = 0; i < mode; i++) { for (int j = 0; j < mode; j++) { int n = i; int m = j; massiveTiles[i][j].setOnMouseClicked(event -> { if (BotMode.getBotMode() == 0) { if (massiveTiles[n][m].isSelected() || event.getClickCount() > 1 || !event.isStillSincePress()) { return; } if (firstselected == null) { firstselected = massiveTiles[n][m]; massiveTiles[n][m].open(() -> { }); } else { massiveTiles[n][m].open(() -> { if (!massiveTiles[n][m].hasSameValue(firstselected)) { firstselected.close(); massiveTiles[n][m].close(); } else { firstselected.setOpen(); massiveTiles[n][m].setOpen(); } BotMode.setBotMode(1); BotHod(); firstselected = null; secondselected = null; }); } } }); } } }
Source:
<code>public void selectionChanged(final SelectionChangedEvent event) { Object[] listeners = getListeners(); for (Object listener : listeners) { final ISelectionChangedListener <START> l = <END> (ISelectionChangedListener) listener; SafeRunner.run(new SafeRunnable() { @Override public void run() { l.selectionChanged(event); } }); } }</code><technical_language>rename 'selectionChangedListener'</technical_language>

Target:
public void selectionChanged(final SelectionChangedEvent event) { for (Object listener : getListeners()) { final ISelectionChangedListener selectionChangedListener = (ISelectionChangedListener) listener; SafeRunner.run(new SafeRunnable() { @Override public void run() { selectionChangedListener.selectionChanged(event); } }); } }
Source:
<code>public void addToDBBatch(OMMetadataManager omMetadataManager, BatchOperation batchOperation) throws IOException { if (getOMResponse().getStatus() == OzoneManagerProtocolProtos.Status.OK) { if (omVolumeCreateResponse != null) { omVolumeCreateResponse.addToDBBatch(omMetadataManager, batchOperation); } <START> if (omBucketCreateResponse != null) { <END> omBucketCreateResponse.addToDBBatch(omMetadataManager, batchOperation); } omMetadataManager.getS3Table().putWithBatch(batchOperation, s3Bucket, s3Mapping); } }</code><technical_language>If status is OK omBucketCreateResponse non-null right</technical_language>

Target:
public void addToDBBatch(OMMetadataManager omMetadataManager, BatchOperation batchOperation) throws IOException { if (getOMResponse().getStatus() == OzoneManagerProtocolProtos.Status.OK) { if (omVolumeCreateResponse != null) { omVolumeCreateResponse.addToDBBatch(omMetadataManager, batchOperation); } Preconditions.checkState(omBucketCreateResponse != null); omBucketCreateResponse.addToDBBatch(omMetadataManager, batchOperation); omMetadataManager.getS3Table().putWithBatch(batchOperation, s3Bucket, s3Mapping); } }
Source:
<code>public void clickOnIncrementMemoryButton(String machineName) { seleniumWebDriverHelper.waitAndClick(By.xpath(format(INCREMENT_MEMORY_BUTTON, machineName))); <START> WaitUtils.sleepQuietly(1); <END> }</code><technical_language>clicked button in command before, it</technical_language>

Target:
public void clickOnIncrementMemoryButton(String machineName) { seleniumWebDriverHelper.waitAndClick(By.xpath(format(INCREMENT_MEMORY_BUTTON, machineName))); }
Source:
<code>public TmfXmlPatternSegmentField(Element element) { fName = element.getAttribute(TmfXmlStrings.NAME); fType = element.getAttribute(TmfXmlStrings.TYPE); fConstantValue = element.getAttribute(TmfXmlStrings.VALUE); fStateValue = null; if (fConstantValue.isEmpty()) { Element elementFieldStateValue = (Element) element.getElementsByTagName(TmfXmlStrings.STATE_VALUE).item(0); if (elementFieldStateValue == null) { throw new IllegalArgumentException(); } fStateValue = fModelFactory.createStateValue(elementFieldStateValue, fContainer, new <START> ArrayList<ITmfXmlStateAttribute>()); <END> } }</code><technical_language>needed</technical_language>

Target:
public TmfXmlPatternSegmentField(Element element) { fName = element.getAttribute(TmfXmlStrings.NAME); fType = element.getAttribute(TmfXmlStrings.TYPE); String constantValue = element.getAttribute(TmfXmlStrings.VALUE); if (constantValue.isEmpty()) { fStateValue = null; Element elementFieldStateValue = (Element) element.getElementsByTagName(TmfXmlStrings.STATE_VALUE).item(0); if (elementFieldStateValue == null) { throw new IllegalArgumentException(); } fXmlStateValue = fModelFactory.createStateValue(elementFieldStateValue, fContainer, new ArrayList<ITmfXmlStateAttribute>()); } else { switch (fType) { case TmfXmlStrings.TYPE_INT: fStateValue = TmfStateValue.newValueInt(Integer.parseInt(constantValue)); break; case TmfXmlStrings.TYPE_LONG: fStateValue = TmfStateValue.newValueLong(Long.parseLong(constantValue)); break; case TmfXmlStrings.TYPE_STRING: fStateValue = TmfStateValue.newValueString(constantValue); break; case TmfXmlStrings.TYPE_NULL: fStateValue = TmfStateValue.nullValue(); break; default: throw new IllegalArgumentException("pattern segment field : invalid type of field"); } fXmlStateValue = null; } }
Source:
<code>private void removeIdFromSelectedIds(Integer position) { Set<Integer> newSet = new HashSet<>(); for (Integer selectedPatientsId : selectedPatientPositions) { if(!selectedPatientsId.equals(position)){ newSet.add(selectedPatientsId); } } selectedPatientPositions = newSet; if (selectedPatientPositions.size() == 0 && isLongClicked && enableDownload) { enableDownload = false; if (actionMode != null) { MenuItem item = actionMode.getMenu().findItem(R.id.action_download); item.setEnabled(false); item.getIcon().setAlpha(128); <START> } <END> } }</code><technical_language>@shivtej1505 extracting lines a separate method ? I method name enableDownloadButton easier understand code fast :)</technical_language>

Target:
private void removeIdFromSelectedIds(Integer position) { Set<Integer> newSet = new HashSet<>(); for (Integer selectedPatientsId : selectedPatientPositions) { if(!selectedPatientsId.equals(position)){ newSet.add(selectedPatientsId); } } selectedPatientPositions = newSet; if (selectedPatientPositions.size() == 0 && isLongClicked && enableDownload) toggleDownloadButton(); }
Source:
<code>protected synchronized void updateStatsRow(Object rowKey, Object rowValues[]) { long currentTime = System.nanoTime(); long currentWaitTime; SiteTasker nextTask = m_tasks.peek(); if (nextTask == null) { currentWaitTime = 0; } else { currentWaitTime = currentTime - nextTask.getTimestamp(); } long maxWaitTimeInWindow = Math.max(currentWaitTime, m_recentMaxWaitTime); long totalWaitTimeInWindow = 0; long totalPollCountInWindow = 0; if (!m_historicalData.isEmpty()) { for (QueueStatus status : m_historicalData) { if (status.timestamp >= currentTime - m_maxWaitTimeWindowSize) { maxWaitTimeInWindow = Math.max(maxWaitTimeInWindow, status.maxWait); totalWaitTimeInWindow += status.totalWait; totalPollCountInWindow += status.pollCount; } } } rowValues[columnNameToIndex.get("CURRENT_DEPTH")] = m_depth; rowValues[columnNameToIndex.get("POLL_COUNT")] = totalPollCountInWindow; rowValues[columnNameToIndex.get("AVG_WAIT")] = totalWaitTimeInWindow / Math.max(1, totalPollCountInWindow); <START> rowValues[columnNameToIndex.get("MAX_WAIT")] = maxWaitTimeInWindow; <END> super.updateStatsRow(rowKey, rowValues); }</code><technical_language>microseconds instead of nanoseconds here. I need nanosecond precision for wait time, consistent procedure execution time statistics</technical_language>

Target:
protected synchronized void updateStatsRow(Object rowKey, Object rowValues[]) { long currentTime = System.nanoTime(); long currentWaitTime; SiteTasker nextTask = m_tasks.peek(); if (nextTask == null) { currentWaitTime = 0; } else { currentWaitTime = currentTime - nextTask.getQueueOfferTime(); } long maxWaitTimeInWindow = Math.max(currentWaitTime, m_recentMaxWaitTime); long totalWaitTimeInWindow = 0; long totalPollCountInWindow = 0; if (!m_historicalData.isEmpty()) { for (QueueStatus status : m_historicalData) { if (status.timestamp >= currentTime - m_maxWaitTimeWindowSize) { maxWaitTimeInWindow = Math.max(maxWaitTimeInWindow, status.maxWait); totalWaitTimeInWindow += status.totalWait; totalPollCountInWindow += status.pollCount; } } } rowValues[columnNameToIndex.get("CURRENT_DEPTH")] = m_depth; rowValues[columnNameToIndex.get("POLL_COUNT")] = totalPollCountInWindow; rowValues[columnNameToIndex.get("AVG_WAIT")] = (totalWaitTimeInWindow / Math.max(1, totalPollCountInWindow)) / 1000; rowValues[columnNameToIndex.get("MAX_WAIT")] = maxWaitTimeInWindow / 1000; super.updateStatsRow(rowKey, rowValues); }
Source:
<code>@Override public void start(Listener<RespT> responseListener, Metadata headers) { GrpcClientRequest request = new GrpcClientRequest(nameToKey, method, callOptions, delegate(), headers); Span span = handler.handleSendWithParent(request, invocationContext); spanRef.set(span); responseListener = new TracingClientCallListener<>( responseListener, invocationContext, spanRef, request ); try (Scope scope = currentTraceContext.maybeScope(span.context())) { super.start(responseListener, headers); } catch (Throwable e) { propagateIfFatal(e); <START> spanRef.getAndSet(null); <END> if (span != null) span.error(e).finish(); throw e; } }</code><technical_language>set pass return next line</technical_language>

Target:
@Override public void start(Listener<RespT> responseListener, Metadata headers) { GrpcClientRequest request = new GrpcClientRequest(nameToKey, method, callOptions, delegate(), headers); Span span = handler.handleSendWithParent(request, invocationContext); spanRef.set(span); responseListener = new TracingClientCallListener<>( responseListener, invocationContext, spanRef, request ); try (Scope scope = currentTraceContext.maybeScope(span.context())) { super.start(responseListener, headers); } catch (Throwable e) { propagateIfFatal(e); spanRef.set(null); if (span != null) span.error(e).finish(); throw e; } }
Source:
<code>public Response sendLogoutRequest(@QueryParam("EncryptedNameIdTime") String encryptedNameIdTime) { String nameIdTime = encryptionService.decrypt(encryptedNameIdTime); String[] nameIdTimeArray = StringUtils.split(nameIdTime, "\n"); if (nameIdTimeArray.length == 2) { try { String name = nameIdTimeArray[0]; Long time = Long.parseLong(nameIdTimeArray[1]); if (System.currentTimeMillis() - time > logOutPageTimeOut) { String msg = String.format( "Logout request was older than %sms old so it was rejected. Please refresh page and request again.", logOutPageTimeOut); LOGGER.info(msg); return buildLogoutResponse(msg); } <START> SecurityToken IdpSecToken = getIdpSecurityToken(); <END> if (IdpSecToken == null) { LOGGER.info("Unable to logout. Please try again."); return buildLogoutResponse("Unable to logout. Please try again."); } List<String> sessionIndexes = new SecurityAssertionImpl(IdpSecToken) .getAuthnStatements() .stream() .filter(Objects::nonNull) .map(AuthnStatement::getSessionIndex) .collect(Collectors.toList()); logout(); LogoutRequest logoutRequest = logoutMessage.buildLogoutRequest(name, getEntityId(), sessionIndexes); String relayState = relayStates.encode(name); return getLogoutRequest(relayState, logoutRequest); } catch (RuntimeException e) { LOGGER.info(UNABLE_TO_CREATE_LOGOUT_REQUEST, e); return buildLogoutResponse(UNABLE_TO_CREATE_LOGOUT_REQUEST); } } else { LOGGER.info(UNABLE_TO_DECRYPT_LOGOUT_REQUEST); return buildLogoutResponse(UNABLE_TO_DECRYPT_LOGOUT_REQUEST); } }</code><technical_language>practice is for letter lower-case, idpSecToken. (this applies other 2 similar usages in this file)</technical_language>

Target:
public Response sendLogoutRequest(@QueryParam("EncryptedNameIdTime") String encryptedNameIdTime) { String nameIdTime = encryptionService.decrypt(encryptedNameIdTime); String[] nameIdTimeArray = StringUtils.split(nameIdTime, "\n"); if (nameIdTimeArray.length == 2) { try { String name = nameIdTimeArray[0]; Long time = Long.parseLong(nameIdTimeArray[1]); if (System.currentTimeMillis() - time > logOutPageTimeOut) { String msg = String.format( "Logout request was older than %sms old so it was rejected. Please refresh page and request again.", logOutPageTimeOut); LOGGER.info(msg); return buildLogoutResponse(msg); } SecurityToken idpSecToken = getIdpSecurityToken(); if (idpSecToken == null) { LOGGER.info("Unable to logout. Please try again."); return buildLogoutResponse("Unable to logout. Please try again."); } List<String> sessionIndexes = new SecurityAssertionImpl(idpSecToken) .getAuthnStatements() .stream() .filter(Objects::nonNull) .map(AuthnStatement::getSessionIndex) .collect(Collectors.toList()); logout(); LogoutRequest logoutRequest = logoutMessage.buildLogoutRequest(name, getEntityId(), sessionIndexes); String relayState = relayStates.encode(name); return getLogoutRequest(relayState, logoutRequest); } catch (RuntimeException e) { LOGGER.info(UNABLE_TO_CREATE_LOGOUT_REQUEST, e); return buildLogoutResponse(UNABLE_TO_CREATE_LOGOUT_REQUEST); } } else { LOGGER.info(UNABLE_TO_DECRYPT_LOGOUT_REQUEST); return buildLogoutResponse(UNABLE_TO_DECRYPT_LOGOUT_REQUEST); } }
Source:
<code>protected boolean applyDecorator(View view, RecyclerView parent) { RecyclerView.Adapter adapter = parent.getAdapter(); int position = parent.getChildAdapterPosition(view); int size = adapter.getItemCount(); <START> return size - 1 != position && adapter.getItemViewType(position + 1) == HEADER_TYPE; <END> }</code><technical_language>draw shadow item</technical_language>

Target:
protected boolean applyDecorator(View view, RecyclerView parent) { RecyclerView.Adapter adapter = parent.getAdapter(); int position = parent.getChildAdapterPosition(view); return adapter.getItemViewType(position + 1) == HEADER_TYPE; }
Source:
<code>public void buildShellScriptAfterDisconnect() throws Exception { story.then( s -> { Node node = TestUtils.createSwarmClient( story.j, processDestroyer, tmpDir.newFolder()); WorkflowJob project = story.j.createProject(WorkflowJob.class); project.setConcurrentBuild(false); project.setDefinition(new CpsFlowDefinition(getFlow(node, 1), true)); WorkflowRun build = project.scheduleBuild2(0).waitForStart(); SemaphoreStep.waitForStart("wait-0/1", build); tearDown(); <START> TestUtils.createSwarmClient( <END> node.getNodeName(), story.j, processDestroyer, tmpDir.newFolder()); SemaphoreStep.success("wait-0/1", null); story.j.waitForCompletion(build); story.j.assertLogContains("ON_SWARM_CLIENT=true", build); story.j.assertBuildStatusSuccess(build); tearDown(); }); }</code><technical_language>Note this is waiting in node sh exercises part of <LINK_0> (when <LINK_0>/commits/58b127fa34cd10bfc76659b86292832965fe7c95 added)</technical_language>

Target:
public void buildShellScriptAfterDisconnect() throws Exception { story.then( s -> { Node node = TestUtils.createSwarmClient(story.j, processDestroyer, temporaryFolder); WorkflowJob project = story.j.createProject(WorkflowJob.class); project.setConcurrentBuild(false); project.setDefinition(new CpsFlowDefinition(getFlow(node, 1), true)); WorkflowRun build = project.scheduleBuild2(0).waitForStart(); SemaphoreStep.waitForStart("wait-0/1", build); tearDown(); TestUtils.createSwarmClient( node.getNodeName(), story.j, processDestroyer, temporaryFolder); SemaphoreStep.success("wait-0/1", null); story.j.assertBuildStatusSuccess(story.j.waitForCompletion(build)); story.j.assertLogContains("ON_SWARM_CLIENT=true", build); tearDown(); }); }
Source:
<code>public static CommandRequest payForOrder(UserId userId, OrderId orderId) { final BillingInfo billingInfo = BillingInfo.newBuilder().setInfo("Payment info is here.").build(); final PayForOrder command = PayForOrder.newBuilder() .setOrderId(orderId) .setBillingInfo(billingInfo) .build(); <START> return newCommandRequest(userId, command); <END> }</code><technical_language>Please extract a result variable</technical_language>

Target:
public static CommandRequest payForOrder(UserId userId, OrderId orderId) { final BillingInfo billingInfo = BillingInfo.newBuilder().setInfo("Payment info is here.").build(); final PayForOrder command = PayForOrder.newBuilder() .setOrderId(orderId) .setBillingInfo(billingInfo) .build(); final CommandRequest result = newCommandRequest(userId, command); return result; }
Source:
<code>public Schema capture() throws SQLException { LOGGER.debug("Capturing schema"); ArrayList<Database> databases = new ArrayList<>(); ResultSet rs = connection.createStatement().executeQuery( "SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.SCHEMATA" ); while (rs.next()) { String dbName = rs.getString("SCHEMA_NAME"); String charset = rs.getString("DEFAULT_CHARACTER_SET_NAME"); if (includeDatabases.size() > 0 && !includeDatabases.contains(dbName)) continue; if (IGNORED_DATABASES.contains(dbName)) continue; Database db = new Database(dbName, charset); databases.add(db); } rs.close(); int size = databases.size(); LOGGER.debug("Augmenting " + size + " databases with tables"); int counter = 1; for (Database db : databases) { LOGGER.debug(counter + "/" + size + " Augmenting " + db.getName()); long start = System.currentTimeMillis(); captureDatabase(db); long end = System.currentTimeMillis(); LOGGER.debug(counter + "/" + size + " Augmented " + db.getName() + " after " + (end - start) + "ms"); counter++; } <START> LOGGER.debug("Databases Augmented!"); <END> return new Schema(databases, captureDefaultCharset(), this.sensitivity); }</code><technical_language>too, ditch timing information, it. some point finish metrics</technical_language>

Target:
public Schema capture() throws SQLException { LOGGER.debug("Capturing schemas..."); ArrayList<Database> databases = new ArrayList<>(); ResultSet rs = connection.createStatement().executeQuery( "SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.SCHEMATA" ); while (rs.next()) { String dbName = rs.getString("SCHEMA_NAME"); String charset = rs.getString("DEFAULT_CHARACTER_SET_NAME"); if (includeDatabases.size() > 0 && !includeDatabases.contains(dbName)) continue; if (IGNORED_DATABASES.contains(dbName)) continue; Database db = new Database(dbName, charset); databases.add(db); } rs.close(); int size = databases.size(); LOGGER.debug("Starting schema capture of " + size + " databases..."); int counter = 1; for (Database db : databases) { LOGGER.debug(counter + "/" + size + " Capturing " + db.getName() + "..."); captureDatabase(db); counter++; } LOGGER.debug(size + " database schemas captured!"); return new Schema(databases, captureDefaultCharset(), this.sensitivity); }
Source:
<code>public void shouldInterleaveChargesAndRefundsIfFeatureEnabled() throws Exception { addChargeAndCardDetails(CREATED, "ref-1", now().minusDays(2)); String externalChargeId = addChargeAndCardDetails(CAPTURED, "ref-3", now().minusDays(1)); Long chargeId = Long.parseLong(StringUtils.removeStart(externalChargeId, "charge")); createNewRefundWith(REFUND_SUBMITTED, 10L, chargeId, "refund_ref"); addChargeAndCardDetails(AUTHORISATION_READY, "ref-2", now()); ValidatableResponse response = getChargeApi .withAccountId(accountId) .withQueryParam("from_date", DateTimeUtils.toUTCDateTimeString(now().minusDays(1))) .withQueryParam("to_date", DateTimeUtils.toUTCDateTimeString(now().plusDays(1))) .withHeader(HttpHeaders.ACCEPT, APPLICATION_JSON) .withHeader(FEATURES_HEADER, FEATURE_REFUNDS_IN_TX_LIST) .getTransactions() .statusCode(OK.getStatusCode()) .contentType(JSON) .body("results.size()", is(3)) .body("results[0].transaction_type", is("charge")) .body("results[1].transaction_type", is("charge")) <START> .body("results[2].transaction_type", is("refund") <END> ); }</code><technical_language>This is easier understand! I tests for this more comprehensive in terms of properly checking properties refunds, refunds charges sort date type refunds date range included. However, fine if implemented new DAO is integrated</technical_language>

Target:
public void shouldInterleaveChargesAndRefundsIfFeatureEnabled() throws Exception { addChargeAndCardDetails(CREATED, "ref-1", now().minusDays(2)); String externalChargeId = addChargeAndCardDetails(CAPTURED, "ref-3", now().minusDays(1)); Long chargeId = Long.parseLong(StringUtils.removeStart(externalChargeId, "charge")); createNewRefundWith(REFUND_SUBMITTED, 10L, chargeId, "refund_ref"); addChargeAndCardDetails(AUTHORISATION_READY, "ref-2", now()); ValidatableResponse response = getChargeApi .withAccountId(accountId) .withQueryParam("from_date", DateTimeUtils.toUTCDateTimeString(now().minusDays(1))) .withQueryParam("to_date", DateTimeUtils.toUTCDateTimeString(now().plusDays(1))) .withHeader(HttpHeaders.ACCEPT, APPLICATION_JSON) .withHeader(FEATURES_HEADER, FEATURE_REFUNDS_IN_TX_LIST) .getTransactions() .statusCode(OK.getStatusCode()) .contentType(JSON) .body("results.size()", is(3)) .body("results[0].transaction_type", is("charge")) .body("results[1].transaction_type", is("refund")) .body("results[2].transaction_type", is("charge") ); }
Source:
<code>public Multihash put(byte[] data, boolean isRaw, TransactionId tid, PublicKeyHash owner) { Histogram.Timer writeTimer = writeTimerLog.labels("write").startTimer(); Multihash hash = new Multihash(Multihash.Type.sha2_256, Hash.sha256(data)); Cid cid = new Cid(1, isRaw ? Cid.Codec.Raw : Cid.Codec.DagCbor, hash.type, hash.getHash()); String key = hashToKey(cid); try { transactions.addBlock(cid, tid, owner); String s3Key = folder + key; Map<String, String> extraHeaders = new TreeMap<>(); extraHeaders.put("Content-Type", "application/octet-stream"); <START> extraHeaders.put("User-Agent", "Bond, James Bond"); <END> boolean hashContent = true; String contentHash = hashContent ? ArrayOps.bytesToHex(hash.getHash()) : "UNSIGNED-PAYLOAD"; PresignedUrl putUrl = S3Request.preSignPut(s3Key, data.length, contentHash, false, ZonedDateTime.now(), host, extraHeaders, region, accessKeyId, secretKey); HttpUtil.put(putUrl, data); return cid; } catch (IOException e) { LOG.log(Level.SEVERE, e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } finally { writeTimer.observeDuration(); } }</code><technical_language>required</technical_language>

Target:
public Multihash put(byte[] data, boolean isRaw, TransactionId tid, PublicKeyHash owner) { Histogram.Timer writeTimer = writeTimerLog.labels("write").startTimer(); Multihash hash = new Multihash(Multihash.Type.sha2_256, Hash.sha256(data)); Cid cid = new Cid(1, isRaw ? Cid.Codec.Raw : Cid.Codec.DagCbor, hash.type, hash.getHash()); String key = hashToKey(cid); try { transactions.addBlock(cid, tid, owner); String s3Key = folder + key; Map<String, String> extraHeaders = new TreeMap<>(); extraHeaders.put("Content-Type", "application/octet-stream"); boolean hashContent = true; String contentHash = hashContent ? ArrayOps.bytesToHex(hash.getHash()) : "UNSIGNED-PAYLOAD"; PresignedUrl putUrl = S3Request.preSignPut(s3Key, data.length, contentHash, false, ZonedDateTime.now(), host, extraHeaders, region, accessKeyId, secretKey); HttpUtil.put(putUrl, data); return cid; } catch (IOException e) { LOG.log(Level.SEVERE, e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } finally { writeTimer.observeDuration(); } }
Source:
<code>public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String emailType = getNonNullRequestParamValue(Const.ParamsNames.EMAIL_TYPE); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); CourseAttributes course = logic.getCourse(courseId); Assumption.assertNotNull(course); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); Assumption.assertNotNull(student); EmailWrapper email; if (emailType.equals(EmailType.STUDENT_COURSE_JOIN.name())) { email = emailGenerator.generateStudentCourseJoinEmail(course, student); } else if (emailType.equals(EmailType.FEEDBACK_SESSION_REMINDER.name())) { if (feedbackSessionName == null) { throw new InvalidHttpParameterException("Feedback session name not specified"); } FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); email = emailGenerator.generateFeedbackSessionStudentReminderEmail(feedbackSession, student); } else { <START> throw new InvalidHttpParameterException("Unknown emailType " + emailType); <END> } return new JsonResult(new EmailData(email)); }</code><technical_language>Unknown is accurate some other types (e.g. INSTRUCTOR_COURSE_JOIN, NEW_INSTRUCTOR_ACCOUNT) cater for them, now, never. Email type ... is accepted. is more accurate</technical_language>

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String emailType = getNonNullRequestParamValue(Const.ParamsNames.EMAIL_TYPE); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); CourseAttributes course = logic.getCourse(courseId); Assumption.assertNotNull(course); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); Assumption.assertNotNull(student); EmailWrapper email; if (emailType.equals(EmailType.STUDENT_COURSE_JOIN.name())) { email = emailGenerator.generateStudentCourseJoinEmail(course, student); } else if (emailType.equals(EmailType.FEEDBACK_SESSION_REMINDER.name())) { if (feedbackSessionName == null) { throw new InvalidHttpParameterException("Feedback session name not specified"); } FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); email = emailGenerator.generateFeedbackSessionStudentReminderEmail(feedbackSession, student); } else { throw new InvalidHttpParameterException("Email type " + emailType + " not accepted"); } return new JsonResult(new EmailData(email)); }
Source:
<code>public void testGetStrippedVdsUniqueIdWithUnacceptedChars() { RegisterVdsParameters paramsMock = getQueryParameters(); when(paramsMock.getVdsUniqueId()).thenReturn("Test_^123^"); String result = getQuery().getStrippedVdsUniqueId(); <START> assertEquals("Test_123", result); <END> }</code><technical_language>Please add assertion message asserEquals() call</technical_language>

Target:
public void testGetStrippedVdsUniqueIdWithUnacceptedChars() { RegisterVdsParameters paramsMock = getQueryParameters(); when(paramsMock.getVdsUniqueId()).thenReturn("Test_^123^"); String result = getQuery().getStrippedVdsUniqueId(); assertEquals("Vds id doesn't equal to the expected value", "Test_123", result); }
Source:
<code>public void testPipetteAfterBrushOnSingleLayer() { onDrawingSurfaceView() .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)); onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE); <START> onColorPickerView() <END> .performOpenColorPicker(); onView(allOf(withId(R.id.color_picker_tab_icon), withBackground(R.drawable.ic_color_picker_tab_rgba))).perform(click()); onView(withId(R.id.color_picker_color_rgb_hex)).perform(replaceText("#00000000")); onColorPickerView() .onOkButton() .perform(click()); onToolProperties() .checkMatchesColor(Color.TRANSPARENT); onToolBarView() .performSelectTool(ToolType.PIPETTE); onDrawingSurfaceView() .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)); onToolProperties() .checkMatchesColor(Color.BLACK); }</code><technical_language>Is a reason need color picker for this test? this changed .setColorResource(R.color.pocketpaint_color_picker_transparent)</technical_language>

Target:
public void testPipetteAfterBrushOnSingleLayer() { onDrawingSurfaceView() .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)); onDrawingSurfaceView() .checkPixelColor(Color.BLACK, BitmapLocationProvider.MIDDLE); onToolProperties() .setColorResource(R.color.pocketpaint_color_picker_transparent) .checkMatchesColor(Color.TRANSPARENT); onToolBarView() .performSelectTool(ToolType.PIPETTE); onDrawingSurfaceView() .perform(touchAt(DrawingSurfaceLocationProvider.MIDDLE)); onToolProperties() .checkMatchesColor(Color.BLACK); }
Source:
<code>public By buildBy() { assertValidAnnotations(); By defaultBy = buildDefaultBy(); By mobileNativeBy = buildMobileNativeBy(); if (defaultBy == null) defaultBy = new ByIdOrName(((Field) annotatedElementContainer.getAnnotated()).getName()); <START> <END> if (mobileNativeBy == null) mobileNativeBy = defaultBy; Map<ContentType, By> contentMap = new HashMap<>(); contentMap.put(ContentType.HTML_OR_DEFAULT, defaultBy); contentMap.put(ContentType.NATIVE_MOBILE_SPECIFIC, mobileNativeBy); return new ContentMappedBy(contentMap); }</code><technical_language>extra blank line</technical_language>

Target:
public By buildBy() { assertValidAnnotations(); By defaultBy = buildDefaultBy(); By mobileNativeBy = buildMobileNativeBy(); if (defaultBy == null) { defaultBy = new ByIdOrName(((Field) annotatedElementContainer.getAnnotated()).getName()); } if (mobileNativeBy == null) { mobileNativeBy = defaultBy; } Map<ContentType, By> contentMap = new HashMap<>(); contentMap.put(ContentType.HTML_OR_DEFAULT, defaultBy); contentMap.put(ContentType.NATIVE_MOBILE_SPECIFIC, mobileNativeBy); return new ContentMappedBy(contentMap); }
Source:
<code><START> public IntegrationGraphCorsConfigurer(String path, String[] allowedOrigins) { <END> this.path = path; this.allowedOrigins = allowedOrigins; }</code><technical_language>Redundant modifier. Travis report for class private</technical_language>

Target:
private IntegrationGraphCorsConfigurer(String path, String[] allowedOrigins) { this.path = path; this.allowedOrigins = allowedOrigins; }
Source:
<code>public String getValue(String key) { if (key.startsWith(CLASSPATH)) { final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); String classpathResource = key.substring(CLASSPATH.length(), key.length() - 1); final URL resource = contextClassLoader.getResource(classpathResource); if (resource == null) { <START> logger.warning(String.format("Resource %s is not find in classspath and it is not replaced.", classpathResource)); <END> return null; } return resource.toString(); } return null; }</code><technical_language>log message be: String.format("Resource %s is classspath property %s is replaced.", classpathResource, key)</technical_language>

Target:
public String getValue(String key) { if (key.startsWith(CLASSPATH)) { final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); String classpathResource = key.substring(CLASSPATH.length(), key.length() - 1); final URL resource = contextClassLoader.getResource(classpathResource); if (resource == null) { logger.warning(String.format("Resource %s is not found on the classspath so the property %s is not replaced.", classpathResource, key)); return null; } return resource.toString(); } return null; }
Source:
<code>private String getDescription( Method paramMethod ) { if( paramMethod.isAnnotationPresent( Hidden.class ) ) { return ""; } Description description = paramMethod.getAnnotation( Description.class ); if( description != null ) { return description.value(); } As as = paramMethod.getAnnotation( As.class ); return ReflectionUtil <START> .newInstance( as == null ? DefaultAsProvider.class : as.provider() ) <END> .as( as, paramMethod ); }</code><technical_language>I prefer create DefaultAsProvider reflection</technical_language>

Target:
private String getDescription( Method paramMethod ) { if( paramMethod.isAnnotationPresent( Hidden.class ) ) { return ""; } Description description = paramMethod.getAnnotation( Description.class ); if( description != null ) { return description.value(); } As as = paramMethod.getAnnotation( As.class ); AsProvider provider = as != null ? ReflectionUtil.newInstance( as.provider() ) : new DefaultAsProvider(); return provider.as( as, paramMethod ); }
Source:
<code>default long getVolume() { <START> try { if (getClass().getMethod("getArea").getDeclaringClass().equals(this.getClass())) { throw new IllegalStateException("Class " + getClass().getName() + " must override either getVolume or getArea."); } } catch (NoSuchMethodException e) { e.printStackTrace(); } <END> return getArea(); }</code><technical_language>issues Region class</technical_language>

Target:
default long getVolume() { try { if (getClass().getMethod("getArea").getDeclaringClass().equals(RegionSelector.class)) { throw new IllegalStateException("Class " + getClass().getName() + " must override getVolume."); } } catch (NoSuchMethodException e) { throw new AssertionError(e); } return getArea(); }
Source:
<code>private static void loadLatestStitchPseudoComponents() { try { URL stitchConnectorURL = new URL(STITCH_DATA_CONNECTOR_JSON_URL); HttpsURLConnection con = (HttpsURLConnection) stitchConnectorURL.openConnection(); InputStream ins = con.getInputStream(); <START> String resourceString = IOUtils.toString(ins, "UTF-8"); <END> ins.close(); readFromJsonString(resourceString); } catch (IOException | JSONException e) { loadDefaultStitchConnectorList(); } }</code><technical_language>set timeout</technical_language>

Target:
private static void loadLatestStitchPseudoComponents() { try { URL stitchConnectorURL = new URL(STITCH_DATA_CONNECTOR_JSON_URL); HttpsURLConnection urlc = (HttpsURLConnection) stitchConnectorURL.openConnection(); urlc.setConnectTimeout(2000); urlc.setReadTimeout(2000); InputStream ins = urlc.getInputStream(); String resourceString = IOUtils.toString(ins, "UTF-8"); ins.close(); readFromJsonString(resourceString); } catch (IOException | JSONException e) { loadDefaultStitchConnectorList(); } }