auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String getAttributionId(ContentResolver contentResolver) { try { String projection = {ATTRIBUTION_ID_COLUMN_NAME}; Cursor c = contentResolver.query(ATTRIBUTION_ID_CONTENT_URI, projection, null, null, null); if (c == null || !c.moveToFirst()) { if (c != null) { c.close(); } return null; } String attributionId = c.getString(c.getColumnIndex(ATTRIBUTION_ID_COLUMN_NAME)); c.close(); return attributionId; } catch (Exception e) { Log.d(TAG, "Caught unexpected exception in getAttributionId(): " + e.toString()); return null; } }

Target:
public static String getAttributionId(ContentResolver contentResolver) { Cursor c = null; try { String projection = {ATTRIBUTION_ID_COLUMN_NAME}; c = contentResolver.query(ATTRIBUTION_ID_CONTENT_URI, projection, null, null, null); if (c == null || !c.moveToFirst()) { return null; } String attributionId = c.getString(c.getColumnIndex(ATTRIBUTION_ID_COLUMN_NAME)); return attributionId; } catch (Exception e) { Log.d(TAG, "Caught unexpected exception in getAttributionId(): " + e.toString()); return null; } finally { if (c != null) { c.close(); } } }
Source:
public final Response toResponse(T exception) { String message = exception.getMessage(); ResponseBuilder builder = Response.status(status); try { log.error(message, exception); final SerializableError error; if (includeStackTrace) { StackTraceElement[] stackTrace = exception.getStackTrace(); error = SerializableError.of(message, exception.getClass(), Arrays.asList(stackTrace)); } else { String errorId = UUID.randomUUID().toString(); log.error("error has been logged as {}", errorId, exception); error = SerializableError.of(errorId, RuntimeException.class); } builder.type(MediaType.APPLICATION_JSON); String json = MAPPER.writeValueAsString(error); builder.entity(json); } catch (RuntimeException | JsonProcessingException e) { log.warn("Unable to write out exception as json: {}", e.getMessage(), e); builder = Response.status(status); builder.type(MediaType.TEXT_PLAIN); builder.entity(message); } return builder.build(); }

Target:
public final Response toResponse(T exception) { String message = exception.getMessage(); ResponseBuilder builder = Response.status(status); try { final SerializableError error; if (includeStackTrace) { log.error(message, exception); StackTraceElement[] stackTrace = exception.getStackTrace(); error = SerializableError.of(message, exception.getClass(), Arrays.asList(stackTrace)); } else { String errorId = UUID.randomUUID().toString(); log.error("Error {}: {}", errorId, message, exception); error = SerializableError.of(errorId, RuntimeException.class); } builder.type(MediaType.APPLICATION_JSON); String json = MAPPER.writeValueAsString(error); builder.entity(json); } catch (RuntimeException | JsonProcessingException e) { log.warn("Unable to write out exception as json: {}", e.getMessage(), e); builder = Response.status(status); builder.type(MediaType.TEXT_PLAIN); builder.entity(message); } return builder.build(); }
Source:
public void testAddTaxItemsOnNewInvoice() throws Exception { final Account accountJson = createAccountNoPMBundleAndSubscriptionAndWaitForFirstInvoice(); assertEquals(accountApi.getInvoicesForAccount(accountJson.getAccountId(), true, false, false, false, AuditLevel.NONE, requestOptions).size(), 2); final BigDecimal taxAmount = BigDecimal.TEN; final UUID bundleId = UUID.randomUUID(); final InvoiceItem taxItem = new InvoiceItem(); taxItem.setAccountId(accountJson.getAccountId()); taxItem.setAmount(taxAmount); taxItem.setCurrency(accountJson.getCurrency()); taxItem.setBundleId(bundleId); final InvoiceItems input = new InvoiceItems(); input.add(taxItem); final List<InvoiceItem> createdTaxItems = invoiceApi.createTaxItems(accountJson.getAccountId(), input, true, clock.getUTCToday(), NULL_PLUGIN_PROPERTIES, requestOptions); assertEquals(createdTaxItems.size(), 1); final Invoice invoiceWithItems = invoiceApi.getInvoice(createdTaxItems.get(0).getInvoiceId(), true, null, AuditLevel.NONE, requestOptions); assertEquals(invoiceWithItems.getBalance().compareTo(taxAmount), 0); assertEquals(invoiceWithItems.getItems().size(), 1); assertEquals(invoiceWithItems.getItems().get(0).getBundleId(), bundleId); assertEquals(accountApi.getInvoicesForAccount(accountJson.getAccountId(), requestOptions).size(), 3); }

Target:
public void testAddTaxItemsOnNewInvoice() throws Exception { final Account accountJson = createAccountNoPMBundleAndSubscriptionAndWaitForFirstInvoice(); assertEquals(accountApi.getInvoicesForAccount(accountJson.getAccountId(), true, false, false, false, AuditLevel.NONE, requestOptions).size(), 2); final BigDecimal taxAmount = BigDecimal.TEN; final UUID bundleId = UUID.randomUUID(); final InvoiceItem taxItem = new InvoiceItem(); taxItem.setAccountId(accountJson.getAccountId()); taxItem.setAmount(taxAmount); taxItem.setCurrency(accountJson.getCurrency()); taxItem.setBundleId(bundleId); final InvoiceItems input = new InvoiceItems(); input.add(taxItem); final List<InvoiceItem> createdTaxItems = invoiceApi.createTaxItems(accountJson.getAccountId(), input, true, clock.getUTCToday(), NULL_PLUGIN_PROPERTIES, requestOptions); assertEquals(createdTaxItems.size(), 1); final Invoice invoiceWithItems = invoiceApi.getInvoice(createdTaxItems.get(0).getInvoiceId(), true, null, AuditLevel.NONE, requestOptions); assertEquals(invoiceWithItems.getBalance().compareTo(taxAmount), 0); assertEquals(invoiceWithItems.getItems().size(), 1); assertEquals(invoiceWithItems.getItems().get(0).getBundleId(), bundleId); assertEquals(invoiceWithItems.getItems().get(0).getItemType(), InvoiceItemType.TAX); assertEquals(accountApi.getInvoicesForAccount(accountJson.getAccountId(), requestOptions).size(), 3); }
Source:
public void whenSchemaHasRefToOtherSchemaRootWithSameIdItShouldLoadTheTypes() throws Exception { URL jsonSchemaResource = getClass().getClassLoader().getResource("jsonSchema/jsonSchemaWithRefToRootWithSameId.json"); MetaDataModel metaDataModel = modelFactory.buildModel(jsonSchemaResource); Assert.assertThat(metaDataModel, CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); DefaultStructuredMetadataModel model = (DefaultStructuredMetadataModel) metaDataModel; Assert.assertThat(model.getFields().size(), CoreMatchers.is(1)); Assert.assertThat(model.getFields().get(0).getName(), CoreMatchers.is("position")); Assert.assertThat(model.getFields().get(0).getMetaDataModel().getDataType(), CoreMatchers.is(DataType.JSON)); Assert.assertThat(model.getFields().get(0).getMetaDataModel(), CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); assertWarehouseLocationModel((DefaultStructuredMetadataModel) model.getFields().get(0).getMetaDataModel()); }

