auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Query createKeywordRangeQuery(String fieldName, RangeQueryContext rangeContext, QueryBuildingContext queryContext, ConversionContext conversionContext, FieldContext fieldContext) { final Analyzer queryAnalyzer = queryContext.getQueryAnalyzer(); final Object fromObject = rangeContext.getFrom(); final Object toObject = rangeContext.getTo(); final DocumentBuilderIndexedEntity documentBuilder = Helper.getDocumentBuilder( queryContext ); final String fromString = fromObject == null ? null : fieldContext.objectToString( documentBuilder, fromObject, conversionContext ); final String lowerTerm = fromString == null ? null : Helper.getAnalyzedTerm( fieldName, fromString, "from", queryAnalyzer, fieldContext ); <START> final String toString = toObject == null ? <END> null : fieldContext.objectToString( documentBuilder, toObject, conversionContext ); final String upperTerm = toString == null ? null : Helper.getAnalyzedTerm( fieldName, toString, "to", queryAnalyzer, fieldContext ); return TermRangeQuery.newStringRange( fieldName, lowerTerm, upperTerm, !rangeContext.isExcludeFrom(), !rangeContext.isExcludeTo() ); }</code><technical_language>I wondering consider case explicitly above( null ) invoked. E.g. if null token is "-1", sense exclude some negative values existing in database for some reason. contrived, hear others think</technical_language>

Target:
private static Query createKeywordRangeQuery(String fieldName, RangeQueryContext rangeContext, QueryBuildingContext queryContext, ConversionContext conversionContext, FieldContext fieldContext) { final Analyzer queryAnalyzer = queryContext.getQueryAnalyzer(); final DocumentBuilderIndexedEntity documentBuilder = Helper.getDocumentBuilder( queryContext ); final String fromString = rangeContext.hasFrom() ? fieldContext.objectToString( documentBuilder, rangeContext.getFrom(), conversionContext ) : null; final String lowerTerm = fromString == null ? null : Helper.getAnalyzedTerm( fieldName, fromString, "from", queryAnalyzer, fieldContext ); final String toString = rangeContext.hasTo() ? fieldContext.objectToString( documentBuilder, rangeContext.getTo(), conversionContext ) : null; final String upperTerm = toString == null ? null : Helper.getAnalyzedTerm( fieldName, toString, "to", queryAnalyzer, fieldContext ); return TermRangeQuery.newStringRange( fieldName, lowerTerm, upperTerm, !rangeContext.isExcludeFrom(), !rangeContext.isExcludeTo() ); }
Source:
<code>protected void onDestroy() { super.onDestroy(); conversionManager.shutdown(); conversionManager.removeGlobalDownloadCallback(getSlidingUpFragment()); conversionManager.removeBaseInfoViewListener(getSlidingUpFragment()); conversionManager.removeGlobalJobViewListener(getSlidingUpFragment()); <START> client = null; <END> }</code><technical_language>is this necessary? destroy activity anyway</technical_language>

Target:
protected void onDestroy() { super.onDestroy(); conversionManager.shutdown(); conversionManager.removeGlobalDownloadCallback(getSlidingUpFragment()); conversionManager.removeBaseInfoViewListener(getSlidingUpFragment()); conversionManager.removeGlobalJobViewListener(getSlidingUpFragment()); }
Source:
<code>public <T> Optional<T> getSagaIdentifierFrom(final Event event) { checkNotNull(event); Object identifier =null; try { identifier = identifierMethod.invoke(event); } catch (final IllegalAccessException e) { <START> e.printStackTrace(); END> } catch (final InvocationTargetException e) { e.printStackTrace(); } return Optional.fromNullable((T)identifier); }</code><technical_language>-1: ;p</technical_language>

Target:
public <T> Optional<T> getSagaIdentifierFrom(final Event event) { checkNotNull(event); Object identifier = null; try { identifier = identifierMethod.invoke(event); } catch (IllegalAccessException | InvocationTargetException e) { LOGGER.warn("Failed to retrieve saga identifier from the given event, <getter={}> <event={}>", identifierMethod.getName(), event.getClass().getName(), e); } return Optional.fromNullable((T)identifier); }
Source:
<code>public String getFlagMessage() { <START> return "Mother not HIV Tested"; <END> }</code><technical_language>This name is confusing. sounds patient's mother tested. change "Not tested for HIV"</technical_language>

Target:
public String getFlagMessage() { return "Not HIV Tested"; }
Source:
<code>public boolean canExecute() { <START> final IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); <END> return activeEditor instanceof AbstractMultiPageSashEditor; }</code><technical_language>org.eclipse.papyrus.infra.ui.util.EditorHelper.getCurrentEditor() 1. do for 2. check NPE calling it</technical_language>

Target:
public boolean canExecute() { final IEditorPart activeEditor = EditorHelper.getCurrentEditor(); return activeEditor instanceof IMultiPageEditorPart; }
Source:
<code>private static byte[] getBytes(String path, InputStream in, long maxLength) throws IOException { if (maxLength > Integer.MAX_VALUE) { throw new IOException( MessageFormat.format(JGitText.get().fileIsTooLarge, path)); } int max = (int) maxLength; byte[] buffer = new byte[max]; int read = IO.readFully(in, buffer, 0); if (read == max) { return buffer; <START> } else { <END> byte[] copy = new byte[read]; System.arraycopy(buffer, 0, copy, 0, read); return copy; } }</code><technical_language>unnecessary else clause removed</technical_language>

Target:
private static byte[] getBytes(String path, InputStream in, long maxLength) throws IOException { if (maxLength > Integer.MAX_VALUE) { throw new IOException( MessageFormat.format(JGitText.get().fileIsTooLarge, path)); } int max = (int) maxLength; byte[] buffer = new byte[max]; int read = IO.readFully(in, buffer, 0); if (read == max) { return buffer; } byte[] copy = new byte[read]; System.arraycopy(buffer, 0, copy, 0, read); return copy; }
Source:
<code>Set<Recipe> recipes() { final Group group = new GroupImpl("public", null, asList("read", "search")); final Recipe recipe1 = new RecipeImpl().withId("recipe1234567890") .withCreator("codenvy") .withType("docker") .withScript("FROM ubuntu\ntail -f \\dev\\null") .withTags(asList("ubuntu")) .withPermissions(new PermissionsImpl(null, asList(group))); final Recipe recipe2 = new RecipeImpl().withId("recipe2345678901") .withCreator("codenvy") .withType("docker") .withScript("FROM bosybox\ntail -f \\dev\\null") .withTags(asList("java", "busybox")) .withPermissions(new PermissionsImpl(null, asList(group))); <START> return new HashSet<>(asList(recipe1, recipe2)); <END> }</code><technical_language>Immutable is</technical_language>

