auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static double[] smudgeNoise(final double[] values, final double mean, final double stdDev, final int noiseLengthTolerance) { double[] noiseFreeValues = new double[values.length]; if (isNoise(values[0], mean, stdDev)) { noiseFreeValues[0] = mean; } else { noiseFreeValues[0] = values[0]; } for (int i = 1; i < values.length - noiseLengthTolerance; i++) { noiseFreeValues[i] = values[i]; if (!isNoise(values[i], mean, stdDev)) { noiseFreeValues[i] = values[i]; continue; } LOGGER.info("index {}: value is noise",i, values[i]); for (int j = 1; j <= noiseLengthTolerance; j++) { if (isNoise(values[i + j], mean, stdDev)) { continue; } double averageSurroundingValues = (noiseFreeValues[i - 1] + values[i + j]) / 2; int n = 0; while (isNoise(averageSurroundingValues, mean, stdDev) & n <= 5) { n++; averageSurroundingValues = 0.75 * averageSurroundingValues + 0.25 * mean; } noiseFreeValues[i] = averageSurroundingValues; } } for (int k = values.length - noiseLengthTolerance; k < values.length; k++) { if (isNoise(values[k], mean, stdDev)) { noiseFreeValues[k] = (noiseFreeValues[k - 2] + noiseFreeValues[k - 1]) / 2; } else { noiseFreeValues[k] = values[k]; } } return noiseFreeValues; }

Target:
public static double[] smudgeNoise(final double[] values, final double mean, final double stdDev, final int noiseLengthTolerance) { double[] noiseFreeValues = new double[values.length]; if (isNoise(values[0], mean, stdDev)) { noiseFreeValues[0] = mean; } else { noiseFreeValues[0] = values[0]; } for (int i = 1; i < values.length - noiseLengthTolerance; i++) { noiseFreeValues[i] = values[i]; if (!isNoise(values[i], mean, stdDev)) { noiseFreeValues[i] = values[i]; continue; } for (int j = 1; j <= noiseLengthTolerance; j++) { if (isNoise(values[i + j], mean, stdDev)) { continue; } double averageSurroundingValues = (noiseFreeValues[i - 1] + values[i + j]) / 2; int n = 0; while (isNoise(averageSurroundingValues, mean, stdDev) & n <= MAXIMUM_NOISE_CORRECTIONS) { n++; averageSurroundingValues = 0.75 * averageSurroundingValues + 0.25 * mean; } noiseFreeValues[i] = averageSurroundingValues; } } for (int k = values.length - noiseLengthTolerance; k < values.length; k++) { if (isNoise(values[k], mean, stdDev)) { noiseFreeValues[k] = (noiseFreeValues[k - 2] + noiseFreeValues[k - 1]) / 2; } else { noiseFreeValues[k] = values[k]; } } return noiseFreeValues; }
Source:
public void addToOrderBook(Order order) { if (order.isOrderType() == 1){ ArrayList<Order> tempList = sellOrders.get(order.getStockSymbol()); tempList.add(order); sellOrders.put(order.getStockSymbol(), tempList); } else if (order.isOrderType() == 2){ ArrayList<Order> tempList = buyOrders.get(order.getStockSymbol()); tempList.add(order); buyOrders.put(order.getStockSymbol(), tempList); } }

Target:
public void addToOrderBook(Order order) { if (order.isOrderType() == 1){ ArrayList<Order> tempOrders = sellOrders.get(order.getStockSymbol()); tempOrders.add(order); sellOrders.put(order.getStockSymbol(), tempOrders); } else if (order.isOrderType() == 2){ ArrayList<Order> tempOrders = buyOrders.get(order.getStockSymbol()); tempOrders.add(order); buyOrders.put(order.getStockSymbol(), tempOrders); } }
Source:
void sendMessagesListExceedSize() { final int count = 4; final Mono<Integer> linkMaxSize = Mono.just(1); final byte[] contents = TEST_CONTENTS.getBytes(UTF_8); final ServiceBusMessage[] messages = new ServiceBusMessage[count]; IntStream.range(0, count).forEach(index -> { messages[index] = new ServiceBusMessage(contents).setMessageId(UUID.randomUUID().toString()); }); when(connection.createSendLink(eq(ENTITY_NAME), eq(ENTITY_NAME), eq(retryOptions))) .thenReturn(Mono.just(sendLink)); when(sendLink.getLinkSize()).thenReturn(linkMaxSize); StepVerifier.create(sender.send(messages)) .verifyErrorMatches(error -> error instanceof AmqpException && ((AmqpException) error).getErrorCondition() == AmqpErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED); verify(sendLink, times(0)).send(anyList()); }

Target:
void sendMessagesListExceedSize() { final int count = 4; final Mono<Integer> linkMaxSize = Mono.just(1); final List<ServiceBusMessage> messages = TestUtils.getServiceBusMessages(count, UUID.randomUUID().toString()); when(connection.createSendLink(eq(ENTITY_NAME), eq(ENTITY_NAME), eq(retryOptions))) .thenReturn(Mono.just(sendLink)); when(sendLink.getLinkSize()).thenReturn(linkMaxSize); StepVerifier.create(sender.send(messages)) .verifyErrorMatches(error -> error instanceof AmqpException && ((AmqpException) error).getErrorCondition() == AmqpErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED); verify(sendLink, never()).send(anyList()); }
Source:
public ApiException(String code, String info) { super(info); this.code = code; this.info = info; }

Target:
public ApiException(String code, String info) { super(); this.code = code; this.info = info; }
Source:
public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final String id = "" + requestIdGenerator.incrementAndGet(); final long startTimestamp = System.currentTimeMillis(); final MetricSphereRequest<T> metricSphereRequest = new MetricSphereRequest<>(sphereRequest, id, metricObservable); final CompletionStage<T> completionStage = super.execute(metricSphereRequest); completionStage.whenComplete((nullableResult, nullableThrowable) -> { final long stopTimestamp = System.currentTimeMillis(); if (nullableThrowable == null) { final long duration = stopTimestamp - startTimestamp; metricObservable.notifyObservers(ObservedTotalDuration.of(duration, id, sphereRequest)); } }); return completionStage; }