Target:
public void whenSchemaHasRefToOtherSchemaRootWithSameIdItShouldLoadTheTypes() throws Exception { URL jsonSchemaResource = getClass().getClassLoader().getResource("jsonSchema/jsonSchemaWithRefToRootWithSameId.json"); MetaDataModel metaDataModel = modelFactory.buildModel(jsonSchemaResource); Assert.assertThat(metaDataModel, CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); DefaultStructuredMetadataModel model = (DefaultStructuredMetadataModel) metaDataModel; Assert.assertThat(model.getFields(), IsCollectionWithSize.hasSize(1)); Assert.assertThat(model.getFields().get(0).getName(), CoreMatchers.is("position")); Assert.assertThat(model.getFields().get(0).getMetaDataModel().getDataType(), CoreMatchers.is(DataType.JSON)); Assert.assertThat(model.getFields().get(0).getMetaDataModel(), CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); assertWarehouseLocationModel((DefaultStructuredMetadataModel) model.getFields().get(0).getMetaDataModel()); }
Source:
protected void handleGet(HttpServletRequest req, HttpServletResponse resp, Session session) throws IOException, ServletException { Map<String, String> templateVariableToValue = new HashMap<>(); if (GET_ALL_PROJECT_URI.equals(req.getRequestURI())) { String response = objectMapper.writeValueAsString(projectService.getAllProjects(session.getUser())); this.writeResponse(resp, response); return; } else if (GET_PROJECT_URI_TEMPLATE.match(req.getRequestURI(), templateVariableToValue)) { try { String projectId = templateVariableToValue.get(PROJECT_ID_KEY); try { Integer.parseInt(projectId); } catch (NumberFormatException e) { log.error("Invalid project id: ", projectId); sendErrorResponse(resp, HttpServletResponse.SC_BAD_REQUEST, "Invalid project id"); return; } String response = objectMapper.writeValueAsString(projectService.getProject(projectId)); this.writeResponse(resp, response); } catch (Exception e) { log.error("Exception while fetching project: " + e); sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, "Project id not found"); return; } } else { log.error("Invalid route for projects endpoint: " + req.getRequestURI()); sendErrorResponse(resp, HttpServletResponse.SC_NOT_IMPLEMENTED, "Unsupported projects API " + "endpoint"); return; } }

Target:
protected void handleGet(HttpServletRequest req, HttpServletResponse resp, Session session) throws IOException, ServletException { Map<String, String> templateVariableToValue = new HashMap<>(); if (ALL_PROJECT_URI.equals(req.getRequestURI())) { sendResponse(resp, HttpServletResponse.SC_OK, projectService.getAllProjects(session.getUser())); return; } else if (GET_PROJECT_URI_TEMPLATE.match(req.getRequestURI(), templateVariableToValue)) { try { String projectId = templateVariableToValue.get(PROJECT_ID_KEY); try { Integer.parseInt(projectId); } catch (NumberFormatException e) { log.error("Invalid project id: ", projectId); sendErrorResponse(resp, HttpServletResponse.SC_BAD_REQUEST, "Invalid project id"); return; } sendResponse(resp, HttpServletResponse.SC_OK, projectService.getProject(projectId)); } catch (Exception e) { log.error("Exception while fetching project: " + e); sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, "Project id not found"); return; } } else { log.error("Invalid route for projects endpoint: " + req.getRequestURI()); sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, "Unsupported projects API " + "endpoint"); return; } }
Source:
public void testClippingOfRecordWithDeletion() { final SAMFileHeader header = new SAMFileHeader(); header.addSequence(new SAMSequenceRecord("1", 1000)); final SAMRecord record = new SAMRecord(header); record.setReadPairedFlag(true); record.setCigar( new Cigar(Arrays.asList( new CigarElement(5, CigarOperator.M), new CigarElement(1, CigarOperator.D), new CigarElement(5, CigarOperator.M) ))); record.setReferenceIndex(0); record.setAlignmentStart(1); record.setMateAlignmentStart(5); record.setMateReferenceIndex(0); record.setReadBases("AAAAAAAAAA".getBytes()); final int numToClip = SAMUtils.getNumOverlappingAlignedBasesToClip(record); Assert.assertEquals(numToClip, 6); SAMUtils.clipOverlappingAlignedBases(record, numToClip, false); Assert.assertTrue(record.getCigar().equals(TextCigarCodec.decode("4M6S"))); }

Target:
public void testClippingOfRecordWithDeletion() { final SAMFileHeader header = new SAMFileHeader(); header.addSequence(new SAMSequenceRecord("1", 1000)); final SAMRecord record = new SAMRecord(header); record.setReadPairedFlag(true); record.setCigar(TextCigarCodec.decode("5M1D5M")); record.setReferenceIndex(0); record.setAlignmentStart(1); record.setMateAlignmentStart(5); record.setMateReferenceIndex(0); record.setReadBases("AAAAAAAAAA".getBytes()); final int numToClip = SAMUtils.getNumOverlappingAlignedBasesToClip(record); Assert.assertEquals(numToClip, 6); SAMUtils.clipOverlappingAlignedBases(record, numToClip, false); Assert.assertTrue(record.getCigar().equals(TextCigarCodec.decode("4M6S"))); }
Source:
private void createFiles(String basePath, int numFiles, boolean matchPathFilter) throws IOException { for (int i = 0; i < numFiles; i++) { new File(basePath).mkdirs(); String fileName; if (matchPathFilter) { fileName = pathFilterString + "_" + i; } else { fileName = getRandomStringOfLen(10); } new File(basePath + File.separator + fileName).createNewFile(); } }

