auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); if (throwable == null && runnable instanceof Future<?>) { try { ((Future<?>) runnable).get(); } catch (CancellationException ce) { if (s_logger.isDebugEnabled()) { s_logger.debug("Task Cancelled: ", ce); } } catch (ExecutionException ee) { throwable = ee.getCause(); } catch (InterruptedException ie) { throwable = ie; } } if (throwable != null) { if (m_consumer == null) { s_logger.error("Error from ErrorHandlingScheduledThreadPool thread", throwable); } else { m_consumer.accept(throwable); } } }

Target:
protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); assert(throwable == null); assert(runnable instanceof ScheduledFuture); try { ((Future<?>) runnable).get(); } catch (CancellationException ce) { if (s_logger.isDebugEnabled()) { s_logger.debug("Task Cancelled: ", ce); } } catch (ExecutionException ee) { throwable = ee.getCause(); } catch (InterruptedException ie) { throwable = ie; } if (throwable != null) { if (m_consumer == null) { s_logger.error("Error from ErrorHandlingScheduledThreadPool thread", throwable); } else { m_consumer.accept(throwable); } } }
Source:
public void deleteForDevice(UUID deviceId) throws StateAccessException, SerializationException { List<Op> ops = new ArrayList<Op>(); List<TraceRequestConfig> traceRequests = new ArrayList<>(); String path = paths.getTraceRequestsPath(); if (zk.exists(path)) { Set<String> trIds = zk.getChildren(path); for (String id : trIds) { UUID uuid = UUID.fromString(id); TraceRequestConfig config = get(uuid); if (Objects.equals(config.deviceId, deviceId)) { ops.addAll(prepareDelete(uuid)); } } } zk.multi(ops); }

Target:
public void deleteForDevice(UUID deviceId) throws StateAccessException, SerializationException { List<Op> ops = new ArrayList<>(); String path = paths.getTraceRequestsPath(); if (zk.exists(path)) { Set<String> trIds = zk.getChildren(path); for (String id : trIds) { UUID uuid = UUID.fromString(id); TraceRequestConfig config = get(uuid); if (Objects.equals(config.deviceId, deviceId)) { ops.addAll(prepareDelete(uuid)); } } } zk.multi(ops); }
Source:
protected void clearLeftoverExpiredKeyQueues(CachePartitionSegment container) { Iterator<ICacheRecordStore> iterator = container.recordStoreIterator(); while (iterator.hasNext()) { ICacheRecordStore store = iterator.next(); InvalidationQueue expiredKeys = store.getExpiredKeys(); for (; ; ) { if (expiredKeys.poll() == null) { break; } } } }

Target:
protected void clearLeftoverExpiredKeyQueues(CachePartitionSegment container) { Iterator<ICacheRecordStore> iterator = container.recordStoreIterator(); while (iterator.hasNext()) { ICacheRecordStore store = iterator.next(); InvalidationQueue expiredKeys = store.getExpiredKeys(); expiredKeys.clear(); } }
Source:
private String repeatZeros(int num) { return CharBuffer.allocate(num).toString().replace('\0', '0'); }

Target:
private String repeatZeros(int num) { char[] zeros = new char[num]; Arrays.fill(zeros, '0'); return new String(zeros); }
Source:
public void workingWithAgents() { dashboardWorkspace.selectTabInWorspaceMenu(TabNames.AGENTS); dashboardWorkspace.selectMachine("Workspace Agents", "dev-machine"); agents.forEach( (name, value) -> { dashboardWorkspace.checkAgentExists(name); }); agents.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getAgentState(name), value); dashboardWorkspace.switchAgentState(name); loader.waitOnClosed(); }); clickOnSaveButton(); agents.forEach( (name, value) -> { dashboardWorkspace.switchAgentState(name); loader.waitOnClosed(); }); clickOnSaveButton(); agents.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getAgentState(name), value); }); }

Target:
public void workingWithAgents() { dashboardWorkspace.selectTabInWorspaceMenu(TabNames.AGENTS); dashboardWorkspace.selectMachine("Workspace Agents", "dev-machine"); agents.forEach( (name, value) -> { dashboardWorkspace.checkAgentExists(name); }); agents.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getAgentState(name), value); dashboardWorkspace.switchAgentState(name); WaitUtils.sleepQuietly(1); }); clickOnSaveButton(); agents.forEach( (name, value) -> { dashboardWorkspace.switchAgentState(name); loader.waitOnClosed(); }); clickOnSaveButton(); agents.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getAgentState(name), value); }); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NetworkStatistics other = (NetworkStatistics) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (receiveDropRate == null) { if (other.receiveDropRate != null) return false; } else if (!receiveDropRate.equals(other.receiveDropRate)) return false; if (receiveRate == null) { if (other.receiveRate != null) return false; } else if (!receiveRate.equals(other.receiveRate)) return false; if (status != other.status) return false; if (transmitDropRate == null) { if (other.transmitDropRate != null) return false; } else if (!transmitDropRate.equals(other.transmitDropRate)) return false; if (transmitRate == null) { if (other.transmitRate != null) return false; } else if (!transmitRate.equals(other.transmitRate)) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof NetworkStatistics) return false; NetworkStatistics other = (NetworkStatistics) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (receiveDropRate == null) { if (other.receiveDropRate != null) return false; } else if (!receiveDropRate.equals(other.receiveDropRate)) return false; if (receiveRate == null) { if (other.receiveRate != null) return false; } else if (!receiveRate.equals(other.receiveRate)) return false; if (status != other.status) return false; if (transmitDropRate == null) { if (other.transmitDropRate != null) return false; } else if (!transmitDropRate.equals(other.transmitDropRate)) return false; if (transmitRate == null) { if (other.transmitRate != null) return false; } else if (!transmitRate.equals(other.transmitRate)) return false; return true; }
Source:
public static boolean isInSubDirectory(File baseDir, File file) { try { file = file.getCanonicalFile(); } catch(IOException e) { return false; } return isInSubDirectoryInternal(baseDir, file); }

