auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response addService(@PathParam("clusterId") Long clusterId, Service service) { service.setClusterId(clusterId); try { Cluster cluster = catalogService.getCluster(clusterId); if (cluster == null) { return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND, "cluster: " + clusterId.toString()); } String serviceName = service.getName(); Service result = catalogService.getServiceByName(clusterId, serviceName); if (result != null) { throw new AlreadyExistsException("Service entity already exists with cluster id " + clusterId + " and name " + serviceName); } Service createdService = catalogService.addService(service); return WSUtils.respond(CREATED, SUCCESS, createdService); } catch (ProcessingException ex) { return WSUtils.respond(BAD_REQUEST, ResponseMessage.BAD_REQUEST); } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } }

Target:
public Response addService(@PathParam("clusterId") Long clusterId, Service service) { service.setClusterId(clusterId); try { Cluster cluster = catalogService.getCluster(clusterId); if (cluster == null) { return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND, "cluster: " + clusterId.toString()); } String serviceName = service.getName(); Service result = catalogService.getServiceByName(clusterId, serviceName); if (result != null) { throw new AlreadyExistsException("Service entity already exists with cluster id " + clusterId + " and service name " + serviceName); } Service createdService = catalogService.addService(service); return WSUtils.respond(createdService, CREATED, SUCCESS); } catch (ProcessingException ex) { return WSUtils.respond(BAD_REQUEST, ResponseMessage.BAD_REQUEST); } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } }
Source:
private boolean sendEmail(String courseId, String studentEmail) { try { EmailWrapper email = new EmailGenerator().generateFeedbackSessionSummaryOfCourse(courseId, studentEmail); emailSender.sendEmail(email); return true; } catch (Exception e) { log.severe("Error while sending session summary email" + TeammatesException.toStringWithStackTrace(e)); return false; } }

Target:
private boolean sendEmail(String courseId, String studentEmail) { EmailWrapper email = new EmailGenerator().generateFeedbackSessionSummaryOfCourse(courseId, studentEmail); EmailSendingStatus status = emailSender.sendEmail(email); return status.isSuccess(); }
Source:
public void onFailure(final String errorMessage) { messageBusPromise.then(new Operation<MessageBus>() { @Override public void apply(MessageBus messageBus) throws OperationException { try { messageBus.unsubscribe(wsChannel, subscriptionHandler); } catch (WebSocketException e) { Log.error(getClass(), e); } notification.setStatus(Notification.Status.FINISHED); notification.setType(Notification.Type.ERROR); notification.setImportant(true); notification.setMessage(errorMessage); } }).catchError(promiseErrorHandler); }

Target:
public void onFailure(final String errorMessage) { messageBusPromise.then(new Operation<MessageBus>() { @Override public void apply(MessageBus messageBus) throws OperationException { try { messageBus.unsubscribe(wsChannel, subscriptionHandler); } catch (WebSocketException e) { Log.error(getClass(), e); } notification.setType(Notification.Type.ERROR); notification.setStatus(Notification.Status.FINISHED); notification.setImportant(true); notification.setMessage(errorMessage); } }).catchError(logErrorHandler); }
Source:
public static boolean isRegionReplicaReplicationEnabled(Configuration conf, TableName tn) { return isMetaRegionReplicaReplicationEnabled(conf, tn) || conf.getBoolean(REGION_REPLICA_REPLICATION_CONF_KEY, DEFAULT_REGION_REPLICA_REPLICATION); }

Target:
public static boolean isRegionReplicaReplicationEnabled(Configuration conf, TableName tn) { return isMetaRegionReplicaReplicationEnabled(conf, tn) || isRegionReplicaReplicationEnabled(conf); }
Source:
public ZoneGroupsNameAndIDMap(final int zoneID, final String zoneName, JsonArray groups) { this.zoneID = zoneID; this.zoneName = zoneName; HashMap<Short, String> groupIdNames = new HashMap<Short, String>(groups.size()); HashMap<String, Short> groupNameIds = new HashMap<String, Short>(groups.size()); for (int k = 0; k < groups.size(); k++) { short groupID = ((JsonObject) groups.get(k)).get("group").getAsShort(); String groupName = ((JsonObject) groups.get(k)).get("name").getAsString(); groupIdNames.put(groupID, groupName); groupNameIds.put(groupName, groupID); } this.groupIdNames = groupIdNames; this.groupNameIds = groupNameIds; }

Target:
public ZoneGroupsNameAndIDMap(final int zoneID, final String zoneName, JsonArray groups) { this.zoneID = zoneID; this.zoneName = zoneName; groupIdNames = new HashMap<>(groups.size()); groupNameIds = new HashMap<>(groups.size()); for (int k = 0; k < groups.size(); k++) { short groupID = ((JsonObject) groups.get(k)).get("group").getAsShort(); String groupName = ((JsonObject) groups.get(k)).get("name").getAsString(); groupIdNames.put(groupID, groupName); groupNameIds.put(groupName, groupID); } }
Source:
public void updateFromSmartDashboard(String prefix) { if (!(SmartDashboard.containsKey(prefix + "_P") && SmartDashboard.containsKey(prefix + "_I") && SmartDashboard.containsKey(prefix + "_D") && SmartDashboard.containsKey(prefix + "_F"))) { SmartDashboard.putNumber(prefix + "_P", getP()); SmartDashboard.putNumber(prefix + "_I", getI()); SmartDashboard.putNumber(prefix + "_D", getD()); SmartDashboard.putNumber(prefix + "_F", getD()); return; } setPIDF(SmartDashboard.getNumber(prefix + "_P", getP()), SmartDashboard.getNumber(prefix + "_I", getI()), SmartDashboard.getNumber(prefix + "_D", getD()), SmartDashboard.getNumber(prefix + "_F", getF())); }