Target:
private void createFiles(String basePath, int numFiles, boolean matchPathFilter) throws IOException { new File(basePath).mkdirs(); for (int i = 0; i < numFiles; i++) { String fileName; if (matchPathFilter) { fileName = PATH_FILTER_MATCHED_PREFIX + i; } else { fileName = PATH_FILTER_NOT_MATCHED_PREFIX + i; } new File(basePath + File.separator + fileName).createNewFile(); } }
Source:
public void sendPack(PackStatistics.Accumulator accumulator) throws IOException { if (wantAll.isEmpty()) { preUploadHook.onSendPack(UploadPack.this, wantIds, commonBase); } else { preUploadHook.onSendPack(UploadPack.this, wantAll, commonBase); } msgOut.flush(); PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); @SuppressWarnings("resource") final PackWriter pw = new PackWriter(cfg, walk.getObjectReader(), accumulator); try { configurePackWriter(pw); if (commonBase.isEmpty() && refs != null) { Set<ObjectId> tagTargets = new HashSet<>(); for (Ref ref : refs.values()) { if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); else if (ref.getObjectId() == null) continue; else if (ref.getName().startsWith(Constants.R_HEADS)) tagTargets.add(ref.getObjectId()); } pw.setTagTargets(tagTargets); } preparePack(pw, walk); writePack(pw); if (msgOut != NullOutputStream.INSTANCE) { String msg = pw.getStatistics().getMessage() + '\n'; msgOut.write(Constants.encode(msg)); msgOut.flush(); } } finally { statistics = pw.getStatistics(); if (statistics != null) { postUploadHook.onPostUpload(statistics); } pw.close(); } }

Target:
public void sendPack(PackStatistics.Accumulator accumulator) throws IOException { if (wantAll.isEmpty()) { preUploadHook.onSendPack(UploadPack.this, wantIds, commonBase); } else { preUploadHook.onSendPack(UploadPack.this, wantAll, commonBase); } msgOut.flush(); PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); @SuppressWarnings("resource") final PackWriter pw = new PackWriter(cfg, walk.getObjectReader(), accumulator); try { configurePackWriter(pw); if (commonBase.isEmpty() && refs != null) { Set<ObjectId> tagTargets = new HashSet<>(); for (Ref ref : refs.values()) { if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); else if (ref.getObjectId() == null) { continue; } else if (ref.getName().startsWith(Constants.R_HEADS)) { tagTargets.add(ref.getObjectId()); } } pw.setTagTargets(tagTargets); } preparePack(pw, walk); writePack(pw); if (msgOut != NullOutputStream.INSTANCE) { String msg = pw.getStatistics().getMessage() + '\n'; msgOut.write(Constants.encode(msg)); msgOut.flush(); } } finally { statistics = pw.getStatistics(); if (statistics != null) { postUploadHook.onPostUpload(statistics); } pw.close(); } }
Source:
public void testLogoDetect() throws Exception { LogoDetection.detectLogo("resources/googlework_short.mp4"); String got = bout.toString(); assertThat(got).contains("Description : Google Maps"); assertThat(got).contains("Confidence"); assertThat(got).contains("Start Time Offset"); assertThat(got).contains("End Time Offset"); }

Target:
public void testLogoDetect() throws IOException, ExecutionException, InterruptedException, TimeoutException { LogoDetection.detectLogo("resources/googlework_short.mp4"); String got = bout.toString(); assertThat(got).contains("Description"); assertThat(got).contains("Confidence"); assertThat(got).contains("Start Time Offset"); assertThat(got).contains("End Time Offset"); }
Source:
public Optional<Integer> setMilestone(String repoId, int issueId, String issueTitle, Optional<Integer> issueMilestone) { Issue returnedIssue = getRepoState(repoId).setMilestone(issueId, issueMilestone); if (returnedIssue.getMilestone() == null) return Optional.empty(); return Optional.of(returnedIssue.getMilestone().getNumber()); }

Target:
public Optional<Integer> setMilestone(String repoId, int issueId, String issueTitle, Optional<Integer> issueMilestone) { Issue returnedIssue = getRepoState(repoId).setMilestone(issueId, issueMilestone); return Optional.ofNullable(returnedIssue.getMilestone()) .map(Milestone::getNumber); }
Source:
public static List lookupAllTimeZones() { if (timeZoneList == null) { List timeZones = null; Session session = HibernateFactory.getSession(); timeZones = session.getNamedQuery("RhnTimeZone.loadAll").list(); if (timeZones != null) { Collections.sort(timeZones, new Comparator() { public int compare(Object o1, Object o2) { RhnTimeZone t1 = (RhnTimeZone) o1; RhnTimeZone t2 = (RhnTimeZone) o2; int offSet1 = t1.getTimeZone().getRawOffset(); int offSet2 = t2.getTimeZone().getRawOffset(); if (offSet2 - offSet1 == 0) { return t2.getOlsonName().compareTo(t1.getOlsonName()); } if (offSet1 <= -18000000 && offSet1 >= -36000000 && offSet2 <= -18000000 && offSet2 >= -36000000 && t1.getOlsonName().startsWith("America") && t2.getOlsonName().startsWith("America")) { return offSet2 - offSet1; } if (offSet1 <= -18000000 && offSet1 >= -36000000 && t1.getOlsonName().startsWith("America")) { return -1; } if (offSet2 <= -18000000 && offSet2 >= -36000000 && t2.getOlsonName().startsWith("America")) { return 1; } return offSet1 - offSet2; } } ); } timeZoneList = timeZones; } return timeZoneList; }