Target:
public static boolean isInSubDirectory(File baseDir, File file) { try { file = file.getCanonicalFile(); baseDir = baseDir.getCanonicalFile(); } catch(IOException e) { return false; } return isInSubDirectoryInternal(baseDir, file); }
Source:
private VdcReturnValueBase runVm() { RunVmParams runVmParams = new RunVmParams(getVmId()); runVmParams.setSessionId(getParameters().getSessionId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); runVmParams.setParentCommand(getActionType()); runVmParams.setParentParameters(getParameters()); runVmParams.setEndProcedure(EndProcedure.COMMAND_MANAGED); runVmParams.setRunAsStateless(!getVmPool().isStateful()); ExecutionContext runVmContext = createRunVmContext(); VdcReturnValueBase vdcReturnValue = runInternalAction(VdcActionType.RunVm, runVmParams, cloneContext().withExecutionContext(runVmContext) .withLock(vmPoolHandler.createLock(getVmId())) .withCompensationContext(null)); getTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); return vdcReturnValue; }

Target:
private VdcReturnValueBase runVm() { RunVmParams runVmParams = new RunVmParams(getVmId()); runVmParams.setSessionId(getParameters().getSessionId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); runVmParams.setParentCommand(getActionType()); runVmParams.setParentParameters(getParameters()); runVmParams.setEndProcedure(EndProcedure.COMMAND_MANAGED); runVmParams.setRunAsStateless(!getVmPool().isStateful()); ExecutionContext runVmContext = createRunVmContext(); VdcReturnValueBase vdcReturnValue = runInternalAction(VdcActionType.RunVm, runVmParams, cloneContext().withExecutionContext(runVmContext).withCompensationContext(null)); getTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); return vdcReturnValue; }
Source:
public void loadingThroughSystemProperty_nonExistingFile() { System.setProperty("hazelcast.client.failover.config", "idontexist"); new YamlClientFailoverConfigBuilder(); }

Target:
public void loadingThroughSystemProperty_nonExistingFile() { System.setProperty("hazelcast.client.failover.config", "idontexist"); buildConfig(); }
Source:
private SpanStrategy calculateAlternateSpanStrategy(Attributes attributes) { List<SpanStrategy> strategies = new ArrayList<>(); String cssStyle = attributes.getCssStyle(); if (cssStyle != null) { Iterator<CssRule> rules = new CssParser().createRuleIterator(cssStyle); while (rules.hasNext()) { CssRule rule = rules.next(); if (rule.name.equals("font-weight") && rule.value.equals("bold")) { strategies.add(calculateAlternateSpanStrategy(SpanType.BOLD)); } else if (rule.name.equals("font-style") && rule.value.equals("italic")) { strategies.add(calculateAlternateSpanStrategy(SpanType.ITALIC)); } else if (rule.name.equals("text-decoration") && rule.value.equalsIgnoreCase("underline")) { strategies.add(calculateAlternateSpanStrategy(SpanType.UNDERLINED)); } else if (rule.name.equals("font-family") && isFontFamilyMonospace(rule)) { strategies.add(new SubstitutionWithoutCssSpanStrategy(SpanType.MONOSPACE)); } else if (rule.name.equals("text-decoration") && rule.value.equalsIgnoreCase("line-through")) { strategies.add(new SubstitutionWithoutCssSpanStrategy(SpanType.DELETED)); } } } strategies = ImmutableList.copyOf(FluentIterable.from(strategies).filter(not(isNull()))); if (strategies.isEmpty()) { return null; } else if (strategies.size() == 1) { return strategies.get(0); } return new CompositeSpanStrategy(strategies); }

Target:
private SpanStrategy calculateAlternateSpanStrategy(Attributes attributes) { List<SpanStrategy> strategies = new ArrayList<>(); String cssStyle = attributes.getCssStyle(); if (cssStyle != null) { Iterator<CssRule> rules = new CssParser().createRuleIterator(cssStyle); while (rules.hasNext()) { CssRule rule = rules.next(); if (rule.name.equals("font-weight") && rule.value.equals("bold")) { strategies.add(calculateAlternateSpanStrategy(SpanType.BOLD)); } else if (rule.name.equals("font-style") && rule.value.equals("italic")) { strategies.add(calculateAlternateSpanStrategy(SpanType.ITALIC)); } else if (rule.name.equals("text-decoration") && rule.value.equalsIgnoreCase("underline")) { strategies.add(calculateAlternateSpanStrategy(SpanType.UNDERLINED)); } else if (rule.name.equals("text-decoration") && rule.value.equalsIgnoreCase("line-through")) { strategies.add(calculateAlternateSpanStrategy(SpanType.DELETED)); } else if (rule.name.equals("font-family") && isFontFamilyMonospace(rule)) { strategies.add(new SubstitutionWithoutCssSpanStrategy(SpanType.MONOSPACE)); } } } strategies = ImmutableList.copyOf(FluentIterable.from(strategies).filter(not(isNull()))); if (strategies.isEmpty()) { return null; } else if (strategies.size() == 1) { return strategies.get(0); } return new CompositeSpanStrategy(strategies); }
Source:
private static String validate(Details details, RightCurlyOption bracePolicy, boolean shouldStartLine, String targetSourceLine) { final DetailAST rcurly = details.rcurly; final DetailAST lcurly = details.lcurly; final DetailAST nextToken = details.nextToken; final boolean shouldCheckLastRcurly = details.shouldCheckLastRcurly; String violation = ""; if (bracePolicy == RightCurlyOption.SAME && !hasLineBreakBefore(rcurly) && lcurly.getLineNo() != rcurly.getLineNo()) { violation = MSG_KEY_LINE_BREAK_BEFORE; } else if (shouldCheckLastRcurly) { if (rcurly.getLineNo() == nextToken.getLineNo()) { violation = MSG_KEY_LINE_ALONE; } } else if (shouldBeOnSameLine(bracePolicy, details)) { violation = MSG_KEY_LINE_SAME; } else if (shouldBeAlone(bracePolicy, details)) { violation = MSG_KEY_LINE_ALONE; } else if (shouldStartLine && !isOnStartOfLine(details, targetSourceLine)) { violation = MSG_KEY_LINE_NEW; } return violation; }