Target:
public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final String id = "" + requestIdGenerator.incrementAndGet(); final long startTimestamp = System.currentTimeMillis(); final MetricSphereRequest<T> metricSphereRequest = new MetricSphereRequest<>(sphereRequest, id, metricObservable); final CompletionStage<T> completionStage = super.execute(metricSphereRequest); completionStage.whenComplete((nullableResult, nullableThrowable) -> { final long stopTimestamp = System.currentTimeMillis(); final long duration = stopTimestamp - startTimestamp; metricObservable.notifyObservers(ObservedTotalDuration.of(duration, id, sphereRequest, metricSphereRequest.getCorrelationId())); }); return completionStage; }
Source:
public void applyTextEdit(TextEditActivity edit) { content.delete(edit.getOffset(), edit.getReplacedText().length()); content.insert(edit.getOffset(), edit.getText()); }

Target:
public void applyTextEdit(TextEditActivity edit) { if (edit.getReplacedText().length() > 0) { content.delete(edit.getOffset(), edit.getReplacedText().length()); } if (edit.getText().length() > 0) { content.insert(edit.getOffset(), edit.getText()); } }
Source:
public Randomizer<?> getRandomizer(Field field) { EnhancedRandom enhancedRandom = EnhancedRandomBuilder.aNewEnhancedRandomBuilder() .seed(seed) .dateRange(LocalDate.now().minusYears(Constants.DEFAULT_DATE_RANGE), LocalDate.now()) .build(); return (() -> enhancedRandom.nextObject(field.getType())); }

Target:
public Randomizer<?> getRandomizer(Field field) { if (enhancedRandom == null) { enhancedRandom = EnhancedRandomBuilder.aNewEnhancedRandomBuilder() .seed(seed) .dateRange(LocalDate.now().minusYears(Constants.DEFAULT_DATE_RANGE), LocalDate.now()) .build(); } return () -> enhancedRandom.nextObject(field.getType()); }
Source:
public List<Surveillance> getAllPendingSurveillances() { List<PendingSurveillanceEntity> pendingResults = survDao.getAllPendingSurveillance(); List<Surveillance> results = new ArrayList<Surveillance>(); if (pendingResults != null) { for (PendingSurveillanceEntity pr : pendingResults) { Surveillance surv = convertToDomain(pr); results.add(surv); } } Iterator<Surveillance> iterator = results.iterator(); while (iterator.hasNext()) { if (!permissions.hasAccess( Permissions.PENDING_SURVEILLANCE, PendingSurveillanceDomainPermissions.GET_ALL, iterator.next())) { iterator.remove(); } } return results; }

Target:
public List<Surveillance> getAllPendingSurveillances() { List<PendingSurveillanceEntity> pendingResults = survDao.getAllPendingSurveillance(); List<Surveillance> results = new ArrayList<Surveillance>(); if (pendingResults != null) { for (PendingSurveillanceEntity pr : pendingResults) { Surveillance surv = convertToDomain(pr); results.add(surv); } } return results; }
Source:
public void copyTo(final TemplateOptions to) { super.copyTo(to); if (to instanceof AzureComputeTemplateOptions) { final AzureComputeTemplateOptions eTo = AzureComputeTemplateOptions.class.cast(to); eTo.addressSpaceAddressPrefix(addressSpaceAddressPrefix); eTo.subnetName(subnetName); eTo.subnetName(networkSecurityGroupName); eTo.subnetAddressPrefix(subnetAddressPrefix); eTo.storageAccountName(storageAccountName); eTo.storageAccountType(storageAccountType); eTo.reservedIPName(reservedIPName); } }

Target:
public void copyTo(final TemplateOptions to) { super.copyTo(to); if (to instanceof AzureComputeTemplateOptions) { final AzureComputeTemplateOptions eTo = AzureComputeTemplateOptions.class.cast(to); eTo.virtualNetworkName(virtualNetworkName); if (!subnetNames.isEmpty()) { eTo.subnetNames(subnetNames); } eTo.storageAccountName(storageAccountName); eTo.storageAccountType(storageAccountType); eTo.reservedIPName(reservedIPName); } }
Source:
protected Control createDialogArea(Composite parent) { super.createDialogArea(parent); Composite composite = (Composite) super.createDialogArea(parent); IRemoteServicesManager manager = TerminalViewPlugin.getService(IRemoteServicesManager.class); @SuppressWarnings("unchecked") List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting( IRemoteCommandShellService.class, IRemoteProcessService.class); remoteConnWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, connTypes); if (initialConnection != null) { remoteConnWidget.setConnection(initialConnection); } else if (initialId != null && initialName != null) { remoteConnWidget.setConnection(initialId, initialName); } remoteConnWidget.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { validateDialog(); } }); return composite; }