Target:
public static List lookupAllTimeZones() { if (timeZoneList == null) { List timeZones = null; Session session = HibernateFactory.getSession(); timeZones = session.getNamedQuery("RhnTimeZone.loadAll").list(); if (timeZones != null) { Collections.sort(timeZones, new Comparator() { public int compare(Object o1, Object o2) { RhnTimeZone t1 = (RhnTimeZone) o1; RhnTimeZone t2 = (RhnTimeZone) o2; Integer offSet1 = t1.getTimeZone().getRawOffset(); Integer offSet2 = t2.getTimeZone().getRawOffset(); if (offSet1 == 0 && offSet2 != 0) { return -1; } if (offSet1 != 0 && offSet2 == 0) { return 1; } if (offSet2.equals(offSet1)) { return t2.getOlsonName().compareTo(t1.getOlsonName()); } return offSet2.compareTo(offSet1); } }); } timeZoneList = timeZones; } return timeZoneList; }
Source:
public void handleCoupleMbusDeviceResponse(final DeviceMessageMetadata deviceMessageMetadata, final MbusChannelElementsResponseDto mbusChannelElementsResponseDto) throws FunctionalException { this.checkAndHandleIfChannelNotFound(mbusChannelElementsResponseDto); final String deviceIdentification = deviceMessageMetadata.getDeviceIdentification(); final SmartMeter gatewayDevice = this.domainHelperService.findSmartMeter(deviceIdentification); this.checkAndHandleChannelOnGateway(gatewayDevice, mbusChannelElementsResponseDto); this.handleChannelFound(deviceMessageMetadata, mbusChannelElementsResponseDto); }

Target:
public void handleCoupleMbusDeviceResponse(final DeviceMessageMetadata deviceMessageMetadata, final MbusChannelElementsResponseDto mbusChannelElementsResponseDto) throws FunctionalException { final String deviceIdentification = deviceMessageMetadata.getDeviceIdentification(); final SmartMeter gatewayDevice = this.domainHelperService.findSmartMeter(deviceIdentification); this.checkAndHandleIfChannelNotFound(mbusChannelElementsResponseDto); this.checkAndHandleChannelOnGateway(gatewayDevice, mbusChannelElementsResponseDto); this.doCoupleMBusDevice(gatewayDevice, mbusChannelElementsResponseDto); }
Source:
private Node processTextNode(Node node, Document doc) { Node localNode = node; String theText = localNode.getNodeValue(); theText = theText.replaceAll(ldquo.toString(), "\""); theText = theText.replaceAll(rdquo.toString(), "\""); theText = theText.replaceAll(lsquo.toString(), "'"); theText = theText.replaceAll(rsquo.toString(), "'"); localNode.setNodeValue(theText); return localNode; }

Target:
private Node processTextNode(Node node, Document doc) { String theText = node.getNodeValue(); theText = theText.replaceAll(ldquo.toString(), "\""); theText = theText.replaceAll(rdquo.toString(), "\""); theText = theText.replaceAll(lsquo.toString(), "'"); theText = theText.replaceAll(rsquo.toString(), "'"); node.setNodeValue(theText); return node; }
Source:
public void processBarrier(CheckpointBarrier receivedBarrier, InputChannelInfo channelInfo) throws IOException { final long barrierId = receivedBarrier.getId(); if (totalNumberOfInputChannels == 1) { markCheckpointStart(receivedBarrier.getTimestamp()); markAlignmentEnd(0); notifyCheckpoint(receivedBarrier); return; } if (LOG.isDebugEnabled()) { LOG.debug("Received barrier for checkpoint from channel {}", barrierId, channelInfo); } CheckpointBarrierCount barrierCount = null; int pos = 0; for (CheckpointBarrierCount next : pendingCheckpoints) { if (next.checkpointId == barrierId) { barrierCount = next; break; } pos++; } if (barrierCount != null) { int numBarriersNew = barrierCount.incrementBarrierCount(); if (numBarriersNew == totalNumberOfInputChannels) { for (int i = 0; i <= pos; i++) { pendingCheckpoints.pollFirst(); } if (!barrierCount.isAborted()) { if (LOG.isDebugEnabled()) { LOG.debug("Received all barriers for checkpoint {}", barrierId); } markAlignmentEnd(); notifyCheckpoint(receivedBarrier); } } } else { if (barrierId > latestPendingCheckpointID) { markCheckpointStart(receivedBarrier.getTimestamp()); latestPendingCheckpointID = barrierId; pendingCheckpoints.addLast(new CheckpointBarrierCount(barrierId)); if (pendingCheckpoints.size() > MAX_CHECKPOINTS_TO_TRACK) { pendingCheckpoints.pollFirst(); } } } }

Target:
public void processBarrier(CheckpointBarrier receivedBarrier, InputChannelInfo channelInfo) throws IOException { final long barrierId = receivedBarrier.getId(); if (totalNumberOfInputChannels == 1) { markAlignmentStartAndEnd(receivedBarrier.getTimestamp()); notifyCheckpoint(receivedBarrier); return; } if (LOG.isDebugEnabled()) { LOG.debug("Received barrier for checkpoint from channel {}", barrierId, channelInfo); } CheckpointBarrierCount barrierCount = null; int pos = 0; for (CheckpointBarrierCount next : pendingCheckpoints) { if (next.checkpointId == barrierId) { barrierCount = next; break; } pos++; } if (barrierCount != null) { int numBarriersNew = barrierCount.incrementBarrierCount(); if (numBarriersNew == totalNumberOfInputChannels) { for (int i = 0; i <= pos; i++) { pendingCheckpoints.pollFirst(); } if (!barrierCount.isAborted()) { if (LOG.isDebugEnabled()) { LOG.debug("Received all barriers for checkpoint {}", barrierId); } markAlignmentEnd(); notifyCheckpoint(receivedBarrier); } } } else { if (barrierId > latestPendingCheckpointID) { markAlignmentStart(receivedBarrier.getTimestamp()); latestPendingCheckpointID = barrierId; pendingCheckpoints.addLast(new CheckpointBarrierCount(barrierId)); if (pendingCheckpoints.size() > MAX_CHECKPOINTS_TO_TRACK) { pendingCheckpoints.pollFirst(); } } } }
Source:
protected void maybeCommitOffsets(Consumer<?, ?> consumer, boolean hardCommit) { if (_isFlushlessModeEnabled) { boolean isTimeToCommit = System.currentTimeMillis() - _lastCommittedTime > _offsetCommitInterval; if (hardCommit) { LOG.info("Calling flush on the producer."); _datastreamTask.getEventProducer().flush(); commitWithRetries(consumer, Optional.empty()); _flushlessProducer.clear(); _lastCommittedTime = System.currentTimeMillis(); } else if (isTimeToCommit) { LOG.info("Trying to commit offsets."); Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>(); for (TopicPartition tp : consumer.assignment()) { _flushlessProducer.getAckCheckpoint(tp.topic(), tp.partition()) .ifPresent(o -> offsets.put(tp, new OffsetAndMetadata(o + 1))); } commitWithRetries(consumer, Optional.of(offsets)); _lastCommittedTime = System.currentTimeMillis(); } } else { super.maybeCommitOffsets(consumer, hardCommit); } }