Target:
public void updateFromSmartDashboard(String prefix) { if (!(SmartDashboard.containsKey(prefix + "_P") && SmartDashboard.containsKey(prefix + "_I") && SmartDashboard.containsKey(prefix + "_D") && SmartDashboard.containsKey(prefix + "_F"))) { SmartDashboard.putNumber(prefix + "_P", getP()); SmartDashboard.putNumber(prefix + "_I", getI()); SmartDashboard.putNumber(prefix + "_D", getD()); SmartDashboard.putNumber(prefix + "_F", getF()); return; } setPIDF(SmartDashboard.getNumber(prefix + "_P", getP()), SmartDashboard.getNumber(prefix + "_I", getI()), SmartDashboard.getNumber(prefix + "_D", getD()), SmartDashboard.getNumber(prefix + "_F", getF())); }
Source:
private String getJenkinsReportsUrl() { String build_url = System.getProperty("BUILD_URL"); if (isEmpty(build_url)) { build_url = System.getenv("BUILD_URL"); } String workspace = System.getProperty("WORKSPACE"); if (isEmpty(workspace)) { workspace = System.getenv("WORKSPACE"); } if (!isEmpty(build_url)) { String reportRelativePath = ""; if (!isEmpty(workspace)) { Path pathAbsoluteReportsFolder = Paths.get("").normalize().toAbsolutePath(); Path pathAbsoluteWorkSpace = Paths.get(workspace).normalize().toAbsolutePath(); Path pathRelative = pathAbsoluteWorkSpace.relativize(pathAbsoluteReportsFolder); reportRelativePath = pathRelative.toString() + '/'; } return resolveUrlSource("%s/artifact/%s", build_url, reportRelativePath); } else { return null; } }

Target:
private String getJenkinsReportsUrl() { String build_url = System.getProperty("BUILD_URL"); if (!isEmpty(build_url)) { String workspace = System.getProperty("WORKSPACE", System.getenv("WORKSPACE")); String reportRelativePath = ""; if (!isEmpty(workspace)) { Path pathAbsoluteReportsFolder = Paths.get("").normalize().toAbsolutePath(); Path pathAbsoluteWorkSpace = Paths.get(workspace).normalize().toAbsolutePath(); Path pathRelative = pathAbsoluteWorkSpace.relativize(pathAbsoluteReportsFolder); reportRelativePath = pathRelative.toString().replace('\\', '/') + '/'; } return resolveUrlSource("%s/artifact/%s", build_url, reportRelativePath); } else { return null; } }
Source:
private TickingTimer createTickingTimer(UI ui) { return new TickingTimer("Browser Request Delay Timer", BROWSER_REQUEST_DELAY, integer -> { }, () -> { Platform.runLater(() -> { System.out.println("\nREQUEST DELAY TIMER\n"); if (nextRepoId.isPresent() && nextIssueId.isPresent() && isPullRequest.isPresent()) { ui.getBrowserComponent().showIssue(nextRepoId.get(), nextIssueId.get(), isPullRequest.get(), false); } }); timer.pause(); }, TimeUnit.MILLISECONDS); }

Target:
private TickingTimer createTickingTimer(UI ui) { return new TickingTimer("Browser Request Delay Timer", BROWSER_REQUEST_DELAY, integer -> { }, () -> { Platform.runLater(() -> { if (nextRepoId.isPresent() && nextIssueId.isPresent() && isPullRequest.isPresent()) { ui.getBrowserComponent().showIssue(nextRepoId.get(), nextIssueId.get(), isPullRequest.get(), false); } }); timer.pause(); }, TimeUnit.MILLISECONDS); }
Source:
public void shouldCollectDefinedValueUsingPartialFunction() { final PartialFunction<Integer, String> pf = new PartialFunction<Integer, String>() { @Override public String apply(Integer i) { return String.valueOf(i); } @Override public boolean isDefinedAt(Integer i) { return i % 2 == 1; } }; final Future<String> future = Future.of(zZz(3)).collect(pf); waitUntil(future::isCompleted); assertThat(future.getValue().get()).isEqualTo(Try.success("3")); }

Target:
public void shouldCollectDefinedValueUsingPartialFunction() { final PartialFunction<Integer, String> pf = Function1.<Integer, String> of(String::valueOf).partial(i -> i % 2 == 1); final Future<String> future = Future.of(zZz(3)).collect(pf); waitUntil(future::isCompleted); assertThat(future.getValue().get()).isEqualTo(Try.success("3")); }
Source:
protected abstract void processIncoming() throws IOException, ClientConnectionException; private void processHeartbeat() { if (!this.isInInit() && this.policy.isIncomingHeartbeat() && this.lastIncomingHeartbeat + this.policy.getIncomingHeartbeat() < System.currentTimeMillis()) { log.debug("Heartbeat exeeded. Closing channel"); this.disconnect("Heartbeat exeeded"); } }

Target:
protected abstract void processIncoming() throws IOException, ClientConnectionException; private void processHeartbeat() { if (!this.isInInit() && this.policy.isIncomingHeartbeat() && this.isIncomingHeartbeatExeeded()) { log.debug("Heartbeat exeeded. Closing channel"); this.disconnect("Heartbeat exeeded"); } }
Source:
public String toString() { String AddInfo = getAdditionalInformation(); return String.format("%s(%s %s)", super.toString(), (!StringUtils.isEmpty(AddInfo) ? AddInfo + "," : ""), (getParameters() != null ? getParameters().toString() : "null")); }

Target:
public String toString() { String AddInfo = getAdditionalInformation(); return String.format("%s(%s %s)", super.toString(), (!AddInfo.isEmpty() ? AddInfo + "," : ""), (getParameters() != null ? getParameters().toString() : "null")); }
Source:
public void run() { try { serverChannel.register(nioSelector, SelectionKey.OP_ACCEPT); startupComplete(); int currentProcessor = 0; while (isRunning()) { int ready = nioSelector.select(selectTimeOutMs); if (ready > 0) { Set<SelectionKey> keys = nioSelector.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while (iter.hasNext() && isRunning()) { SelectionKey key = null; try { key = iter.next(); iter.remove(); if (key.isAcceptable()) { accept(key, processors.get(currentProcessor)); } else { throw new IllegalStateException("Unrecognized key state for acceptor thread."); } currentProcessor = (currentProcessor + 1) % processors.size(); } catch (Exception e) { key.cancel(); metrics.acceptConnectionErrorCount.inc(); logger.debug("Error in accepting new connection", e); } } } } logger.debug("Closing server socket and selector."); serverChannel.socket().close(); serverChannel.close(); nioSelector.close(); shutdownComplete(); } catch (Exception e) { metrics.acceptorShutDownErrorCount.inc(); logger.error("Error during shutdown of acceptor thread", e); } }