Target:
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout(2, false)); IRemoteServicesManager manager = TerminalViewPlugin.getService(IRemoteServicesManager.class); @SuppressWarnings("unchecked") List<IRemoteConnectionType> connTypes = manager.getConnectionTypesSupporting( IRemoteCommandShellService.class, IRemoteProcessService.class); remoteConnWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, connTypes); if (initialConnection != null) { remoteConnWidget.setConnection(initialConnection); } else if (initialId != null && initialName != null) { remoteConnWidget.setConnection(initialId, initialName); } GridData gd = new GridData(); gd.horizontalSpan = 2; remoteConnWidget.setLayoutData(gd); remoteConnWidget.addSelectionListener(new ValidationSelectionListener()); Label encodingLabel = new Label(composite, SWT.NONE); encodingLabel.setLayoutData(new GridData()); encodingLabel.setText(ConsoleMessages.ENCODING); encodingCombo = new Combo(composite, SWT.READ_ONLY); encodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); int i = 0; String hostEncoding = Charset.defaultCharset().name(); for (String encoding : getEncodings()) { encodingCombo.add(encoding); if (encoding.equals(hostEncoding)) { selectedEncoding = encoding; encodingCombo.select(i); } i++; } encodingCombo.addSelectionListener(new ValidationSelectionListener()); return composite; }
Source:
public void testCollisionInformation() throws IOException, InterruptedException { final String expectedMetadata = "1.0;94.0;5.0;143.0;25.0;119.0;35.0;150.0;73.0;138.0;92.0;150.0;100.0;118.0;" + "110.0;143.0;124.0;141.0;120.0;88.0;106.0;105.0;21.0;101.0;105.0;98.0;105.0;39.0;82.0;0.0;68.0;" + "29.0;52.0;0.0;38.0;17.0;7.0;19.0;27.0;31.0;22.0;95.0"; Project project = new Project(InstrumentationRegistry.getTargetContext(), "testProject"); final String filePath = project.getDefaultScene().getDirectory() + "/" + IMAGE_DIRECTORY_NAME + "/collision_donut.png"; Sprite sprite = new SingleSprite("testSprite"); project.getDefaultScene().addSprite(sprite); ProjectManager.getInstance().setProject(project); ProjectManager.getInstance().setCurrentSprite(sprite); XstreamSerializer.getInstance().saveProject(project); File imageFile = ResourceImporter.createImageFileFromResourcesInDirectory( InstrumentationRegistry.getContext().getResources(), org.catrobat.catroid.test.R.drawable.catroid_banzai, new File(project.getDefaultScene().getDirectory(), IMAGE_DIRECTORY_NAME), "collision_donut.png", 1); LookData lookData = new LookData("test", imageFile); sprite.getLookList().add(lookData); lookData.getCollisionInformation().loadOrCreateCollisionPolygon(); String metadata = ImageEditing.readMetaDataStringFromPNG(filePath, Constants.COLLISION_PNG_META_TAG_KEY); assertEquals(expectedMetadata, metadata); }

Target:
public void testCollisionInformation() throws IOException, InterruptedException { lookData.getCollisionInformation().loadOrCreateCollisionPolygon(); String metadata = ImageEditing.readMetaDataStringFromPNG(filePath, Constants.COLLISION_PNG_META_TAG_KEY); assertEquals(expectedMetadata, metadata); }
Source:
public List<EventLog> getEvents(Instant start, int count, Optional<EventLogCategory> category, Optional<EventLogLevel> level) { List<EventLog> events = new ArrayList<>(); ConcurrentMap<Address, Throwable> throwables = CollectionFactory.makeConcurrentMap(); try { cacheManager.executor().submitConsumer(m -> { Cache<Object, Object> cache = m.getCache(EVENT_LOG_CACHE); QueryFactory<Query> queryFactory = Search.getQueryFactory(cache); QueryBuilder query = queryFactory.from(ServerEventImpl.class).orderBy("when", SortOrder.DESC).maxResults(count); FilterConditionContext filter = query.having("when").lte(start); FilterConditionContext categoryFilter = category.map(c -> filter.and(queryFactory.having("category").eq(c))).orElse(filter); FilterConditionContext levelFilter = level.map(l -> categoryFilter.and(queryFactory.having("level").eq(l))).orElse(categoryFilter); List<EventLog> nodeEvents = levelFilter.toBuilder().build().list(); return nodeEvents; }, (address, nodeEvents, t) -> { if (t == null) { events.addAll(nodeEvents); } else { throwables.put(address, t); } }).get(10, TimeUnit.SECONDS); if (throwables.size() > 0) { throw new CacheException(throwables.values().iterator().next()); } } catch (Exception e) { log.debug("Could not retrieve events", e); throw new CacheException(e); } Collections.sort(events); return events.subList(0, Math.min(events.size(), count)); }

Target:
public List<EventLog> getEvents(Instant start, int count, Optional<EventLogCategory> category, Optional<EventLogLevel> level) { List<EventLog> events = new ArrayList<>(); AtomicReference<Throwable> throwable = new AtomicReference<>(); try { cacheManager.executor().submitConsumer(m -> { Cache<Object, Object> cache = m.getCache(EVENT_LOG_CACHE); QueryFactory<Query> queryFactory = Search.getQueryFactory(cache); QueryBuilder query = queryFactory.from(ServerEventImpl.class).orderBy("when", SortOrder.DESC).maxResults(count); FilterConditionContext filter = query.having("when").lte(start); category.map(c -> filter.and(queryFactory.having("category").eq(c))); level.map(l -> filter.and(queryFactory.having("level").eq(l))); List<EventLog> nodeEvents = filter.toBuilder().build().list(); return nodeEvents; }, (address, nodeEvents, t) -> { if (t == null) { events.addAll(nodeEvents); } else { throwable.set(t); } }).get(1, TimeUnit.MINUTES); if (throwable.get() != null) { throw new CacheException(throwable.get()); } } catch (Exception e) { log.debug("Could not retrieve events", e); throw new CacheException(e); } Collections.sort(events); return events.subList(0, Math.min(events.size(), count)); }
Source:
protected void finalize() throws Throwable { close(); Files.deleteIfExists(tmpFile); }

Target:
protected void finalize() throws Throwable { closeAndDeleteTempFile(); }
Source:
public RecipeViewHolder(@NonNull Context context, @NonNull View itemView) { super(context, itemView); mRecipeTextView = (TextView) itemView.findViewById(R.id.recipe_textview); mArrowExpandImageView = (ImageView) itemView.findViewById(R.id.arrow_expand_imageview); }

Target:
public RecipeViewHolder(@NonNull Context context, @NonNull View itemView) { super(itemView); mRecipeTextView = (TextView) itemView.findViewById(R.id.recipe_textview); mArrowExpandImageView = (ImageView) itemView.findViewById(R.id.arrow_expand_imageview); }
Source:
public void obtainsAuthor() throws Exception { final Alias alias = new MkBase().randomAlias(); final Inbox inbox = alias.inbox(); final Bout bout = inbox.bout(inbox.start()); final Attachments attachments = bout.attachments(); final String name = "name"; attachments.create(name); final Attachment attachment = attachments.get(name); MatcherAssert.assertThat( attachment.author(), Matchers.equalTo(alias.name()) ); }