Target:
protected void maybeCommitOffsets(Consumer<?, ?> consumer, boolean hardCommit) { if (_isFlushlessModeEnabled) { boolean isTimeToCommit = System.currentTimeMillis() - _lastCommittedTime > _offsetCommitInterval; if (hardCommit) { LOG.info("Calling flush on the producer."); _datastreamTask.getEventProducer().flush(); commitSafeOffsets(consumer); _flushlessProducer.clear(); } else if (isTimeToCommit) { commitSafeOffsets(consumer); } } else { super.maybeCommitOffsets(consumer, hardCommit); } }
Source:
synchronized ClientJobState getClientJobState(JobId jobId) { if (!jobsMap.containsKey(jobId)) { List<InternalJob> internalJobs = dbManager.loadInternalJob(Arrays.asList(jobId.longValue())); if (!internalJobs.isEmpty()) { InternalJob internalJob = internalJobs.get(0); ClientJobState clientJobState = new ClientJobState(internalJob); jobsMap.put(jobId, clientJobState); } } return jobsMap.get(jobId); }

Target:
synchronized ClientJobState getClientJobState(JobId jobId) { if (!jobsMap.containsKey(jobId)) { if (!finishedJobsLRUCache.containsKey(jobId)) { List<InternalJob> internalJobs = dbManager.loadInternalJob(jobId.longValue()); if (!internalJobs.isEmpty()) { InternalJob internalJob = internalJobs.get(0); ClientJobState clientJobState = new ClientJobState(internalJob); finishedJobsLRUCache.put(jobId, clientJobState); } } return finishedJobsLRUCache.get(jobId); } else { return jobsMap.get(jobId); } }
Source:
public void testGetWorkflows() throws IOException { System.out.println("End test :" + TestHelper.getTestMethodName()); String body = get("clusters/" + CLUSTER_NAME + "/workflows", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); String workflowsStr = node.get(WorkflowAccessor.WorkflowProperties.Workflows.name()).toString(); Set<String> workflows = OBJECT_MAPPER.readValue(workflowsStr, OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, String.class)); Assert.assertEquals(workflows, _workflowMap.get(CLUSTER_NAME).keySet()); System.out.println("End test :" + TestHelper.getTestMethodName()); }

Target:
public void testGetWorkflows() throws IOException { System.out.println("Start test :" + TestHelper.getTestMethodName()); String body = get("clusters/" + CLUSTER_NAME + "/workflows", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); String workflowsStr = node.get(WorkflowAccessor.WorkflowProperties.Workflows.name()).toString(); Set<String> workflows = OBJECT_MAPPER.readValue(workflowsStr, OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, String.class)); Assert.assertEquals(workflows, _workflowMap.get(CLUSTER_NAME).keySet()); System.out.println("End test :" + TestHelper.getTestMethodName()); }
Source:
public UploadImagePopupView(EventBus eventBus) { super(eventBus); vmDiskPopupWidget = new VmDiskPopupWidget(false); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); localize(); driver.initialize(this); }

Target:
public UploadImagePopupView(EventBus eventBus) { super(eventBus); vmDiskPopupWidget = new VmDiskPopupWidget(false); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); localize(); UploadImagePopupView.ViewIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); }
Source:
public void testNullIdsForInputTransformers() throws Exception { List<ServiceReference<InputTransformer>> serviceReferences = new ArrayList<>(); ServiceReference<InputTransformer> serviceReference = mock(ServiceReference.class); serviceReferences.add(serviceReference); List<ServiceReference<InputTransformer>> serviceReferencesFiltered = serviceReferences .stream() .filter(ref -> ref.getProperty(Constants.SERVICE_ID) != null) .collect(Collectors.toList()); when(serviceReference.getProperty(SERVICE_ID)).thenReturn(null); when(bundleContext.getServiceReferences(InputTransformer.class, "(id=*)")) .thenReturn(serviceReferencesFiltered); transformersCommand.inputOption = true; transformersCommand.executeWithSubject(); assertThat( consoleOutput.getOutput(), containsString(TransformersCommand.getNoActiveString(TransformersCommand.INPUT))); }

Target:
public void testNullIdsForInputTransformers() throws Exception { List<ServiceReference<InputTransformer>> serviceReferences = new ArrayList<>(); ServiceReference<InputTransformer> serviceReference = mock(ServiceReference.class); serviceReferences.add(serviceReference); List<ServiceReference<InputTransformer>> serviceReferencesFiltered = serviceReferences .stream() .filter(ref -> ref.getProperty(Constants.SERVICE_ID) != null) .collect(Collectors.toList()); when(serviceReference.getProperty(SERVICE_ID)).thenReturn(null); when(bundleContext.getServiceReferences(InputTransformer.class, FILTER)) .thenReturn(serviceReferencesFiltered); transformersCommand.setInputOption(true); transformersCommand.executeWithSubject(); assertThat( consoleOutput.getOutput(), containsString(String.format("%s%n%n", "There are no active Input transformers"))); }
Source:
public void update() { if(worldObj.isRemote) { return; } battery.tick(getWorld(), getPos()); battery.addPower(1000); EnumFacing currentSide = (EnumFacing) worldObj.getBlockState(pos).getProperties().get(BlockBCBase_Neptune.BLOCK_FACING_6); int target = 100000; if(currentSide == EnumFacing.UP.getOpposite()) { progress += 1000; } progress += battery.extractPower(0, target - progress); if (progress >= target) { progress = 0; int radius = 3; BlockPos offset = new BlockPos(currentSide.getDirectionVec()); offset = new BlockPos(offset.getX() * radius, offset.getY() * radius, offset.getZ() * radius); AxisAlignedBB aabb = new AxisAlignedBB(this.pos, this.pos).expandXyz(radius).offset(offset); List<EntityItem> entityItems = worldObj.getEntitiesWithinAABB(EntityItem.class, aabb); int index = 0, max = 3; for(EntityItem entityItem : entityItems) { ItemStack stack = entityItem.getEntityItem(); stack = ItemTransactorHelper.getTransactor(this, currentSide).insert(stack, false, false); if(stack == null) { entityItem.setDead(); } else { entityItem.setEntityItemStack(stack); } if(index++ >= max) { break; } } } putInInventories(currentSide); }