Target:
public void run() { try { serverChannel.register(nioSelector, SelectionKey.OP_ACCEPT); startupComplete(); int currentProcessor = 0; while (isRunning()) { int ready = nioSelector.select(selectTimeOutMs); if (ready > 0) { Set<SelectionKey> keys = nioSelector.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while (iter.hasNext() && isRunning()) { SelectionKey key = null; try { key = iter.next(); iter.remove(); if (key.isAcceptable()) { accept(key, processors.get(currentProcessor)); } else { throw new IllegalStateException("Unrecognized key state for acceptor thread."); } currentProcessor = (currentProcessor + 1) % processors.size(); } catch (Exception e) { key.cancel(); metrics.acceptConnectionErrorCount.inc(); logger.debug("Error in accepting new connection", e); } } } } logger.debug("Closing server socket and selector."); serverChannel.close(); nioSelector.close(); shutdownComplete(); } catch (Exception e) { metrics.acceptorShutDownErrorCount.inc(); logger.error("Error during shutdown of acceptor thread", e); } }
Source:
private Optional<ConnectionSlot> acquireConnectionSlot(final String client, final String eventType, final String partition) throws ConnectionSlotOccupiedException { final String parent = zkPathForConsumer(client, eventType, partition); List<String> children = ImmutableList.of(); try { children = zkHolder.get() .getChildren() .forPath(parent); } catch (final KeeperException.NoNodeException e) { } catch (Exception e) { LOG.error("Zookeeper error when getting consumer nodes", e); throw new NakadiRuntimeException(e); } if (children.size() >= maxConnections) { return Optional.empty(); } final List<String> occupiedSlots = children; final List<String> availableSlots = SLOT_NAMES.stream() .filter(slot -> !occupiedSlots.contains(slot)) .collect(Collectors.toList()); final int slotIndex = new Random().nextInt(availableSlots.size()); final String slot = availableSlots.get(slotIndex); final String zkPath = parent + "/" + slot; try { zkHolder.get() .create() .creatingParentsIfNeeded() .withMode(CreateMode.EPHEMERAL) .forPath(zkPath); } catch (final KeeperException.NodeExistsException e) { throw new ConnectionSlotOccupiedException(); } catch (Exception e) { LOG.error("Zookeeper error when creating consumer node", e); throw new NakadiRuntimeException(e); } return Optional.of(new ConnectionSlot(client, eventType, partition, slot)); }

Target:
private ConnectionSlot acquireConnectionSlot(final String client, final String eventType, final String partition) { final String parent = zkPathForConsumer(client, eventType, partition); final String slotId = UUID.randomUUID().toString(); final String zkPath = parent + "/" + slotId; try { zkHolder.get() .create() .creatingParentsIfNeeded() .withMode(CreateMode.EPHEMERAL) .forPath(zkPath); } catch (Exception e) { LOG.error("Zookeeper error when creating consumer node", e); throw new NakadiRuntimeException(e); } final ConnectionSlot acquiredSlot = new ConnectionSlot(client, eventType, partition, slotId); ACQUIRED_SLOTS.add(acquiredSlot); return acquiredSlot; }
Source:
protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) { Object element = sel.getFirstElement(); if ((element instanceof TmfGenericTreeEntry)) { SegmentStoreStatisticsModel model = ((TmfGenericTreeEntry<SegmentStoreStatisticsModel>) element).getModel(); IAction gotoStartTime = new Action(Messages.SegmentStoreStatisticsViewer_GotoMinAction) { @Override public void run() { long start = model.getMinStart(); long end = model.getMinEnd(); broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentsStatisticsViewer.this, TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end), getTrace())); updateContent(start, end, true); } }; IAction gotoEndTime = new Action(Messages.SegmentStoreStatisticsViewer_GotoMaxAction) { @Override public void run() { long start = model.getMaxStart(); long end = model.getMaxEnd(); broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentsStatisticsViewer.this, TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end), getTrace())); updateContent(start, end, true); } }; manager.add(gotoStartTime); manager.add(gotoEndTime); } }

Target:
protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) { Object element = sel.getFirstElement(); if ((element instanceof TmfGenericTreeEntry || element instanceof SegmentStoreStatisticsEntry) && !(element instanceof HiddenTreeViewerEntry) ) { IAction gotoStartTime = new Action(Messages.SegmentStoreStatisticsViewer_GotoMinAction) { @Override public void run() { long start; long end; if (element instanceof TmfGenericTreeEntry) { SegmentStoreStatisticsModel model = ((TmfGenericTreeEntry<SegmentStoreStatisticsModel>) element).getModel(); start = model.getMinStart(); end = model.getMinEnd(); } else { ISegment minObject = ((SegmentStoreStatisticsEntry) element).getEntry().getMinObject(); start = minObject == null ? 0 : minObject.getStart(); end = minObject == null ? 0 : minObject.getEnd(); } broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentsStatisticsViewer.this, TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end), getTrace())); updateContent(start, end, true); } }; IAction gotoEndTime = new Action(Messages.SegmentStoreStatisticsViewer_GotoMaxAction) { @Override public void run() { long start; long end; if (element instanceof TmfGenericTreeEntry) { SegmentStoreStatisticsModel model = ((TmfGenericTreeEntry<SegmentStoreStatisticsModel>) element).getModel(); start = model.getMaxStart(); end = model.getMaxEnd(); } else { ISegment maxObject = ((SegmentStoreStatisticsEntry) element).getEntry().getMaxObject(); start = maxObject == null ? 0 : maxObject.getStart(); end = maxObject == null ? 0 : maxObject.getEnd(); } broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentsStatisticsViewer.this, TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end), getTrace())); updateContent(start, end, true); } }; manager.add(gotoStartTime); manager.add(gotoEndTime); } }
Source:
protected Set<CDOID> confirming(CDODataInput in, OMMonitor monitor) throws IOException { if (monitor == null) { monitor = new EclipseMonitor(new NullProgressMonitor()); } Set<CDOID> result = new HashSet<CDOID>(); int size = in.readInt(); monitor.begin(size + infos); try { for (int i = 0; i < size; i++) { CDOID id = in.readCDOID(); result.add(id); monitor.worked(); } readRevisionAvailabilityInfo(in, targetInfo, result, monitor.fork()); readRevisionAvailabilityInfo(in, sourceInfo, result, monitor.fork()); if (infos > 2) { readRevisionAvailabilityInfo(in, targetBaseInfo, result, monitor.fork()); } if (infos > 3) { readRevisionAvailabilityInfo(in, sourceBaseInfo, result, monitor.fork()); } return result; } finally { monitor.done(); } }