Target:
private static String validate(Details details, RightCurlyOption bracePolicy, boolean shouldStartLine, String targetSourceLine) { final DetailAST rcurly = details.rcurly; final DetailAST nextToken = details.nextToken; final boolean shouldCheckLastRcurly = details.shouldCheckLastRcurly; String violation = ""; if (shouldHaveBeLineBreakBefore(bracePolicy, details)) { violation = MSG_KEY_LINE_BREAK_BEFORE; } else if (shouldCheckLastRcurly) { if (rcurly.getLineNo() == nextToken.getLineNo()) { violation = MSG_KEY_LINE_ALONE; } } else if (shouldBeOnSameLine(bracePolicy, details)) { violation = MSG_KEY_LINE_SAME; } else if (shouldBeAloneOnLine(bracePolicy, details)) { violation = MSG_KEY_LINE_ALONE; } else if (shouldStartLine && !isOnStartOfLine(details, targetSourceLine)) { violation = MSG_KEY_LINE_NEW; } return violation; }
Source:
public SipMessage.Builder<T> withRouteHeaders(final RouteHeader... routes) { if (routes != null) { this.routeHeaders = ensureList(this.routeHeaders); this.routeHeaders.clear(); routeHeader = routes[0]; this.routeHeaders.addAll(Arrays.asList(routes)); } return this; }

Target:
public SipMessage.Builder<T> withRouteHeaders(final RouteHeader... routes) { if (routes != null && routes.length > 0) { this.routeHeaders = ensureList(this.routeHeaders); this.routeHeaders.clear(); routeHeader = routes[0]; this.routeHeaders.addAll(Arrays.asList(routes)); } return this; }
Source:
private void saveSanStorage() { StorageModel storageModel = (StorageModel) getWindow(); final SanStorageModel sanStorageModel = (SanStorageModel) storageModel.getCurrentStorageItem(); List<String> unkownStatusLuns = new ArrayList(); List<LUNs> usedStatusLuns = new ArrayList(); for (LunModel lunModel : sanStorageModel.getAddedLuns()) { if (lunModel.getStatus() == LunStatus.Used) { usedStatusLuns.add((LUNs) lunModel.getEntity()); } else if (lunModel.getStatus() == LunStatus.Unknown) { unkownStatusLuns.add(lunModel.getLunId()); } } if (!unkownStatusLuns.isEmpty()) { Guid hostId = sanStorageModel.getContainer().getHost().getSelectedItem().getId(); Object target = getWidgetModel() != null ? getWidgetModel() : sanStorageModel.getContainer(); Frontend.getInstance() .runQuery(VdcQueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModel.getType(), true, unkownStatusLuns), new AsyncQuery(target, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue; if (response.getSucceeded()) { List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue(); postGetLunsMessages(sanStorageModel.getUsedLunsMessages(checkedLuns)); } else { sanStorageModel.setGetLUNsFailure( ConstantsManager.getInstance() .getConstants() .couldNotRetrieveLUNsLunsFailure()); } } }, true)); } else { postGetLunsMessages(sanStorageModel.getUsedLunsMessages(usedStatusLuns)); } }

Target:
private void saveSanStorage() { StorageModel storageModel = (StorageModel) getWindow(); final SanStorageModel sanStorageModel = (SanStorageModel) storageModel.getCurrentStorageItem(); List<String> unkownStatusLuns = new ArrayList<>(); List<LUNs> usedStatusLuns = new ArrayList<>(); for (LunModel lunModel : sanStorageModel.getAddedLuns()) { if (lunModel.getStatus() == LunStatus.Used) { usedStatusLuns.add((LUNs) lunModel.getEntity()); } else if (lunModel.getStatus() == LunStatus.Unknown) { unkownStatusLuns.add(lunModel.getLunId()); } } if (!unkownStatusLuns.isEmpty()) { Guid hostId = sanStorageModel.getContainer().getHost().getSelectedItem().getId(); Model target = getWidgetModel() != null ? getWidgetModel() : sanStorageModel.getContainer(); Frontend.getInstance() .runQuery(VdcQueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModel.getType(), true, unkownStatusLuns), new AsyncQuery(target, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue; if (response.getSucceeded()) { List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue(); postGetLunsMessages(sanStorageModel.getUsedLunsMessages(checkedLuns)); } else { sanStorageModel.setGetLUNsFailure( ConstantsManager.getInstance() .getConstants() .couldNotRetrieveLUNsLunsFailure()); } } }, true)); } else { postGetLunsMessages(sanStorageModel.getUsedLunsMessages(usedStatusLuns)); } }
Source:
public OperationReport getOperationSummary() { String operationSummaryJson = artifact.getSoleAttributeAsString(DispoConstants.OperationSummary, "{}"); try { return DispoUtil.jsonObjToOperationSummary(operationSummaryJson); } catch (Exception ex) { throw new OseeCoreException("Could not parse Operation Summary Json", ex); } }

Target:
public OperationReport getOperationSummary() { String operationSummaryJson = artifact.getSoleAttributeAsString(DispoConstants.OperationSummary, "{}"); return DispoUtil.jsonObjToOperationSummary(operationSummaryJson); }
Source:
private static void shutdownLeaderElectionService(LeaderElectionService leaderElectionService) { leaderElectionService.markNotEligibleForLeadership(); try { leaderElectionService.stepDown(); } catch (Exception e) { log.info("could not step down, continuing shutdown anyway", e); } }

Target:
private static void shutdownLeaderElectionService(LeaderElectionService leaderElectionService) { leaderElectionService.markNotEligibleForLeadership(); leaderElectionService.stepDown(); }
Source:
public static void addTypes(Biome biome, Type... types) { Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot register biome types for unregistered biome"); List<Type> subTags = listSubTags(types); for (Type type : subTags) { type.biomes.add(biome); } getBiomeInfo(biome).types.addAll(subTags); }

Target:
public static void addTypes(Biome biome, Type... types) { Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot add types to unregistered biome %s", biome); List<Type> subTypes = listSubTypes(types); for (Type type : subTypes) { type.biomes.add(biome); } getBiomeInfo(biome).types.addAll(subTypes); }
Source:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } int amountToKeep = source.getManaCostsToPay().getX(); if (amountToKeep == 0) { player.discard(player.getHand(), source, game); } else if (amountToKeep < player.getHand().size()) { TargetCardInHand target = new TargetCardInHand(amountToKeep, new FilterCard()); target.setTargetName("cards to keep"); target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game); Cards cards = player.getHand().copy(); cards.removeIf(target.getTargets()::contains); } return true; }