Target:
public void update() { if (worldObj.isRemote) { return; } if (!(worldObj.getBlockState(pos).getBlock() instanceof BlockChute)) { return; } battery.tick(getWorld(), getPos()); battery.addPower(1000); EnumFacing currentSide = worldObj.getBlockState(pos).getValue(BlockBCBase_Neptune.BLOCK_FACING_6); int target = 100000; if (currentSide == EnumFacing.UP.getOpposite()) { progress += 1000; } progress += battery.extractPower(0, target - progress); if (progress >= target) { progress = 0; putItemsFromGround(currentSide); } putInInventories(currentSide); }
Source:
public UserInfo[] getBrokerUsers() throws OperationCanceledException, AuthenticatorException, IOException { if (mBrokerProxy != null) { return mBrokerProxy.getBrokerUsers(); } return null; }

Target:
public UserInfo[] getBrokerUsers() throws OperationCanceledException, AuthenticatorException, IOException { return mBrokerProxy != null ? mBrokerProxy.getBrokerUsers() : null; }
Source:
public void visitCaseClause(CaseClauseTree tree) { ExpressionTree expression = tree.expression(); if (expression.is(Kind.COMMA_OPERATOR)) { int nbCommas = getNumberOfCommas(expression); String lastCase = ((BinaryExpressionTree)expression).rightOperand().toString(); String msg = String.format(MESSAGE, nbCommas + 1, lastCase); addIssue(expression, msg); } super.visitCaseClause(tree); }

Target:
public void visitCaseClause(CaseClauseTree tree) { ExpressionTree expression = tree.expression(); if (expression.is(Kind.COMMA_OPERATOR)) { int nbCommas = getNumberOfCommas(expression); ExpressionTree rightOperand = ((BinaryExpressionTree)expression).rightOperand(); String lastCase = CheckUtils.asString(rightOperand); String msg = String.format(MESSAGE, nbCommas + 1, lastCase); addIssue(expression, msg); } super.visitCaseClause(tree); }
Source:
public static String updateLocationEndpointInWsdl(InputStream wsdlStream, URL managedEndpoint, ApiVersionBean apiVersion, IStorage storage) throws StorageException { Document document = readWsdlInputStream(wsdlStream); Boolean updateStorage = false; for(int i = 0; i < SOAP_ADDRESS.length;i++) { NodeList nodeList = document.getDocumentElement().getElementsByTagName(SOAP_ADDRESS[i]); if (nodeList != null) { for (int j = 0; j < nodeList.getLength(); j++) { Node node = nodeList.item(j); String location = node.getAttributes().getNamedItem(LOCATION).getNodeValue(); String endpoint = managedEndpoint.toString(); if (!location.equals(endpoint)) { node.getAttributes().getNamedItem(LOCATION).setNodeValue(managedEndpoint.toString()); updateStorage = true; } } } } String wsdl = xmlDocumentToString(document); if (updateStorage) storage.updateApiDefinition(apiVersion, new ByteArrayInputStream(wsdl.getBytes(StandardCharsets.UTF_8))); return wsdl; }

Target:
public static String updateLocationEndpointInWsdl(InputStream wsdlStream, URL managedEndpoint, ApiVersionBean apiVersion, IStorage storage) throws StorageException { Document document = readWsdlInputStream(wsdlStream); Boolean updateStorage = false; for(int i = 0; i < SOAP_ADDRESS.length;i++) { NodeList nodeList = document.getDocumentElement().getElementsByTagName(SOAP_ADDRESS[i]); if (nodeList != null) { for (int j = 0; j < nodeList.getLength(); j++) { Node node = nodeList.item(j); String location = node.getAttributes().getNamedItem(LOCATION).getNodeValue(); String endpoint = managedEndpoint.toString(); if (!location.equals(endpoint)) { node.getAttributes().getNamedItem(LOCATION).setNodeValue(managedEndpoint.toString()); updateStorage = true; } } } } String wsdl = xmlDocumentToString(document); if (updateStorage) { storage.updateApiDefinition(apiVersion, new ByteArrayInputStream(wsdl.getBytes(StandardCharsets.UTF_8))); } return wsdl; }
Source:
public void addListener_triggeredByLocalCommit() { final SharedRealm sharedRealm = getSharedRealm(); Table table = sharedRealm.getTable("test_table"); final AtomicInteger listenerCounter = new AtomicInteger(0); final AtomicBoolean transactionCommitted = new AtomicBoolean(false); final Collection collection = new Collection(sharedRealm, table.where()); looperThread.keepStrongReference.add(collection); collection.addListener(collection, new RealmChangeListener<Collection>() { @Override public void onChange(Collection collection1) { switch (listenerCounter.getAndIncrement()) { case 0: assertEquals(collection1.size(), 4); break; case 1: assertFalse(transactionCommitted.get()); assertEquals(collection1.size(), 5); sharedRealm.close(); break; } } }); addRow(sharedRealm); transactionCommitted.set(true); looperThread.testComplete(); }

