auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String getPassword(SessionContext session, NamedResource resourceKey, int retryIndex) throws IOException { char[] password = null; if (credentialSourceSupplier != null) { CredentialSource credentialSource = null; try { credentialSource = credentialSourceSupplier.get(); } catch (XMLStreamException e) { log.xmlFailedToCreateCredential(e); } password = credentialSource.applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, ClearPassword::getPassword)); } else if (credential != null) { password = credential.castAndApply(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, ClearPassword::getPassword)); } return new String(password); }

Target:
public String getPassword(SessionContext session, NamedResource resourceKey, int retryIndex) throws IOException { char[] password = null; if (credentialSourceSupplier != null) { CredentialSource credentialSource = null; try { credentialSource = credentialSourceSupplier.get(); } catch (XMLStreamException e) { throw log.xmlFailedToCreateCredential(e); } password = credentialSource.applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, ClearPassword::getPassword)); } else if (credential != null) { password = credential.castAndApply(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, ClearPassword::getPassword)); } if (password == null) { throw log.xmlFailedToCreateCredential(new NullPointerException()); } return new String(password); }
Source:
default Map<String, Object> getEventStyle(ITimeEvent event) { StateItem stateItem = null; if (event instanceof TimeEvent) { int index = getStateTableIndex(event); StateItem[] stateTable = getStateTable(); if (index >= 0 && index < stateTable.length) { stateItem = stateTable[index]; } } return stateItem != null ? stateItem.getStyleMap() : Collections.emptyMap(); }

Target:
default Map<String, Object> getEventStyle(ITimeEvent event) { StateItem stateItem = null; if (event instanceof TimeEvent) { int index = getStateTableIndex(event); StateItem[] stateTable = getStateTable(); if (index >= 0 && index < stateTable.length) { stateItem = stateTable[index]; } } Map<String, Object> styleMap = new HashMap<>(); if (stateItem != null) { styleMap.putAll(stateItem.getStyleMap()); } styleMap.putAll(getSpecificEventStyle(event)); return styleMap; }
Source:
private void analyse(InputFile inputFile, List<JavaScriptCheck> visitors) { Issuable issuable = perspective(Issuable.class, inputFile); ScriptTree scriptTree; RecognitionException parseException = null; try { scriptTree = (ScriptTree) parser.parse(new java.io.File(inputFile.absolutePath())); scanFile(inputFile, visitors, issuable, scriptTree); } catch (RecognitionException e) { parseException = e; LOG.error("Unable to parse file: " + inputFile.absolutePath()); LOG.error(e.getMessage()); } catch (Exception e) { throw new AnalysisException("Unable to parse file: " + inputFile.absolutePath(), e); } if (parseException != null) { processRecognitionException(parseException, issuable); } }

Target:
private void analyse(InputFile inputFile, List<JavaScriptCheck> visitors) { Issuable issuable = perspective(Issuable.class, inputFile); ScriptTree scriptTree; try { scriptTree = (ScriptTree) parser.parse(new java.io.File(inputFile.absolutePath())); scanFile(inputFile, visitors, issuable, scriptTree); } catch (RecognitionException e) { LOG.error("Unable to parse file: " + inputFile.absolutePath()); LOG.error(e.getMessage()); processRecognitionException(e, issuable); } catch (Exception e) { throw new AnalysisException("Unable to parse file: " + inputFile.absolutePath(), e); } }
Source:
private ArrayList<String> getTabUrls() { String currentTab = driver.getWindowHandle(); ArrayList<String> result = new ArrayList<>(); for(String windowHandler : driver.getWindowHandles()) { driver.switchTo().window(windowHandler); result.add(driver.getCurrentUrl()); } driver.switchTo().window(currentTab); return result; }

Target:
private List<String> getTabUrls() { String currentTab = driver.getWindowHandle(); List<String> result = new ArrayList<>(); for(String windowHandler : driver.getWindowHandles()) { driver.switchTo().window(windowHandler); result.add(driver.getCurrentUrl()); } driver.switchTo().window(currentTab); return result; }
Source:
private void processFinishedPartitions( final List<Future<StepExecution>> tasks, final Set<StepExecution> result) throws InterruptedException, ExecutionException, Exception { for(int i = 0; i < tasks.size(); i++) { Future<StepExecution> curTask = tasks.get(i); if(curTask.isDone()) { StepExecution curStepExecution = curTask.get(); if(analyzer != null) { analyzer.analyzeStatus(curStepExecution.getStatus().getBatchStatus(), curStepExecution.getExitStatus().getExitCode()); } result.add(curStepExecution); tasks.remove(i); i--; } } }

Target:
private void processFinishedPartitions( final List<Future<StepExecution>> tasks, final Set<StepExecution> result) throws Exception { for(int i = 0; i < tasks.size(); i++) { Future<StepExecution> curTask = tasks.get(i); if(curTask.isDone()) { StepExecution curStepExecution = curTask.get(); if(analyzer != null) { analyzer.analyzeStatus(curStepExecution.getStatus().getBatchStatus(), curStepExecution.getExitStatus().getExitCode()); } result.add(curStepExecution); tasks.remove(i); i--; } } }
Source:
public Integer getMaxVmNameLengthSysprep() { Integer maxVmNameLengthNonWindows = (Integer) getConfigValuePreConverted(ConfigurationValues.MaxVmNameLengthSysprep); if (maxVmNameLengthNonWindows == null) { return 64; } return maxVmNameLengthNonWindows; }