Target:
Set<Recipe> recipes() { final Group group = new GroupImpl("public", null, asList("read", "search")); final Recipe recipe1 = new RecipeImpl().withId("recipe1234567890") .withCreator("codenvy") .withType("docker") .withScript("FROM ubuntu\ntail -f \\dev\\null") .withTags(asList("ubuntu")) .withPermissions(new PermissionsImpl(null, asList(group))); final Recipe recipe2 = new RecipeImpl().withId("recipe2345678901") .withCreator("codenvy") .withType("docker") .withScript("FROM bosybox\ntail -f \\dev\\null") .withTags(asList("java", "busybox")) .withPermissions(new PermissionsImpl(null, asList(group))); return Collections.unmodifiableSet(new HashSet<>(asList(recipe1, recipe2))); }
Source:
<code>public void testOpenMRSPatientDataSourceAndCreatePatientAction() throws InterruptedException, IOException, PatientNotFoundException { Long taskID = createPatientTestTask(); activateTrigger(); assertTrue(waitForTaskExecution(taskID)); <START> deleteTask(taskID); <END> checkIfPatientWasCreatedProperly(); }</code><technical_language>is a problem deleting task, is invoked early, please remove deleting task, motech db is dropped OPENMRSITs</technical_language>

Target:
public void testOpenMRSPatientDataSourceAndCreatePatientAction() throws InterruptedException, IOException, PatientNotFoundException { Long taskID = createPatientTestTask(); activateTrigger(); assertTrue(waitForTaskExecution(taskID)); checkIfPatientWasCreatedProperly(); }
Source:
<code>public void setHasUpgradeOption(String mode, View.OnClickListener onLearnMoreClick){ <START> if(mode.equalsIgnoreCase(EnrollmentMode.AUDIT.toString())) { <END> propContainer.setVisibility(View.VISIBLE); Drawable trophyIcon = new IconDrawable(coursePropMsg.getContext(), FontAwesomeIcons.fa_trophy) .sizeRes(coursePropMsg.getContext(), R.dimen.medium_icon_size) .colorRes(coursePropMsg.getContext(), R.color.neutralBlackT); coursePropMsg.setCompoundDrawablesWithIntrinsicBounds(trophyIcon, null, null, null); learnMore.setOnClickListener(onLearnMoreClick); } else { propContainer.setVisibility(View.GONE); } }</code><technical_language>move this condition in MyCoursesAdapter if (isValuePropEnabled) if possible</technical_language>

Target:
public void setHasUpgradeOption(String mode, View.OnClickListener onLearnMoreClick) { if (mode.equalsIgnoreCase(EnrollmentMode.AUDIT.toString())) { propContainer.setVisibility(View.VISIBLE); learnMore.setOnClickListener(onLearnMoreClick); } else { propContainer.setVisibility(View.GONE); } }
Source:
<code>protected boolean readNextPage() { definitionLevelDecoder = null; valuesDecoder = null; remainingCountInPage = 0; DataPage page = pageReader.readPage(); if (page == null) { return false; } <START> Decoders.FlatDecodersCombo flatDecodersCombo = Decoders.readFlatPage(page, columnDescriptor, dictionary); <END> this.definitionLevelDecoder = flatDecodersCombo.getDefinitionLevelDecoder(); this.valuesDecoder = (Int32ValuesDecoder) flatDecodersCombo.getValuesDecoder(); remainingCountInPage = page.getValueCount(); return true; }</code><technical_language>static import Decoders.FlatDecodersCombo, Decoders.readFlatPage</technical_language>

Target:
protected boolean readNextPage() { definitionLevelDecoder = null; valuesDecoder = null; remainingCountInPage = 0; DataPage page = pageReader.readPage(); if (page == null) { return false; } FlatDecoders flatDecoders = readFlatPage(page, columnDescriptor, dictionary); this.definitionLevelDecoder = flatDecoders.getDefinitionLevelDecoder(); this.valuesDecoder = (Int32ValuesDecoder) flatDecoders.getValuesDecoder(); remainingCountInPage = page.getValueCount(); return true; }
Source:
<code>private PinotExpression handleCast(CallExpression cast, Function<VariableReferenceExpression, Selection> context) { if (cast.getArguments().size() == 1) { RowExpression input = cast.getArguments().get(0); Type expectedType = cast.getType(); if (typeManager.canCoerce(input.getType(), expectedType)) { return input.accept(this, context); } <START> else { <END> throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), "Non implicit casts not supported: " + cast); } } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("This type of CAST operator not supported. Received: %s", cast)); }</code><technical_language>else { is redundant</technical_language>

Target:
private PinotExpression handleCast(CallExpression cast, Function<VariableReferenceExpression, Selection> context) { if (cast.getArguments().size() == 1) { RowExpression input = cast.getArguments().get(0); Type expectedType = cast.getType(); if (typeManager.canCoerce(input.getType(), expectedType)) { return input.accept(this, context); } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), "Non implicit casts not supported: " + cast); } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("This type of CAST operator not supported. Received: %s", cast)); }
Source:
<code>private SimpleEMTask( final MemoryStore memoryStore, final SimpleEMTaskReady simpleEMTaskReady, final HeartBeatTriggerManager heartBeatTriggerManager, final PartitionTracker partitionTracker, final DataIdFactory<Long> dataIdFactory, @Parameter(Iterations.class) final int iterations, @Parameter(PeriodMillis.class) final long periodMillis) { this.memoryStore = memoryStore; this.simpleEMTaskReady = simpleEMTaskReady; this.heartBeatTriggerManager = heartBeatTriggerManager; this.iterations = iterations; this.periodMillis = periodMillis; final long firstItem = dataIdFactory.getId(); this.memoryStore.getElasticStore().put(DATATYPE, firstItem, firstItem); for (int index = 1; index < 9; index++) { final long item = dataIdFactory.getId(); this.memoryStore.getElasticStore().put(DATATYPE, item, item); } final long lastItem = dataIdFactory.getId(); this.memoryStore.getElasticStore().put(DATATYPE, lastItem, lastItem); <START> <END> partitionTracker.registerPartition(DATATYPE, firstItem, lastItem); }</code><technical_language>worried this loop clean. I assign multiple ids getIds put items once</technical_language>