Target:
public void addListener_triggeredByLocalCommit() { final SharedRealm sharedRealm = getSharedRealm(); Table table = sharedRealm.getTable("test_table"); final AtomicInteger listenerCounter = new AtomicInteger(0); final Collection collection = new Collection(sharedRealm, table.where()); looperThread.keepStrongReference.add(collection); collection.addListener(collection, new RealmChangeListener<Collection>() { @Override public void onChange(Collection collection1) { switch (listenerCounter.getAndIncrement()) { case 0: assertEquals(collection1.size(), 4); break; case 1: assertEquals(collection1.size(), 5); sharedRealm.close(); break; default: fail(); break; } } }); addRow(sharedRealm); assertEquals(2, listenerCounter.get()); looperThread.testComplete(); }
Source:
public static boolean addPatientCorrelationPLQRecords(PatientLocationQueryResponseType plqRecords) { dao = new CorrelatedIdentifiersDaoImpl(); boolean result = false; for(PatientLocationResponse rec : plqRecords.getPatientLocationResponse()){ if(null != rec.getCorrespondingPatientId() && null != rec.getRequestedPatientId()){ AssigningAuthorityHomeCommunityMappingDAO mappingDao = new AssigningAuthorityHomeCommunityMappingDAO(); CorrelatedIdentifiers newId = new CorrelatedIdentifiers(); newId.setRlsId(rec.getHomeCommunityId()); newId.setCorrelatedPatientId(rec.getCorrespondingPatientId().getExtension()); newId.setCorrelatedPatientAssigningAuthorityId(rec.getCorrespondingPatientId().getRoot()); newId.setPatientId(rec.getRequestedPatientId().getExtension()); newId.setPatientAssigningAuthorityId(rec.getRequestedPatientId().getRoot()); dao.addPatientCorrelation(newId); mappingDao.storeMapping(rec.getHomeCommunityId(), rec.getHomeCommunityId()); result = true; } } return result; }

Target:
public static boolean addPatientCorrelationPLQRecords(PatientLocationQueryResponseType plqRecords) { CorrelatedIdentifiersDao dao = new CorrelatedIdentifiersDaoImpl(); boolean result = false; for(PatientLocationResponse rec : plqRecords.getPatientLocationResponse()){ if(null != rec.getCorrespondingPatientId() && null != rec.getRequestedPatientId()){ AssigningAuthorityHomeCommunityMappingDAO mappingDao = new AssigningAuthorityHomeCommunityMappingDAO(); CorrelatedIdentifiers newId = new CorrelatedIdentifiers(); newId.setRlsId(rec.getHomeCommunityId()); newId.setCorrelatedPatientId(rec.getCorrespondingPatientId().getExtension()); newId.setCorrelatedPatientAssigningAuthorityId(rec.getCorrespondingPatientId().getRoot()); newId.setPatientId(rec.getRequestedPatientId().getExtension()); newId.setPatientAssigningAuthorityId(rec.getRequestedPatientId().getRoot()); dao.addPatientCorrelation(newId); mappingDao.storeMapping(rec.getHomeCommunityId(), rec.getHomeCommunityId()); result = true; } } return result; }
Source:
void shouldThrowExceptionWhenTheDefaultJobTimeoutIsNotValid() { String defaultJobTimeout = "foo"; CreateOrUpdateDefaultJobTimeoutCommand command = new CreateOrUpdateDefaultJobTimeoutCommand(defaultJobTimeout); cruiseConfig.server().setJobTimeout(defaultJobTimeout); assertThatCode(() -> command.isValid(cruiseConfig)) .isInstanceOf(GoConfigInvalidException.class) .hasMessage("Timeout should be a valid number as it represents number of minutes"); }

Target:
void shouldThrowExceptionWhenTheDefaultJobTimeoutIsNotValid() throws Exception { String defaultJobTimeout = "foo"; CreateOrUpdateDefaultJobTimeoutCommand command = new CreateOrUpdateDefaultJobTimeoutCommand(defaultJobTimeout); command.update(cruiseConfig); assertThatCode(() -> command.isValid(cruiseConfig)) .isInstanceOf(GoConfigInvalidException.class) .hasMessage("Timeout should be a valid number as it represents number of minutes"); }
Source:
public MessageStoringChannel() { this.setBeanName("input"); }

Target:
public MessageStoringChannel() { this.setBeanName(INPUT); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); } this.setContentView(R.layout.main); if (savedInstanceState == null) { Uri uri = BaseballCardContract.getUri(this.getPackageName()); Cursor cursor = this.getContentResolver().query(uri, BaseballCardContract.PROJECTION, null, null, null); FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); ft.add(R.id.fragment_holder, new BaseballCardList(), FragmentTags.CARD_LIST) .addToBackStack(null) .commit(); if (cursor == null || cursor.getCount() == 0) { this.getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_holder, new BaseballCardDetails(), FragmentTags.EDIT_CARD) .addToBackStack(FragmentTags.EDIT_CARD).commit(); } cursor.close(); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } } prefs = getSharedPreferences(SharedPreferenceKeys.PREFS, MODE_PRIVATE); showSurvey1Dialog(); showSurvey2Dialog(); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); } this.setContentView(R.layout.main); fragmentManager = getSupportFragmentManager(); if (savedInstanceState == null) { fragmentManager.beginTransaction() .add(R.id.fragment_holder, new BaseballCardList(), FragmentTags.CARD_LIST) .addToBackStack(FragmentTags.CARD_LIST) .commit(); fragmentManager.addOnBackStackChangedListener(this); } prefs = getSharedPreferences(SharedPreferenceKeys.PREFS, MODE_PRIVATE); showSurvey1Dialog(); showSurvey2Dialog(); }
Source:
void oneFiringUnitVsOneTargetableUnitMakesOneFiringGroup() { final Unit targetUnit = givenAnyUnit(); final Unit fireUnit = givenAnyUnit(); final List<FiringGroup> firingGroups = FiringGroupSplitterGeneral.of(OFFENSE, unit -> true, UNITS) .apply( givenBattleStateBuilder() .gameData(givenGameData().withAlliedAirIndependent(true).build()) .attacker(attacker) .defender(defender) .attackingUnits(List.of(fireUnit)) .defendingUnits(List.of(targetUnit)) .build()); assertThat(firingGroups, hasSize(1)); assertThat(firingGroups.get(0).getDisplayName(), is(UNITS)); assertThat(firingGroups.get(0).getFiringUnits(), contains(fireUnit)); assertThat(firingGroups.get(0).getTargetUnits(), contains(targetUnit)); assertThat(firingGroups.get(0).isSuicideOnHit(), is(false)); }