Target:
public Integer getMaxVmNameLengthSysprep() { Integer maxVmNameLengthSysprep = (Integer) getConfigValuePreConverted(ConfigurationValues.MaxVmNameLengthSysprep); if (maxVmNameLengthSysprep == null) { return 64; } return maxVmNameLengthSysprep; }
Source:
public void close() { healthCheckExecutor.shutdownNow(); log.info("Shutting down health checker for CQL client {}", SafeArg.of("cqlClient", clientName)); boolean shutdown = false; try { shutdown = healthCheckExecutor.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { log.error("Interrupted while shutting down health checker for CQL client {}. Should not happen", SafeArg.of("cqlClient", clientName)); Thread.currentThread().interrupt(); } if (!shutdown) { log.error("Failed to shutdown health checker in a timely manner for {}", SafeArg.of("clusterSession", clientName)); } else { log.info("Shut down health checker for {}", SafeArg.of("cqlClient", clientName)); } }

Target:
public void close() { Cluster cluster = session.getCluster(); session.close(); cluster.close(); }
Source:
public boolean hasValue(@Nullable String value){ boolean ret = false; if (adapter != null) { ret = (getAdapterPosition(value) >= 0); } return ret; }

Target:
public boolean hasValue(@Nullable String value){ if (adapter != null) { return (getAdapterPosition(value) >= 0); } return false; }
Source:
public static IndexedRecord createRecord(Schema recordSchema, Object[] values) { IndexedRecord record = new GenericData.Record(recordSchema); int i = 0; for (Schema.Field f : recordSchema.getFields()) { Schema fieldSchema = f.schema(); if (fieldSchema.getType() == Type.UNION) { for (Schema possible : fieldSchema.getTypes()) { if (possible.getType() != Type.NULL) { fieldSchema = possible; break; } } if (fieldSchema.getType() == Type.UNION) { throw new RuntimeException("No non-null type found in union."); } } if (fieldSchema.getType() == Type.RECORD) { record.put(f.pos(), createRecord(fieldSchema, (Object[]) values[i++])); } else if (fieldSchema.getType() == Type.ARRAY) { record.put(f.pos(), createArray(fieldSchema, (Object[]) values[i++])); } else { record.put(f.pos(), values[i++]); } } return record; }

Target:
public static IndexedRecord createRecord(Schema recordSchema, Object[] values) { IndexedRecord record = new GenericData.Record(recordSchema); int i = 0; for (Schema.Field f : recordSchema.getFields()) { Schema fieldSchema = f.schema(); if (fieldSchema.getType() == Type.UNION) { for (Schema possible : fieldSchema.getTypes()) { if (possible.getType() != Type.NULL) { fieldSchema = possible; break; } } if (fieldSchema.getType() == Type.UNION) { throw TalendRuntimeException.createUnexpectedException("No non-null type found in union."); } } if (fieldSchema.getType() == Type.RECORD) { record.put(f.pos(), createRecord(fieldSchema, (Object[]) values[i++])); } else if (fieldSchema.getType() == Type.ARRAY) { record.put(f.pos(), createArray(fieldSchema, (Object[]) values[i++])); } else { record.put(f.pos(), values[i++]); } } return record; }
Source:
public Boolean isRestrictedDefaultSpec(Upload testSpec) { if ((testSpec.getType().equals("APPIUM_RUBY_TEST_SPEC") || testSpec.getType().equals("APPIUM_NODE_TEST_SPEC") || testSpec.getType().equals("APPIUM_WEB_RUBY_TEST_SPEC") || testSpec.getType().equals("APPIUM_WEB_NODE_TEST_SPEC")) && (testSpec.getCategory().equals("CURATED"))) { return true; } return false; }

Target:
public Boolean isRestrictedDefaultSpec(Upload testSpec) { if (testSpec != null) { if ((APPIUM_RUBY_TEST_SPEC.equals(testSpec.getType()) || APPIUM_NODE_TEST_SPEC.equals(testSpec.getType()) || APPIUM_WEB_RUBY_TEST_SPEC.equals(testSpec.getType()) || APPIUM_WEB_NODE_TEST_SPEC.equals(testSpec.getType())) && (CURATED.equals(testSpec.getCategory()))) { return true; } } return false; }
Source:
public void destroy(final String identifier) throws EhcacheEntityNotFoundException, EntityBusyException { Hold existingMaintenance = maintenanceHolds.get(identifier); Hold localMaintenance = null; if (existingMaintenance == null) { localMaintenance = createAccessLockFor(identifier).tryWriteLock(); } if (existingMaintenance == null && localMaintenance == null) { throw new EntityBusyException("Destroy operation failed; " + identifier + " clustered tier's maintenance lease held"); } else { EntityRef<EhcacheClientEntity, UUID> ref = getEntityRef(identifier); try { if (!ref.destroy()) { throw new EntityBusyException("Destroy operation failed; " + identifier + " clustered tier in use by other clients"); } } catch (EntityNotProvidedException e) { LOGGER.error("Unable to delete clustered tier manager for id " + identifier, e); silentlyUnlock(localMaintenance, identifier); throw new AssertionError(e); } catch (EntityNotFoundException e) { silentlyUnlock(localMaintenance, identifier); throw new EhcacheEntityNotFoundException(e); } catch (Error e) { silentlyUnlock(localMaintenance, identifier); throw e; } catch (RuntimeException e) { silentlyUnlock(localMaintenance, identifier); throw e; } } if (localMaintenance != null) { localMaintenance.unlock(); } }

Target:
public void destroy(final String identifier) throws EhcacheEntityNotFoundException, EntityBusyException { Hold existingMaintenance = maintenanceHolds.get(identifier); Hold localMaintenance = null; if (existingMaintenance == null) { localMaintenance = createAccessLockFor(identifier).tryWriteLock(); } if (existingMaintenance == null && localMaintenance == null) { throw new EntityBusyException("Destroy operation failed; " + identifier + " clustered tier's maintenance lease held"); } boolean finished = false; try { EntityRef<EhcacheClientEntity, UUID> ref = getEntityRef(identifier); try { if (!ref.destroy()) { throw new EntityBusyException("Destroy operation failed; " + identifier + " clustered tier in use by other clients"); } finished = true; } catch (EntityNotProvidedException e) { LOGGER.error("Unable to delete clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } catch (EntityNotFoundException e) { throw new EhcacheEntityNotFoundException(e); } } finally { if (localMaintenance != null) { if (finished) { localMaintenance.unlock(); } else { silentlyUnlock(localMaintenance, identifier); } } } }
Source:
protected StringWidget(Context context, FormEntryPrompt prompt, boolean readOnlyOverride) { super(context, prompt); answerText = new EditText(context); answerText.setId(ViewIds.generateViewId()); readOnly = prompt.isReadOnly() || readOnlyOverride; answerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, getAnswerFontSize()); TableLayout.LayoutParams params = new TableLayout.LayoutParams(); String height = prompt.getQuestion().getAdditionalAttribute(null, ROWS); if (height != null && height.length() != 0) { try { int rows = Integer.parseInt(height); answerText.setMinLines(rows); answerText.setGravity( Gravity.TOP); } catch (Exception e) { Timber.e("Unable to process the rows setting for the answerText field: %s", e.toString()); } } params.setMargins(7, 5, 7, 5); answerText.setLayoutParams(params); answerText.setKeyListener(new TextKeyListener(Capitalize.SENTENCES, false)); answerText.setHorizontallyScrolling(false); answerText.setSingleLine(false); String s = prompt.getAnswerText(); if (s != null) { answerText.setText(s); Selection.setSelection(answerText.getText(), answerText.getText().toString().length()); } if (readOnly) { answerText.setBackground(null); answerText.setEnabled(false); answerText.setTextColor(themeUtils.getPrimaryTextColor()); answerText.setFocusable(false); } addAnswerView(answerText); answerText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { widgetValueChanged(); } }); }

Target:
protected StringWidget(Context context, FormEntryPrompt prompt, boolean readOnlyOverride) { super(context, prompt); answerText = new EditText(context); answerText.setId(ViewIds.generateViewId()); readOnly = prompt.isReadOnly() || readOnlyOverride; answerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, getAnswerFontSize()); TableLayout.LayoutParams params = new TableLayout.LayoutParams(); String height = prompt.getQuestion().getAdditionalAttribute(null, ROWS); if (height != null && height.length() != 0) { try { int rows = Integer.parseInt(height); answerText.setMinLines(rows); answerText.setGravity( Gravity.TOP); } catch (Exception e) { Timber.e("Unable to process the rows setting for the answerText field: %s", e.toString()); } } params.setMargins(7, 5, 7, 5); answerText.setLayoutParams(params); answerText.setKeyListener(new TextKeyListener(Capitalize.SENTENCES, false)); answerText.setHorizontallyScrolling(false); answerText.setSingleLine(false); setDisplayValueFromModel(); if (readOnly) { answerText.setBackground(null); answerText.setEnabled(false); answerText.setTextColor(themeUtils.getPrimaryTextColor()); answerText.setFocusable(false); } addAnswerView(answerText); answerText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { widgetValueChanged(); } }); }
Source:
public List<String> getNamesByGidsAndPrefixes(final List<Integer> gids, final List<String> prefixes) { try { final StringBuilder sql = new StringBuilder(); sql.append("SELECT nval FROM names WHERE gid IN (:gids) ") .append(" AND ( "); final int prefixesSize = prefixes.size(); for (int i=0; i<prefixesSize; i++) { final String prefix = prefixes.get(i) + "%"; sql.append(" nval LIKE '" + prefix + "'"); if(i+1 != prefixesSize) { sql.append(" OR "); } } sql.append(" ) "); final Query query = this.getSession().createSQLQuery(sql.toString()); query.setParameterList("gids", gids); return query.list(); } catch (final HibernateException e) { final String message = "Error with getNamesByGidsAndPrefixes(gids=" + gids + ", prefixes=" + prefixes +") query from Name " + e.getMessage(); NameDAO.LOG.error(message); throw new MiddlewareQueryException(message, e); } }