Target:
private SimpleEMTask( final MemoryStore memoryStore, final SimpleEMTaskReady simpleEMTaskReady, final HeartBeatTriggerManager heartBeatTriggerManager, final PartitionTracker partitionTracker, final DataIdFactory<Long> dataIdFactory, @Parameter(Iterations.class) final int iterations, @Parameter(PeriodMillis.class) final long periodMillis) throws IdGenerationException { this.memoryStore = memoryStore; this.simpleEMTaskReady = simpleEMTaskReady; this.heartBeatTriggerManager = heartBeatTriggerManager; this.iterations = iterations; this.periodMillis = periodMillis; final List<Long> ids = dataIdFactory.getIds(NUM_DATA); this.memoryStore.getElasticStore().putList(DATATYPE, ids, ids); partitionTracker.registerPartition(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); }
Source:
<code>public boolean acquireLock(InvocationContext ctx, Object key, long timeoutMillis, boolean skipLocking) throws InterruptedException, TimeoutException { LockInfo lockInfo = new LockInfo(ctx); updateContentionStats(key, lockInfo); boolean locked = false; long start = timeService.time(); try { locked = actual.acquireLock(ctx, key, timeoutMillis, skipLocking); } finally { long end = timeService.time(); lockInfo.lockTimeStamp = end; if (lockInfo.contention) { lockInfo.lockWaiting = timeService.timeDuration(start, end, NANOSECONDS); } <START> if (lockInfoMap.get(key) == null && locked) { <END> lockInfoMap.put(key, lockInfo); } else if (!locked) { lockInfo.updateStats(-1); } } return locked; }</code><technical_language>lockInfoMap.putIfAbsent instead of get put: code is work concurrent access</technical_language>

Target:
public boolean acquireLock(InvocationContext ctx, Object key, long timeoutMillis, boolean skipLocking) throws InterruptedException, TimeoutException { LockInfo lockInfo = new LockInfo(ctx); updateContentionStats(key, lockInfo); boolean locked = false; long start = timeService.time(); try { locked = actual.acquireLock(ctx, key, timeoutMillis, skipLocking); } finally { long end = timeService.time(); lockInfo.lockTimeStamp = end; if (lockInfo.contention) { lockInfo.lockWaiting = timeService.timeDuration(start, end, NANOSECONDS); } if (locked) { lockInfoMap.putIfAbsent(key, lockInfo); } else { lockInfo.updateStats(-1); } } return locked; }
Source:
<code>public RealmQuery<E> isNull(String fieldName) { realm.checkIfValid(); <START> long columnIndices[] = schema.parseFieldName(fieldName); <END> this.query.isNull(columnIndices); return this; }</code><technical_language>is parseFieldName a name getColumnIndicies? more clear me? parsing number of things</technical_language>

Target:
public RealmQuery<E> isNull(String fieldName) { realm.checkIfValid(); long[] columnIndices = schema.getColumnIndices(fieldName); this.query.isNull(columnIndices); return this; }
Source:
<code>public Boolean apply(WebDriver webDriver) { if (webElement == null) { return (!webDriver.findElements(By.xpath(xpath)).isEmpty() == isPresent); } else { return (!webElement.findElements(By.xpath(xpath)).isEmpty() == isPresent); <START> } <END> }</code><technical_language>body of if block else block me</technical_language>

Target:
public Boolean apply(WebDriver webDriver) { SearchContext search = (webElement == null) ? webDriver : webElement; return search.findElements(By.xpath(xpath)).isEmpty() != isPresent; }
Source:
<code>public List<User> getAllActiveUsersSortedByNameAndSurname() { <START> return search("FROM User WHERE active = 1 AND visible IS NULL ORDER BY surname ASC, name ASC"); <END> }</code><technical_language>Is visible changed integer renamed deleted NULL more</technical_language>

Target:
public List<User> getAllActiveUsersSortedByNameAndSurname() { return search("FROM User WHERE active = 1 AND deleted = 0 ORDER BY surname ASC, name ASC"); }
Source:
<code>private Map<String, String> getMapFromJsonObject(String json) { <START> Type stringMapType = new TypeToken<Map<String, Object>>() {}.getType(); <END> return new Gson().fromJson(json, stringMapType); }</code><technical_language>this variable name updated well</technical_language>

Target:
private Map<String, Object> getMapFromJsonObject(String json) throws JsonSyntaxException { Type typeToken = new TypeToken<Map<String, Object>>() {}.getType(); return new Gson().fromJson(json, typeToken); }
Source:
<code>public int compareTo(ScoredSearchHit other) { int comparison = this.isExact.compareTo(other.isExact); if (comparison == 0) { <START> return score - other.score; <END> } return comparison; }</code><technical_language>Integer.compare(int a, int b); handle edge cases better, a problem here, for future reference</technical_language>

Target:
public int compareTo(ScoredSearchHit other) { int comparison = Boolean.compare(isExact, other.isExact); if (comparison == 0) { return Integer.compare(score, other.score); } return comparison; }
Source:
<code>public void updateAllowedConnectionType(ConnectionType allowedConnectionType) { if (allowedConnectionType == null) { throw new IllegalArgumentException("Allowed connection type cannot be null"); } downloadConnectionAllowedChecker.updateAllowedConnectionType(allowedConnectionType); <START> DownloadsNetworkRecoveryCreator.getInstance().updateAllowedConnection(allowedConnectionType); <END> submitAllStoredDownloads(() -> Log.v("Allowed connectionType updated to " + allowedConnectionType + ". All jobs submitted")); }</code><technical_language>rename this method consistent updateAllowedConnectionType</technical_language>