Target:
protected Set<CDOID> confirming(CDODataInput in, OMMonitor monitor) throws IOException { Set<CDOID> result = new HashSet<CDOID>(); int size = in.readInt(); if (monitor != null) { monitor.begin(size + infos); } try { for (int i = 0; i < size; i++) { CDOID id = in.readCDOID(); result.add(id); if (monitor != null) { monitor.worked(); } } readRevisionAvailabilityInfo(in, targetInfo, result, monitor != null ? monitor.fork() : null); readRevisionAvailabilityInfo(in, sourceInfo, result, monitor != null ? monitor.fork() : null); if (infos > 2) { readRevisionAvailabilityInfo(in, targetBaseInfo, result, monitor != null ? monitor.fork() : null); } if (infos > 3) { readRevisionAvailabilityInfo(in, sourceBaseInfo, result, monitor != null ? monitor.fork() : null); } return result; } finally { if (monitor != null) { monitor.done(); } } }
Source:
public int getEffectiveMaxBatchChangesLimit(CurrentUser user) { int maxBatchChangesLimitOfUser = user.getCapabilities().getRange(GlobalCapability.BATCH_CHANGES_LIMIT) .getMax(); if (maxBatchChangesLimitOfUser > 0) return maxBatchChangesLimitOfUser; if (maxBatchChangesOfSystem > 0) return maxBatchChangesOfSystem; return 0; }

Target:
public int getEffectiveMaxBatchChangesLimit(CurrentUser user) { if (user.getCapabilities().canPerform(BATCH_CHANGES_LIMIT)) { return user.getCapabilities().getRange(BATCH_CHANGES_LIMIT).getMax(); } return systemMaxBatchChangesOf; }
Source:
public WallThermostatStateMsg(String rawMsg) { super(rawMsg); logger.debug(this.msgType+" Payload Len -> "+this.payload.length); if (this.payload.length == WALL_THERMOSTAT_STATE_SHORT_PAYLOAD_LEN || this.payload.length == WALL_THERMOSTAT_STATE_PAIR_THERM_PAYLOAD_LEN || this.payload.length == WALL_THERMOSTAT_STATE_UNTIL_PAYLOAD_LEN || this.payload.length == WALL_THERMOSTAT_STATE_TEMP_PAYLOAD_LEN) { ctrlMode = ThermostatControlMode.values()[(this.payload[0]&0x3)]; dstActive = extractBitFromByte(this.payload[0], 3);; lanGateway = extractBitFromByte(this.payload[0], 4); lockedForManualSetPoint = extractBitFromByte(this.payload[0], 5); rfError = extractBitFromByte(this.payload[0], 6); batteryLow = extractBitFromByte(this.payload[0], 7); displayMeasuredTemp = (this.payload[1]==0?false:true); desiredTemperature = (this.payload[2] & 0x7f) / 2.0; if (this.payload.length == WALL_THERMOSTAT_STATE_PAIR_THERM_PAYLOAD_LEN) { int mTemp = this.payload[3]; mTemp &= 0x01; mTemp <<= 8; mTemp |= (this.payload[4]&0xff); this.measuredTemperature = mTemp/10.0; } else if (this.payload.length == WALL_THERMOSTAT_STATE_UNTIL_PAYLOAD_LEN) { } else if (this.payload.length ==WALL_THERMOSTAT_STATE_TEMP_PAYLOAD_LEN) { int mTemp = this.payload[2]; mTemp &= 0x80; mTemp <<= 1; mTemp |= (this.payload[6]&0xff); this.measuredTemperature = mTemp/10.0; } } else logger.error("Got "+this.msgType+" message with incorrect length!"); }