Target:
public List<String> getNamesByGidsAndPrefixes(final List<Integer> gids, final List<String> prefixes) { try { final StringBuilder sql = new StringBuilder(); sql.append("SELECT nval FROM names WHERE gid IN (:gids) ") .append(" AND ( "); final List<String> formattedPrefixes = prefixes.stream().map(prefix -> " nval LIKE '" + prefix + "%'").collect(Collectors.toList()); sql.append(String.join(" OR ", formattedPrefixes)); sql.append(" ) "); final Query query = this.getSession().createSQLQuery(sql.toString()); query.setParameterList("gids", gids); return query.list(); } catch (final HibernateException e) { final String message = "Error with getNamesByGidsAndPrefixes(gids=" + gids + ", prefixes=" + prefixes +") query from Name " + e.getMessage(); NameDAO.LOG.error(message); throw new MiddlewareQueryException(message, e); } }
Source:
public Comparator getComparator() { return new Comparator() { @Override public int compare(Object o1, Object o2) { return Longs.compare(((SerializablePair<Long, Long>) o1).rhs, ((SerializablePair<Long, Long>) o2).rhs); } }; }

Target:
public Comparator getComparator() { return VALUE_COMPARATOR; }
Source:
public void logFailure(JoinPoint joinPoint, Throwable e, String service, String version) { if (eventRecorder != null && eventRecorder.isRecordEventEnabled()) { MethodSignature sig = (MethodSignature) joinPoint.getSignature(); Logger log = LoggerFactory.getLogger(sig.getDeclaringType()); log.info("{} threw an exception: {}", sig.getName(), e.getMessage()); ErrorEventBuilder builder = new ErrorEventBuilder(); builder.setAssertion(AssertionExtractor.getAssertion(joinPoint.getArgs())); builder.setThrowable(e); builder.setInvoker(sig.getDeclaringType().toString()); builder.setMethod(sig.getName()); builder.setService(service); builder.setVersion(version); builder.buildMessageID(); builder.buildTransactionID(); builder.buildDescription(); eventRecorder.recordEvent(builder.getEvent()); } }