Target:
public void updateAllowedConnectionType(ConnectionType allowedConnectionType) { if (allowedConnectionType == null) { throw new IllegalArgumentException("Allowed connection type cannot be null"); } connectionChecker.updateAllowedConnectionType(allowedConnectionType); DownloadsNetworkRecoveryCreator.getInstance().updateAllowedConnectionType(allowedConnectionType); submitAllStoredDownloads(() -> Log.v("Allowed connectionType updated to " + allowedConnectionType + ". All jobs submitted")); }
Source:
<code><START> public int rank(final Set<ResourceType> resourceTypes, final Collection<ServiceConfiguration<?>> serviceConfigs) { <END> if (findSingletonAmongst(XAStoreConfiguration.class, serviceConfigs) == null) { return 0; } final int underlyingRank = underlyingStoreProvider.rank(resourceTypes, serviceConfigs); if (underlyingRank != 0) { return 10 + underlyingRank; } else { return 0; } }</code><technical_language>This wrong... XAStore a recursive call StoreSupport.selectStoreProvider is passed a StoreProvider filters out this provider set of returned store providers</technical_language>

Target:
public int rank(final Set<ResourceType> resourceTypes, final Collection<ServiceConfiguration<?>> serviceConfigs) { if (findSingletonAmongst(XAStoreConfiguration.class, serviceConfigs) == null) { return 0; } final int underlyingRank; if (resourceTypes.equals(EnumSet.of(ResourceType.Core.HEAP))) { underlyingRank = 1; } else { underlyingRank = underlyingStoreProvider.rank(resourceTypes, serviceConfigs); } if (underlyingRank != 0) { return 10 + underlyingRank; } else { return 0; } }
Source:
<code>public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { <START> if (!getExpression().evaluate(tuple, ptr) || ptr.getLength() == 0) { <END> return false; } PDataType type = getExpression().getDataType(); String stringValue = (String)type.toObject(ptr); BigDecimal decimalValue = (BigDecimal) getDataType().toObject(stringValue); byte[] byteValue = getDataType().toBytes(decimalValue); ptr.set(byteValue); return true; }</code><technical_language>Subtle difference for ptr.getLength() == 0 case. Return true in this case indication expression able evaluated, answer null (as opposed returning false means able evaluate result enough information). cases end evaluating null, filter evaluation server side, operating partial data, expression continue evaluated more key/values for a row</technical_language>

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!getExpression().evaluate(tuple, ptr)) { return false; } else if (ptr.getLength() == 0) { return true; } PDataType type = getExpression().getDataType(); String stringValue = (String)type.toObject(ptr); if (stringValue == null) { return false; } stringValue = stringValue.trim(); BigDecimal decimalValue = (BigDecimal) getDataType().toObject(stringValue); byte[] byteValue = getDataType().toBytes(decimalValue); ptr.set(byteValue); return true; }
Source:
<code>public void testOpenshiftConnectionCredentials() throws Exception { CDKOpenshiftUtility util = new CDKOpenshiftUtility(); ADBInfo adb = createADB(); IServer s = mockServer("openshift33"); <START> <END> createCDKFile("Basic", null, null); IConnection con = util.createOpenshiftConnection(s, adb, false); assertNotNull(con); assertEquals(con.getUsername(), "openshift-dev"); assertEquals(con.getPassword(), "devel"); createCDKFile("Basic", "test", null); con = util.createOpenshiftConnection(s, adb, false); assertNotNull(con); assertEquals(con.getUsername(), "test"); assertEquals(con.getPassword(), null); createCDKFile("Basic", "test", "pass"); con = util.createOpenshiftConnection(s, adb, false); assertNotNull(con); assertEquals(con.getUsername(), "test"); assertEquals(con.getPassword(), "pass"); }</code><technical_language>ConnectionRegistry registry = mock(ConnectionRegistry.class)</technical_language>

Target:
public void testOpenshiftConnectionCredentials() throws Exception { CDKOpenshiftUtility util = new CDKOpenshiftUtility(); ADBInfo adb = createADB(); IServer s = mockServer("openshift33"); createCDKFile("Basic", null, null); IConnection con = util.createOpenshiftConnection(s, adb, null); assertNotNull(con); assertEquals(con.getUsername(), "openshift-dev"); assertEquals(con.getPassword(), "devel"); createCDKFile("Basic", "test", null); con = util.createOpenshiftConnection(s, adb, null); assertNotNull(con); assertEquals(con.getUsername(), "test"); assertEquals(con.getPassword(), null); createCDKFile("Basic", "test", "pass"); con = util.createOpenshiftConnection(s, adb, null); assertNotNull(con); assertEquals(con.getUsername(), "test"); assertEquals(con.getPassword(), "pass"); }
Source:
<code>public void testSetDatastoreProperties() throws Exception { datastoreProperties.init(); properties.init(); SandboxedInstanceTestFixture sandboxedInstanceTestFixture = new SandboxedInstanceTestFixture(); sandboxedInstanceTestFixture.setUp(); properties.setDatastoreProperties(datastoreProperties); assertThat((Iterable<String>) properties.moduleName.getPossibleValues(), containsInAnyOrder( "Account", "Customer")); assertThat(properties.selectColumnIds.getPossibleValues(), empty()); <START> } <END></code><technical_language>I in next methods call sandboxedInstanceTestFixture .tearDown() in a try/finally close</technical_language>

Target:
public void testSetDatastoreProperties() throws Exception { datastoreProperties.init(); properties.init(); try (MockRuntimeSourceOrSinkTestFixture testFixture = new MockRuntimeSourceOrSinkTestFixture( isA(SalesforceInputProperties.class), createDefaultTestDataset())) { testFixture.setUp(); properties.setDatastoreProperties(datastoreProperties); assertThat((Iterable<String>) properties.moduleName.getPossibleValues(), containsInAnyOrder( "Account", "Customer")); assertThat(properties.selectColumnIds.getPossibleValues(), empty()); } }
Source:
<code>private static RelDataType inferRowType(SqlOperatorBinding opBinding) { final RelDataType inputRowType = opBinding.getOperandType(0); final RelDataTypeFactory typeFactory = opBinding.getTypeFactory(); final RelDataType timestampType = typeFactory.createSqlType(SqlTypeName.TIMESTAMP); return typeFactory.builder() .kind(inputRowType.getStructKind()) .addAll(inputRowType.getFieldList()) .add("wstart", timestampType) <START> .add("wend", timestampType) <END> .build(); }</code><technical_language>Note I asked of authors of "one sql rule all" paper. reason wstart wend of layout for a paper. I suggestion window_start window_end. I in a JIRA email (sorry I recall is) agreed switch window_start window_end. I suggest window_start window_end, understood easier wstart/wend</technical_language>