Target:
public void obtainsAuthor() throws Exception { final Alias alias = new MkBase().randomAlias(); final Inbox inbox = alias.inbox(); final Attachments attachments = inbox.bout(inbox.start()) .attachments(); final String name = "name"; attachments.create(name); final Attachment attachment = attachments.get(name); MatcherAssert.assertThat( attachment.author(), Matchers.equalTo(alias.name()) ); }
Source:
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { boolean retry = false; try { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data) : null; switch (response.getStatusCode()) { case 500: case 503: retry = super.shouldRetryRequest(command, response); break; default: break; } } finally { releasePayload(response); } return retry; }

Target:
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { boolean retry = false; try { byte[] data = closeClientButKeepContentStream(response); switch (response.getStatusCode()) { case 500: case 503: retry = super.shouldRetryRequest(command, response); break; default: break; } } finally { releasePayload(response); } return retry; }
Source:
public static String decode(String s, boolean tolerant) throws URLEncodedFormatException { if (s.length() == 0) return ""; int len = s.length(); ByteArrayOutputStream decodedBytes = new ByteArrayOutputStream(); boolean hasDecodedSomething = false; for (int i = 0; i < len; i++) { char c = s.charAt(i); if (c == '%') { if (i >= len - 2) { throw new URLEncodedFormatException(s); } char[] hexChars = new char[2]; hexChars[0] = s.charAt(++i); hexChars[1] = s.charAt(++i); String hexval = new String(hexChars); try { long read = Fields.hexToLong(hexval); if (read == 0) throw new URLEncodedFormatException("Can't encode" + " 00"); decodedBytes.write((int) read); hasDecodedSomething = true; } catch (NumberFormatException nfe) { if(tolerant && !hasDecodedSomething) { try { byte[] buf = ('%'+hexval).getBytes("UTF-8"); decodedBytes.write(buf, 0, buf.length); continue; } catch (UnsupportedEncodingException e) { throw new Error("Impossible: JVM doesn't support UTF-8: " + e, e); } } throw new URLEncodedFormatException("Not a two character hex % escape: "+hexval+" in "+s); } } else { try { byte[] encoded = (String.valueOf(c)).getBytes("UTF-8"); decodedBytes.write(encoded, 0, encoded.length); } catch (UnsupportedEncodingException e) { throw new Error("Impossible: JVM doesn't support UTF-8: " + e, e); } } } try { decodedBytes.close(); return new String(decodedBytes.toByteArray(), "utf-8"); } catch (IOException ioe1) { } throw new URLEncodedFormatException(s); }

Target:
public static String decode(String s, boolean tolerant) throws URLEncodedFormatException { if (s.length() == 0) return ""; int len = s.length(); ByteArrayOutputStream decodedBytes = new ByteArrayOutputStream(); boolean hasDecodedSomething = false; for (int i = 0; i < len; i++) { char c = s.charAt(i); if (c == '%') { if (i >= len - 2) { throw new URLEncodedFormatException(s); } char[] hexChars = new char[2]; hexChars[0] = s.charAt(++i); hexChars[1] = s.charAt(++i); String hexval = new String(hexChars); try { long read = Fields.hexToLong(hexval); if (read == 0) throw new URLEncodedFormatException("Can't encode" + " 00"); decodedBytes.write((int) read); hasDecodedSomething = true; } catch (NumberFormatException nfe) { if(tolerant && !hasDecodedSomething) { try { byte[] buf = ('%'+hexval).getBytes("UTF-8"); decodedBytes.write(buf, 0, buf.length); continue; } catch (UnsupportedEncodingException e) { throw new Error("Impossible: JVM doesn't support UTF-8: " + e, e); } } throw new URLEncodedFormatException("Not a two character hex % escape: "+hexval+" in "+s); } } else { try { byte[] encoded = String.valueOf(c).getBytes("UTF-8"); decodedBytes.write(encoded, 0, encoded.length); } catch (UnsupportedEncodingException e) { throw new Error("Impossible: JVM doesn't support UTF-8: " + e, e); } } } try { decodedBytes.close(); return new String(decodedBytes.toByteArray(), "utf-8"); } catch (IOException ioe1) { } throw new URLEncodedFormatException(s); }
Source:
public static synchronized void install() { if (hasBeenInstalled) { return; } try { AgentLoader.loadAgentClass(Http2Agent.class.getName(), ""); hasBeenInstalled = true; } catch (Exception e) { logger.error("Unable to dynamically install jetty-alpn-agent via ea-agent-loader, proceeding anyway...", e); } }

Target:
public static synchronized void install() { if (hasBeenInstalled) { return; } try { AgentLoader.loadAgentClass(Http2Agent.class.getName(), ""); hasBeenInstalled = true; } catch (Exception e) { log.warn("Unable to dynamically install jetty-alpn-agent via ea-agent-loader, proceeding anyway...", e); } }
Source:
private void setDefaultLibraryCategoryIcons(List<ShortcutCategoryDTO> categories) { Platform.runLater(() -> { try { StringBuilder cssBuilder = new StringBuilder(); for (ShortcutCategoryDTO category : categories) { cssBuilder.append("#" + LibrarySidebarToggleGroupSkin.getToggleButtonId(category.getId()) + "{\n"); URI categoryIcon = category.getIcon(); if (categoryIcon == null) { cssBuilder .append("-fx-background-image: url('/org/phoenicis/javafx/views/common/phoenicis.png');\n"); } else { cssBuilder.append("-fx-background-image: url('" + categoryIcon + "');\n"); } cssBuilder.append("}\n"); } String css = cssBuilder.toString(); Path temp = Files.createTempFile("defaultLibraryCategoryIcons", ".css").toAbsolutePath(); File tempFile = temp.toFile(); tempFile.deleteOnExit(); Files.write(temp, css.getBytes()); String defaultLibraryCategoryIconsCss = temp.toUri().toString(); this.themeManager.setDefaultLibraryCategoryIconsCss(defaultLibraryCategoryIconsCss); } catch (IOException e) { LOGGER.warn("Could not set default category icons.", e); } }); }