Target:
public void logFailure(JoinPoint joinPoint, Throwable e, String service, String version) { MethodSignature sig = (MethodSignature) joinPoint.getSignature(); Logger log = LoggerFactory.getLogger(sig.getDeclaringType()); log.info("{} threw an exception: {}", sig.getName(), e.getMessage()); if (eventRecorder != null && eventRecorder.isRecordEventEnabled()) { ErrorEventBuilder builder = new ErrorEventBuilder(); builder.setAssertion(AssertionExtractor.getAssertion(joinPoint.getArgs())); builder.setThrowable(e); builder.setInvoker(sig.getDeclaringType().getName()); builder.setMethod(sig.getName()); builder.setService(service); builder.setVersion(version); builder.buildMessageID(); builder.buildTransactionID(); builder.buildDescription(); eventRecorder.recordEvent(builder.getEvent()); } }
Source:
public File execute(MCPEnvironment environment) throws Exception { File input = (File)environment.getArguments().get("input"); environment.project.getLogger().lifecycle(input.getAbsolutePath()); File output = environment.getFile("output.jar"); File rejects = environment.getFile("rejects.zip"); File hashFile = environment.getFile("lastinput.sha1"); HashStore hashStore = new HashStore(environment.project).load(hashFile); hashStore.add(input); Files.walk(patchesDir.toPath()) .filter(Files::isRegularFile) .filter(Files::exists) .forEach(e -> hashStore.add(patchesDir.toPath().relativize(e).toString(), e.toFile())); if (hashStore.isSame() && output.exists()) return output; PatchAction action = new PatchAction(environment.project); action.setBase(input); action.setPatches(patchesDir); action.setOutput(output); action.setPatchMode(PatchMode.FUZZY); action.setMaxFuzzOffset(0); action.setVerbose(false); action.setRejects(rejects); boolean success = action.execute() == 0; if (!success) { environment.logger.error("Rejects saved to: {}", rejects); throw new RuntimeException("Patch failure."); } else { hashStore.save(hashFile); } return output; }

Target:
public File execute(MCPEnvironment environment) throws Exception { File input = (File) environment.getArguments().get("input"); File output = environment.getFile("output.jar"); File rejects = environment.getFile("rejects.zip"); File hashFile = environment.getFile("lastinput.sha1"); HashStore hashStore = new HashStore(environment.project).load(hashFile); hashStore.add(input); try (ZipInputStream zin = new ZipInputStream(new FileInputStream(environment.getConfigZip()))) { ZipEntry e; while ((e = zin.getNextEntry()) != null) { if (e.getName().startsWith(path)) { hashStore.add(e.getName().substring(path.length()), IOUtils.toByteArray(zin)); } } } if (hashStore.isSame() && output.exists()) { return output; } CliOperation.Result<PatchOperation.PatchesSummary> result = PatchOperation.builder() .logTo(new LoggingOutputStream(environment.logger, LogLevel.LIFECYCLE)) .basePath(input.toPath()) .patchesPath(environment.getConfigZip().toPath()) .patchesPrefix(path) .outputPath(output.toPath()) .verbose(false) .mode(PatchMode.ACCESS) .rejectsPath(rejects.toPath()) .build() .operate(); boolean success = result.exit == 0; if (!success) { environment.logger.error("Rejects saved to: {}", rejects); throw new RuntimeException("Patch failure."); } else { hashStore.save(hashFile); } return output; }
Source:
public BeanDefinition parse(Element element, ParserContext parserContext) { CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element)); parserContext.pushContainingComponent(compositeDef); Map<String, Map<String, String>> providerDetailMap = retrieveProviders(element); List<ClientRegistration> clientRegs = retrieveClientRegistrations(element, providerDetailMap); BeanDefinition inMemClientRegRepoBeanDef = BeanDefinitionBuilder .rootBeanDefinition(InMemoryClientRegistrationRepository.class).addConstructorArgValue(clientRegs) .getBeanDefinition(); String beanName = parserContext.getReaderContext().generateBeanName(inMemClientRegRepoBeanDef); parserContext.registerBeanComponent(new BeanComponentDefinition(inMemClientRegRepoBeanDef, beanName)); BeanDefinition inMemOAuth2AuthorizedClientServiceBeanDef = BeanDefinitionBuilder .rootBeanDefinition(InMemoryOAuth2AuthorizedClientService.class) .addConstructorArgValue(new RuntimeBeanReference(InMemoryClientRegistrationRepository.class)) .getBeanDefinition(); beanName = parserContext.getReaderContext().generateBeanName(inMemOAuth2AuthorizedClientServiceBeanDef); parserContext.registerBeanComponent( new BeanComponentDefinition(inMemOAuth2AuthorizedClientServiceBeanDef, beanName)); parserContext.popAndRegisterContainingComponent(); return null; }

Target:
public BeanDefinition parse(Element element, ParserContext parserContext) { CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element)); parserContext.pushContainingComponent(compositeDef); Map<String, Map<String, String>> providerDetailMap = getProviders(element); List<ClientRegistration> clientRegs = getClientRegistrations(element, parserContext, providerDetailMap); BeanDefinition inMemClientRegRepoBeanDef = BeanDefinitionBuilder .rootBeanDefinition(InMemoryClientRegistrationRepository.class).addConstructorArgValue(clientRegs) .getBeanDefinition(); String beanName = parserContext.getReaderContext().generateBeanName(inMemClientRegRepoBeanDef); parserContext.registerBeanComponent(new BeanComponentDefinition(inMemClientRegRepoBeanDef, beanName)); parserContext.popAndRegisterContainingComponent(); return null; }
Source:
private TarArchiveInputStream intoTarArchive(Consumer<TarArchiveOutputStream> consumer) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final TarArchiveOutputStream taos = new TarArchiveOutputStream(baos); consumer.accept(taos); taos.close(); return new TarArchiveInputStream(new ByteArrayInputStream(baos.toByteArray())); }

Target:
private TarArchiveInputStream intoTarArchive(Consumer<TarArchiveOutputStream> consumer) throws IOException { @Cleanup final ByteArrayOutputStream baos = new ByteArrayOutputStream(); @Cleanup final TarArchiveOutputStream taos = new TarArchiveOutputStream(baos); consumer.accept(taos); taos.close(); return new TarArchiveInputStream(new ByteArrayInputStream(baos.toByteArray())); }
Source:
protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { SubMonitor subMonitor = SubMonitor.convert(monitor); if (resource == null) { subMonitor.done(); return null; } subMonitor.beginTask(NLS.bind( CoreText.GitResourceVariantTree_fetchingVariant, resource.getName()), IProgressMonitor.UNKNOWN); try { return fetchVariant(resource, subMonitor); } finally { subMonitor.done(); } }

Target:
protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { SubMonitor subMonitor = SubMonitor.convert(monitor); if (resource == null) { subMonitor.done(); return null; } subMonitor.beginTask(NLS.bind( CoreText.GitResourceVariantTree_fetchingVariant, resource.getName()), IProgressMonitor.UNKNOWN); try { return fetchVariant(resource, subMonitor); } finally { monitor.done(); } }
Source:
public DefaultSourceConfigurationImpl(final Map<String, Object> configMap) { this.configMap = new HashMap<>(); configMap.keySet().stream() .forEach(s->this.configMap.put(s, configMap.get(s))); }

Target:
public DefaultSourceConfigurationImpl(final Map<String, Object> configMap) { this.configMap = new HashMap<>(); this.configMap.putAll(configMap); }
Source:
static Consumer<List<BatchElement<Integer, List<StartIdentifiedAtlasDbTransactionResponse>>>> consumer( LockLeaseService lockLeaseService, LockWatchEventCache lockWatchEventCache) { return batch -> { int numTransactions = batch.stream().map(BatchElement::argument).reduce(0, Integer::sum); List<StartIdentifiedAtlasDbTransactionResponse> startTransactionResponses = getStartTransactionResponses(lockLeaseService, lockWatchEventCache, numTransactions); int start = 0; for (BatchElement<Integer, List<StartIdentifiedAtlasDbTransactionResponse>> batchElement : batch) { int end = start + batchElement.argument(); batchElement.result().set(startTransactionResponses.subList(start, end)); start = end; } }; }

Target:
static Consumer<List<BatchElement<Integer, List<StartIdentifiedAtlasDbTransactionResponse>>>> consumer( LockLeaseService lockLeaseService, LockWatchEventCache lockWatchEventCache) { return batch -> { int numTransactions = batch.stream().mapToInt(BatchElement::argument).reduce(0, Integer::sum); List<StartIdentifiedAtlasDbTransactionResponse> startTransactionResponses = getStartTransactionResponses(lockLeaseService, lockWatchEventCache, numTransactions); int start = 0; for (BatchElement<Integer, List<StartIdentifiedAtlasDbTransactionResponse>> batchElement : batch) { int end = start + batchElement.argument(); batchElement.result().set(ImmutableList.copyOf(startTransactionResponses.subList(start, end))); start = end; } }; }
Source:
public Map<byte[], List<byte[]>> rollWal(long now) throws IOException { this.lastRollTime = now; Map<byte[], List<byte[]>> regionsToFlush = wal.rollWriter(true); this.rollRequest.set(false); return regionsToFlush; }

Target:
public Map<byte[], List<byte[]>> rollWal(long now) throws IOException { this.lastRollTime = now; this.rollRequest.set(false); return wal.rollWriter(true); }
Source:
private List<? extends ParameterValue> filter(List<ParameterValue> parameters) { if (this.run == null) { return parameters; } if (this.parameterDefinitionNames == null) { return parameters; } String shouldKeepFlag = SystemProperties.getString(KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME); if ("true".equalsIgnoreCase(shouldKeepFlag)) { return parameters; } List<ParameterValue> filteredParameters = new ArrayList<ParameterValue>(); for (ParameterValue v : this.parameters) { if (this.parameterDefinitionNames.contains(v.getName()) || isSafeParameter(v.getName())) { filteredParameters.add(v); } else if ("false".equalsIgnoreCase(shouldKeepFlag)) { LOGGER.log(Level.WARNING, "Skipped parameter `{0}` as it is undefined on `{1}`. Set `-D{2}=true` to allow " + "undefined parameters to be injected as environment variables or `-D{3}=[comma-separated list]` to whitelist specific parameter names, " + "even though it represents a security breach or `-D{2}=false to explicitly forbid it without warning.", new Object { v.getName(), run.getParent().getFullName(), KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME, SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME }); } } return filteredParameters; }

Target:
private List<? extends ParameterValue> filter(List<ParameterValue> parameters) { if (this.run == null) { return parameters; } if (this.parameterDefinitionNames == null) { return parameters; } String shouldKeepFlag = SystemProperties.getString(KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME); if ("true".equalsIgnoreCase(shouldKeepFlag)) { return parameters; } List<ParameterValue> filteredParameters = new ArrayList<ParameterValue>(); for (ParameterValue v : this.parameters) { if (this.parameterDefinitionNames.contains(v.getName()) || isSafeParameter(v.getName())) { filteredParameters.add(v); } else if ("false".equalsIgnoreCase(shouldKeepFlag)) { LOGGER.log(Level.WARNING, "Skipped parameter `{0}` as it is undefined on `{1}`. Set `-D{2}=true` to allow " + "undefined parameters to be injected as environment variables or `-D{3}=[comma-separated list]` to whitelist specific parameter names, " + "even though it represents a security breach or `-D{2}=false` to no longer show this message.", new Object { v.getName(), run.getParent().getFullName(), KEEP_UNDEFINED_PARAMETERS_SYSTEM_PROPERTY_NAME, SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME }); } } return filteredParameters; }
Source:
private String findSchemeIdColumn() { if (DbConnectionFactory.isMySql()) { return MYSQL_FIND_SCHEME_ID_COLUMN; } else if (DbConnectionFactory.isPostgres()) { return POSTGRES_FIND_SCHEME_ID_COLUMN; } else if (DbConnectionFactory.isMsSql()) { return MSSQL_FIND_SCHEME_ID_COLUMN; } else if (DbConnectionFactory.isOracle()) { return ORACLE_FIND_SCHEME_ID_COLUMN; } else { return null; } }

Target:
private String findSchemeIdColumn() { String sql = null; if (DbConnectionFactory.isMySql()) { sql = MYSQL_FIND_SCHEME_ID_COLUMN; } else if (DbConnectionFactory.isPostgres()) { sql = POSTGRES_FIND_SCHEME_ID_COLUMN; } else if (DbConnectionFactory.isMsSql()) { sql = MSSQL_FIND_SCHEME_ID_COLUMN; } else if (DbConnectionFactory.isOracle()) { sql = ORACLE_FIND_SCHEME_ID_COLUMN; } return sql; }
Source:
public String get(String key) { String value = getTestProperties().getProperty(key); if (value != null) { LOGGER.warn("Overridden '" + key + "=" + value + "' property will be used for current test!"); return value; } value = CONFIG.resourceFile.equals(resourceFile) ? PlaceholderResolver.resolve(propertiesHolder.get(resourceFile), key) : propertiesHolder.get(resourceFile).getProperty(key); String decryptedText = decrypt(value, CRYPTO_PATTERN); if ((null != value) && (null != decryptedText) && (!decryptedText.equals(value))) { value = decryptedText; } return value != null ? value : StringUtils.EMPTY; }