Target:
private static RelDataType inferRowType(SqlOperatorBinding opBinding) { final RelDataType inputRowType = opBinding.getOperandType(0); final RelDataTypeFactory typeFactory = opBinding.getTypeFactory(); final RelDataType timestampType = typeFactory.createSqlType(SqlTypeName.TIMESTAMP); return typeFactory.builder() .kind(inputRowType.getStructKind()) .addAll(inputRowType.getFieldList()) .add("window_start", timestampType) .add("window_end", timestampType) .build(); }
Source:
<code>private void visitReturn(DetailAST ast) { if (ast.getFirstChild().getType() == TokenTypes.SEMI) { context.hasVoidReturn = true; <START> context.visitLiteralReturn(maxForVoid); <END> } else { context.hasVoidReturn = false; context.visitLiteralReturn(max); } }</code><technical_language>accessing a field is frowned upon. visit method call right hasVoidReturn, pass method instead</technical_language>

Target:
private void visitReturn(DetailAST ast) { if (ast.getFirstChild().getType() == TokenTypes.SEMI) { context.visitLiteralReturn(maxForVoid, true); } else { context.visitLiteralReturn(max, false); } }
Source:
<code>public void validate(final TokenCredentials credentials) { CommonHelper.assertNotBlank("signingSecret", signingSecret); final String token = credentials.getToken(); boolean verified = false; SignedJWT signedJWT = null; try { final JWT jwt = JWTParser.parse(token); if (jwt instanceof SignedJWT) { signedJWT = (SignedJWT) jwt; } else if (jwt instanceof EncryptedJWT) { final JWEObject jweObject = (JWEObject) jwt; String secret = this.encryptionSecret; if (CommonHelper.isBlank(secret)) { logger.warn("Encryption secret is not configured. Falling back to signing secret"); secret = this.signingSecret; } jweObject.decrypt(new DirectDecrypter(secret.getBytes("UTF-8"))); signedJWT = jweObject.getPayload().toSignedJWT(); } else { throw new TechnicalException("unsupported unsecured jwt"); } verified = signedJWT.verify(new MACVerifier(this.signingSecret)); } catch (final Exception e) { throw new TechnicalException("Cannot decrypt / verify JWT", e); } if (!verified) { final String message = "JWT verification failed: " + token; throw new CredentialsException(message); <START> } <END> try { final JWTClaimsSet claimSet = signedJWT.getJWTClaimsSet(); final UserProfile profile = ProfileHelper.buildProfile(claimSet.getSubject(), claimSet.getClaims()); credentials.setUserProfile(profile); } catch (final Exception e) { throw new TechnicalException("Cannot get claimSet", e); } }</code><technical_language>I setSecret set signing encryption secrets</technical_language>

Target:
public void validate(final TokenCredentials credentials) { CommonHelper.assertNotBlank("signingSecret", signingSecret); final String token = credentials.getToken(); boolean verified = false; SignedJWT signedJWT = null; try { final JWT jwt = JWTParser.parse(token); if (jwt instanceof SignedJWT) { signedJWT = (SignedJWT) jwt; } else if (jwt instanceof EncryptedJWT) { final JWEObject jweObject = (JWEObject) jwt; CommonHelper.assertNotBlank("encryptionSecret", encryptionSecret); jweObject.decrypt(new DirectDecrypter(this.encryptionSecret.getBytes("UTF-8"))); signedJWT = jweObject.getPayload().toSignedJWT(); } else { throw new TechnicalException("unsupported unsecured jwt"); } verified = signedJWT.verify(new MACVerifier(this.signingSecret)); } catch (final Exception e) { throw new TechnicalException("Cannot decrypt / verify JWT", e); } if (!verified) { final String message = "JWT verification failed: " + token; throw new CredentialsException(message); } try { final JWTClaimsSet claimSet = signedJWT.getJWTClaimsSet(); final UserProfile profile = ProfileHelper.buildProfile(claimSet.getSubject(), claimSet.getClaims()); credentials.setUserProfile(profile); } catch (final Exception e) { throw new TechnicalException("Cannot get claimSet", e); } }
Source:
<code>void checksumFile(File file, Checksum checksum) { checksum.update(MountableFile.getUnixFileMode(file.toPath())); if (file.isDirectory()) { try (Stream<Path> stream = Files.walk(file.toPath())) { <START> stream.filter(it -> !Files.isDirectory(it)).forEach(path -> { <END> checksumFile(path.toFile(), checksum); }); } } else { FileUtils.checksum(file, checksum); } }</code><technical_language>file mode included in checksum line 506 is cool... here, walk contents, walking sub_files_ (i.e. direct child files child files of subdirectories)? If case capture file mode of subdirectories - is correct interpretation</technical_language>

Target:
void checksumFile(File file, Checksum checksum) { Path path = file.toPath(); checksum.update(MountableFile.getUnixFileMode(path)); if (file.isDirectory()) { try (Stream<Path> stream = Files.walk(path)) { stream.filter(it -> it != path).forEach(it -> { checksumFile(it.toFile(), checksum); }); } } else { FileUtils.checksum(file, checksum); } }
Source:
<code><START> protected String createAssertion(JsonFactory jsonFactory, long currentTime) throws IOException { <END> JsonWebSignature.Header header = new JsonWebSignature.Header(); header.setAlgorithm("RS256"); header.setType("JWT"); header.setKeyId(privateKeyId); JsonWebToken.Payload payload = new JsonWebToken.Payload(); payload.setIssuer(clientEmail); payload.setAudience(OAuth2Utils.TOKEN_SERVER_URI.toString()); payload.setIssuedAtTimeSeconds(currentTime / 1000); payload.setExpirationTimeSeconds(currentTime / 1000 + 3600); payload.setSubject(serviceAccountUser); payload.put("scope", Joiner.on(' ').join(scopes)); String assertion; try { assertion = JsonWebSignature.signUsingRsaSha256( privateKey, jsonFactory, header, payload); } catch (GeneralSecurityException e) { throw new IOException( "Error signing service account access token request with private key.", e); } return assertion; }</code><technical_language>protected is for want allow a subclass override method, want prevent code subclass & package calling it; I intending - want visible test. If case, package-private</technical_language>