Target:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } int amountToKeep = source.getManaCostsToPay().getX(); if (amountToKeep == 0) { player.discard(player.getHand(), source, game); } else if (amountToKeep < player.getHand().size()) { TargetCardInHand target = new TargetCardInHand(amountToKeep, new FilterCard()); target.setTargetName("cards to keep"); target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game); Cards cards = player.getHand().copy(); cards.removeIf(target.getTargets()::contains); player.discard(cards, source, game); } return true; }
Source:
public boolean updateNode(final @Nonnull Node node) throws IOException { boolean exists; try { exists = Queue.withLock(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (node == nodes.get(node.getNodeName())) { jenkins.trimLabels(); return true; } return false; } }); } catch (Exception e) { exists = false; } if (exists) { persistNode(node); return true; } return false; }

Target:
public boolean updateNode(final @Nonnull Node node) throws IOException { boolean exists; try { exists = Queue.withLock(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (node == nodes.get(node.getNodeName())) { jenkins.trimLabels(); return true; } return false; } }); } catch (RuntimeException e) { throw e; } catch (Exception e) { exists = false; } if (exists) { persistNode(node); return true; } return false; }
Source:
public boolean addMemberToReplicaSet(MongoDBServer secondary, Integer id) { BSONObject existingConfig = getReplicaSetConfig(); if (existingConfig == null) { LOG.warn("Couldn't load existing config for replica set."); return false; } BasicBSONObject newConfig = ReplicaSetConfig.fromExistingConfig(existingConfig) .member(secondary, id) .build(); return reconfigureReplicaSet(newConfig); }

Target:
public boolean addMemberToReplicaSet(MongoDBServer secondary, Integer id) { BSONObject existingConfig = getReplicaSetConfig(); if (existingConfig == null) { LOG.warn("Couldn't load existing config for replica set from {}. Server not added.", getServerAddress(), secondary); return false; } BasicBSONObject newConfig = ReplicaSetConfig.fromExistingConfig(existingConfig) .member(secondary, id) .build(); return reconfigureReplicaSet(newConfig); }
Source:
public void should_return_endpoints_with_context_path_and_base_path_set_to_root_different_port() { contextRunner.withConfiguration(UserConfigurations.of(EndpointConfig.class)) .withPropertyValues("management.endpoint.health.enabled=true", "management.endpoint.info.enabled=true", "management.endpoints.web.exposure.include=info,health", "management.endpoints.web.base-path=/", "management.servet.port=0", "server.servlet.context-path=foo") .run(context -> { SkipPatternProvider skipPatternProvider = context .getBean(SkipPatternProvider.class); Pattern pattern = skipPatternProvider.skipPattern(); then(pattern.pattern()).contains("/(health|health/.*|info|info/.*)"); }); }

Target:
public void should_return_endpoints_with_context_path_and_base_path_set_to_root_different_port() { contextRunner.withConfiguration(UserConfigurations.of(ServerPropertiesConfig.class)) .withPropertyValues("management.endpoints.web.base-path=/", "management.server.port=0", "server.servlet.context-path=foo") .run(context -> { then(extractAllPatterns(context)).containsExactlyInAnyOrder( "/(health|health/.*|info|info/.*)", SleuthWebProperties.DEFAULT_SKIP_PATTERN); }); }
Source:
public Collection<SequenceRegion> getSequenceRegions() { return sequenceRegionMap.values(); }

Target:
public List<SequenceRegion> getSequenceRegions() { return Collections.unmodifiableList(new ArrayList<>(sequenceRegionMap.values())); }
Source:
private String checkRatioLimit(final String minmax, final BigDecimal v) { if (v != null && (v.compareTo(BigDecimal.ZERO) == -1 || v.compareTo(BigDecimal.ONE) == 1)) { return String.format( "given %s ratio is %s, but must be between 0.0 and 1.0", minmax, v); } return null; }

Target:
private String checkRatioLimit(final String minmax, final BigDecimal v) { if (v != null && (v.compareTo(BigDecimal.ZERO) < 0 || v.compareTo(BigDecimal.ONE) > 0)) { return String.format( "given %s ratio is %s, but must be between 0.0 and 1.0", minmax, v); } return null; }
Source:
public void testFullTableLoad() { Query query = Query.builder() .table(playerStatsTable) .metric(invoke(playerStatsTable.getMetric("lowScore"))) .metric(invoke(playerStatsTable.getMetric("highScore"))) .timeDimension(toProjection(playerStatsTable.getTimeDimension("recordedDate"), TimeGrain.DAY)) .build(); List<Object> results; FutureTask<QueryResult> queryResult = engine.executeQuery(query); queryResult.run(); try { QueryResult result = queryResult.get(); results = StreamSupport.stream(result.getData().spliterator(), false) .collect(Collectors.toList()); } catch (TransactionException e) { throw new TransactionException(null); } catch (InterruptedException e) { throw new IllegalStateException(e); } catch (ExecutionException e) { throw new IllegalStateException(e); } PlayerStats stats0 = new PlayerStats(); stats0.setId("0"); stats0.setLowScore(241); stats0.setHighScore(2412); stats0.setRecordedDate(Timestamp.valueOf("2019-07-11 00:00:00")); PlayerStats stats1 = new PlayerStats(); stats1.setId("1"); stats1.setLowScore(35); stats1.setHighScore(1234); stats1.setRecordedDate(Timestamp.valueOf("2019-07-12 00:00:00")); PlayerStats stats2 = new PlayerStats(); stats2.setId("2"); stats2.setLowScore(72); stats2.setHighScore(1000); stats2.setRecordedDate(Timestamp.valueOf("2019-07-13 00:00:00")); assertEquals(3, results.size()); assertEquals(stats0, results.get(0)); assertEquals(stats1, results.get(1)); assertEquals(stats2, results.get(2)); }