Target:
void oneFiringUnitVsOneTargetableUnitMakesOneFiringGroup() { final Unit targetUnit = givenAnyUnit(); final Unit fireUnit = givenAnyUnit(); final List<FiringGroup> firingGroups = FiringGroupSplitterGeneral.of( OFFENSE, FiringGroupSplitterGeneral.Type.OFFENSIVE_NORMAL, UNITS) .apply( givenBattleStateBuilder() .gameData(givenGameData().withAlliedAirIndependent(true).build()) .attacker(attacker) .defender(defender) .attackingUnits(List.of(fireUnit)) .defendingUnits(List.of(targetUnit)) .build()); assertThat(firingGroups, hasSize(1)); assertThat(firingGroups.get(0).getDisplayName(), is(UNITS)); assertThat(firingGroups.get(0).getFiringUnits(), contains(fireUnit)); assertThat(firingGroups.get(0).getTargetUnits(), contains(targetUnit)); assertThat(firingGroups.get(0).isSuicideOnHit(), is(false)); }
Source:
private void assertNotAMember(String organizationUuid, UserDto user) { assertThat(dbClient.organizationMemberDao().select(dbSession, organizationUuid, user.getId())).isNotPresent(); assertThat(userIndex.getNullableByLogin(user.getLogin()).organizationUuids()).doesNotContain(organizationUuid); }

Target:
private void assertNotAMember(String organizationUuid, UserDto user) { assertThat(dbClient.organizationMemberDao().select(dbSession, organizationUuid, user.getId())).isNotPresent(); assertThat(userIndex.search(UserQuery.builder().setOrganizationUuid(organizationUuid).setTextQuery(user.getLogin()).build(), new SearchOptions()).getDocs()).isEmpty(); }
Source:
public void setRelativeCoordinatesToPreviousPoint(float previousX, float previousY) { relativeX = Math.round(this.xCoord * DSTFileConstants.STITCH_POINT_UNIT_FACTOR) - Math.round(previousX * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); relativeY = Math.round(this.yCoord * DSTFileConstants.STITCH_POINT_UNIT_FACTOR) - Math.round(previousY * DSTFileConstants.STITCH_POINT_UNIT_FACTOR); setDSTPointBytes(); }

Target:
public void setRelativeCoordinatesToPreviousPoint(float previousX, float previousY) { relativeX = toEmbroideryUnit(xCoord) - toEmbroideryUnit(previousX); relativeY = toEmbroideryUnit(yCoord) - toEmbroideryUnit(previousY); }
Source:
public void theRetrieveAdministrativeStatusRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }

Target:
public void theRetrieveAdministrativeStatusRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
public static ItemStack setupNewMap(World worldIn, double worldX, double worldZ, byte scale, boolean trackingPosition, boolean unlimitedTracking) { ItemStack itemstack = new ItemStack(CUSTOM_MAP, 1, worldIn.getUniqueDataId(PREFIX)); String s = PREFIX + "_" + itemstack.getMetadata(); MapData mapdata = new MapData(s); worldIn.setData(s, mapdata); mapdata.scale = scale; mapdata.calculateMapCenter(worldX, worldZ, mapdata.scale); mapdata.dimension = worldIn.provider.getDimension(); mapdata.trackingPosition = trackingPosition; mapdata.unlimitedTracking = unlimitedTracking; mapdata.markDirty(); return itemstack; }

Target:
public static ItemStack setupNewMap(World worldIn, double worldX, double worldZ, byte scale, boolean trackingPosition, boolean unlimitedTracking) { ItemStack itemstack = new ItemStack(CUSTOM_MAP, 1, worldIn.getUniqueDataId(PREFIX)); String s = PREFIX + "_" + itemstack.getMetadata(); MapData mapdata = new CustomMapData(s); worldIn.setData(s, mapdata); mapdata.scale = scale; mapdata.calculateMapCenter(worldX, worldZ, mapdata.scale); mapdata.dimension = worldIn.provider.getDimension(); mapdata.trackingPosition = trackingPosition; mapdata.unlimitedTracking = unlimitedTracking; mapdata.markDirty(); return itemstack; }
Source:
private FmsUser umsUserToUser(User umsUser) { FmsUser fmsUser = new FmsUser(); fmsUser.withName(umsUser.getWorkloadUsername()); fmsUser.withFirstName(getOrDefault(umsUser.getFirstName(), "None")); fmsUser.withLastName(getOrDefault(umsUser.getLastName(), "None")); fmsUser.withAzureObjectId(getOptionalAzureObjectId(umsUser.getCloudIdentitiesList())); return fmsUser; }

Target:
private FmsUser umsUserToUser(User umsUser) { FmsUser fmsUser = new FmsUser(); fmsUser.withName(umsUser.getWorkloadUsername()); fmsUser.withFirstName(getOrDefault(umsUser.getFirstName(), "None")); fmsUser.withLastName(getOrDefault(umsUser.getLastName(), "None")); return fmsUser; }
Source:
public String generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); org.ovirt.engine.api.model.GraphicsType type = org.ovirt.engine.api.model.GraphicsType.valueOf(consoleString); GraphicsType graphicsType = getMappingLocator().getMapper(org.ovirt.engine.api.model.GraphicsType.class, GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, new ConfigureConsoleOptionsParams(consoleOptions, true)).getReturnValue(); return runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); }

Target:
public Response generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); GraphicsType type = GraphicsType.valueOf(consoleString); org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = getMappingLocator().getMapper(GraphicsType.class, org.ovirt.engine.core.common.businessentities.GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, new ConfigureConsoleOptionsParams(consoleOptions, true)).getReturnValue(); String descriptor = runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); Response.ResponseBuilder builder = Response.ok(descriptor.getBytes(), ApiMediaType.APPLICATION_X_VIRT_VIEWER); return builder.build(); }
Source:
protected int getTotalCount() throws ServerException { try { return ((Number) managerProvider.get().createNamedQuery("User.getTotalCount").getSingleResult()).intValue(); } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }

Target:
protected long getTotalCount() throws ServerException { try { return managerProvider.get().createNamedQuery("User.getTotalCount", Long.class).getSingleResult(); } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }