auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private PipelineGroups mergePipelineConfigs() { PipelineGroups groups = new PipelineGroups(); List<PipelineConfigs> allPipelineConfigs = new ArrayList<>(); for (PipelineConfigs partPipesConf : this.main.getGroups()) { allPipelineConfigs.add(partPipesConf); } for (PartialConfig part : this.parts) { for (PipelineConfigs partPipesConf : part.getGroups()) { for (PipelineConfig pipelineConfig : partPipesConf) { main.getAllPipelineConfigs().add(pipelineConfig); } allPipelineConfigs.add(partPipesConf); } } Map<String, List<PipelineConfigs>> map = new LinkedHashMap<>(); for (PipelineConfigs pipes : allPipelineConfigs) { String key = pipes.getGroup(); if (map.get(key) == null) { map.put(key, new ArrayList<PipelineConfigs>()); } map.get(key).add(pipes); } for (List<PipelineConfigs> oneGroup : map.values()) { if (oneGroup.size() == 1) groups.add(oneGroup.get(0)); else groups.add(new MergePipelineConfigs(oneGroup)); } return groups; }

Target:
private PipelineGroups mergePipelineConfigs() { PipelineGroups groups = new PipelineGroups(); List<PipelineConfigs> allPipelineConfigs = new ArrayList<>(); for (PipelineConfigs partPipesConf : this.main.getGroups()) { allPipelineConfigs.add(partPipesConf); } for (PartialConfig part : this.parts) { for (PipelineConfigs partPipesConf : part.getGroups()) { allPipelineConfigs.add(partPipesConf); } } Map<String, List<PipelineConfigs>> map = new LinkedHashMap<>(); for (PipelineConfigs pipes : allPipelineConfigs) { String key = pipes.getGroup(); if (map.get(key) == null) { map.put(key, new ArrayList<PipelineConfigs>()); } map.get(key).add(pipes); } for (List<PipelineConfigs> oneGroup : map.values()) { if (oneGroup.size() == 1) groups.add(oneGroup.get(0)); else groups.add(new MergePipelineConfigs(oneGroup)); } return groups; }
Source:
public boolean registerIntentToParticipate(Study study, Account account) { Phone phone = account.getPhone(); if (phone == null) { return false; } List<Subpopulation> subpops = subpopService.getSubpopulations(study.getStudyIdentifier()); for (Subpopulation subpop : subpops) { CacheKey cacheKey = CacheKey.itp(subpop.getGuid(), study.getStudyIdentifier(), phone); IntentToParticipate intent = cacheProvider.getObject(cacheKey, IntentToParticipate.class); if (intent != null) { StudyParticipant participant = participantService.getParticipant(study, account.getId(), true); consentService.consentToResearch(study, subpop.getGuid(), participant, intent.getConsentSignature(), intent.getScope(), true); cacheProvider.removeObject(cacheKey); return true; } } return false; }

Target:
public boolean registerIntentToParticipate(Study study, Account account) { Phone phone = account.getPhone(); if (phone == null) { return false; } boolean consentsUpdated = false; StudyParticipant participant = null; List<Subpopulation> subpops = subpopService.getSubpopulations(study.getStudyIdentifier()); for (Subpopulation subpop : subpops) { CacheKey cacheKey = CacheKey.itp(subpop.getGuid(), study.getStudyIdentifier(), phone); IntentToParticipate intent = cacheProvider.getObject(cacheKey, IntentToParticipate.class); if (intent != null) { if (participant == null) { participant = participantService.getParticipant(study, account.getId(), true); } consentService.consentToResearch(study, subpop.getGuid(), participant, intent.getConsentSignature(), intent.getScope(), true); cacheProvider.removeObject(cacheKey); consentsUpdated = true; } } return consentsUpdated; }
Source:
protected void installConfigApi(Config zkConf) { try { UUID hostId = HostIdGenerator.getHostId(); ClusterConfig clusterConf = new ClusterConfig(zkConf.withFallback( MidoNodeConfigurator.apply(zkConf).runtimeConfig(hostId))); ClusterNode.Context ctx = new ClusterNode.Context(hostId, true); ConfMinion conf = new ConfMinion(ctx, clusterConf); bind(ConfMinion.class).toInstance(new ConfMinion(ctx, clusterConf)); } catch (Exception e) { log.error("Failed to start config API", e); } }

Target:
protected void installConfigApi(Config zkConf) { try { UUID hostId = HostIdGenerator.getHostId(); ClusterConfig clusterConf = new ClusterConfig(zkConf.withFallback( MidoNodeConfigurator.apply(zkConf).runtimeConfig(hostId))); ClusterNode.Context ctx = new ClusterNode.Context(hostId, true); bind(ConfMinion.class).toInstance(new ConfMinion(ctx, clusterConf)); } catch (Exception e) { log.error("Failed to start config API", e); } }
Source:
public void bootstrap() throws InfrastructureException { if (finishEventFuture != null) { throw new IllegalStateException("Bootstrap method must be called only once."); } if (!hasInstallersToBootstrap()) { return; } finishEventFuture = new CompletableFuture<>(); eventService.subscribe(bootstrapperStatusListener, BootstrapperStatusEvent.class); try { LOG.info("Launching bootstrapper"); doBootstrapAsync(installerEndpoint + ENDPOINT_IDS.getAndIncrement(), outputEndpoint + ENDPOINT_IDS.getAndIncrement()); LOG.info("Launched bootstrapper. Waiting for Done event"); BootstrapperStatusEvent resultEvent = finishEventFuture.get(bootstrappingTimeoutMinutes, TimeUnit.MINUTES); if (resultEvent.getStatus().equals(BootstrapperStatus.FAILED)) { throw new InfrastructureException(resultEvent.getError()); } } catch (ExecutionException e) { throw new InfrastructureException(e.getCause().getMessage(), e); } catch (TimeoutException e) { throw new InfrastructureException("Bootstrapping of machine " + machineName + " reached timeout"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new InfrastructureException("Bootstrapping of machine " + machineName + " was interrupted"); } finally { eventService.unsubscribe(bootstrapperStatusListener, BootstrapperStatusEvent.class); } }

Target:
public void bootstrap() throws InfrastructureException { if (finishEventFuture != null) { throw new IllegalStateException("Bootstrap method must be called only once."); } finishEventFuture = new CompletableFuture<>(); eventService.subscribe(bootstrapperStatusListener, BootstrapperStatusEvent.class); try { LOG.info("Launching bootstrapper"); doBootstrapAsync(installerEndpoint + ENDPOINT_IDS.getAndIncrement(), outputEndpoint + ENDPOINT_IDS.getAndIncrement()); LOG.info("Launched bootstrapper. Waiting for Done event"); BootstrapperStatusEvent resultEvent = finishEventFuture.get(bootstrappingTimeoutMinutes, TimeUnit.MINUTES); if (resultEvent.getStatus().equals(BootstrapperStatus.FAILED)) { throw new InfrastructureException(resultEvent.getError()); } } catch (ExecutionException e) { throw new InfrastructureException(e.getCause().getMessage(), e); } catch (TimeoutException e) { throw new InfrastructureException("Bootstrapping of machine " + machineName + " reached timeout"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new InfrastructureException("Bootstrapping of machine " + machineName + " was interrupted"); } finally { eventService.unsubscribe(bootstrapperStatusListener, BootstrapperStatusEvent.class); } }
Source:
protected void reportAttemptingFullContext(@NotNull DFA dfa, @Nullable BitSet conflictingAlts, @NotNull ATNConfigSet configs, int startIndex, int stopIndex) { conflictingAltResolvedBySLL = conflictingAlts.nextSetBit(0); decisions[currentDecision].LL_Fallback++; super.reportAttemptingFullContext(dfa, conflictingAlts, configs, startIndex, stopIndex); }

Target:
protected void reportAttemptingFullContext(@NotNull DFA dfa, @Nullable BitSet conflictingAlts, @NotNull ATNConfigSet configs, int startIndex, int stopIndex) { if ( conflictingAlts!=null ) { conflictingAltResolvedBySLL = conflictingAlts.nextSetBit(0); } else { conflictingAltResolvedBySLL = configs.getAlts().nextSetBit(0); } decisions[currentDecision].LL_Fallback++; super.reportAttemptingFullContext(dfa, conflictingAlts, configs, startIndex, stopIndex); }
Source:
public void testOverrideIndicatorState() { testCountOverrideIndicators(); int count= 0; for (Annotation fOverrideAnnotation : fOverrideAnnotations) { Accessor indicator= new Accessor(fOverrideAnnotation, "org.eclipse.jdt.internal.ui.javaeditor.OverrideIndicatorManager$OverrideIndicator", getClass().getClassLoader()); if (indicator.getBoolean("fIsOverwriteIndicator")) count++; } assertEquals(2, count); }

Target:
public void testOverrideIndicatorState() { testCountOverrideIndicators(); int count= 0; for (Annotation overrideAnnotation : fOverrideAnnotations) { Accessor indicator= new Accessor(overrideAnnotation, "org.eclipse.jdt.internal.ui.javaeditor.OverrideIndicatorManager$OverrideIndicator", getClass().getClassLoader()); if (indicator.getBoolean("fIsOverwriteIndicator")) count++; } assertEquals(2, count); }
Source:
public void emptySeries() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Slice size is too big."); Series series = new Series(""); List<String> slices = series.slices(1); }

Target:
public void emptySeries() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Slice size is too big."); Series series = new Series(""); series.slices(1); }
Source:
protected void executeCommand() { auditLogDirector.log(this, AuditLogType.USER_REGISTER_DISK_INITIATED); TransactionSupport.executeInNewTransaction(() -> { if (getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE) { final DiskImage newDiskImage = getDiskImage(); newDiskImage.setDiskAlias(ImagesHandler.getDiskAliasWithDefault(newDiskImage, generateDefaultAliasForRegiteredDisk(Calendar.getInstance()))); ArrayList<Guid> storageIds = new ArrayList<>(); storageIds.add(getParameters().getStorageDomainId()); newDiskImage.setStorageIds(storageIds); addDiskImageToDb(newDiskImage, getCompensationContext(), Boolean.TRUE); unregisteredDisksDao.removeUnregisteredDisk(newDiskImage.getId(), null); getReturnValue().setActionReturnValue(newDiskImage.getId()); getReturnValue().setSucceeded(true); } else if (getDiskImage().getDiskStorageType() == DiskStorageType.CINDER) { VdcReturnValueBase returnValue = runInternalAction(VdcActionType.RegisterCinderDisk, new RegisterCinderDiskParameters( (CinderDisk) getDiskImage(), getParameters().getStorageDomainId())); setReturnValue(returnValue); } return null; }); initQcowCompat(); }

Target:
protected void executeCommand() { auditLogDirector.log(this, AuditLogType.USER_REGISTER_DISK_INITIATED); TransactionSupport.executeInNewTransaction(() -> { if (getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE) { final DiskImage newDiskImage = getDiskImage(); newDiskImage.setDiskAlias(ImagesHandler.getDiskAliasWithDefault(newDiskImage, generateDefaultAliasForRegiteredDisk(Calendar.getInstance()))); ArrayList<Guid> storageIds = new ArrayList<>(); storageIds.add(getParameters().getStorageDomainId()); newDiskImage.setStorageIds(storageIds); addDiskImageToDb(newDiskImage, getCompensationContext(), Boolean.TRUE); unregisteredDisksDao.removeUnregisteredDisk(newDiskImage.getId(), null); getReturnValue().setActionReturnValue(newDiskImage.getId()); getReturnValue().setSucceeded(true); } else if (getDiskImage().getDiskStorageType() == DiskStorageType.CINDER) { VdcReturnValueBase returnValue = runInternalAction(VdcActionType.RegisterCinderDisk, new RegisterCinderDiskParameters( (CinderDisk) getDiskImage(), getParameters().getStorageDomainId())); setReturnValue(returnValue); } return null; }); fetchQcowCompat(); }
Source:
protected String getMessage(Message message) { switch(message) { case CHECK: return "This conversion doesn't seem right. Correct it automatically?"; case SUGGESTION: return "Writing for an international audience? Automatically add the converted metric equivalent."; case CHECK_UNKNOWN_UNIT: return "This conversion doesn't seem right, unable to recognize the used unit."; case UNIT_MISMATCH: return "These units don't seem to be compatible."; default: throw new RuntimeException("Unknown message type."); } }

Target:
protected String getMessage(Message message) { switch(message) { case CHECK: return "This conversion doesn't seem right. Do you want to correct it automatically?"; case SUGGESTION: return "Writing for an international audience? Consider adding the metric equivalent."; case CHECK_UNKNOWN_UNIT: return "This conversion doesn't seem right, unable to recognize the used unit."; case UNIT_MISMATCH: return "These units don't seem to be compatible."; default: throw new RuntimeException("Unknown message type." + message); } }
Source:
private String getNetworkNames(List<Network> networks) { return networks.stream().map(Network::getName).collect(Collectors.joining(",")); }

Target:
private String getNetworkNames(List<Network> networks) { return StringUtils.join(Entities.objectNames(networks), ", "); }
Source:
public String handle(final HttpRequest request) throws WebSitesException { String action = request.getParameter("Action"); String id = request.getParameter("Id"); String currentPath = request.getParameter("path"); if (currentPath != null) { currentPath = doubleAntiSlash(currentPath); } if ("newSite".equals(action)) { currentPath = addNewDesignedSite(controller, request); } else if ("updateDescription".equals(action)) { updateDesignedSite(controller, request, currentPath); } else if ("addFolder".equals(action)) { addFolderInSite(controller, request, currentPath); } else if ("renameFolder".equals(action)) { renameFolderInSite(controller, request, currentPath); } else if ("deleteFolder".equals(action)) { deleteFolderInSite(controller, request, currentPath); } else if ("addPage".equals(action)) { addPageInSite(controller, request, currentPath); } else if ("renamePage".equals(action)) { renamePageInSite(controller, request, currentPath); } else if ("deletePage".equals(action)) { deletePageInSite(controller, request, currentPath); } else if ("classifySite".equals(action)) { classifySite(controller, request, id); } else if ("design".equals(action)) { SiteDetail site = controller.getWebSite(id); controller.setSessionSite(site); request.setAttribute("Site", site); } else { SiteDetail site = controller.getSessionSite(); id = site.getPK().getId(); request.setAttribute("Site", site); } return "/webSites/jsp/design.jsp?Action=design&path=" + currentPath + "&Id=" + id; }

Target:
public String handle(final HttpRequest request) throws WebSitesException { String action = request.getParameter("Action"); String id = request.getParameter("Id"); String currentPath = request.getParameter(WebSitesRequestRouter.PATH_PARAM); if (currentPath != null) { currentPath = doubleAntiSlash(currentPath); } switch (action) { case "newSite": currentPath = addNewDesignedSite(controller, request); break; case "updateDescription": updateDesignedSite(controller, request, currentPath); break; case "addFolder": addFolderInSite(controller, request, currentPath); break; case "renameFolder": renameFolderInSite(controller, request, currentPath); break; case "deleteFolder": deleteFolderInSite(controller, request, currentPath); break; case "addPage": addPageInSite(controller, request, currentPath); break; case "renamePage": renamePageInSite(controller, request, currentPath); break; case "deletePage": deletePageInSite(controller, request, currentPath); break; case "classifySite": classifySite(controller, request, id); break; case "design": setSiteToDesign(controller, request, id); break; default: id = backToDesignedSite(controller, request); break; } return "/webSites/jsp/design.jsp?Action=design&Path=" + currentPath + "&Id=" + id; }
Source:
TxnContext put(@Nonnull Table<K, V, M> table, @Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { if (!table.getNamespace().equals(namespace)) { throw new IllegalArgumentException("TxnContext can't apply table from namespace " + table.getNamespace() + " to transaction on namespace " + namespace); } table.numPuts.incrementAndGet(); tablesInTxn.add(table); operations.add(() -> { table.put(key, value, metadata); }); return this; }

Target:
TxnContext put(@Nonnull Table<K, V, M> table, @Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { validateTableWrittenIsInNamespace(table); operations.add(() -> { table.put(key, value, metadata); table.getMetrics().incNumPuts(); }); return this; }
Source:
public int getTarget(int source) { if (source < 0 || source >= size) { throw new IndexOutOfBoundsException("source #" + source + " has no target in identity mapping of size " + size); } return source; }

Target:
public int getTarget(int source) { if (source < 0 || (size != -1 && source >= size)) { throw new IndexOutOfBoundsException("source #" + source + " has no target in identity mapping of size " + size); } return source; }
Source:
public void setOnResponseError(Throwable cause) { this.responseHandlingError = cause; if (responseHandlingError != null) { for (MessageObserver handler : getMessageObservers()) { if (handler instanceof MessageObserver2) { ((MessageObserver2) handler).onResponseHandlingError(responseHandlingError); } } } if (responseHandlingError != null) { synchronized (this) { notifyAll(); } } }

Target:
public void setOnResponseError(Throwable cause) { this.responseHandlingError = cause; if (responseHandlingError != null) { for (MessageObserver handler : getMessageObservers()) { if (handler instanceof MessageObserver2) { ((MessageObserver2) handler).onResponseHandlingError(responseHandlingError); } } synchronized (this) { notifyAll(); } } }
Source:
public void create(byte[] tableMetadata) { if (conns.get().selectExistsUnregisteredQuery( "SELECT 1 FROM " + config.metadataTable().getQualifiedName() + " WHERE table_name = ?", tableName.getQualifiedName())) { return; } String prefixedTableName = prefixedTableName(); try { conns.get().executeUnregisteredQuery( String.format("CREATE TABLE %s (" + " row_name BYTEA NOT NULL," + " col_name BYTEA NOT NULL," + " ts INT8 NOT NULL," + " val BYTEA," + " CONSTRAINT %s PRIMARY KEY (row_name, col_name, ts) ", prefixedTableName, PrimaryKeyConstraintNames.get(prefixedTableName)) + ")"); } catch (PalantirSqlException e) { if (!e.getMessage().contains("already exists")) { log.error("Error occurred trying to create the table", e); throw e; } else if (prefixedTableName.length() > ATLASDB_POSTGRES_TABLE_NAME_LIMIT) { final String msg = String.format("The table name is longer than the postgres limit of %d characters. " + "Attempted to truncate the name but the truncated table name or truncated primary " + "key constraint name already exists. Please ensure all your table names have unique " + "first %d characters.", ATLASDB_POSTGRES_TABLE_NAME_LIMIT, ATLASDB_POSTGRES_TABLE_NAME_LIMIT); log.error("Failed to create the table {}. {}", prefixedTableName, msg, e); throw new RuntimeException("Failed to create the table" + prefixedTableName + "." + msg, e); } } ignoringError(() -> { conns.get().insertOneUnregisteredQuery( String.format( "INSERT INTO %s (table_name, table_size) VALUES (?, ?)", config.metadataTable().getQualifiedName()), tableName.getQualifiedName(), TableValueStyle.RAW.getId()); }, ExceptionCheck::isUniqueConstraintViolation); }

Target:
public void create(byte[] tableMetadata) { if (conns.get().selectExistsUnregisteredQuery( "SELECT 1 FROM " + config.metadataTable().getQualifiedName() + " WHERE table_name = ?", tableName.getQualifiedName())) { return; } String prefixedTableName = prefixedTableName(); try { conns.get().executeUnregisteredQuery( String.format("CREATE TABLE %s (" + " row_name BYTEA NOT NULL," + " col_name BYTEA NOT NULL," + " ts INT8 NOT NULL," + " val BYTEA," + " CONSTRAINT %s PRIMARY KEY (row_name, col_name, ts) ", prefixedTableName, PrimaryKeyConstraintNames.get(prefixedTableName)) + ")"); } catch (PalantirSqlException e) { if (!e.getMessage().contains("already exists")) { log.error("Error occurred trying to create the table", e); throw e; } else if (prefixedTableName.length() > ATLASDB_POSTGRES_TABLE_NAME_LIMIT) { log.error(FAILED_TO_CREATE_TABLE_MESSAGE, prefixedTableName, ATLASDB_POSTGRES_TABLE_NAME_LIMIT, ATLASDB_POSTGRES_TABLE_NAME_LIMIT, e); String exceptionMsg = MessageFormatter.arrayFormat(FAILED_TO_CREATE_TABLE_MESSAGE, new Object[]{ prefixedTableName, ATLASDB_POSTGRES_TABLE_NAME_LIMIT, ATLASDB_POSTGRES_TABLE_NAME_LIMIT}) .getMessage(); throw new RuntimeException(exceptionMsg, e); } } ignoringError(() -> { conns.get().insertOneUnregisteredQuery( String.format( "INSERT INTO %s (table_name, table_size) VALUES (?, ?)", config.metadataTable().getQualifiedName()), tableName.getQualifiedName(), TableValueStyle.RAW.getId()); }, ExceptionCheck::isUniqueConstraintViolation); }
Source:
public int getLoad() { return m_load; }

Target:
public Integer getLoad() { return m_load; }
Source:
public void postProcess(PinotTaskConfig pinotTaskConfig) { String realtimeTableName = pinotTaskConfig.getConfigs().get(MinionConstants.TABLE_NAME_KEY); ZNRecord realtimeToOfflineSegmentsTaskRecord = _minionTaskZkMetadataManager.getRealtimeToOfflineSegmentsTaskZNRecord(realtimeTableName); Preconditions.checkState(realtimeToOfflineSegmentsTaskRecord.getVersion() == _expectedVersion, "Version mismatch for realtimeToOfflineSegmentsTask ZNode: %s, expected: %d, but found: %d. " + "ZNode may have been modified by another task.", realtimeToOfflineSegmentsTaskRecord, _expectedVersion, realtimeToOfflineSegmentsTaskRecord.getVersion()); RealtimeToOfflineSegmentsTaskMetadata realtimeToOfflineSegmentsTaskMetadata = RealtimeToOfflineSegmentsTaskMetadata.fromZNRecord(realtimeToOfflineSegmentsTaskRecord); realtimeToOfflineSegmentsTaskMetadata.setWatermarkMillis(_nextWatermark); _minionTaskZkMetadataManager .setRealtimeToOfflineSegmentsTaskMetadata(realtimeToOfflineSegmentsTaskMetadata, _expectedVersion); }

Target:
public void postProcess(PinotTaskConfig pinotTaskConfig) { String realtimeTableName = pinotTaskConfig.getConfigs().get(MinionConstants.TABLE_NAME_KEY); RealtimeToOfflineSegmentsTaskMetadata newMinionMetadata = new RealtimeToOfflineSegmentsTaskMetadata(realtimeTableName, _nextWatermark); _minionTaskZkMetadataManager.setRealtimeToOfflineSegmentsTaskMetadata(newMinionMetadata, _expectedVersion); }
Source:
public WebSession extractWebSession(HttpMessage msg) { SessionScript sessionScript = getScriptInterface(script); if (sessionScript != null) { SessionWrapper wrapper = getSessionWrapper(msg); try { sessionScript.extractWebSession(wrapper); } catch (Exception e) { LOG.error(e.getMessage(), e); } return wrapper.getSession(); } return new ScriptBasedSession(); }

Target:
public WebSession extractWebSession(HttpMessage msg) { SessionScript sessionScript = getScriptInterface(script); if (sessionScript != null) { SessionWrapper wrapper = getSessionWrapper(msg); try { sessionScript.extractWebSession(wrapper); } catch (Exception e) { getScriptsExtension().handleScriptException(script, e); } return wrapper.getSession(); } return new ScriptBasedSession(); }
Source:
public TaskResult runTask() { Optional<String> paramServerType = systemConfig.getOptional("param_server.database.type", String.class); if (!paramServerType.isPresent()) { throw new ConfigException("param_server.database.type is required to use this operator."); } Config params = request.getLocalConfig(); List<String> keys = params.getKeys(); if (keys.size() == 0) { throw new ConfigException("no key is set."); } TaskResult taskResult = TaskResult.empty(request); Config storeParams = taskResult.getStoreParams(); paramServerClient.begin(); for (String key : keys) { Optional<String> destKey = params.getOptional(key, String.class); if (destKey.isPresent()) { storeParams.set( destKey.get(), paramServerClient.get(key, request.getSiteId()).or("") ); } } paramServerClient.finalize(); return taskResult; }

Target:
public TaskResult runTask() { Optional<String> paramServerType = systemConfig.getOptional("param_server.type", String.class); if (!paramServerType.isPresent()) { throw new ConfigException("param_server.type is required to use this operator."); } Config params = request.getLocalConfig(); List<String> keys = params.getKeys(); if (keys.size() == 0) { throw new ConfigException("no key is set."); } TaskResult taskResult = TaskResult.empty(request); Config storeParams = taskResult.getStoreParams(); for (String key : keys) { Optional<String> destKey = params.getOptional(key, String.class); if (destKey.isPresent()) { Optional<Record> record = paramServerClient.get(key, request.getSiteId()); storeParams.set( destKey.get(), record.isPresent() ? record.get().value().get("value") : "" ); } } paramServerClient.commit(); return taskResult; }
Source:
private void readFromStackRaw(Stack stack, byte[] buffer, int bufferOffset, int bytes) throws IOException, FormatException { long remainingBytesInChunk = remainingBytesInChunk(stack); while (bytes > 0) { while (remainingBytesInChunk == 0) { switchChunk(stack, state.currentChunk + 1); in.seek(state.chunkFileStart); remainingBytesInChunk = remainingBytesInChunk(stack); } int bytesToRead = (int)Math.min(bytes, remainingBytesInChunk); in.read( buffer, bufferOffset, bytesToRead ); bufferOffset += bytesToRead; remainingBytesInChunk -= bytesToRead; bytes -= bytesToRead; } }

Target:
private void readFromStackRaw(Stack stack, byte[] buffer, int bufferOffset, int bytes) throws IOException, FormatException { long remainingBytesInChunk = remainingBytesInChunk(stack); while (bytes > 0) { while (remainingBytesInChunk == 0) { switchChunk(stack, state.currentChunk + 1); in.seek(state.chunkFileStart); remainingBytesInChunk = remainingBytesInChunk(stack); } int bytesToRead = (int)Math.min(bytes, remainingBytesInChunk); if(buffer != null) { in.read( buffer, bufferOffset, bytesToRead ); } else { in.skipBytes(bytesToRead); } bufferOffset += bytesToRead; remainingBytesInChunk -= bytesToRead; bytes -= bytesToRead; } }
Source:
private static Properties getDefaultProperties() { if (defaultProperties == null) { String[] keyArr = { SERVER_NAME, SERVER_PORT, DATABASE_NAME, JDBC_URL, USER, PASSWORD, DRIVER_CLASS_NAME, DATASOURCE_CLASS_NAME, MAX_POOL_SIZE, ALLOW_LOCAL_TXS }; String[] defaultPropArr = { "", "", "", "jdbc:h2:mem:jbpm-db;MVCC=true", "sa", "", "org.h2.Driver", "org.h2.jdbcx.JdbcDataSource", "5", "true" }; Assert.assertTrue("Unequal number of keys for default properties", keyArr.length == defaultPropArr.length); defaultProperties = new Properties(); for (int i = 0; i < keyArr.length; ++i) { defaultProperties.put(keyArr[i], defaultPropArr[i]); } } return defaultProperties; }

Target:
private static Properties getDefaultProperties() { if (defaultProperties == null) { String[] keyArr = { SERVER_NAME, SERVER_PORT, DATABASE_NAME, JDBC_URL, USER, PASSWORD, DRIVER_CLASS_NAME, DATASOURCE_CLASS_NAME, MAX_POOL_SIZE, ALLOW_LOCAL_TXS }; String[] defaultPropArr = { "", "", "", "jdbc:h2:mem:jbpm-db;MVCC=true", "sa", "", "org.h2.Driver", "org.h2.jdbcx.JdbcDataSource", "16", "true" }; Assert.assertTrue("Unequal number of keys for default properties", keyArr.length == defaultPropArr.length); defaultProperties = new Properties(); for (int i = 0; i < keyArr.length; ++i) { defaultProperties.put(keyArr[i], defaultPropArr[i]); } } return defaultProperties; }
Source:
public void onTestStart(ITestResult result) { StringBuilder builder = new StringBuilder(); String testName = result.getName().toString(); String className = result.getTestClass().getName().toString(); builder.append( "<table>" + "<h1>Class: <em>" +className+ "." + testName + " </em></h1>" + "<tr class=\"step\"><td>&nbsp</td><td><h1><em>" + testName + "</em></h1></td><td> <br/> &nbsp;</td></tr>" ); CommonUtils.appendTextToFile(logPath, builder.toString()); System.out.println(className + " " + testName); }

Target:
public void onTestStart(ITestResult result) { StringBuilder builder = new StringBuilder(); String testName = result.getName().toString(); String className = result.getTestClass().getName().toString(); builder.append( "<table>" + "<h1>Class: <em>" +className+ "." + testName + " </em></h1>" + "<tr class=\"step\">" + "<td>&nbsp</td>" + "<td><h1><em>" + testName + "</em></h1></td>" + "<td> <br/> &nbsp;</td></tr>" ); CommonUtils.appendTextToFile(logPath, builder.toString()); System.out.println(className + " " + testName); }
Source:
public void titleOfDuckDuckGoShouldContainSearchQueryName() { goTo("<LINK_0>"); $("#search_form_input_homepage").fill().with("FluentLenium"); $("#search_button_homepage").submit(); await().atMost(5, TimeUnit.SECONDS).until($("#search_form_homepage")).not().present(); assertThat(window().title()).contains("FluentLenium"); }

Target:
public void titleOfDuckDuckGoShouldContainSearchQueryName() { goTo("<LINK_0>"); $("#search_form_input_homepage").fill().with("FluentLenium"); $("#search_button_homepage").submit(); await().atMost(5, TimeUnit.SECONDS).until(el("#search_form_homepage")).not().present(); assertThat(window().title()).contains("FluentLenium"); }
Source:
public void testPipelineCreationOnNodeRestart() throws Exception { conf.setTimeDuration(OZONE_SCM_STALENODE_INTERVAL, 5, TimeUnit.SECONDS); init(3); waitForPipelines(1); List<HddsDatanodeService> dns = new ArrayList<>(cluster.getHddsDatanodes()); List<Pipeline> pipelines = pipelineManager.getPipelines(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE); for (HddsDatanodeService dn : dns) { cluster.shutdownHddsDatanode(dn.getDatanodeDetails()); } RatisPipelineProvider ratisPipelineProvider = (RatisPipelineProvider) pipelineManager.getPipelineFactory().getProvider( HddsProtos.ReplicationType.RATIS); try { ratisPipelineProvider.createPipeline(pipelines.get(0)); Assert.fail("pipeline creation should fail after shutting down pipeline"); } catch (IOException ioe) { Assert.assertTrue(ioe instanceof MultipleIOException); } waitForPipelines(0); for (HddsDatanodeService dn : dns) { cluster.restartHddsDatanode(dn.getDatanodeDetails(), false); } for (Pipeline pipeline : pipelines) { pipelineManager.finalizeAndDestroyPipeline(pipeline, false); } pipelineManager.triggerPipelineCreation(); waitForPipelines(1); }

Target:
public void testPipelineCreationOnNodeRestart() throws Exception { conf.setTimeDuration(OZONE_SCM_STALENODE_INTERVAL, 5, TimeUnit.SECONDS); init(3); waitForPipelines(1); List<HddsDatanodeService> dns = new ArrayList<>(cluster.getHddsDatanodes()); List<Pipeline> pipelines = pipelineManager.getPipelines(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE); for (HddsDatanodeService dn : dns) { cluster.shutdownHddsDatanode(dn.getDatanodeDetails()); } try { pipelineManager.createPipeline(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE); Assert.fail("pipeline creation should fail after shutting down pipeline"); } catch (IOException ioe) { Assert.assertTrue(ioe instanceof InsufficientDatanodesException); } waitForPipelines(0); for (HddsDatanodeService dn : dns) { cluster.restartHddsDatanode(dn.getDatanodeDetails(), false); } for (Pipeline pipeline : pipelines) { pipelineManager.finalizeAndDestroyPipeline(pipeline, false); } pipelineManager.triggerPipelineCreation(); waitForPipelines(1); }
Source:
private void acceptConnection() { try (Socket s = configServerSocket.accept(); MessageReader in = new MessageReader(s.getInputStream()); OutputStream output = s.getOutputStream()) { LOGGER.log(Level.FINE, "OpenGrok: Got request from {0}", s.getInetAddress().getHostAddress()); Message m = in.readMessage(); handleMessage(m, output); } catch (SocketException e) { if (!configServerSocket.isClosed()) { LOGGER.log(Level.SEVERE, "Socket error", e); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error reading config file: ", e); } catch (RuntimeException e) { LOGGER.log(Level.SEVERE, "Error parsing config file: ", e); } catch (ValidationException e) { LOGGER.log(Level.WARNING, "Received invalid message", e); } }

Target:
private void acceptConnection() { try (Socket s = configServerSocket.accept(); MessageReader in = new MessageReader(s.getInputStream()); OutputStream output = s.getOutputStream()) { LOGGER.log(Level.FINE, "OpenGrok: Got request from {0}", s.getInetAddress().getHostAddress()); Message m = in.readMessage(); handleMessage(m, output); } catch (SocketException e) { if (!configServerSocket.isClosed()) { LOGGER.log(Level.SEVERE, "Socket error", e); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error reading message : ", e); } catch (ValidationException e) { LOGGER.log(Level.WARNING, "Received invalid message", e); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Error parsing message : ", e); } }
Source:
private void updateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry, long stopRank, long startTime, long stopTime) { ITmfTrace trace = timeAnalysisEntry.getTrace(); TimeChartDecorationProvider decorationProvider = fDecorationProviders.get(trace); if (decorationProvider == null) { return; } boolean done = false; while (!done) { synchronized (timeAnalysisEntry) { try (ITmfContext context = (timeAnalysisEntry.getLastRank() != -1) ? trace.seekEvent(timeAnalysisEntry.getLastRank()) : trace.seekEvent(0);) { while (!done) { if (timeAnalysisEntry.getLastRank() >= trace.getNbEvents()) { done = true; break; } if (context == null || context.getRank() != timeAnalysisEntry.getLastRank()) { break; } while (true) { long rank = context.getRank(); ITmfEvent event = trace.getNext(context); if (event == null) { done = true; break; } TimeChartEvent timeEvent = new TimeChartEvent(timeAnalysisEntry, event, rank, decorationProvider); if (timeEvent.getTime() >= startTime && timeEvent.getTime() <= stopTime) { timeAnalysisEntry.addTraceEvent(timeEvent); } if (context.getRank() == trace.getNbEvents() || context.getRank() == stopRank) { done = true; break; } if (context.getRank() % trace.getCacheSize() == 1) { break; } } timeAnalysisEntry.setLastRank(context.getRank()); } redrawViewer(true); } } } redrawViewer(true); }

Target:
private void updateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry, long stopRank, long startTime, long stopTime) { ITmfTrace trace = timeAnalysisEntry.getTrace(); TimeChartDecorationProvider decorationProvider = fDecorationProviders.get(trace); if (decorationProvider == null) { return; } boolean done = false; while (!done) { synchronized (timeAnalysisEntry) { try (ITmfContext context = checkNotNull( timeAnalysisEntry.getLastRank() != -1 ? trace.seekEvent(timeAnalysisEntry.getLastRank()) : trace.seekEvent(0));) { if (timeAnalysisEntry.getLastRank() >= trace.getNbEvents()) { done = true; break; } while (true) { long rank = context.getRank(); ITmfEvent event = trace.getNext(context); if (event == null) { done = true; break; } TimeChartEvent timeEvent = new TimeChartEvent(timeAnalysisEntry, event, rank, decorationProvider); if (timeEvent.getTime() >= startTime && timeEvent.getTime() <= stopTime) { timeAnalysisEntry.addTraceEvent(timeEvent); } if (context.getRank() == trace.getNbEvents() || context.getRank() == stopRank) { done = true; break; } if (context.getRank() % trace.getCacheSize() == 1) { break; } } timeAnalysisEntry.setLastRank(context.getRank()); } } redrawViewer(true); } }
Source:
public static Optional<org.junit.platform.engine.discovery.FilePosition> fromQuery(String query) { FilePosition result = null; Integer line = null; Integer column = null; if (StringUtils.isNotBlank(query)) { try { for (String pair : query.split("&")) { String[] data = pair.split("="); if (data.length == 2) { String key = data[0]; if (line == null && "line".equals(key)) { line = Integer.valueOf(data[1]); } else if (column == null && "column".equals(key)) { column = Integer.valueOf(data[1]); } } if (line != null && column != null) { break; } } } catch (IllegalArgumentException ex) { logger.debug(ex, () -> "Failed to parse 'line' and/or 'column' from query string: " + query); } if (line != null) { result = column == null ? new FilePosition(line) : new FilePosition(line, column); } } return Optional.ofNullable(result); }

Target:
public static Optional<FilePosition> fromQuery(String query) { FilePosition result = null; Integer line = null; Integer column = null; if (StringUtils.isNotBlank(query)) { try { for (String pair : query.split("&")) { String[] data = pair.split("="); if (data.length == 2) { String key = data[0]; if (line == null && "line".equals(key)) { line = Integer.valueOf(data[1]); } else if (column == null && "column".equals(key)) { column = Integer.valueOf(data[1]); } } if (line != null && column != null) { break; } } } catch (IllegalArgumentException ex) { logger.debug(ex, () -> "Failed to parse 'line' and/or 'column' from query string: " + query); } if (line != null) { result = column == null ? new FilePosition(line) : new FilePosition(line, column); } } return Optional.ofNullable(result); }
Source:
private static void rederive(String uri) throws ConnectorException, IOException, OSException { SecureRandom random = new SecureRandom(); byte[] newContextId = new byte[8]; random.nextBytes(newContextId); HashMapCtxDB db = HashMapCtxDB.getInstance(); OSCoreCtx oldCtx = db.getContext(uri); OSCoreCtx ctx = new OSCoreCtx(oldCtx.getMasterSecret(), true, oldCtx.getAlg(), oldCtx.getSenderId(), oldCtx.getRecipientId(), oldCtx.getKdf(), oldCtx.getRecipientReplaySize(), oldCtx.getSalt(), newContextId); ctx.setIncludeContextId(true); db.addContext(uri, ctx); String resource = "/rederive"; String URI = uri + resource; System.out.println(URI); CoapClient c = new CoapClient(URI); Request r = new Request(Code.GET); r.getOptions().setOscore(new byte[0]); System.out.println(Utils.prettyPrint(r)); CoapResponse resp = null; resp = c.advanced(r); System.out.println(Utils.prettyPrint(resp)); c.shutdown(); }

Target:
private static void rederive(String uri) throws ConnectorException, IOException, OSException { SecureRandom random = new SecureRandom(); byte[] newContextId = new byte[8]; random.nextBytes(newContextId); HashMapCtxDB db = HashMapCtxDB.getInstance(); OSCoreCtx oldCtx = db.getContext(uri); OSCoreCtx ctx = new OSCoreCtx(oldCtx.getMasterSecret(), true, oldCtx.getAlg(), oldCtx.getSenderId(), oldCtx.getRecipientId(), oldCtx.getKdf(), oldCtx.getRecipientReplaySize(), oldCtx.getSalt(), newContextId); ctx.setIncludeContextId(true); db.addContext(uri, ctx); String resource = "/rederive"; String URI = uri + resource; System.out.println(URI); CoapClient c = new CoapClient(URI); Request r = new Request(Code.GET); r.getOptions().setOscore(Bytes.EMPTY); System.out.println(Utils.prettyPrint(r)); CoapResponse resp = null; resp = c.advanced(r); System.out.println(Utils.prettyPrint(resp)); c.shutdown(); }
Source:
private void updateData(@NonNull TimeQueryFilter filters, IProgressMonitor monitor) { if (fXYDataProvider == null) { TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "Data provider for this viewer is not available"); return; } boolean isComplete = false; do { TmfModelResponse<ITmfXyModel> response = fXYDataProvider.fetchXY(filters, monitor); ITmfXyModel model = response.getModel(); if (model == null || !(model instanceof ITmfCommonXAxisModel)) { Activator.getDefault().logError("The model is of the wrong type: " + model); } extractXYModelAndUpdateViewModel((ITmfCommonXAxisModel) model); updateDisplay(); ITmfResponse.Status status = response.getStatus(); if (status == ITmfResponse.Status.COMPLETED) { isComplete = true; } else if (status == ITmfResponse.Status.FAILED || status == ITmfResponse.Status.CANCELLED) { TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, response.getStatusMessage()); isComplete = true; } else { try { Thread.sleep(BUILD_UPDATE_TIMEOUT); } catch (InterruptedException e) { TraceCompassLogUtils.traceInstant(LOGGER, Level.INFO, e.getMessage()); } } } while (!isComplete); }

Target:
private void updateData(@NonNull TimeQueryFilter filters, IProgressMonitor monitor) { if (fXYDataProvider == null) { TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "Data provider for this viewer is not available"); return; } boolean isComplete = false; do { TmfModelResponse<ITmfXyModel> response = fXYDataProvider.fetchXY(filters, monitor); ITmfXyModel model = response.getModel(); if (!(model instanceof ITmfCommonXAxisModel)) { Activator.getDefault().logError("The model is of the wrong type: " + model); return; } extractXYModelAndUpdateViewModel((ITmfCommonXAxisModel) model); updateDisplay(); ITmfResponse.Status status = response.getStatus(); if (status == ITmfResponse.Status.COMPLETED) { isComplete = true; } else if (status == ITmfResponse.Status.FAILED || status == ITmfResponse.Status.CANCELLED) { TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, response.getStatusMessage()); isComplete = true; } else { try { Thread.sleep(BUILD_UPDATE_TIMEOUT); } catch (InterruptedException e) { TraceCompassLogUtils.traceInstant(LOGGER, Level.INFO, e.getMessage()); } } } while (!isComplete); }
Source:
public void verifyMonetizationModuleNotShown() { Assertion.assertTrue(!checkIfElementOnPage(monetizationModuleContainer)); PageObjectLogging.log("verifyMonetizationModuleNotShown", "Monetization module is not shown", true); }

Target:
public void verifyMonetizationModuleNotShown() { Assertion.assertFalse(checkIfElementOnPage(monetizationModuleContainer)); PageObjectLogging.log("verifyMonetizationModuleNotShown", "Monetization module is not shown", true); }
Source:
public boolean hasCollision() { for (Script script : getScriptList()) { Brick scriptBrick = script.getScriptBrick(); if (scriptBrick instanceof FormulaBrick) { FormulaBrick formulaBrick = (FormulaBrick) scriptBrick; for (Formula formula : formulaBrick.getFormulas()) { if (formula.containsElement(FormulaElement.ElementType.COLLISION_FORMULA)) { return true; } } } for (Brick brick : script.brickList) { if (brick instanceof FormulaBrick) { FormulaBrick formulaBrick = (FormulaBrick) brick; for (Formula formula : formulaBrick.getFormulas()) { if (formula.containsElement(FormulaElement.ElementType.COLLISION_FORMULA)) { return true; } } } } } Scene scene = ProjectManager.getInstance().getCurrentScene(); for (Sprite sprite : scene.getSpriteList()) { if (sprite.hasToCollideWith(this)) { return true; } } return false; }

Target:
public boolean hasCollision() { boolean hasCollision = (this.getRequiredResources() & Brick.COLLISION) > 0; if (hasCollision) { return true; } Scene scene = ProjectManager.getInstance().getCurrentScene(); for (Sprite sprite : scene.getSpriteList()) { if (sprite.hasToCollideWith(this)) { return true; } } return false; }
Source:
private HashMap<String, Container> createIDTable(List<EmailMessage> emailMessages) { HashMap<String, Container> id_table = new HashMap<>(); for (EmailMessage message : emailMessages) { String messageID = message.getMessageID(); Container container = id_table.get(messageID); if (container != null) { if (container.hasMessage()) { messageID = String.format("<Bogus-id: %d >", bogus_id_count++); container = null; } else { container.setMessage(message); } } if (container == null) { container = new Container(message); id_table.put(messageID, container); } processMessageReferences(message, container, id_table); } return id_table; }

Target:
private Map<String, EmailContainer> createIDTable(List<EmailMessage> emailMessages) { HashMap<String, EmailContainer> id_table = new HashMap<>(); for (EmailMessage message : emailMessages) { String messageID = message.getMessageID(); EmailContainer container = id_table.get(messageID); if (container != null) { if (container.hasMessage()) { messageID = String.format("<Bogus-id: %d >", bogus_id_count++); container = null; } else { container.setMessage(message); } } if (container == null) { container = new EmailContainer(message); id_table.put(messageID, container); } processMessageReferences(message, container, id_table); } return id_table; }
Source:
private void printPrincipalRecord(ExtMap extMap) { if (extMap != null) { logger.info(String.format("PrincipalRecord: ID %s, name: %s, display name: %s, email: %s, first name: %s, last name: %s, department: %s, title: %s", extMap.get(Authz.PrincipalRecord.ID, ""), extMap.get(Authz.PrincipalRecord.NAME, ""), extMap.get(Authz.PrincipalRecord.DISPLAY_NAME, ""), extMap.get(Authz.PrincipalRecord.EMAIL, ""), extMap.get(Authz.PrincipalRecord.FIRST_NAME, ""), extMap.get(Authz.PrincipalRecord.LAST_NAME, ""), extMap.get(Authz.PrincipalRecord.DEPARTMENT, ""), extMap.get(Authz.PrincipalRecord.TITLE, "") )); logger.info("Groups of PrincipalRecord: "); for (ExtMap group : extMap.get(Authz.PrincipalRecord.GROUPS, Collections.<ExtMap> emptyList())) { printGroupRecord(group); } logger.info("End of groups of PrincipalRecord: "); } }

Target:
private void printPrincipalRecord(ExtMap extMap) { if (extMap != null) { logger.info( String.format( "PrincipalRecord: ID '%s', name: '%s', principal: '%s', namespace: '%s', display name: '%s', email: '%s', first name: '%s', last name: '%s', department: '%s', title: '%s'", extMap.get(Authz.PrincipalRecord.ID, ""), extMap.get(Authz.PrincipalRecord.NAME, ""), extMap.get(Authz.PrincipalRecord.PRINCIPAL, ""), extMap.get(Authz.PrincipalRecord.NAMESPACE, ""), extMap.get(Authz.PrincipalRecord.DISPLAY_NAME, ""), extMap.get(Authz.PrincipalRecord.EMAIL, ""), extMap.get(Authz.PrincipalRecord.FIRST_NAME, ""), extMap.get(Authz.PrincipalRecord.LAST_NAME, ""), extMap.get(Authz.PrincipalRecord.DEPARTMENT, ""), extMap.get(Authz.PrincipalRecord.TITLE, "") ) ) ; logger.info("Groups of PrincipalRecord: "); for (ExtMap group : extMap.get(Authz.PrincipalRecord.GROUPS, Collections.<ExtMap> emptyList())) { printGroupRecord(group); } logger.info("End of groups of PrincipalRecord: "); } }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.CLASSDEF, ctx -> { PyClassDefTree pyClassDefTree = ((PyClassDefTree) ctx.syntaxNode()); PyNameTree classNameTree = pyClassDefTree.name(); String className = classNameTree.name(); if(!pattern().matcher(className).matches()) { String message = String.format(MESSAGE, className, format); ctx.addIssue(classNameTree, message); } }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.CLASSDEF, ctx -> { PyClassDefTree pyClassDefTree = (PyClassDefTree) ctx.syntaxNode(); PyNameTree classNameTree = pyClassDefTree.name(); String className = classNameTree.name(); if(!pattern().matcher(className).matches()) { String message = String.format(MESSAGE, className, format); ctx.addIssue(classNameTree, message); } }); }
Source:
private static boolean isOptionalProperty(Class beanClass, PropertyDescriptor beanProp) { Field field = getField(beanClass, beanProp.getName()); if (field == null) { throw new ConfigException.BadBean("Bean property '" + beanProp + "' of class " + beanClass.getName() + " does not exist"); } return (field.getAnnotationsByType(Optional.class).length > 0); }

Target:
private static boolean isOptionalProperty(Class beanClass, PropertyDescriptor beanProp) { Field field = getField(beanClass, beanProp.getName()); return (field.getAnnotationsByType(Optional.class).length > 0); }