Target:
public void testFullTableLoad() throws Exception { Query query = Query.builder() .table(playerStatsTable) .metric(invoke(playerStatsTable.getMetric("lowScore"))) .metric(invoke(playerStatsTable.getMetric("highScore"))) .timeDimension(toProjection(playerStatsTable.getTimeDimension("recordedDate"), TimeGrain.DAY)) .build(); List<Object> results = toList(engine.executeQuery(query, transaction).getData()); PlayerStats stats0 = new PlayerStats(); stats0.setId("0"); stats0.setLowScore(241); stats0.setHighScore(2412); stats0.setRecordedDate(Timestamp.valueOf("2019-07-11 00:00:00")); PlayerStats stats1 = new PlayerStats(); stats1.setId("1"); stats1.setLowScore(35); stats1.setHighScore(1234); stats1.setRecordedDate(Timestamp.valueOf("2019-07-12 00:00:00")); PlayerStats stats2 = new PlayerStats(); stats2.setId("2"); stats2.setLowScore(72); stats2.setHighScore(1000); stats2.setRecordedDate(Timestamp.valueOf("2019-07-13 00:00:00")); assertEquals(3, results.size()); assertEquals(stats0, results.get(0)); assertEquals(stats1, results.get(1)); assertEquals(stats2, results.get(2)); }
Source:
private void assertDatasetCount(ApplicationManager appManager, long expectedMsgCount) throws Exception { KeyValueTable counter = (KeyValueTable) getDataset("counter").get(); CloseableIterator<KeyValue<byte[], byte[]>> scanner = counter.scan(null, null); try { int size = 0; while (scanner.hasNext()) { KeyValue<byte[], byte[]> keyValue = scanner.next(); Assert.assertEquals(1L, Bytes.toLong(keyValue.getValue())); size++; } Assert.assertEquals(expectedMsgCount, size); } finally { scanner.close(); } }

Target:
private void assertDatasetCount(ApplicationManager appManager, long expectedMsgCount) throws Exception { DataSetManager<KeyValueTable> datasetManager = getDataset("counter"); KeyValueTable counter = datasetManager.get(); CloseableIterator<KeyValue<byte[], byte[]>> scanner = counter.scan(null, null); try { int size = 0; while (scanner.hasNext()) { KeyValue<byte[], byte[]> keyValue = scanner.next(); Assert.assertEquals(1L, Bytes.toLong(keyValue.getValue())); size++; } Assert.assertEquals(expectedMsgCount, size); } finally { scanner.close(); } }
Source:
public void addChain(Chain c) { EntityInfo info = c.getEntityInfo(); if ( info == null || info.getType() == null) { logger.debug("No entity info could be found while adding chain with asym id (author id {}). Will consider it a polymer chain.", c.getId(), c.getName()); polyChains.add(c); } else if ( info.getType() == EntityType.POLYMER) { polyChains.add(c); } else if (info.getType() == EntityType.NONPOLYMER) { nonPolyChains.add(c); } else if (info.getType() == EntityType.WATER) { waterChains.add(c); } else if (info.getType() == EntityType.MACROLIDE) { logger.warn("Chain with asym id (author id {}) has entity type 'macrolide', considering it non-polymeric", c.getId(), c.getName()); nonPolyChains.add(c); } else { logger.warn("Chain with asym id (author id {}) has unsupported entity type '{}'. Will not add it to the Structure.", c.getId(), c.getName(), info.getType().toString()); } }

Target:
public void addChain(Chain c) { EntityInfo info = c.getEntityInfo(); if ( info == null || info.getType() == null) { logger.info("No entity info could be found while adding chain with asym id (author id {}). Will consider it a polymer chain.", c.getId(), c.getName()); polyChains.add(c); } else if ( info.getType() == EntityType.POLYMER) { polyChains.add(c); } else if (info.getType() == EntityType.NONPOLYMER) { nonPolyChains.add(c); } else if (info.getType() == EntityType.WATER) { waterChains.add(c); } else if (info.getType() == EntityType.MACROLIDE) { logger.warn("Chain with asym id (author id {}) has entity type 'macrolide', considering it non-polymeric", c.getId(), c.getName()); nonPolyChains.add(c); } else { logger.warn("Chain with asym id (author id {}) has unsupported entity type '{}'. Will not add it to the Structure.", c.getId(), c.getName(), info.getType().toString()); } }
Source:
private static void fireOnCommit(final NodeProvisioner.PlannedNode plannedNode, final Node newNode) { for (CloudProvisioningListener cl : CloudProvisioningListener.all()) { try { cl.onCommit(plannedNode, newNode); } catch (Throwable e) { LOGGER.log(Level.SEVERE, "Unexpected uncaught exception encountered while " + "processing onCommit() listener call in " + cl + " for agent " + plannedNode.displayName, e); } } }

Target:
private static void fireOnCommit(final NodeProvisioner.PlannedNode plannedNode, final Node newNode) { for (CloudProvisioningListener cl : CloudProvisioningListener.all()) { try { cl.onCommit(plannedNode, newNode); } catch (Error e) { throw e; } catch (Throwable e) { LOGGER.log(Level.SEVERE, "Unexpected uncaught exception encountered while " + "processing onCommit() listener call in " + cl + " for agent " + newNode.getDisplayName(), e); } } }
Source:
public SchedulePage createMeeting(String organizer, String subject, int minutesFrom, int minutesTo, String attendee, String password) { String startTime = TimeManager.getTime(minutesFrom, "hh:mm a"); String endTime = TimeManager.getTime(minutesTo, "hh:mm a"); setOrganizerTxtBox(organizer); setSubjectTxtBox(subject); setStartTimeDate(startTime); setEndTimeDate(endTime); setAttendeeTxtBox(attendee); clickCreateBtn(); confirmCredentials(password); return waitForMaskDisappears(); }