Target:
private void setDefaultLibraryCategoryIcons(List<ShortcutCategoryDTO> categories) { Platform.runLater(() -> { try { StringBuilder cssBuilder = new StringBuilder(); for (ShortcutCategoryDTO category : categories) { cssBuilder.append("#" + LibrarySidebarToggleGroupSkin.getToggleButtonId(category.getId()) + "{\n"); final String categoryIconPath = Optional.ofNullable(category.getIcon()) .map(categoryIcon -> categoryIcon.toString()) .orElse("/org/phoenicis/javafx/views/common/phoenicis.png"); cssBuilder.append(String.format("-fx-background-image: url('%s');\n", categoryIconPath)); cssBuilder.append("}\n"); } String css = cssBuilder.toString(); Path temp = Files.createTempFile("defaultLibraryCategoryIcons", ".css").toAbsolutePath(); File tempFile = temp.toFile(); tempFile.deleteOnExit(); Files.write(temp, css.getBytes()); String defaultLibraryCategoryIconsCss = temp.toUri().toString(); this.themeManager.setDefaultLibraryCategoryIconsCss(defaultLibraryCategoryIconsCss); } catch (IOException e) { LOGGER.warn("Could not set default category icons.", e); } }); }
Source:
private void processPayoutNotification(StripeNotification notification) { logger.info("Processing payout created notification with id for connect account [{}]", PAYMENT_GATEWAY_NAME, notification.getId(), notification.getAccount()); try { StripePayout stripePayout = toPayout(notification.getObject()); StripeNotificationType stripeNotificationType = byType(notification.getType()); if (PAYOUT_CREATED.equals(stripeNotificationType)) { Payout payout = new Payout(stripePayout.getId(), notification.getAccount(), stripePayout.getCreated()); sendToPayoutReconcileQueue(notification.getAccount(), payout); } payoutEmitterService.emitPayoutEvent(stripeNotificationType.getEventClass(), notification.getAccount(), stripePayout); } catch (StripeParseException e) { logger.error("{} payout notification parsing failed for connect account [{}]: {}", PAYMENT_GATEWAY_NAME, notification.getAccount(), e); } }

Target:
private void processPayoutNotification(StripeNotification notification) { logger.info("Processing payout created notification with id for connect account [{}]", PAYMENT_GATEWAY_NAME, notification.getId(), notification.getAccount()); try { StripePayout stripePayout = toPayout(notification.getObject()); StripeNotificationType stripeNotificationType = byType(notification.getType()); if (PAYOUT_CREATED.equals(stripeNotificationType)) { Payout payout = new Payout(stripePayout.getId(), notification.getAccount(), stripePayout.getCreated()); sendToPayoutReconcileQueue(notification.getAccount(), payout); } Optional<Class<? extends PayoutEvent>> mayBeEventClass = stripeNotificationType.getEventClass(); if (mayBeEventClass.isEmpty()) { logger.warn("Event class is not assigned for Stripe payout type - payout [{}]", notification.getType(), stripePayout.getId()); } else { payoutEmitterService.emitPayoutEvent(mayBeEventClass.get(), notification.getAccount(), stripePayout); } } catch (StripeParseException e) { logger.error("{} payout notification parsing failed for connect account [{}]: {}", PAYMENT_GATEWAY_NAME, notification.getAccount(), e); } }
Source:
void prepareValues() { if (constraintValue() == BaseSingleFieldConstraint.TYPE_PREDICATE) { editingCol().setOperator(null); } if (!(tableFormat() == GuidedDecisionTable52.TableFormat.LIMITED_ENTRY || constraintValue() == BaseSingleFieldConstraint.TYPE_LITERAL)) { editingCol().setBinding(null); } }