Target:
public String get(String key) { String value = getTestProperties().getProperty(key); if (value != null) { LOGGER.warn("Overridden '" + key + "=" + value + "' property will be used for current test!"); return value; } value = CONFIG.resourceFile.equals(resourceFile) ? PlaceholderResolver.resolve(propertiesHolder.get(resourceFile), key) : propertiesHolder.get(resourceFile).getProperty(key); if(isEncrypted(value, CRYPTO_PATTERN)) { value = decrypt(value, CRYPTO_PATTERN);; } return value != null ? value : StringUtils.EMPTY; }
Source:
private void staggeredProcessNext(ReplicableCommand command, RspFilter filter, List<Address> dests, ResponseMode mode, DeliverOrder deliverOrder, Marshaller marshaller, CompletableFuture<Responses> theFuture, int destIndex, long deadline, Responses rsps) { if (theFuture.isDone()) { return; } if (timeService.isTimeExpired(deadline)) { theFuture.complete(rsps); return; } try { processCallsStaggered(command, filter, dests, mode, deliverOrder, marshaller, theFuture, destIndex + 1, deadline, rsps); } catch (Exception e) { theFuture.completeExceptionally(e); } }

Target:
private void staggeredProcessNext(ReplicableCommand command, RspFilter filter, List<Address> dests, ResponseMode mode, DeliverOrder deliverOrder, Marshaller marshaller, CompletableFuture<Responses> theFuture, int destIndex, long deadline, Responses rsps) { if (theFuture.isDone()) { return; } if (timeService.isTimeExpired(deadline)) { rsps.setTimedOut(); theFuture.complete(rsps); return; } try { processCallsStaggered(command, filter, dests, mode, deliverOrder, marshaller, theFuture, destIndex + 1, deadline, rsps); } catch (Exception e) { theFuture.completeExceptionally(e); } }
Source:
protected abstract ConnectionListener createConnectionListener(Credential credential) throws ResourceException; protected abstract void destroyConnectionListener(ConnectionListener cl) throws ResourceException; protected abstract ManagedConnectionPool createManagedConnectionPool(Credential credential); @Override public void prefill(Credential credential) { this.prefillCredential = credential; if (shouldPrefill) { ManagedConnectionPool mcp = getManagedConnectionPool(credential); mcp.prefill(); } }

Target:
protected abstract ConnectionListener createConnectionListener(Credential credential) throws ResourceException; protected abstract void destroyConnectionListener(ConnectionListener cl) throws ResourceException; protected abstract ManagedConnectionPool createManagedConnectionPool(Credential credential); @Override public void prefill() { if (poolConfiguration.isPrefill()) { ManagedConnectionPool mcp = pools.get(getPrefillCredential()); if (mcp == null) { getManagedConnectionPool(getPrefillCredential()); } else { mcp.prefill(); } } }
Source:
public void addEntry(IndexEntry entry, long fileEndOffset) throws StoreException { try { rwLock.readLock().lock(); if (mapped.get()) { throw new StoreException("IndexSegment : " + indexFile.getAbsolutePath() + " cannot add to a mapped index ", StoreErrorCodes.Illegal_Index_Operation); } logger.trace("IndexSegment inserting key - value - offset size ttl " + "originalMessageOffset fileEndOffset {}", indexFile.getAbsolutePath(), entry.getKey(), entry.getValue().getOffset(), entry.getValue().getSize(), entry.getValue().getTimeToLiveInMs(), entry.getValue().getOriginalMessageOffset(), fileEndOffset); if (index.put(entry.getKey(), entry.getValue()) == null) { numberOfItems.incrementAndGet(); sizeWritten.addAndGet(entry.getKey().sizeInBytes() + IndexValue.Index_Value_Size_In_Bytes); bloomFilter.add(ByteBuffer.wrap(entry.getKey().toBytes())); } endOffset.set(fileEndOffset); lastModifiedSec.set(SystemTime.getInstance().milliseconds()/1000); if (keySize == Key_Size_Invalid_Value) { StoreKey key = entry.getKey(); keySize = key.sizeInBytes(); logger.info("IndexSegment : setting key size to of key for index with start offset {}", indexFile.getAbsolutePath(), key.sizeInBytes(), key.getLongForm(), startOffset); } if (valueSize == Value_Size_Invalid_Value) { valueSize = entry.getValue().getBytes().capacity(); logger.info("IndexSegment : setting value size to for index with start offset {}", indexFile.getAbsolutePath(), valueSize, startOffset); } } finally { rwLock.readLock().unlock(); } }

Target:
public void addEntry(IndexEntry entry, long fileEndOffset) throws StoreException { try { rwLock.readLock().lock(); if (mapped.get()) { throw new StoreException("IndexSegment : " + indexFile.getAbsolutePath() + " cannot add to a mapped index ", StoreErrorCodes.Illegal_Index_Operation); } logger.trace("IndexSegment inserting key - value - offset size ttl " + "originalMessageOffset fileEndOffset {}", indexFile.getAbsolutePath(), entry.getKey(), entry.getValue().getOffset(), entry.getValue().getSize(), entry.getValue().getTimeToLiveInMs(), entry.getValue().getOriginalMessageOffset(), fileEndOffset); if (index.put(entry.getKey(), entry.getValue()) == null) { numberOfItems.incrementAndGet(); sizeWritten.addAndGet(entry.getKey().sizeInBytes() + IndexValue.Index_Value_Size_In_Bytes); bloomFilter.add(ByteBuffer.wrap(entry.getKey().toBytes())); } endOffset.set(fileEndOffset); lastModifiedTimeSec.set(SystemTime.getInstance().milliseconds() / 1000); if (keySize == Key_Size_Invalid_Value) { StoreKey key = entry.getKey(); keySize = key.sizeInBytes(); logger.info("IndexSegment : setting key size to of key for index with start offset {}", indexFile.getAbsolutePath(), key.sizeInBytes(), key.getLongForm(), startOffset); } if (valueSize == Value_Size_Invalid_Value) { valueSize = entry.getValue().getBytes().capacity(); logger.info("IndexSegment : setting value size to for index with start offset {}", indexFile.getAbsolutePath(), valueSize, startOffset); } } finally { rwLock.readLock().unlock(); } }
Source:
public byte[] convert(Blob source) { if (source == null) { return null; } try { InputStream blobStream = source.getBinaryStream(); if (blobStream != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); StreamUtils.copy(blobStream, baos); return baos.toByteArray(); } } catch (SQLException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } return null; }