Target:
public SchedulePage createMeeting(String organizer, String subject, int minutesFrom, int minutesTo, String attendee, String password) { String startTime = TimeManager.getTime(minutesFrom, "hh:mm a"); String endTime = TimeManager.getTime(minutesTo, "hh:mm a"); setOrganizerTxtBox(organizer); setSubjectTxtBox(subject); setStartTimeDate(startTime); setEndTimeDate(endTime); setAttendeeTxtBox(attendee); clickCreateBtn(); confirmCredentials(password); isMessageMeetingCreatedDisplayed(); return this; }
Source:
AdHocCompilerCache(int maxLiteralEntries, int maxCoreEntries) { MAX_LITERAL_ENTRIES = maxLiteralEntries; MAX_CORE_ENTRIES = maxCoreEntries; m_literalCache = new MemoryBoundedLinkedHashMap<String, AdHocPlannedStatement>(MAX_LITERAL_ENTRIES, MAX_LITERAL_MEM); m_coreCache = new LinkedHashMap<String, List<BoundPlan> >(MAX_CORE_ENTRIES * 2, .75f, true) { private static final long serialVersionUID = 1L; @Override public boolean removeEldestEntry(Map.Entry<String, List<BoundPlan> > eldest) { if (size() > MAX_CORE_ENTRIES) { ++m_planEvictions; return true; } return false; } }; }

Target:
AdHocCompilerCache(int maxLiteralEntries, int maxCoreEntries) { MAX_LITERAL_ENTRIES = maxLiteralEntries; MAX_CORE_ENTRIES = maxCoreEntries; m_literalCache = new AdHocStatementCache(MAX_LITERAL_ENTRIES, MAX_LITERAL_MEM); m_coreCache = new LinkedHashMap<String, List<BoundPlan> >(MAX_CORE_ENTRIES * 2, .75f, true) { private static final long serialVersionUID = 1L; @Override public boolean removeEldestEntry(Map.Entry<String, List<BoundPlan> > eldest) { if (size() > MAX_CORE_ENTRIES) { ++m_planEvictions; return true; } return false; } }; }
Source:
public static Document openXmlFromZip(File zipFile, String xmlFile) throws IOException, ZipException { XMLParser parser = new XMLParser(); ZipUnArchiver zip = new ZipUnArchiver(zipFile); TemporaryFolder zipFolder = new TemporaryFolder(); zipFolder.create(); try { zip.extract(xmlFile, zipFolder.getRoot()); return parser.parse(new XMLIOSource(new File(zipFolder.getRoot(), xmlFile))); } finally { zipFolder.delete(); } }

Target:
public static Document openXmlFromZip(File zipFile, String xmlFile) throws IOException, ZipException { XMLParser parser = new XMLParser(); ZipFile zip = new ZipFile(zipFile); try { ZipEntry entry = zip.getEntry(xmlFile); return parser.parse(new XMLIOSource(zip.getInputStream(entry))); } finally { zip.close(); } }
Source:
public void sanity() { profile.define(context); Map<String, BuiltInActiveRule> activeRules = getActiveRulesByRuleKey(context); assertThat(activeRules.size()).isEqualTo(3); assertThat(activeRules.keySet()).contains("HTL-0"); assertThat(activeRules.keySet()).contains("HTL-3"); }

Target:
public void sanity() { profile.define(context); Map<String, BuiltInActiveRule> activeRules = getActiveRulesByRuleKey(context); assertThat(activeRules.size()).isEqualTo(4); assertThat(activeRules.keySet()).contains("HTL-0"); assertThat(activeRules.keySet()).contains("HTL-1"); assertThat(activeRules.keySet()).contains("HTL-6"); }
Source:
public String getCommandName() { return s_name; }

Target:
public String getCommandName() { return APINAME.toLowerCase() + BaseAsyncCmd.RESPONSE_SUFFIX; }
Source:
public void parseOneFile( Project project, ProjectMetadata metadata, ImportingJob job, String fileSource, Reader reader, int limit, JSONObject options, List<Exception> exceptions ) { String sep = JSONUtilities.getString(options, "separator", "\\t"); if (sep == null || "".equals(sep)) { sep = "\\t"; } sep = StringEscapeUtils.unescapeJava(sep); boolean processQuotes = JSONUtilities.getBoolean(options, "processQuotes", true); boolean strictQuotes = JSONUtilities.getBoolean(options, "strictQuotes", false); Character quote = CSVParser.DEFAULT_QUOTE_CHARACTER; String quoteCharacter = JSONUtilities.getString(options, "quoteCharacter", null); if (!StringUtils.isBlank(quoteCharacter)) { quote = quoteCharacter.charAt(0); } final CSVParser parser = new CSVParser( sep, quote, (char) 0, strictQuotes, CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE, !processQuotes); final LineNumberReader lnReader = new LineNumberReader(reader); TableDataReader dataReader = new TableDataReader() { @Override public List<Object> getNextRowOfCells() throws IOException { String line = lnReader.readLine(); if (line == null) { return null; } else { return getCells(line, parser, lnReader); } } }; TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, lnReader, limit, options, exceptions); }

Target:
public void parseOneFile( Project project, ProjectMetadata metadata, ImportingJob job, String fileSource, Reader reader, int limit, JSONObject options, List<Exception> exceptions ) { String sep = JSONUtilities.getString(options, "separator", "\\t"); if (sep == null || "".equals(sep)) { sep = "\\t"; } sep = StringEscapeUtils.unescapeJava(sep); boolean processQuotes = JSONUtilities.getBoolean(options, "processQuotes", true); boolean strictQuotes = JSONUtilities.getBoolean(options, "strictQuotes", false); Character quote = CSVParser.DEFAULT_QUOTE_CHARACTER; String quoteCharacter = JSONUtilities.getString(options, "quoteCharacter", null); if (quoteCharacter != null && quoteCharacter.trim().length() == 1) { quote = quoteCharacter.trim().charAt(0); } final CSVParser parser = new CSVParser( sep, quote, (char) 0, strictQuotes, CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE, !processQuotes); final LineNumberReader lnReader = new LineNumberReader(reader); TableDataReader dataReader = new TableDataReader() { @Override public List<Object> getNextRowOfCells() throws IOException { String line = lnReader.readLine(); if (line == null) { return null; } else { return getCells(line, parser, lnReader); } } }; TabularImportingParserBase.readTable(project, metadata, job, dataReader, fileSource, limit, options, exceptions); super.parseOneFile(project, metadata, job, fileSource, lnReader, limit, options, exceptions); }
Source:
public static String getCompanyName(User user) { String result = null; if (user != null && user.company != null && user.company.trim().length() > 0) { result = user.company.trim(); } return result ; }