Target:
void prepareValues() { if (constraintValue() == BaseSingleFieldConstraint.TYPE_PREDICATE) { editingCol().setOperator(null); } if (!isBindable()) { editingCol().setBinding(null); } }
Source:
public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters()); Guid currentChildId = getCurrentChildId(getParameters()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Command: '{}' id: '{}' executing step: '{}'", getActionType(), getCommandId(), getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: break; case MERGE: break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; } persistCommandIfNeeded(); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }

Target:
public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters()); Guid currentChildId = getCurrentChildId(getParameters()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Command '{}' id '{}' executing step '{}'", getActionType(), getCommandId(), getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: break; case MERGE: break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; } persistCommandIfNeeded(); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sdkapp_main); if (getIntent().getExtras() != null && getIntent().getExtras().containsKey("session")) { SessionUtils.setsession(this, (AlfrescoSession) getIntent().getExtras().getParcelable("session")); } FragmentDisplayer.loadFragment(this, R.id.body, ListUISamplesFragments.TAG); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { ActionBar bar = getActionBar(); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_USE_LOGO); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { bar.setHomeButtonEnabled(true); } } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sdkapp_main); if (getIntent().getExtras() != null && getIntent().getExtras().containsKey(PARAM_SESSION)) { SessionUtils.setsession(this, (AlfrescoSession) getIntent().getExtras().getParcelable(PARAM_SESSION)); } FragmentDisplayer.loadFragment(this, R.id.body, ListUISamplesFragments.TAG); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { ActionBar bar = getActionBar(); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_USE_LOGO); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { bar.setHomeButtonEnabled(true); } } }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) { HashMap<String, Object> body = new HashMap<>(); try { String publishId = request.getParameter("publish_id"); db.single(Publish.class).where("publish_id = ?", publishId).execute().ifPresent(publish -> { String datasource = publish.getDatasource(); body.put("datasource", datasource); String queryId = publish.getQueryId(); body.put("queryid", queryId); Query query = db.single(Query.class).where("query_id = ? AND datasource = ?", queryId, datasource).execute().get(); body.put("engine", query.getEngine()); createHistoryResult(body, config.getSelectLimit(), datasource, query, true); Optional<Comment> comment = db.single(Comment.class).where("datasource = ? AND engine = ? AND query_id = ?", datasource, query.getEngine(), queryId).execute(); body.put("comment", comment.orElse(null)); }); } catch (Throwable e) { LOGGER.error(e.getMessage(), e); body.put("error", e.getMessage()); } writeJSON(response, body); }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) { HashMap<String, Object> body = new HashMap<>(); try { String publishId = getRequiredParameter(request, "publish_id"); db.single(Publish.class).where("publish_id = ?", publishId).execute().ifPresent(publish -> { String datasource = publish.getDatasource(); body.put("datasource", datasource); String queryId = publish.getQueryId(); body.put("queryid", queryId); Query query = db.single(Query.class).where("query_id = ? AND datasource = ?", queryId, datasource).execute().get(); body.put("engine", query.getEngine()); createHistoryResult(body, config.getSelectLimit(), datasource, query, true); Optional<Comment> comment = db.single(Comment.class).where("datasource = ? AND engine = ? AND query_id = ?", datasource, query.getEngine(), queryId).execute(); body.put("comment", comment.orElse(null)); }); } catch (Throwable e) { LOGGER.error(e.getMessage(), e); body.put("error", e.getMessage()); } writeJSON(response, body); }
Source:
public SELF isEqualTo(ZonedDateTime expected) { Objects.instance().assertNotNull(info, actual); assertDateTimeParameterIsNotNull(expected); return super.isEqualTo(sameInstantInActualTimeZone(expected)); }

Target:
public SELF isEqualTo(ZonedDateTime expected) { return super.isEqualTo(sameInstantInActualTimeZone(expected)); }
Source:
public boolean isNetworkError() { if (getMessage().startsWith(NETWORK_ERROR_MSG) || getMessage().startsWith(CONNECTION_ISSUES_MSG)) { return true; } else { return false; } }

Target:
public boolean isNetworkError() { if (getMessage().startsWith(NETWORK_ERROR_MSG)) { return true; } else { return false; } }
Source:
public Distribution getDistribution() { double mean = d_quantiles.getQuantile(1); double stdev = (d_quantiles.getQuantile(2) - mean) / 1.960 ; if(d_coninuous) { return new Gaussian(mean, stdev); } else { return new LogGaussian(mean, stdev); } }

Target:
public Distribution getDistribution() { double mean = d_quantiles.getQuantile(d_quantiles.indexOf(0.5)); double stdev = (d_quantiles.getQuantile(d_quantiles.indexOf(0.975)) - d_quantiles.getQuantile(d_quantiles.indexOf(0.025))) / (2 * 1.960); if(d_isLogTransformed) { return new Gaussian(mean, stdev); } else { return new LogGaussian(mean, stdev); } }
Source:
public void auditRequestMessage(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, Boolean isRequesting, Properties webContextProperties, String serviceName, AuditTransforms transforms) { LOG.trace("--- Before auditing of request message ---"); LogEventRequestType auditLogMsg = transforms.transformRequestToAuditMsg(request, assertion, target, direction, _interface, isRequesting, webContextProperties, serviceName); auditLogMessages(auditLogMsg, assertion); LOG.trace("--- After auditing of request message ---"); }

Target:
public void auditRequestMessage(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, Boolean isRequesting, Properties webContextProperties, String serviceName, AuditTransforms transforms) { LOG.trace("--- Before asynchronous audit call of request message ---"); LogEventRequestType auditLogMsg = transforms.transformRequestToAuditMsg(request, assertion, target, direction, _interface, isRequesting, webContextProperties, serviceName); auditLogMessages(auditLogMsg, assertion); LOG.trace("--- After asynchronous audit call of request message ---"); }
Source:
public void onBackPressed() { Log.v(TAG, "onBackPressed"); super.onBackPressed(); Log.v(TAG, "Logging out"); Intent intent = new Intent(MainActivity.this, WebViewActivity.class); intent.putExtra("url", single_logout_url); startActivityForResult(intent, WEBVIEW_ACTIVITY); }

Target:
public void onBackPressed() { Log.v(TAG, "onBackPressed:"); super.onBackPressed(); String AIS_TARGET_URL = getResources().getString(R.string.ais_target_url); Intent intent = new Intent(MainActivity.this, WebViewActivity.class); intent.putExtra(AIS_TARGET_URL, singleLogoutUrl); startActivityForResult(intent, WEBVIEW_ACTIVITY); }
Source:
public LoggerServiceImpl() { actions.put( "log-record", new Runnable() { @Override public void run() { logrecord(); } } ); }

Target:
public LoggerServiceImpl() { }
Source:
public void removeKeyListener(KeyListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.removeKeyListener(listener); if (this.dropdownTableViewer != null && !this.dropdownTable.isDisposed()) this.dropdownTable.removeKeyListener(listener); }

Target:
public void removeKeyListener(KeyListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.removeKeyListener(listener); if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.removeKeyListener(listener); }
Source:
private IBrandingAdvice getBrandingAdvice() { for (IBrandingAdvice iBrandingAdvice : info.getAdvice(configSpec, true, null, null, IBrandingAdvice.class)) return iBrandingAdvice; return null; }

Target:
private IBrandingAdvice getBrandingAdvice() { for (IBrandingAdvice advice : info.getAdvice(configSpec, true, null, null, IBrandingAdvice.class)) return advice; return null; }
Source:
public synchronized void init() { try { Driver driver = DriverManager.getDriver(URL_PREFIX); LOGGER.error("LoggingDriver already installed; removing"); try { DriverManager.deregisterDriver(driver); } catch (SQLException e) { throw new IllegalStateException("Unable to de-register logging JDBC driver", e); } } catch (SQLException expected) { LOGGER.error("SQLException ", expected); } try { DriverManager.registerDriver(this); } catch (SQLException e) { throw new IllegalStateException("Unable to register logging JDBC driver", e); } }

Target:
public synchronized void init() { try { Driver driver = DriverManager.getDriver(URL_PREFIX); LOGGER.error("LoggingDriver already installed; removing"); try { DriverManager.deregisterDriver(driver); } catch (SQLException e) { throw new IllegalStateException("Unable to de-register logging JDBC driver", e); } } catch (SQLException expected) { LOGGER.debug(expected.getMessage(), expected); } try { DriverManager.registerDriver(this); } catch (SQLException e) { throw new IllegalStateException("Unable to register logging JDBC driver", e); } }
Source:
public void simpleStringExtraInjected() { ExtraInjectedActivity activity = Robolectric.buildActivity(ExtraInjectedActivity_.class, ExtraInjectedActivity_.intent(context) .stringExtra("Hello!") .get()) .setup() .get(); assertThat(activity.stringExtra).isEqualTo("Hello!"); }

Target:
public void simpleStringExtraInjected() { Intent intent = ExtraInjectedActivity_.intent(context) .stringExtra("Hello!") .get(); ExtraInjectedActivity activity = Robolectric.buildActivity(ExtraInjectedActivity_.class, intent) .setup() .get(); assertThat(activity.stringExtra).isEqualTo("Hello!"); }
Source:
public String getNameForThread() { return "socket=" + String.format("%s-%s-%s", getLogType(), this.protocol, this.port); }

Target:
public String getNameForThread() { return String.format("socket=%s-%s-%s", getLogType(), this.protocol, this.port); }
Source:
private void addStrategyTypeProperties(Collection<ResourceProperty> properties, IBuildStrategy buildStrategy) { if (buildStrategy == null) { properties.add(new ResourceProperty("strategy", "<UNKNOWN>")); return; } properties.add(new ResourceProperty("strategy", buildStrategy.getType().toString())); switch(buildStrategy.getType()) { case BuildStrategyType.SOURCE: ISourceBuildStrategy sti = (ISourceBuildStrategy) buildStrategy; properties.add(new ResourceProperty("builder image", sti.getImage().toString())); break; case BuildStrategyType.DOCKER: IDockerBuildStrategy docker = (IDockerBuildStrategy) buildStrategy; properties.add(new ResourceProperty("base image", docker.getBaseImage().toString())); break; case BuildStrategyType.CUSTOM: ICustomBuildStrategy custom = (ICustomBuildStrategy) buildStrategy; properties.add(new ResourceProperty("builder image", custom.getImage().toString())); break; default: } }

Target:
private void addStrategyTypeProperties(Collection<ResourceProperty> properties, IBuildStrategy buildStrategy) { if (buildStrategy == null || buildStrategy.getType() == null) { properties.add(new UnknownResourceProperty(LABEL_STRATEGY)); return; } properties.add(new ResourceProperty(LABEL_STRATEGY, buildStrategy.getType().toString())); switch(buildStrategy.getType()) { case BuildStrategyType.SOURCE: ISourceBuildStrategy sti = (ISourceBuildStrategy) buildStrategy; properties.add(new ResourceProperty("builder image", sti.getImage().toString())); break; case BuildStrategyType.DOCKER: IDockerBuildStrategy docker = (IDockerBuildStrategy) buildStrategy; properties.add(new ResourceProperty("base image", docker.getBaseImage().toString())); break; case BuildStrategyType.CUSTOM: ICustomBuildStrategy custom = (ICustomBuildStrategy) buildStrategy; properties.add(new ResourceProperty("builder image", custom.getImage().toString())); break; default: } }
Source:
public void wipe(Context context) { log.info("Removing all the data and restarting the app."); resetBlockchain(); wallet.shutdownAutosaveAndWait(); stopBlockchainService(); walletFile.delete(); cleanupFiles(); config.clear(true); PinRetryController.getInstance().clearPinFailPrefs(); File walletBackupFile = getFileStreamPath(Constants.Files.WALLET_KEY_BACKUP_PROTOBUF); if(walletBackupFile.exists()) walletBackupFile.delete(); File blockChainFile = new File(getDir("blockstore", Context.MODE_PRIVATE), Constants.Files.BLOCKCHAIN_FILENAME); if (blockChainFile.exists()) blockChainFile.delete(); ProcessPhoenix.triggerRebirth(context); }

Target:
public void wipe(Context context) { log.info("Removing all the data and restarting the app."); resetBlockchain(); wallet.shutdownAutosaveAndWait(); stopBlockchainService(); walletFile.delete(); cleanupFiles(); config.clear(true); PinRetryController.getInstance().clearPinFailPrefs(); File walletBackupFile = getFileStreamPath(Constants.Files.WALLET_KEY_BACKUP_PROTOBUF); if(walletBackupFile.exists()) walletBackupFile.delete(); ProcessPhoenix.triggerRebirth(context); }
Source:
public Action<?, ?> clusterProxyRegistrationAction() { return new AbstractChangePrimaryGatewayAction<>(StackEvent.class) { @Override protected void doExecute(ChangePrimaryGatewayContext context, StackEvent payload, Map<Object, Object> variables) { Stack stack = context.getStack(); stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.REPAIR_IN_PROGRESS, "Changing the primary gateway cluster proxy registration"); List<String> instanceIds = getInstanceIds(variables); ClusterProxyUpdateRegistrationRequest request; if (Objects.nonNull(instanceIds)) { List<String> instanceIdsToRegister = stack.getNotDeletedInstanceMetaDataList().stream() .map(InstanceMetaData::getInstanceId) .filter(instanceId -> !instanceIds.contains(instanceId)) .collect(Collectors.toList()); request = new ClusterProxyUpdateRegistrationRequest(stack.getId(), instanceIdsToRegister); } else { request = new ClusterProxyUpdateRegistrationRequest(stack.getId()); } sendEvent(context, request.selector(), request); } }; }