Target:
public WallThermostatStateMsg(String rawMsg) { super(rawMsg); logger.debug(this.msgType + " Payload Len -> " + this.payload.length); if (this.payload.length == WALL_THERMOSTAT_STATE_SHORT_PAYLOAD_LEN || this.payload.length == WALL_THERMOSTAT_STATE_PAIR_THERM_PAYLOAD_LEN || this.payload.length == WALL_THERMOSTAT_STATE_UNTIL_PAYLOAD_LEN || this.payload.length == WALL_THERMOSTAT_STATE_TEMP_PAYLOAD_LEN) { ctrlMode = ThermostatControlMode.values()[(this.payload[0] & 0x3)]; dstActive = extractBitFromByte(this.payload[0], 3); ; lanGateway = extractBitFromByte(this.payload[0], 4); lockedForManualSetPoint = extractBitFromByte(this.payload[0], 5); rfError = extractBitFromByte(this.payload[0], 6); batteryLow = extractBitFromByte(this.payload[0], 7); displayMeasuredTemp = (this.payload[1] == 0 ? false : true); desiredTemperature = (this.payload[2] & 0x7f) / 2.0; if (this.payload.length == WALL_THERMOSTAT_STATE_PAIR_THERM_PAYLOAD_LEN) { int mTemp = this.payload[3]; mTemp &= 0x01; mTemp <<= 8; mTemp |= (this.payload[4] & 0xff); this.measuredTemperature = mTemp / 10.0; } else if (this.payload.length == WALL_THERMOSTAT_STATE_UNTIL_PAYLOAD_LEN) { } else if (this.payload.length == WALL_THERMOSTAT_STATE_TEMP_PAYLOAD_LEN) { int mTemp = this.payload[2]; mTemp &= 0x80; mTemp <<= 1; mTemp |= (this.payload[6] & 0xff); this.measuredTemperature = mTemp / 10.0; } } else { logger.error("Got " + this.msgType + " message with incorrect length!"); } }
Source:
boolean cleanup() default false; } private static final String CENTRAL_LABEL = "Red Hat Central"; private static final String MAVEN_SETTINGS_PATH = System.getProperty("maven.config.file") == null ? "./target/classes/settings.xml" : System.getProperty("maven.config.file");; private static Map<org.jboss.tools.central.reddeer.projects.Project, List<String>> projectWarnings = new HashMap<org.jboss.tools.central.reddeer.projects.Project, List<String>>(); private static final Logger log = Logger.getLogger(ExamplesOperator.class); private static final String BLACKLIST_ERRORS_REGEXES_FILE = "resources/blacklist-test-errors-regexes.json"; public static JSONObject blacklistErrorsFileContents; @BeforeClass public static void setup() { String mvnConfigFileName = new File(MAVEN_SETTINGS_PATH).getAbsolutePath(); WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog(); preferenceDialog.open(); TreeItem t = new DefaultTreeItem(new DefaultTree(preferenceDialog), "Java", "Installed JREs"); t.select(); List<TableItem> tis = new DefaultTable(0).getItems(); for (TableItem ti : tis) { if (ti.getText(0).startsWith("Java SE 8") || ti.getText(0).startsWith("openjdk-1.8")) { ti.setChecked(true); new PushButton("Apply").click(); } } MavenSettingsPreferencePage prefPage = new MavenSettingsPreferencePage(preferenceDialog); preferenceDialog.select(prefPage); prefPage.setUserSettingsLocation(mvnConfigFileName); preferenceDialog.ok(); new DefaultToolItem(new WorkbenchShell(), CENTRAL_LABEL).click(); new DefaultEditor(CENTRAL_LABEL); }

Target:
boolean cleanup() default false; } private static final String CENTRAL_LABEL = "Red Hat Central"; private static Map<org.jboss.tools.central.reddeer.projects.Project, List<String>> projectWarnings = new HashMap<org.jboss.tools.central.reddeer.projects.Project, List<String>>(); private static final Logger log = Logger.getLogger(ExamplesOperator.class); private static final String BLACKLIST_ERRORS_REGEXES_FILE = "resources/blacklist-test-errors-regexes.json"; public static JSONObject blacklistErrorsFileContents; @BeforeClass public static void setup() { WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog(); preferenceDialog.open(); JREsPreferencePage jrePreferencePage = new JREsPreferencePage(preferenceDialog); preferenceDialog.select(jrePreferencePage); List<TableItem> tis = new DefaultTable(0).getItems(); for (TableItem ti : tis) { if (ti.getText(0).startsWith("Java SE 8") || ti.getText(0).startsWith("openjdk-1.8")) { ti.setChecked(true); jrePreferencePage.apply(); } } preferenceDialog.ok(); new DefaultToolItem(new WorkbenchShell(), CENTRAL_LABEL).click(); new DefaultEditor(CENTRAL_LABEL); }
Source:
public Coin getBalance(BalanceType balanceType) { lock.lock(); try { if (balanceType == BalanceType.AVAILABLE || balanceType == BalanceType.AVAILABLE_SPENDABLE) { List<TransactionOutput> candidates = calculateAllSpendCandidates(true, balanceType == BalanceType.AVAILABLE_SPENDABLE); CoinSelection selection = DefaultCoinSelector.get().select(NetworkParameters.MAX_MONEY, candidates); return selection.valueGathered; } else if (balanceType == BalanceType.ESTIMATED || balanceType == BalanceType.ESTIMATED_SPENDABLE) { List<TransactionOutput> all = calculateAllSpendCandidates(false, balanceType == BalanceType.ESTIMATED_SPENDABLE); Coin value = Coin.ZERO; for (TransactionOutput out : all) value = value.add(out.getValue()); return value; } else { throw new AssertionError("Unknown balance type"); } } finally { lock.unlock(); } }

Target:
public Coin getBalance(BalanceType balanceType) { lock.lock(); try { if (balanceType == BalanceType.AVAILABLE || balanceType == BalanceType.AVAILABLE_SPENDABLE) { List<TransactionOutput> candidates = calculateAllSpendCandidates(true, balanceType == BalanceType.AVAILABLE_SPENDABLE); CoinSelection selection = coinSelector.select(NetworkParameters.MAX_MONEY, candidates); return selection.valueGathered; } else if (balanceType == BalanceType.ESTIMATED || balanceType == BalanceType.ESTIMATED_SPENDABLE) { List<TransactionOutput> all = calculateAllSpendCandidates(false, balanceType == BalanceType.ESTIMATED_SPENDABLE); Coin value = Coin.ZERO; for (TransactionOutput out : all) value = value.add(out.getValue()); return value; } else { throw new AssertionError("Unknown balance type"); } } finally { lock.unlock(); } }
Source:
public void populateDecisionTable( final GuidedDecisionTable52 dtable, final int maxRowCount ) { if ( this.values.size() < maxRowCount ) { for ( int iRow = this.values.size(); iRow < maxRowCount; iRow++ ) { this.values.add( new DTCellValue52( "" ) ); } } for ( int iRow = 0; iRow < this.values.size(); iRow++ ) { dtable.getData().get( iRow ).add( GuidedDecisionTable52.RULE_NAME_COLUMN_INDEX, this.values.get( iRow ) ); } }