Target:
public byte[] convert(Blob source) { if (source == null) { return null; } InputStream blobStream = null; try { blobStream = source.getBinaryStream(); if (blobStream != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); StreamUtils.copy(blobStream, baos); return baos.toByteArray(); } } catch (SQLException e) { throw new DataRetrievalFailureException("Couldn't retrieve data from blob.", e); } catch (IOException e) { throw new DataRetrievalFailureException("Couldn't retrieve data from blob.", e); } finally { if (blobStream != null) { try { blobStream.close(); } catch (IOException e) { throw new CleanupFailureDataAccessException("Couldn't close binary stream for given blob.", e); } } } return null; }
Source:
public Matrix removeRow(int i, Factory factory) { if (i >= this.rows || i < 0) { throw new IllegalArgumentException("Illegal row number, must be 0.." + (this.rows - 1)); } Matrix that = factory.createMatrix(this.rows - 1, this.columns); for (int ii = 0; ii < i; ii++) { that.setRow(ii, this.getRow(ii)); } for (int ii = i + 1; ii < this.rows; ii++) { that.setRow(ii - 1, this.getRow(ii)); } return that; }

Target:
public Matrix removeRow(int i, Factory factory) { if (i >= rows || i < 0) { throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + (rows - 1)); } Matrix result = factory.createMatrix(rows - 1, columns); for (int ii = 0; ii < i; ii++) { result.setRow(ii, getRow(ii)); } for (int ii = i + 1; ii < rows; ii++) { result.setRow(ii - 1, getRow(ii)); } return result; }
Source:
public CourseRoster(List<StudentAttributes> students, List<InstructorAttributes> instructors) { populateStudentListByEmail(students); populateInstructorListByEmail(instructors); for (StudentAttributes studentAttributes : this.getStudents()) { teamToMembersTable.computeIfAbsent(studentAttributes.getTeam(), key -> new ArrayList<>()) .add(studentAttributes); } }

Target:
public CourseRoster(List<StudentAttributes> students, List<InstructorAttributes> instructors) { populateStudentListByEmail(students); populateInstructorListByEmail(instructors); buildTeamToMembersTable(); }
Source:
private QueryBuilder buildSearchQuery() { BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder(); for (ElasticsearchColumnHandle column : columns) { BoolQueryBuilder columnQueryBuilder = new BoolQueryBuilder(); Type type = column.getColumnType(); tupleDomain.getDomains().ifPresent((domains) -> { Domain domain = domains.get(column); if (domain != null) { columnQueryBuilder.should(buildPredicate(column.getColumnJsonPath(), domain, type)); } }); boolQueryBuilder.must(columnQueryBuilder); } return boolQueryBuilder.hasClauses() ? boolQueryBuilder : new MatchAllQueryBuilder(); }

Target:
private QueryBuilder buildSearchQuery() { BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder(); for (ElasticsearchColumnHandle column : columns) { BoolQueryBuilder columnQueryBuilder = new BoolQueryBuilder(); Type type = column.getColumnType(); if (tupleDomain.getDomains().isPresent()) { Domain domain = tupleDomain.getDomains().get().get(column); if (domain != null) { columnQueryBuilder.should(buildPredicate(column.getColumnJsonPath(), domain, type)); } } boolQueryBuilder.must(columnQueryBuilder); } if (boolQueryBuilder.hasClauses()) { return boolQueryBuilder; } return new MatchAllQueryBuilder(); }
Source:
public void testEstimatedAndSplitForSmallTable() throws Exception { TableName tableName = newTestTableName(); try (Admin admin = connection.getAdmin()) { admin.createTable( new HTableDescriptor(tableName).addFamily(new HColumnDescriptor(COLUMN_FAMILY))); try (Table table = connection.getTable(tableName)) { table.put(Arrays.asList( new Put(Bytes.toBytes("row1")).addColumn(COLUMN_FAMILY, QUALIFIER1, Bytes.toBytes("1")), new Put(Bytes.toBytes("row2")).addColumn(COLUMN_FAMILY, QUALIFIER1, Bytes.toBytes("2")))); } List<SampleRowKeysResponse> sampleRowKeys = getSampleKeys(tableName); try { CloudBigtableIO.Source source = new CloudBigtableIO.Source(new CloudBigtableScanConfiguration( projectId, zoneId, clusterId, tableName.getQualifierAsString(), new Scan())); long estimatedSizeBytes = source.getEstimatedSizeBytes(null); SampleRowKeysResponse lastSample = sampleRowKeys.get(sampleRowKeys.size() - 1); Assert.assertEquals(lastSample.getOffsetBytes(), estimatedSizeBytes); List<SourceWithKeys> bundles = source.splitIntoBundles(estimatedSizeBytes / 2 + 1, null); Assert.assertEquals(sampleRowKeys.size() * 2 - 1, bundles.size()); } finally { admin.deleteTable(tableName); } } }