Target:
public Action<?, ?> clusterProxyRegistrationAction() { return new AbstractChangePrimaryGatewayAction<>(StackEvent.class) { @Override protected void doExecute(ChangePrimaryGatewayContext context, StackEvent payload, Map<Object, Object> variables) { Stack stack = context.getStack(); stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.REPAIR_IN_PROGRESS, "Changing the primary gateway cluster proxy registration"); List<String> repairInstanceIds = getInstanceIds(variables); ClusterProxyUpdateRegistrationRequest request; if (Objects.nonNull(repairInstanceIds)) { List<String> instanceIdsToRegister = stack.getNotDeletedInstanceMetaDataList().stream() .map(InstanceMetaData::getInstanceId) .filter(instanceId -> !repairInstanceIds.contains(instanceId)) .collect(Collectors.toList()); LOGGER.debug("When changing the primary gateway cluster proxy in stack {}, will be reregistered", stack.getId(), instanceIdsToRegister); request = new ClusterProxyUpdateRegistrationRequest(stack.getId(), instanceIdsToRegister); } else { LOGGER.debug("When changing the primary gateway cluster proxy in stack {}, the whole stack will be reregistered", stack.getId()); request = new ClusterProxyUpdateRegistrationRequest(stack.getId()); } sendEvent(context, request.selector(), request); } }; }
Source:
public void testProcessQueryGraphQl() throws Exception { Exception exception = assertThrows(JsonParseException.class, () -> { AsyncQuery queryObj = new AsyncQuery(); ElideResponse response = new ElideResponse(200, "ResponseBody"); String query = "{\"query\":\"{ group { edges { node { name commonName description } } } }\",\"variables\":null}"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; queryObj.setId(id); queryObj.setQuery(query); queryObj.setQueryType(QueryType.GRAPHQL_V1_0); queryObj.setResultType(ResultType.EMBEDDED); when(runner.run(eq(query), eq(user), any())).thenReturn(response); AsyncQueryThread queryThread = new AsyncQueryThread(queryObj, user, elide, runner, asyncQueryDao, "v1", resultStorageEngine); queryResultObj = queryThread.processQuery(); assertEquals(queryResultObj.getResponseBody(), "ResponseBody"); assertEquals(queryResultObj.getHttpStatus(), 200); }); }