Target:
public void populateDecisionTable(final GuidedDecisionTable52 dtable, final int maxRowCount) { if (values.size() < maxRowCount) { for (int iRow = values.size(); iRow < maxRowCount; iRow++) { values.add(new DTCellValue52("")); } } for (int iRow = 0; iRow < values.size(); iRow++) { dtable.getData().get(iRow).add(GuidedDecisionTable52.RULE_NAME_COLUMN_INDEX, values.get(iRow)); } }
Source:
public static void refreshRadius(IPapyrusEditPart editpart, int defaultCornerWidth, int defaultCornerHeight) { if (editpart.getPrimaryShape() instanceof IRoundedRectangleFigure) { IRoundedRectangleFigure roundedRectangleFigure = (IRoundedRectangleFigure) editpart.getPrimaryShape(); if (((GraphicalEditPart) editpart).getModel() instanceof View) { int width = NotationUtils.getIntValue((View) ((GraphicalEditPart) editpart).getModel(), RADIUS_WIDTH, defaultCornerWidth); int height = NotationUtils.getIntValue((View) ((GraphicalEditPart) editpart).getModel(), RADIUS_HEIGHT, defaultCornerHeight); if (!xor(width == 0, height == 0)) { roundedRectangleFigure.setCornerDimensions(new Dimension(width, height)); } } } }

Target:
public static void refreshRadius(IPapyrusEditPart editpart, int defaultCornerWidth, int defaultCornerHeight) { if (editpart.getPrimaryShape() instanceof IRoundedRectangleFigure) { IRoundedRectangleFigure roundedRectangleFigure = (IRoundedRectangleFigure) editpart.getPrimaryShape(); if (((GraphicalEditPart) editpart).getModel() instanceof View) { int width = NotationUtils.getIntValue((View) ((GraphicalEditPart) editpart).getModel(), RADIUS_WIDTH, defaultCornerWidth); int height = NotationUtils.getIntValue((View) ((GraphicalEditPart) editpart).getModel(), RADIUS_HEIGHT, defaultCornerHeight); roundedRectangleFigure.setCornerDimensions(new Dimension(width, height)); } } }
Source:
private void printSwitchNode(SwitchNode n, Void arg) { printComment(n.getComment(), arg); printer.print("switch("); n.getSelector().accept(this, arg); printer.println(") {"); if (n.getEntries() != null) { if(configuration.isIndentInSwitch()) { printer.indent(); } for (final SwitchEntry e : n.getEntries()) { e.accept(this, arg); } if(configuration.isIndentInSwitch()) { printer.unindent(); } } printer.print("}"); }

Target:
private void printSwitchNode(SwitchNode n, Void arg) { printComment(n.getComment(), arg); printer.print("switch("); n.getSelector().accept(this, arg); printer.println(") {"); if (n.getEntries() != null) { indentIf(configuration.isIndentCaseInSwitch()); for (final SwitchEntry e : n.getEntries()) { e.accept(this, arg); } unindentIf(configuration.isIndentCaseInSwitch()); } printer.print("}"); }
Source:
public Cagemail(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); this.subtype.add("Aura"); TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(2, 2, Duration.WhileOnBattlefield))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockAttachedEffect(AttachmentType.AURA))); }

Target:
public Cagemail(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); this.subtype.add("Aura"); TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); Ability ability1 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(2, 2, Duration.WhileOnBattlefield)); Effect effect = new CantBlockAttachedEffect(AttachmentType.AURA); effect.setText("and can't block."); ability1.addEffect(effect); this.addAbility(ability1); }
Source:
AttemptResult<Void> evaluateResult(List<AttemptResult<Void>> results) { Optional<AttemptResult<Void>> error = results.stream() .filter(it -> it.getState() == AttemptState.BREAK).findFirst(); if (error.isPresent()) { return error.get(); } long count = results.stream().filter(it -> it.getState() == AttemptState.CONTINUE).count(); if (count > 0) { return AttemptResults.justContinue(); } return AttemptResults.finishWith(null); }

Target:
AttemptResult<Void> evaluateResult(List<AttemptResult<Void>> results) { Optional<AttemptResult<Void>> error = results.stream() .filter(it -> it.getState() == AttemptState.BREAK).findFirst(); if (error.isPresent()) { return error.get(); } if (shouldContinue(results)) { return AttemptResults.justContinue(); } return AttemptResults.finishWith(null); }
Source:
private Map<String, List<Pair<VDS, LUNs>>> createLunMap(boolean sameLunSizesPerHost) { RandomUtils rnd = RandomUtils.instance(); String lunId = rnd.nextString(34); int lunSize = rnd.nextInt(); List<Pair<VDS, LUNs>> lunList = new ArrayList<>(); for (int i = 0; i < 10; i++) { LUNs lun = new LUNs(); if (!sameLunSizesPerHost) { lunSize++; } lun.setDeviceSize(lunSize); lunList.add(new Pair<>(new VDS(), lun)); } return new SingletonMap(lunId, lunList); }