Target:
String createAssertion(JsonFactory jsonFactory, long currentTime) throws IOException { JsonWebSignature.Header header = new JsonWebSignature.Header(); header.setAlgorithm("RS256"); header.setType("JWT"); header.setKeyId(privateKeyId); JsonWebToken.Payload payload = new JsonWebToken.Payload(); payload.setIssuer(clientEmail); payload.setAudience(OAuth2Utils.TOKEN_SERVER_URI.toString()); payload.setIssuedAtTimeSeconds(currentTime / 1000); payload.setExpirationTimeSeconds(currentTime / 1000 + 3600); payload.setSubject(serviceAccountUser); payload.put("scope", Joiner.on(' ').join(scopes)); String assertion; try { assertion = JsonWebSignature.signUsingRsaSha256( privateKey, jsonFactory, header, payload); } catch (GeneralSecurityException e) { throw new IOException( "Error signing service account access token request with private key.", e); } return assertion; }
Source:
<code>protected void fireExpressionEditorSelectedEvent() { <START> final Optional<BaseExpressionGrid> parentGrid = findParentGrid(parent); <END> editorSelectedEvent.fire(new ExpressionEditorSelectedEvent(sessionManager.getCurrentSession(), parentGrid)); }</code><technical_language>version is more readable, wanted ask if noticed. update to: java final Optional<BaseExpressionGrid> parentGrid = findParentGrid(); if findParentGrid declared as: java private Optional<BaseExpressionGrid> findParentGrid()</technical_language>

Target:
protected void fireExpressionEditorSelectedEvent() { final Optional<BaseExpressionGrid> parentGrid = findParentGrid(); editorSelectedEvent.fire(new ExpressionEditorSelectedEvent(sessionManager.getCurrentSession(), parentGrid)); }
Source:
<code>public void addInput(Page page) { requireNonNull(page, "page is null"); checkState(state == State.RUNNING, "Operator is %s", state); <START> lifespanAndStageStateTracker.update(page); <END> lifespanAndStageStateTracker.getStatisticsPagesToProcess(page).forEach(statisticsPage -> { OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); statisticsAggregationOperator.addInput(statisticsPage); timer.end(statisticsTiming); }); }</code><technical_language>Decode tableCommitContext here, pass a parameter</technical_language>

Target:
public void addInput(Page page) { requireNonNull(page, "page is null"); checkState(state == State.RUNNING, "Operator is %s", state); TableCommitContext tableCommitContext = getTableCommitContext(page); lifespanAndStageStateTracker.update(page, tableCommitContext); lifespanAndStageStateTracker.getStatisticsPagesToProcess(page, tableCommitContext).forEach(statisticsPage -> { OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); statisticsAggregationOperator.addInput(statisticsPage); timer.end(statisticsTiming); }); }
Source:
<code>@Override public void decompressPage(ByteBuffer page, int pageSize) throws IgniteCheckedException { assert page.capacity() == pageSize; byte compressType = PageIO.getCompressionType(page); if (compressType == UNCOMPRESSED_PAGE) return; short compressedSize = PageIO.getCompressedSize(page); short compactSize = PageIO.getCompactedSize(page); assert compactSize <= pageSize && compactSize >= compressedSize; if (compressType != COMPACTED_PAGE) { ByteBuffer dst = compressBuf.get(); page.limit(compressedSize) .position(PageIO.COMMON_HEADER_END); dst.limit(compactSize - PageIO.COMMON_HEADER_END); <START> if (compressType == ZSTD_COMPRESSED_PAGE) { <END> Zstd.decompress(dst, page); dst.flip(); } else if (compressType == LZ4_COMPRESSED_PAGE) { Lz4.decompress(page, dst); dst.flip(); } else if (compressType == SNAPPY_COMPRESSED_PAGE) { try { Snappy.uncompress(page, dst); } catch (IOException e) { throw new IgniteException(e); } } else throw new IllegalStateException("Unknown compression: " + compressType); page.position(PageIO.COMMON_HEADER_END).limit(compactSize); page.put(dst).flip(); assert page.limit() == compactSize; } else page.position(0).limit(compactSize); CompactablePageIO io = PageIO.getPageIO(page); io.restorePage(page, pageSize); setCompressionInfo(page, null, 0, 0); }</code><technical_language>Please switch instead</technical_language>