Target:
public static String getCompanyName(User user) { String result = ""; if (user != null && user.company != null && user.company.trim().length() > 0) { result = user.company.trim(); } return result ; }
Source:
public void testTcpGateways() { TestingUtilities.waitListening(this.server1, null); this.client1.setPort(this.server1.getPort()); IntegrationFlow flow = f -> f .handle(Tcp.outboundGateway(this.client1)) .transform(Transformers.objectToString()); IntegrationFlowRegistration theFlow = this.flowContext.registration(flow).register(); assertThat(theFlow.getMessagingTemplate().convertSendAndReceive("foo", String.class), equalTo("FOO")); }

Target:
public void testTcpGateways() { TestingUtilities.waitListening(this.server1, null); IntegrationFlow flow = f -> f .handle(Tcp.outboundGateway(Tcp.netClient("localhost", this.server1.getPort()) .serializer(TcpCodecs.crlf()) .deserializer(TcpCodecs.lengthHeader1()) .id("client1")) .remoteTimeout(m -> 5000)) .transform(Transformers.objectToString()); IntegrationFlowRegistration theFlow = this.flowContext.registration(flow).register(); assertThat(theFlow.getMessagingTemplate().convertSendAndReceive("foo", String.class), equalTo("FOO")); }
Source:
public void testAddPotentialOwnersToNonExistentTask() { processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument"); assertNotNull(processInstanceId); List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter()); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); userTaskService.release(task.getId(), "salaboy"); userTaskAdminService.addPotentialOwners(15456, false, factory.newUser("john")); }

Target:
public void testAddPotentialOwnersToNonExistentTask() { processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument"); Assertions.assertThat(processInstanceId).isNotNull(); List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter()); Assertions.assertThat(tasks).hasSize(1); TaskSummary task = tasks.get(0); userTaskService.release(task.getId(), "salaboy"); Assertions.assertThatThrownBy( () -> userTaskAdminService.addPotentialOwners(15456, false, factory.newUser("john"))) .hasMessageContaining("Task with id 15456 not found"); }
Source:
public List<Location> getLocation(@NotNull String protocolId, @NotNull String locationData, @NotNull final Project project) { if (!PROTOCOL.equals(protocolId)) { return Collections.emptyList(); } List<Location> locations = ContainerUtil.newArrayList(); String[] locationDataItems = locationData.split("\\."); if (locationDataItems.length == 1) { Collection<GoFunctionDeclaration> goFunctionDeclarations = GoFunctionIndex.find( locationData, project, GlobalSearchScope.projectScope(project)); for (GoFunctionDeclaration goFunctionDeclaration : goFunctionDeclarations) { Location<GoFunctionDeclaration> functionLocation = PsiLocation.fromPsiElement(project, goFunctionDeclaration); if (functionLocation == null) { continue; } locations.add(functionLocation); } return locations; } if (locationDataItems.length == 2) { Collection<GoTypeSpec> goTypeSpecs = GoTypesIndex.find( locationDataItems[0], project, GlobalSearchScope.projectScope(project)); for (GoTypeSpec goTypeSpec : goTypeSpecs) { Location<GoTypeSpec> typeLocation = PsiLocation.fromPsiElement(project, goTypeSpec); if (typeLocation == null) { continue; } for (GoMethodDeclaration method : typeLocation.getPsiElement().getMethods()) { if (locationDataItems[1].equals(method.getName())) { Location<GoMethodDeclaration> methodLocation = PsiLocation.fromPsiElement(method); if (methodLocation == null) { continue; } locations.add(methodLocation); } } } return locations; } throw new RuntimeException("Unsupported location: " + locationData); }

Target:
public List<Location> getLocation(@NotNull String protocolId, @NotNull String locationData, @NotNull final Project project) { if (!PROTOCOL.equals(protocolId)) { return Collections.emptyList(); } List<Location> locations = ContainerUtil.newArrayList(); String[] locationDataItems = locationData.split("\\."); if (locationDataItems.length == 1) { Collection<GoFunctionDeclaration> goFunctionDeclarations = GoFunctionIndex.find( locationData, project, GlobalSearchScope.projectScope(project)); for (GoFunctionDeclaration goFunctionDeclaration : goFunctionDeclarations) { Location<GoFunctionDeclaration> functionLocation = PsiLocation.fromPsiElement(project, goFunctionDeclaration); ContainerUtil.addIfNotNull(locations, functionLocation); } return locations; } if (locationDataItems.length == 2) { Collection<GoTypeSpec> goTypeSpecs = GoTypesIndex.find( locationDataItems[0], project, GlobalSearchScope.projectScope(project)); for (GoTypeSpec goTypeSpec : goTypeSpecs) { for (GoMethodDeclaration method : goTypeSpec.getMethods()) { if (locationDataItems[1].equals(method.getName())) { Location<GoMethodDeclaration> methodLocation = PsiLocation.fromPsiElement(method); ContainerUtil.addIfNotNull(locations, methodLocation); } } } return locations; } throw new RuntimeException("Unsupported location: " + locationData); }
Source:
private static void insertFromJson(Session session) { User alice = new User("alice", 30); User bob = new User("bob", 35); ObjectNode aliceScores = JsonNodeFactory.instance.objectNode() .put("call_of_duty", 4.8) .put("pockemon_go", 9.7); ObjectNode bobScores = JsonNodeFactory.instance.objectNode() .put("zelda", 8.3) .put("pockemon_go", 12.4); Statement stmt = insertInto("examples", "json_jackson_function") .value("id", 1) .value("user", fromJson(alice)) .value("scores", fromJson(aliceScores)); session.execute(stmt); PreparedStatement pst = session.prepare( insertInto("examples", "json_jackson_function") .value("id", bindMarker("id")) .value("user", fromJson(bindMarker("user"))) .value("scores", fromJson(bindMarker("scores")))); session.execute(pst.bind() .setInt("id", 2) .set("user", bob, User.class) .set("scores", bobScores, JsonNode.class)); }

Target:
private static void insertFromJson(Session session) { User alice = new User("alice", 30); User bob = new User("bob", 35); ObjectNode aliceScores = JsonNodeFactory.instance.objectNode() .put("call_of_duty", 4.8) .put("pokemon_go", 9.7); ObjectNode bobScores = JsonNodeFactory.instance.objectNode() .put("zelda", 8.3) .put("pokemon_go", 12.4); Statement stmt = insertInto("examples", "json_jackson_function") .value("id", 1) .value("user", fromJson(alice)) .value("scores", fromJson(aliceScores)); session.execute(stmt); PreparedStatement pst = session.prepare( insertInto("examples", "json_jackson_function") .value("id", bindMarker("id")) .value("user", fromJson(bindMarker("user"))) .value("scores", fromJson(bindMarker("scores")))); session.execute(pst.bind() .setInt("id", 2) .set("user", bob, User.class) .set("scores", bobScores, JsonNode.class)); }
Source:
public AddVdsVDSCommand(P parameters) { super(parameters, false); }

Target:
public AddVdsVDSCommand(P parameters) { super(parameters, true); }
Source:
public static MambuAPIServiceFactory getFactory(Protocol protocol, String domain, String username, String password) { Injector injector = Guice.createInjector(new MambuAPIModule(protocol, domain, username, password, "Mambu SDKv1.0")); return new MambuAPIServiceFactory(injector); }

Target:
public static MambuAPIServiceFactory getFactory(Protocol protocol, String domain, String username, String password) { Injector injector = Guice.createInjector(new MambuAPIModule(protocol, domain, username, password, DEFAULT_USER_AGENT_HEADER_VALUE)); return new MambuAPIServiceFactory(injector); }
Source:
public String getId() { return "itemcategory-uncategorized"; }

Target:
public String getId() { return ID; }
Source:
public void testResponseExceptionMapper() throws Exception { ExceptionMappingClient client = new CxfTypeSafeClientBuilder() .register(NotFoundExceptionMapper.class) .register(NotFoundClientReqFilter.class) .baseUrl(new URL("http://localhost/null")) .build(ExceptionMappingClient.class); Response r = client.getEntity(); System.out.println(r.getStatus()); fail("Did not throw expected mapped exception: NoSuchEntityException"); }

Target:
public void testResponseExceptionMapper() throws Exception { ExceptionMappingClient client = new CxfTypeSafeClientBuilder() .register(NotFoundExceptionMapper.class) .register(NotFoundClientReqFilter.class) .baseUrl(new URL("http://localhost/null")) .build(ExceptionMappingClient.class); Response r = client.getEntity(); fail(r, "Did not throw expected mapped exception: NoSuchEntityException"); }
Source:
public byte[] request(FContext context, boolean oneway, byte[] payload) throws TTransportException { if (oneway) { flush(payload); return null; } BlockingQueue<byte[]> queue = new ArrayBlockingQueue<>(1); lock.lock(); if (queueMap.containsKey(context.getOpId())) { lock.unlock(); throw new TTransportException("request already in flight for context"); } queueMap.put(context.getOpId(), queue); lock.unlock(); try { flush(payload); byte[] response; try { response = queue.poll(context.getTimeout(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new TTransportException("request: interrupted"); } if (response == null) { throw new TTransportException(TTransportException.TIMED_OUT, "request: timed out"); } if (response == POISON_PILL) { throw new TTransportException(TTransportException.NOT_OPEN, "request: transport closed, request canceled"); } return response; } finally { lock.lock(); queueMap.remove(context.getOpId()); lock.unlock(); } }

Target:
public TTransport request(FContext context, boolean oneway, byte[] payload) throws TTransportException { if (oneway) { flush(payload); return null; } BlockingQueue<byte[]> queue = new ArrayBlockingQueue<>(1); synchronized (this) { if (queueMap.containsKey(getOpId(context))) { throw new TTransportException("request already in flight for context"); } queueMap.put(getOpId(context), queue); } try { flush(payload); byte[] response; try { response = queue.poll(context.getTimeout(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new TTransportException("request: interrupted"); } if (response == null) { throw new TTransportException(TTransportException.TIMED_OUT, "request: timed out"); } if (response == POISON_PILL) { throw new TTransportException(TTransportException.NOT_OPEN, "request: transport closed, request canceled"); } return new TMemoryInputTransport(response); } finally { synchronized (this) { queueMap.remove(getOpId(context)); } } }
Source:
default boolean getBooleanValue(JsonObject jsonObject) throws DataException { try { return jsonObject.getBoolean(this.toString()); } catch (RuntimeException e) { throw new DataException("Not possible to retrieve boolean value for key " + this.toString() + ". Exception: " + e.getMessage()); } }

Target:
default boolean getBooleanValue(JsonObject jsonObject) throws DataException { try { return jsonObject.getBoolean(this.toString()); } catch (ClassCastException | NullPointerException e) { throw new DataException("Not possible to retrieve boolean value for key " + this.toString() + ". Exception: " + e.getMessage()); } }
Source:
public Map<Object, Object> instantiate(Target<?> target, Parameters parameters) { List<br.com.caelum.iogi.parameters.Parameter> params = parameters.forTarget(target); if (params.isEmpty()) { return emptyMap(); } String key = getParameterKey(params); if (params.get(0).isDecorated()) { List<Object> values = new ArrayList<>(); for (Parameter value : params) { values.add(value.getValue()); } return createSingletonMap(key, values); } return createSingletonMap(key, params.get(0).getValue()); }

Target:
public Map<Object, Object> instantiate(Target<?> target, Parameters parameters) { List<Parameter> params = parameters.forTarget(target); if (params.isEmpty()) { return emptyMap(); } String key = getParameterKey(params); if (params.get(0).isDecorated()) { List<Object> values = new ArrayList<>(); for (Parameter value : params) { values.add(value.getValue()); } return createSingletonMap(key, values); } return createSingletonMap(key, params.get(0).getValue()); }