Target:
private Map<String, List<Pair<VDS, LUNs>>> createLunMap(boolean sameLunSizesPerHost) { RandomUtils rnd = RandomUtils.instance(); String lunId = rnd.nextString(34); int lunSize = rnd.nextInt(); List<Pair<VDS, LUNs>> lunList = new ArrayList<>(); for (int i = 0; i < 10; i++) { LUNs lun = new LUNs(); if (!sameLunSizesPerHost) { lunSize++; } lun.setDeviceSize(lunSize); lunList.add(new Pair<>(new VDS(), lun)); } return Collections.singletonMap(lunId, lunList); }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length != 1) { return false; } if (args[0].equalsIgnoreCase("purge")) { TFM_Util.adminAction(sender.getName(), "Unblocking commands for all players", true); int counter = 0; for (Player player : server.getOnlinePlayers()) { TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); if (playerdata.allCommandsBlocked()) { counter += 1; playerdata.setCommandsBlocked(false); } } playerMsg("Unblocked commands for " + counter + " players."); return true; } if (args[0].equalsIgnoreCase("-a")) { TFM_PlayerData playerdata; TFM_Util.adminAction(sender.getName(), "Blocking commands for all non-Superadmins.", true); for (Player player : server.getOnlinePlayers()) { if (!TFM_AdminList.isSuperAdmin(player)) { playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setMuted(true); } } } final Player player = getPlayer(args[0]); if (player == null) { playerMsg(TFM_Command.PLAYER_NOT_FOUND); return true; } if (TFM_AdminList.isSuperAdmin(player)) { playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked."); return true; } TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked()); TFM_Util.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true); playerMsg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands."); return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length != 1) { return false; } if (args[0].equalsIgnoreCase("purge")) { TFM_Util.adminAction(sender.getName(), "Unblocking commands for all players", true); int counter = 0; for (Player player : server.getOnlinePlayers()) { TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); if (playerdata.allCommandsBlocked()) { counter += 1; playerdata.setCommandsBlocked(false); } } playerMsg("Unblocked commands for " + counter + " players."); return true; } if (args[0].equalsIgnoreCase("-a")) { TFM_Util.adminAction(sender.getName(), "Blocking commands for all non-superadmins", true); for (Player player : server.getOnlinePlayers()) { if (!TFM_AdminList.isSuperAdmin(player)) { TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setCommandsBlocked(true); } } } final Player player = getPlayer(args[0]); if (player == null) { playerMsg(TFM_Command.PLAYER_NOT_FOUND); return true; } if (TFM_AdminList.isSuperAdmin(player)) { playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked."); return true; } TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked()); TFM_Util.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true); playerMsg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands."); return true; }
Source:
public static void createDBServer() { dsProps = ExecutorTestUtil.getDatasourceProperties(); dsProps.setProperty("url", "jdbc:h2:tcp://localhost/target/jbpm-exec-test;MVCC=TRUE"); PersistenceUtil.startH2TcpServer(dsProps); }

Target:
public static void createDBServer() { dsProps = ExecutorTestUtil.getDatasourceProperties(); dsProps.setProperty("url", "jdbc:h2:tcp://localhost:9123/target/jbpm-exec-test;MVCC=TRUE"); dsProps.setProperty("tcpPort", "9123"); PersistenceUtil.startH2TcpServer(dsProps); }
Source:
private boolean emitNoResolvedType(NoType type, String defaultEmit) { if (!opts.partialInput || !type.isNoResolvedType()) { emit(defaultEmit); return true; } NoResolvedType nType = (NoResolvedType) type; if (nType.getReferenceName() != null) { String displayName = type.getDisplayName(); emit(Constants.INTERNAL_NAMESPACE + "." + displayName); List<JSType> templateTypes = nType.getTemplateTypes(); if (templateTypes != null && templateTypes.size() > 0) { emitGenericTypeArguments(type.getTemplateTypes().iterator()); } } else { emit(defaultEmit); } return false; }

Target:
private void emitNoResolvedType(NoType type, String defaultEmit) { if (!opts.partialInput || !type.isNoResolvedType()) { emit(defaultEmit); return; } NoResolvedType nType = (NoResolvedType) type; if (nType.getReferenceName() == null) { emit(defaultEmit); return; } String displayName = type.getDisplayName(); emit(Constants.INTERNAL_NAMESPACE + "." + displayName); List<JSType> templateTypes = nType.getTemplateTypes(); if (templateTypes != null && templateTypes.size() > 0) { emitGenericTypeArguments(type.getTemplateTypes().iterator()); } }
Source:
private Map<String, Object> getEntityFieldsAsMap(JsonNode node) { Map<String, Object> result = new HashMap<>(); for (Iterator<String> it = node.fieldNames(); it.hasNext();) { String fieldName = it.next(); result.put(fieldName, getEntityFieldAsObject(node, fieldName)); if (fieldName.endsWith(TablesConstants.ODATA_TYPE_KEY_SUFFIX) && TablesConstants.ODATA_TYPE_NULL.equals(node.get(fieldName).asText())) { String nullFieldName = fieldName.substring(0, fieldName.length() - TablesConstants.ODATA_TYPE_KEY_SUFFIX.length()); result.put(nullFieldName, null); } } return result; }

Target:
private Map<String, Object> getEntityFieldsAsMap(JsonNode node) throws IOException { Map<String, Object> result = new HashMap<>(); for (Iterator<String> it = node.fieldNames(); it.hasNext();) { String fieldName = it.next(); result.put(fieldName, getEntityFieldAsObject(node, fieldName)); } return result; }
Source:
public void start(String program) { this.transport.start(program, new HashMap<String, String>()); }

Target:
public void start(String program) { this.transport.start(program, Collections.<String, String> emptyMap()); }
Source:
public void itThrowsAOrmExceptionForOtherErrors() throws Exception { PhoneBookDb p = phoneBook.open(); try { p.updateSchema(executor); String invalidKey = null; final Person.Key pk = new Person.Key(invalidKey); final Person bob = new Person(pk, 18); p.people().insert(Collections.singleton(bob)); fail("Expected " + OrmException.class); } catch (OrmException e) { assertTrue(e.getCause() instanceof SQLException); assertContainsString(e.getMessage(), p.people().getRelationName()); } finally { p.close(); } }

Target:
public void itThrowsAOrmExceptionForOtherErrors() throws Exception { PhoneBookDb p = phoneBook.open(); try { p.updateSchema(executor); String invalidKey = null; final Person.Key pk = new Person.Key(invalidKey); final Person bob = new Person(pk, 18); p.people().insert(Collections.singleton(bob)); fail("Expected " + OrmException.class); } catch (OrmException e) { assertTrue(e.getCause() instanceof SQLException); assertFalse(e instanceof OrmDuplicateKeyException); assertContainsString(e.getMessage(), p.people().getRelationName()); } finally { p.close(); } }
Source:
public void testR2dbcConnectionSuccessful() { try (R2dbcPostgresContainer postgres = (R2dbcPostgresContainer) new R2dbcPostgresContainer() .withInitScript("init_postgresql.sql")) { postgres.start(); R2dbc r2dbc = new R2dbc(postgres.getR2dbcConnectionFactory()); String queryResult = (String) r2dbc.inTransaction(handle -> handle.createQuery("SELECT foo FROM bar").mapResult(result -> result.map((row, metadata) -> row.get("foo"))) ).blockFirst(); assertEquals("Value from init script should equal real value", "hello world", queryResult); } }