Target:
@Override public void decompressPage(ByteBuffer page, int pageSize) throws IgniteCheckedException { assert page.capacity() == pageSize; byte compressType = PageIO.getCompressionType(page); if (compressType == UNCOMPRESSED_PAGE) return; short compressedSize = PageIO.getCompressedSize(page); short compactSize = PageIO.getCompactedSize(page); assert compactSize <= pageSize && compactSize >= compressedSize; if (compressType == COMPACTED_PAGE) { page.position(0).limit(compactSize); } else { ByteBuffer dst = compressBuf.get(); page.limit(compressedSize) .position(PageIO.COMMON_HEADER_END); dst.limit(compactSize - PageIO.COMMON_HEADER_END); switch (compressType) { case ZSTD_COMPRESSED_PAGE: Zstd.decompress(dst, page); dst.flip(); break; case LZ4_COMPRESSED_PAGE: Lz4.decompress(page, dst); dst.flip(); break; case SNAPPY_COMPRESSED_PAGE: try { Snappy.uncompress(page, dst); } catch (IOException e) { throw new IgniteException(e); } break; default: throw new IgniteException("Unknown compression: " + compressType); } page.position(PageIO.COMMON_HEADER_END).limit(compactSize); page.put(dst).flip(); assert page.limit() == compactSize; } CompactablePageIO io = PageIO.getPageIO(page); io.restorePage(page, pageSize); setCompressionInfo(page, null, 0, 0); }
Source:
<code>private UriSchemeHandlerPreferencePage openPreferenceAndGetPage() { <START> Shell shell = Display.getCurrent().getActiveShell(); <END> this.dialog = PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.ui.preferencePages.General.LinkHandlers", null, null); this.dialog.setBlockOnOpen(false); this.dialog.open(); return (UriSchemeHandlerPreferencePage) this.dialog.getSelectedPage(); }</code><technical_language>new Shell(); this work</technical_language>

Target:
private UriSchemeHandlerPreferencePage openPreferenceAndGetPage() { this.dialog = PreferencesUtil.createPreferenceDialogOn(new Shell(), "org.eclipse.ui.preferencePages.General.LinkHandlers", null, null); this.dialog.setBlockOnOpen(false); this.dialog.open(); return (UriSchemeHandlerPreferencePage) this.dialog.getSelectedPage(); }
Source:
<code>protected static boolean hasIllegalCombination(DetailAST modifiers) { <START> for (DetailAST modifier = modifiers.getFirstChild(); modifier != null; modifier = modifier.getNextSibling()) { <END> int modifierType = modifier.getType(); if (TokenTypes.ANNOTATION == modifierType) { if (INVALID_FINAL_ANNOTATIONS.contains(modifier.findFirstToken(TokenTypes.IDENT).getText())) { return true; } } if (INVALID_FINAL_COMBINATION.contains(modifierType)) { return true; } } return false; }</code><technical_language>replaced with: TokenUtil.findFirstTokenByPredicate(...). I this simplified. java node -> { int modifierType = modifier.getType(); return INVALID_FINAL_COMBINATION.contains(modifierType) || (TokenTypes.ANNOTATION == modifierType && INVALID_FINAL_ANNOTATIONS.contains(modifier.findFirstToken(TokenTypes.IDENT).getText())); }</technical_language>

Target:
protected static boolean hasIllegalCombination(DetailAST modifiers) { if (modifiers.getType() != TokenTypes.MODIFIERS) { return false; } Optional<DetailAST> illegalCombination = TokenUtil.findFirstTokenByPredicate(modifiers, (node) -> { final int type = node.getType(); return INVALID_FINAL_COMBINATION.contains(node.getType()) || (TokenTypes.ANNOTATION == type && INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText())); }); return illegalCombination.isPresent(); }
Source:
<code>public Object getValue(final ELContext context, final Object base, final Object property) { Objects.requireNonNull(context, UndertowLogger.ROOT_LOGGER.nullNotAllowed("ELContext")); if (base != null) { return null; } if (!(property instanceof String)) { return null; } final String klassName = (String) property; final ImportHandler importHandler = context.getImportHandler(); if (importHandler == null) { return null; } Class<?> klass; if (WildFlySecurityManager.isChecking()) { <START> klass = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() { <END> @Override public Class<?> run() { return importHandler.resolveClass(klassName); } }); } else { klass = importHandler.resolveClass(klassName); } if (klass != null) { context.setPropertyResolved(true); return new ELClass(klass); } return null; }</code><technical_language>this stuff fixed in Jastow itself, in a test</technical_language>

Target:
public Object getValue(final ELContext context, final Object base, final Object property) { Objects.requireNonNull(context, UndertowLogger.ROOT_LOGGER.nullNotAllowed("ELContext")); if (base != null) { return null; } if (!(property instanceof String)) { return null; } final String klassName = (String) property; final ImportHandler importHandler = context.getImportHandler(); if (importHandler == null) { return null; } final Class<?> klass; if (WildFlySecurityManager.isChecking()) { klass = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() { @Override public Class<?> run() { return importHandler.resolveClass(klassName); } }); } else { klass = importHandler.resolveClass(klassName); } if (klass != null) { context.setPropertyResolved(true); return new ELClass(klass); } return null; }
Source:
<code>private void addDefaultLanguageCookie(HttpServletRequest httpRequest, HttpServletResponse response) { Cookie languageCookie = null; <START> if(!LOCALIZATION_CHINESE.equals(LOCALIZATION)) <END> return; if(httpRequest.getCookies()!=null) { for(Cookie c : httpRequest.getCookies()) { if(DEFAULT_LANGUAGE.equals(c.getName()) && c.getName()!=null) { languageCookie = c; break; } } } if(languageCookie == null) { languageCookie = new Cookie(DEFAULT_LANGUAGE, LOCALIZATION_CHINESE); languageCookie.setPath("/"); response.addCookie(languageCookie); } }</code><technical_language>check StringUtils.isNotBlank(LOCALIZATION.get())</technical_language>

Target:
private void addDefaultLanguageCookie(HttpServletRequest httpRequest, HttpServletResponse response) { Cookie languageCookie = null; if(!StringUtils.isNotBlank(LOCALIZATION.get())) return; if(httpRequest.getCookies()!=null) { for(Cookie c : httpRequest.getCookies()) { if(LANG.equals(c.getName()) && c.getName()!=null) { languageCookie = c; break; } } } if(languageCookie == null) { languageCookie = new Cookie(LANG, LOCALIZATION.get()); languageCookie.setPath("/"); response.addCookie(languageCookie); } }
Source:
<code>public void writeTo(View t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { final Timer.Context context = metricRegistry.timer(name(t.getClass(), "rendering")).time(); try { for (ViewRenderer renderer : renderers) { if (renderer.isRenderable(t)) { renderer.render(t, detectLocale(headers), entityStream); return; } } throw new ViewRenderException("Unable to find a renderer for " + t.getTemplateName()); } catch (ViewRenderException e) { <START> LOGGER.error("Template Error", e); <END> throw new WebApplicationException(e); } finally { context.stop(); } }</code><technical_language>preference format log message in ExceptionMapper, this ExceptionMapper well</technical_language>

Target:
public void writeTo(View t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { final Timer.Context context = metricRegistry.timer(name(t.getClass(), "rendering")).time(); try { for (ViewRenderer renderer : renderers) { if (renderer.isRenderable(t)) { renderer.render(t, detectLocale(headers), entityStream); return; } } throw new ViewRenderException("Unable to find a renderer for " + t.getTemplateName()); } catch (ViewRenderException e) { throw new WebApplicationException(e); } finally { context.stop(); } }
Source:
<code>public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Connection)) { return false; } if (object == this) { return true; } Connection connection = (Connection) object; List<EObject> allFirstElements = new ArrayList<>(); allFirstElements.add(this.getOrigin()); <START> allFirstElements.addAll(this.getTargets()); <END> List<EObject> allSecondElements = new ArrayList<>(); allSecondElements.add(connection.getOrigin()); allSecondElements.addAll(connection.getTargets()); List<String> firstElementsIds = new ArrayList<>(); List<String> secondElementIds = new ArrayList<>(); String firstTraceType = ""; String secondTracetype = ""; for (EObject element : allFirstElements) { firstElementsIds.add(EMFHelper.getIdentifier(element)); } for (EObject element : allSecondElements) { secondElementIds.add(EMFHelper.getIdentifier(element)); } firstTraceType = EMFHelper.getIdentifier(this.getTlink().eClass()); secondTracetype = EMFHelper.getIdentifier(connection.getTlink().eClass()); return firstElementsIds.containsAll(secondElementIds) && firstTraceType.equals(secondTracetype); }</code><technical_language>ArrayList<>(Collection) constructor</technical_language>