Target:
public void testEstimatedAndSplitForSmallTable() throws Exception { TableName tableName = newTestTableName(); try (Admin admin = connection.getAdmin()) { admin.createTable( new HTableDescriptor(tableName).addFamily(new HColumnDescriptor(COLUMN_FAMILY))); try (Table table = connection.getTable(tableName)) { table.put(Arrays.asList( new Put(Bytes.toBytes("row1")).addColumn(COLUMN_FAMILY, QUALIFIER1, Bytes.toBytes("1")), new Put(Bytes.toBytes("row2")).addColumn(COLUMN_FAMILY, QUALIFIER1, Bytes.toBytes("2")))); } List<SampleRowKeysResponse> sampleRowKeys = getSampleKeys(tableName); try { BoundedSource<Result> source = CloudBigtableIO.read(new CloudBigtableScanConfiguration( projectId, zoneId, clusterId, tableName.getQualifierAsString(), new Scan())); long estimatedSizeBytes = source.getEstimatedSizeBytes(null); SampleRowKeysResponse lastSample = sampleRowKeys.get(sampleRowKeys.size() - 1); Assert.assertEquals(lastSample.getOffsetBytes(), estimatedSizeBytes); List<? extends BoundedSource<Result>> bundles = source.splitIntoBundles(estimatedSizeBytes / 2 + 1, null); Assert.assertEquals(sampleRowKeys.size() * 2 - 1, bundles.size()); } finally { admin.deleteTable(tableName); } } }
Source:
void onChunkOperationComplete(PutChunk chunk) { if (chunk.getChunkBlobId() == null) { if (operationException.get() == null) { operationException.set(new RouterException("Could not complete operation", RouterErrorCode.AmbryUnavailable)); } logger.error("Failed putting chunk at index: " + chunk.getChunkIndex() + ", failing the entire operation"); complete(); } else if (numDataChunks == 1 || chunk == metadataPutChunk) { blobId = chunk.getChunkBlobId(); if (chunk.failedAttempts > 0) { logger.info("Slipped put succeeded for blob: " + chunk.getChunkBlobId()); } else { logger.trace("Successfully put blob: " + chunk.getChunkBlobId()); } complete(); } else { logger.trace("Successfully put chunk with blob id: " + chunk.getChunkBlobId()); metadataPutChunk.addChunkId(chunk.chunkBlobId, chunk.chunkIndex); } }

Target:
void onChunkOperationComplete(PutChunk chunk) { if (chunk.getChunkBlobId() == null) { logger.error("Failed putting chunk at index: " + chunk.getChunkIndex() + ", failing the entire operation"); operationCompleted = true; } else if (numDataChunks == 1 || chunk == metadataPutChunk) { blobId = chunk.getChunkBlobId(); if (chunk.failedAttempts > 0) { logger.trace("Slipped put succeeded for chunk: " + chunk.getChunkBlobId()); } else { logger.trace("Successfully put chunk: " + chunk.getChunkBlobId()); } operationCompleted = true; } else { logger.trace("Successfully put chunk with blob id: " + chunk.getChunkBlobId()); metadataPutChunk.addChunkId(chunk.chunkBlobId, chunk.chunkIndex); } chunk.clear(); }
Source:
public void testMultipleClients() throws Throwable { try (Connection clientA = CLUSTER.newConnection()) { VoltronReadWriteLock lockA = new VoltronReadWriteLock(clientA, "test"); Hold hold = lockA.writeLock(); try (Connection clientB = CLUSTER.newConnection()) { Future<Void> waiter = async(() -> { new VoltronReadWriteLock(clientB, "test").writeLock().unlock(); return null; }); try { waiter.get(100, TimeUnit.MILLISECONDS); fail("TimeoutException expected"); } catch (TimeoutException e) { } hold.unlock(); waiter.get(); } } }

Target:
public void testMultipleClients() throws Throwable { try (Connection clientA = CLUSTER.newConnection(); Connection clientB = CLUSTER.newConnection()) { VoltronReadWriteLock lockA = new VoltronReadWriteLock(clientA, "test"); Hold hold = lockA.writeLock(); Future<Void> waiter = async(() -> { new VoltronReadWriteLock(clientB, "test").writeLock().unlock(); return null; }); try { waiter.get(100, TimeUnit.MILLISECONDS); fail("TimeoutException expected"); } catch (TimeoutException e) { } hold.unlock(); waiter.get(); } }
Source:
public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>(); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TIMESTAMP, NAME_TIMESTAMP)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_SOURCE, NAME_SOURCE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TYPE, NAME_TYPE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_REFERENCE, NAME_REFERENCE)); if ((fEvent instanceof ITmfSourceLookup) && (((ITmfSourceLookup)fEvent).getCallsite() != null)) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_SOURCE_LOOKUP, NAME_SOURCE_LOOKUP)); } if ((fEvent instanceof ITmfModelLookup) && (((ITmfModelLookup)fEvent).getModelUri() != null)) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_MODEL_URI, NAME_MODEL_URI)); } descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CONTENT, NAME_CONTENT)); if((fEvent instanceof CtfTmfEvent) && !((CtfTmfEvent)fEvent).listCustomAttributes().isEmpty()){ if(((CtfTmfEvent)fEvent).listCustomAttributes().size() != 1) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CUSTOM_ATTRIBUTE, NAME_CUSTOM_ATTRIBUTES)); } else { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CUSTOM_ATTRIBUTE, NAME_CUSTOM_ATTRIBUTE)); } } return descriptors.toArray(new IPropertyDescriptor[0]); }

Target:
public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>(); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TIMESTAMP, NAME_TIMESTAMP)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_SOURCE, NAME_SOURCE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TYPE, NAME_TYPE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_REFERENCE, NAME_REFERENCE)); if ((fEvent instanceof ITmfSourceLookup) && (((ITmfSourceLookup)fEvent).getCallsite() != null)) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_SOURCE_LOOKUP, NAME_SOURCE_LOOKUP)); } if ((fEvent instanceof ITmfModelLookup) && (((ITmfModelLookup)fEvent).getModelUri() != null)) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_MODEL_URI, NAME_MODEL_URI)); } descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CONTENT, NAME_CONTENT)); if((fEvent instanceof ITmfCustomAttribute) && !((ITmfCustomAttribute)fEvent).listCustomAttributes().isEmpty()){ if(((ITmfCustomAttribute)fEvent).listCustomAttributes().size() != 1) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CUSTOM_ATTRIBUTE, NAME_CUSTOM_ATTRIBUTES)); } else { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CUSTOM_ATTRIBUTE, NAME_CUSTOM_ATTRIBUTE)); } } return descriptors.toArray(new IPropertyDescriptor[0]); }