Target:
public void testR2dbcConnectionSuccessful() { try (R2dbcPostgresContainer postgres = new R2dbcPostgresContainer() .withInitScript("init_postgresql.sql")) { postgres.start(); R2dbc r2dbc = new R2dbc(postgres.getR2dbcConnectionFactory()); String queryResult = (String) r2dbc.inTransaction(handle -> handle.createQuery("SELECT foo FROM bar").mapResult(result -> result.map((row, metadata) -> row.get("foo"))) ).blockFirst(); assertEquals("Value from init script should equal real value", "hello world", queryResult); } }
Source:
public static ObjectLink decodeObjlnk(byte[] value) throws TlvException { ByteBuffer bff = ByteBuffer.allocate(4).order(ByteOrder.BIG_ENDIAN); LOG.error("received byle length ->" + value.length); bff.put(value); int val1 = bff.getShort(0); int val2 = bff.getShort(2); return new ObjectLink(val1, val2); }

Target:
public static ObjectLink decodeObjlnk(byte[] value) throws TlvException { ByteBuffer bff = ByteBuffer.allocate(4).order(ByteOrder.BIG_ENDIAN); bff.put(value); int val1 = bff.getShort(0); int val2 = bff.getShort(2); return new ObjectLink(val1, val2); }
Source:
public final void start(final Environment env) { startThread(new CommandRunnable() { @Override public void run() throws Failure { parseCommandLine(); boolean ok = true; for (final Change.Id changeId : changeIds) { try { ok = ok && modifyOne(changeId); } catch (Exception e) { ok = false; writeError("fatal: internal server error while modifying reviewers in " + changeId + "\n"); log.error("internal error while modifying reviewers in " + changeId, e); } } if (!ok) { throw new UnloggedFailure(1, "one or more modifications of reviewers failed; review output above"); } } }); }

Target:
public final void start(final Environment env) { startThread(new CommandRunnable() { @Override public void run() throws Failure { parseCommandLine(); if (changeIds.isEmpty()) { writeError("error: You must specify a change"); } boolean ok = true; for (final Change.Id changeId : changeIds) { try { ok = ok && modifyOne(changeId); } catch (Exception e) { ok = false; log.error("internal error while modifying reviewers in " + changeId, e); writeError("fatal: internal server error while modifying " + "reviewers in " + changeId + "\n"); } } if (!ok) { throw error("one or more modifications of reviewers failed; " + "review output above"); } } }); }
Source:
protected final SunrisePageData pageData(final UserContext userContext, final PageContent content, final Http.Context ctx) { final Messages messages = messages(userContext); final PageHeader pageHeader = new PageHeader(content.getAdditionalTitle()); pageHeader.setLocation(new LocationSelector(projectContext(), userContext)); pageHeader.setNavMenu(new NavMenuData(categories(), userContext, reverseRouter(), saleCategoryExtId)); pageHeader.setCustomerServiceNumber(configuration().getString("checkout.customerServiceNumber")); return new SunrisePageData(pageHeader, new PageFooter(), content, getPageMeta(ctx, userContext)); }

Target:
protected final SunrisePageData pageData(final UserContext userContext, final PageContent content, final Http.Context ctx) { final PageHeader pageHeader = new PageHeader(content.getAdditionalTitle()); pageHeader.setLocation(new LocationSelector(projectContext(), userContext)); pageHeader.setNavMenu(new NavMenuData(categoryTree(), userContext, reverseRouter(), saleCategoryExtId.orElse(null))); pageHeader.setMiniCart(new MiniCart(CartSessionUtils.getCartItemCount(session()))); pageHeader.setCustomerServiceNumber(configuration().getString("checkout.customerServiceNumber")); return new SunrisePageData(pageHeader, new PageFooter(), content, getPageMeta(ctx, userContext)); }
Source:
protected <T extends Node> T pop(String location, FragmentBuilder builder, Class<T> cls, String uri) { if (builder == null) { if (log.isLoggable(Level.WARNING)) { log.warning("No fragment builder for this thread (" + Thread.currentThread() + ") - trying to pop node of type: " + cls); } return null; } if (builder.getCurrentNode() == null) { if (log.isLoggable(Level.FINEST)) { log.finest("WARNING: No 'current node' for this thread (" + Thread.currentThread() + ") - trying to pop node of type: " + cls); } return null; } processInContent(location, builder, -1); processOutContent(location, builder, -1); Node node = builder.popNode(cls, uri); if (node != null) { node.setDuration(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()) - node.getBaseTime()); return cls.cast(node); } if (log.isLoggable(Level.FINEST)) { log.finest("Current node (type=" + builder.getCurrentNode().getClass() + ") does not match required cls=" + cls + " and uri=" + uri + " at location=" + location); } return null; }

Target:
protected <T extends Node> T pop(String location, FragmentBuilder builder, Class<T> cls, String uri) { if (builder == null) { if (log.isLoggable(Level.WARNING)) { log.warning("No fragment builder for this thread (" + Thread.currentThread() + ") - trying to pop node of type: " + cls); } return null; } if (builder.getCurrentNode() == null) { if (log.isLoggable(Level.FINEST)) { log.finest("WARNING: No 'current node' for this thread (" + Thread.currentThread() + ") - trying to pop node of type: " + cls); } return null; } processInContent(location, builder, -1); processOutContent(location, builder, -1); Node node = builder.popNode(cls, uri); if (node != null) { node.setDuration(TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - node.getBaseTime()); return cls.cast(node); } if (log.isLoggable(Level.FINEST)) { log.finest("Current node (type=" + builder.getCurrentNode().getClass() + ") does not match required cls=" + cls + " and uri=" + uri + " at location=" + location); } return null; }