Target:
public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Connection)) { return false; } if (object == this) { return true; } Connection connection = (Connection) object; List<EObject> allFirstElements = new ArrayList<>(this.getTargets()); allFirstElements.add(this.getOrigin()); List<EObject> allSecondElements = new ArrayList<>(connection.getTargets()); allSecondElements.add(connection.getOrigin()); String firstTraceType = EMFHelper.getIdentifier(this.getTlink().eClass()); String secondTracetype = EMFHelper.getIdentifier(connection.getTlink().eClass()); if (!(firstTraceType.equals(secondTracetype))) { return false; } List<String> firstElementsIds = allFirstElements.stream().map(e -> EMFHelper.getIdentifier(e)) .collect(Collectors.toList()); List<String> secondElementsIds = allSecondElements.stream().map(e -> EMFHelper.getIdentifier(e)) .collect(Collectors.toList()); return firstElementsIds.containsAll(secondElementsIds); }
Source:
<code>public void setUp() { cluster = new Cluster(); cluster.setId(clusterId); <START> Network externalNetwork = new Network(); externalNetwork.setProvidedBy(new ProviderNetwork()); <END> List<Network> networks = new ArrayList<>(); networks.add(new Network()); networks.add(externalNetwork); when(getQueryParameters().getId()).thenReturn(clusterId); when(clusterDao.get(clusterId)).thenReturn(cluster); when(networkDao.getAllForCluster(clusterId, getUser().getId(), getQueryParameters().isFiltered())).thenReturn( networks); }</code><technical_language>i missing a test for a situation external network is set all, is set provider is set. this happen in cases of db glitches, out of scope for this patch, worthwhile test code fail null\empty collections null objects</technical_language>

Target:
public void setUp() { cluster = new Cluster(); cluster.setId(clusterId); externalNetwork = new Network(); setIsValidProvidedBy(true); List<Network> networks = new ArrayList<>(); networks.add(new Network()); networks.add(externalNetwork); when(getQueryParameters().getId()).thenReturn(clusterId); when(clusterDao.get(clusterId)).thenReturn(cluster); when(networkDao.getAllForCluster(clusterId, getUser().getId(), getQueryParameters().isFiltered())).thenReturn( networks); }
Source:
<code>public String getContentTypeFieldLabelKey(){ String legacyName = LegacyFieldTypes.getLegacyName(this.getClass()); <START> String key = legacyName.substring(0, 1).toUpperCase() + legacyName.substring(1); <END> return key; }</code><technical_language>![MINOR](<LINK_1> 'Severity: MINOR') Immediately return this expression instead of assigning temporary variable "key". [![rule](<LINK_0>](<LINK_2></technical_language>

Target:
public String getContentTypeFieldLabelKey(){ String legacyName = LegacyFieldTypes.getLegacyName(this.getClass()); return legacyName.substring(0, 1).toUpperCase() + legacyName.substring(1); }
Source:
<code>public HL7Recipient(String recipientName, String recipientUrl, String recipientUsername, String recipientPassword) { <START> this(recipientName, recipientUrl); <END> this.recipientPassword = recipientPassword; this.recipientUsername = recipientUsername; }</code><technical_language>args constructors call this one. other way</technical_language>

Target:
public HL7Recipient(String recipientName, String recipientUrl, String recipientUsername, String recipientPassword) { this.recipientName = recipientName; this.recipientUrl = recipientUrl; this.recipientUsername = recipientUsername; this.recipientPassword = recipientPassword; }
Source:
<code>private static boolean isPackage(String qualifier) { checkNotNull(qualifier); <START> checkArgument(!qualifier.isEmpty()); <END> int indexOfWildcardChar = qualifier.indexOf(PACKAGE_WILDCARD_INDICATOR); int qualifierLength = qualifier.length(); boolean result = indexOfWildcardChar == (qualifierLength - PACKAGE_WILDCARD_INDICATOR.length()); return result; }</code><technical_language>Please Preconditions2 instead. This is reason this utility exists</technical_language>

Target:
private static boolean isPackage(String qualifier) { checkNotEmptyOrBlank(qualifier); int indexOfWildcardChar = qualifier.indexOf(PACKAGE_WILDCARD_INDICATOR); int qualifierLength = qualifier.length(); boolean result = indexOfWildcardChar == (qualifierLength - PACKAGE_WILDCARD_INDICATOR.length()); return result; }
Source:
<code>public void addToClipboard(List<T> items) throws CloneNotSupportedException, IOException { for (T item : items) { clipboard.add((T) item.clone()); <START> item.copyResourcesToDirectory(ClipboardHandler.getInstance().getClipboardDirectory()); <END> } }</code><technical_language>happen list is empty this is called</technical_language>

Target:
public void addToClipboard(List<T> items) throws CloneNotSupportedException, IOException { for (T item : items) { T clone = (T) item.clone(); clone.copyResourcesToDirectory(ClipboardHandler.getClipboardDirectory()); clipboard.add(clone); } }