Target:
public void testProcessQueryGraphQl() throws Exception { assertThrows(InvalidJsonException.class, () -> { AsyncQuery queryObj = new AsyncQuery(); ElideResponse response = new ElideResponse(200, "ResponseBody"); String query = "{\"query\":\"{ group { edges { node { name commonName description } } } }\",\"variables\":null}"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; queryObj.setId(id); queryObj.setQuery(query); queryObj.setQueryType(QueryType.GRAPHQL_V1_0); queryObj.setResultType(ResultType.EMBEDDED); when(runner.run(any(), eq(query), eq(user), any())).thenReturn(response); AsyncQueryThread queryThread = new AsyncQueryThread(queryObj, user, elide, runner, asyncQueryDao, "v1", resultStorageEngine, BASE_URL_ENDPOINT); queryResultObj = queryThread.processQuery(); assertEquals(queryResultObj.getResponseBody(), "ResponseBody"); assertEquals(queryResultObj.getHttpStatus(), 200); }); }
Source:
private void updateVdsDynamic(V1Node node, VdsDynamic dynamic) { Map<String, String> labels = node.getMetadata().getLabels(); if ("true".equals(labels.get("kubevirt.io/schedulable"))) { dynamic.setStatus(VDSStatus.Up); } else { dynamic.setStatus(VDSStatus.NonOperational); dynamic.setNonOperationalReason(NonOperationalReason.KUBEVIRT_NOT_SCHEDULABLE); logUnmetConditions(node); } dynamic.setCpuThreads(node.getStatus() .getCapacity() .getOrDefault("cpu", new Quantity("0")) .getNumber() .intValue()); Map<String, Quantity> capacity = node.getStatus().getCapacity(); dynamic.setCpuThreads(capacity.getOrDefault("cpu", new Quantity("0")).getNumber().intValue()); Quantity memoryInKiB = capacity.getOrDefault("memory", new Quantity("0")); dynamic.setPhysicalMemMb(Units.parse(new QuantityFormatter().format(memoryInKiB))); V1NodeSystemInfo nodeInfo = node.getStatus().getNodeInfo(); dynamic.setKernelVersion(nodeInfo.getKernelVersion()); dynamic.setBootUuid(nodeInfo.getBootID()); dynamic.setHostOs(nodeInfo.getOperatingSystem()); dynamic.setHardwareUUID(nodeInfo.getSystemUUID()); }

Target:
private void updateVdsDynamic(V1Node node, VdsDynamic dynamic) { Map<String, String> labels = node.getMetadata().getLabels(); if ("true".equals(labels.get("kubevirt.io/schedulable"))) { dynamic.setStatus(VDSStatus.Up); } else { dynamic.setStatus(VDSStatus.NonOperational); dynamic.setNonOperationalReason(NonOperationalReason.KUBEVIRT_NOT_SCHEDULABLE); logUnmetConditions(node); } dynamic.setCpuThreads(node.getStatus() .getCapacity() .getOrDefault("cpu", new Quantity("0")) .getNumber() .intValue()); Map<String, Quantity> capacity = node.getStatus().getCapacity(); dynamic.setCpuThreads(capacity.getOrDefault("cpu", new Quantity("0")).getNumber().intValue()); Quantity memory = capacity.getOrDefault("memory", new Quantity("0")); dynamic.setPhysicalMemMb(Units.parse(new QuantityFormatter().format(memory))); V1NodeSystemInfo nodeInfo = node.getStatus().getNodeInfo(); dynamic.setKernelVersion(nodeInfo.getKernelVersion()); dynamic.setBootUuid(nodeInfo.getBootID()); dynamic.setHostOs(nodeInfo.getOperatingSystem()); dynamic.setHardwareUUID(nodeInfo.getSystemUUID()); }
Source:
public int getTimeOut(Class clazz) { try { Method method = Timeout.class.getMethod("value"); do { if (clazz.isAnnotationPresent(Timeout.class)) { return (Integer) method.invoke(clazz.getDeclaredAnnotation(Timeout.class)); } clazz = clazz.getSuperclass(); } while (clazz != Object.class && clazz != null); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { } return 1; }

Target:
public int getTimeOut(Class clazz) { try { Method method = Timeout.class.getMethod("value"); do { if (clazz.isAnnotationPresent(Timeout.class)) { return (Integer) method.invoke(clazz.getAnnotation(Timeout.class)); } clazz = clazz.getSuperclass(); } while (clazz != Object.class && clazz != null); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { } return Integer.getInteger("webdriver.timeouts.implicitlywait", 5); }