auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCreateEncounterPostActionParameter() throws InterruptedException { Task task = prepareCreateEncounterPostActionParameterTask(); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); activateTrigger(); assertTrue(waitForTaskExecution(task.getId())); Encounter encounter = encounterService.getLatestEncounterByPatientMotechId(DEFAULT_CONFIG_NAME, "654", createdEncounterType.getName()); String firstEncounterUuid = encounter.getUuid(); Patient patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "Jacob Lee"); Person.Address address = patient.getPerson().getPreferredAddress(); assertEquals(firstEncounterUuid, address.getAddress1()); }

Target:
public void testCreateEncounterPostActionParameter() throws InterruptedException { Task task = prepareCreateEncounterPostActionParameterTask(); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); activateTrigger(); assertTrue(waitForTaskExecution(task.getId())); Encounter encounter = encounterService.getLatestEncounterByPatientMotechId(DEFAULT_CONFIG_NAME, createdPatient.getMotechId(), createdEncounterType.getName()); String firstEncounterUuid = encounter.getUuid(); Patient patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "Jacob Lee"); Person.Address address = patient.getPerson().getPreferredAddress(); assertEquals(firstEncounterUuid, address.getAddress1()); }
Source:
public void validate(String name, List<String> objectIds) throws ParameterException { if (objectIds == null) { return; } for (val id : objectIds) { if (tryParse(id) == null) { parameterException(name, id, "is not a valid UUID"); } } }

Target:
public void validate(String name, List<String> objectIds) throws ParameterException { if (objectIds == null) { return; } for (val objectId : objectIds) { if (tryParse(objectId) == null) { parameterException(name, objectId, "is not a valid UUID"); } } }
Source:
private void validateGenotypes() { if ( this.genotypes == null ) throw new IllegalStateException("Genotypes is null"); for ( int i = 0; i < genotypes.size(); i++ ) { if ( genotypes.get(i).isAvailable() ) { for ( Allele gAllele : genotypes.get(i).getAlleles() ) { if ( ! hasAllele(gAllele) && gAllele.isCalled() ) throw new IllegalStateException("Allele in genotype " + gAllele + " not in the variant context " + alleles); } } } }

Target:
private void validateGenotypes() { if ( this.genotypes == null ) throw new IllegalStateException("Genotypes is null"); for ( int i = 0; i < genotypes.size(); i++ ) { Genotype genotype = genotypes.get(i); if ( genotype.isAvailable() ) { final List<Allele> alleles = genotype.getAlleles(); for ( int j = 0, size = alleles.size(); j < size; j++ ) { final Allele gAllele = alleles.get(j); if ( ! hasAllele(gAllele) && gAllele.isCalled() ) throw new IllegalStateException("Allele in genotype " + gAllele + " not in the variant context " + alleles); } } } }
Source:
public String postInBody(String restPath, String bodyContent){ HttpPost post = new HttpPost(prepareRequestURL(restPath)); try { StringEntity entity = new StringEntity(bodyContent); post.setEntity(entity); HttpResponse response = httpclient.execute(post); String result = EntityUtils.toString(response.getEntity()); return result; }catch (ClientProtocolException e) { return null; } catch (UnsupportedEncodingException e) { return null; } catch (IOException e) { return null; } }

Target:
public String postInBody(String restPath, String bodyContent){ log.info("Posting request for " + this.serviceURL + restPath); HttpPost post = new HttpPost(prepareRequestURL(restPath)); String result = ""; try { StringEntity entity = new StringEntity(bodyContent); post.setEntity(entity); HttpResponse response = httpclient.execute(post); result = EntityUtils.toString(response.getEntity()); }catch (ClientProtocolException e) { log.error("ClientProtocolException", e); } catch (UnsupportedEncodingException e) { log.error("UnsupportedEncodingException", e); } catch (IOException e) { log.error("IOException", e); } return result; }
Source:
public static String get() { return getVersionFromStatic(); }

Target:
public static String get() { return INSTANCE.getVersion(); }
Source:
public <T, U> InternalRemoteCache<T, U> withDataFormat(DataFormat dataFormat) { InternalRemoteCache<T, U> newCache = delegate.withDataFormat(dataFormat); if (newCache != delegate) { return newDelegatingCache(newCache); } return (InternalRemoteCache) this; }

Target:
public <T, U> InternalRemoteCache<T, U> withDataFormat(DataFormat dataFormat) { InternalRemoteCache<T, U> newCache = delegate.withDataFormat(dataFormat); if (newCache != delegate) { return newDelegatingCache(newCache); } return (InternalRemoteCache<T, U>) this; }
Source:
public void deleteCollectionDefaultItemReadGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); String itemGroupString = "ITEM"; int defaultItemRead = Constants.DEFAULT_ITEM_READ; Group role = createDefaultReadGroup(itemGroupString, defaultItemRead); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isUnauthorized()); }

Target:
public void deleteCollectionDefaultItemReadGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); String itemGroupString = "ITEM"; int defaultItemRead = Constants.DEFAULT_ITEM_READ; Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(role.getID(), role.getName()))); }
Source:
@Override public SignInPage typeUsername(String username) { fillInput(usernameField, username); return this; }

Target:
public SignInPage typeUsername(String username) { fillInput(usernameField, username); return this; }
Source:
void handleJobCompletion(final JobFinishedEvent event) throws GenieException { final long start = System.nanoTime(); final String jobId = event.getId(); final Map<String, String> tags = Maps.newHashMap(); try { final Job job = retryTemplate.execute(context -> getJob(jobId)); final JobStatus status = job.getStatus(); if (status == JobStatus.INIT || status == JobStatus.RUNNING) { try { retryTemplate.execute(context -> updateJob(job, event, tags)); } catch (Exception e) { log.error("Failed updating for job: {}", jobId, e); tags.put(ERROR_TAG, "JOB_UPDATE_FAILURE"); finalStatusUpdateFailureRate.increment(); } try { retryTemplate.execute(context -> processJobDir(job)); } catch (Exception e) { log.error("Failed archiving directory for job: {}", jobId, e); tags.put(ERROR_TAG, "JOB_DIRECTORY_FAILURE"); archivalFailureRate.increment(); } try { retryTemplate.execute(context -> sendEmail(jobId)); } catch (Exception e) { log.error("Failed sending email for job: {}", jobId, e); tags.put(ERROR_TAG, "SEND_EMAIL_FAILURE"); emailFailureRate.increment(); } } } catch (Exception e) { log.error("Failed getting job with id: {}", jobId, e); tags.put(ERROR_TAG, "GET_JOB_FAILURE"); } final Id timerId = this.jobCompletionId.withTags(tags); this.registry.timer(timerId).record(System.nanoTime() - start, TimeUnit.NANOSECONDS); }

Target:
void handleJobCompletion(final JobFinishedEvent event) throws GenieException { final long start = System.nanoTime(); final String jobId = event.getId(); final Map<String, String> tags = Maps.newHashMap(); try { final Job job = retryTemplate.execute(context -> getJob(jobId)); final JobStatus status = job.getStatus(); if (status.isActive()) { try { retryTemplate.execute(context -> updateJob(job, event, tags)); } catch (Exception e) { log.error("Failed updating for job: {}", jobId, e); tags.put(ERROR_TAG, "JOB_UPDATE_FAILURE"); finalStatusUpdateFailureRate.increment(); } try { retryTemplate.execute(context -> processJobDir(job)); } catch (Exception e) { log.error("Failed archiving directory for job: {}", jobId, e); tags.put(ERROR_TAG, "JOB_DIRECTORY_FAILURE"); archivalFailureRate.increment(); } try { retryTemplate.execute(context -> sendEmail(jobId)); } catch (Exception e) { log.error("Failed sending email for job: {}", jobId, e); tags.put(ERROR_TAG, "SEND_EMAIL_FAILURE"); emailFailureRate.increment(); } } } catch (Exception e) { log.error("Failed getting job with id: {}", jobId, e); tags.put(ERROR_TAG, "GET_JOB_FAILURE"); } finally { final Id timerId = this.jobCompletionId.withTags(tags); this.registry.timer(timerId).record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } }
Source:
private void makeWorkspaceManager() { JPanel workspaceBar = new JPanel(new BorderLayout()); JButton btnChangeWorkspace = new CustomButton(OrbisGISIcon.getIcon("application_go")); btnChangeWorkspace.setToolTipText("Switch to another workspace"); workspaceBar.add(btnChangeWorkspace); addComponent(workspaceBar,SwingConstants.LEFT); }

Target:
private void makeWorkspaceManager() { JPanel workspaceBar = new JPanel(new BorderLayout()); JButton btnChangeWorkspace = new CustomButton(OrbisGISIcon.getIcon("application_go")); btnChangeWorkspace.setToolTipText(I18N.tr("Switch to another workspace")); workspaceBar.add(btnChangeWorkspace); addComponent(workspaceBar, SwingConstants.LEFT); }
Source:
public int estimateVcfNumberOfLines(String vcfFilePath) { logger.debug("Estimating the number of lines in the VCF file {}", vcfFilePath); int estimatedTotalNumberOfLines = 0; String vcfHead; String vcfSection; try { vcfHead = retrieveVcfHead(vcfFilePath); vcfSection = retrieveVcfSection(vcfFilePath); } catch (IOException e) { throw new RuntimeException("Error reading VCF " + vcfFilePath, e); } if (!vcfSection.isEmpty()) { File vcfHeadFile; File vcfSectionFile; try { vcfHeadFile = FileUtils.newGzipFile(vcfHead, "vcfHeadFile"); vcfSectionFile = FileUtils.newGzipFile(vcfSection, "vcfSectionFile"); } catch (IOException e) { throw new RuntimeException("Error while creating zip file", e); } double vcfFileSize = new File(vcfFilePath).length(); double singleVcfLineSize = (vcfSectionFile != null ? vcfSectionFile.length() : 0) / NUMBER_OF_LINES; double vcfHeadFileSize = vcfHeadFile != null ? vcfHeadFile.length() : 0; estimatedTotalNumberOfLines = (int) ((vcfFileSize - vcfHeadFileSize) / singleVcfLineSize); } logger.info("Estimated number of lines in VCF file: {}", estimatedTotalNumberOfLines); return estimatedTotalNumberOfLines; }

Target:
public long estimateVcfNumberOfLines(String vcfFilePath) { logger.debug("Estimating the number of lines in the VCF file {}", vcfFilePath); long estimatedTotalNumberOfLines = 0; String vcfHead; String vcfSection; try { vcfHead = retrieveVcfHead(vcfFilePath); vcfSection = retrieveVcfSection(vcfFilePath); } catch (IOException e) { throw new RuntimeException("Error reading VCF " + vcfFilePath, e); } if (!vcfSection.isEmpty()) { File vcfHeadFile; File vcfSectionFile; try { vcfHeadFile = FileUtils.newGzipFile(vcfHead, "vcfHeadFile"); vcfSectionFile = FileUtils.newGzipFile(vcfSection, "vcfSectionFile"); } catch (IOException e) { throw new RuntimeException("Error while creating zip file", e); } long vcfFileSize = new File(vcfFilePath).length(); long singleVcfLineSize = (vcfSectionFile.length() / NUMBER_OF_LINES); long vcfHeadFileSize = vcfHeadFile.length(); estimatedTotalNumberOfLines = ((vcfFileSize - vcfHeadFileSize) / singleVcfLineSize); } logger.info("Approximate number of lines in VCF file: {}", estimatedTotalNumberOfLines); return estimatedTotalNumberOfLines; }
Source:
public void testNormalUsage() throws IOException { ResourceControllerDataProvider testCache = setupClusterDataCache(); Set<AssignableReplica> assignmentSet = generateReplicas(testCache); ClusterContext context = new ClusterContext(assignmentSet, 2); Assert.assertEquals(context.getEstimatedMaxPartitionCount(), 3); Assert.assertEquals(context.getEstimatedMaxTopStateCount(), 2); Assert.assertEquals(context.getAssignmentForFaultZoneMap(), Collections.emptyMap()); for (String resourceName : _resourceNames) { Assert.assertEquals(context.getEstimatedMaxPartitionByResource(resourceName), 2); Assert.assertEquals( context.getPartitionsForResourceAndFaultZone(_testFaultZoneId, resourceName), Collections.emptySet()); } Map<String, Map<String, Set<String>>> expectedFaultZoneMap = Collections .singletonMap(_testFaultZoneId, assignmentSet.stream().collect(Collectors .groupingBy(AssignableReplica::getResourceName, Collectors.mapping(AssignableReplica::getPartitionName, toSet())))); assignmentSet.stream().forEach(r -> context .addPartitionToFaultZone(_testFaultZoneId, r.getResourceName(), r.getPartitionName())); Assert.assertEquals(context.getAssignmentForFaultZoneMap(), expectedFaultZoneMap); Assert.assertTrue(expectedFaultZoneMap.get(_testFaultZoneId).get(_resourceNames.get(0)) .remove(_partitionNames.get(0))); context.removePartitionFromFaultZone(_testFaultZoneId, _resourceNames.get(0), _partitionNames.get(0)); Assert.assertEquals(context.getAssignmentForFaultZoneMap(), expectedFaultZoneMap); }

Target:
public void testNormalUsage() throws IOException { ResourceControllerDataProvider testCache = setupClusterDataCache(); Set<AssignableReplica> assignmentSet = generateReplicas(testCache); ClusterContext context = new ClusterContext(assignmentSet, 2); Assert.assertEquals(context.getEstimatedMaxPartitionCount(), 3); Assert.assertEquals(context.getEstimatedMaxTopStateCount(), 2); Assert.assertEquals(context.getAssignmentForFaultZoneMap(), Collections.emptyMap()); for (String resourceName : _resourceNames) { Assert.assertEquals(context.getEstimatedMaxPartitionByResource(resourceName), 2); Assert.assertEquals( context.getPartitionsForResourceAndFaultZone(_testFaultZoneId, resourceName), Collections.emptySet()); } Map<String, Map<String, Set<String>>> expectedFaultZoneMap = Collections .singletonMap(_testFaultZoneId, assignmentSet.stream().collect(Collectors .groupingBy(AssignableReplica::getResourceName, Collectors.mapping(AssignableReplica::getPartitionName, Collectors.toSet())))); assignmentSet.stream().forEach(replica -> context .addPartitionToFaultZone(_testFaultZoneId, replica.getResourceName(), replica.getPartitionName())); Assert.assertEquals(context.getAssignmentForFaultZoneMap(), expectedFaultZoneMap); expectedFaultZoneMap.get(_testFaultZoneId).get(_resourceNames.get(0)) .remove(_partitionNames.get(0)); Assert.assertTrue(context.removePartitionFromFaultZone(_testFaultZoneId, _resourceNames.get(0), _partitionNames.get(0))); Assert.assertEquals(context.getAssignmentForFaultZoneMap(), expectedFaultZoneMap); }
Source:
private void transferOut(String inetnum, final String overrideLine) { try { WhoisResources resp = RestTest.target(getPort(), "whois/transfer/inetnum/", "override=" + SyncUpdateUtils.encode(overrideLine), null) .path(URLEncoder.encode(inetnum, "UTF-8")) .request(MediaType.APPLICATION_JSON_TYPE) .delete(WhoisResources.class); printErrorMessage(resp); } catch (ClientErrorException exc) { printErrorMessage(exc.getResponse().readEntity(WhoisResources.class)); throw exc; } catch (WebApplicationException e) { System.out.println("-------------------------"); System.out.println(e.getResponse().readEntity(String.class)); System.out.println("-------------------------"); throw e; } catch (UnsupportedEncodingException e) { fail(e.getMessage()); } }

Target:
private void transferOut(String inetnum, final String overrideLine) { try { WhoisResources resp = RestTest.target(getPort(), "whois/transfer/inetnum/", "override=" + SyncUpdateUtils.encode(overrideLine), null) .path(URLEncoder.encode(inetnum, "UTF-8")) .request(MediaType.APPLICATION_JSON_TYPE) .delete(WhoisResources.class); printErrorMessage(resp); } catch (ClientErrorException exc) { printErrorMessage(exc.getResponse().readEntity(WhoisResources.class)); throw exc; } catch (WebApplicationException e) { fail(e.getResponse().readEntity(String.class)); throw e; } catch (UnsupportedEncodingException e) { fail(e.getMessage()); } }
Source:
public void updateMappedStrings() { if (_alreadyUpdating) { return; } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { _alreadyUpdating = true; onConfigurationChanged(null); setMappedStrings(null); _mappedStringsPropertyWidget.fireValueChanged(); _alreadyUpdating = false; } }); }

Target:
public void updateMappedStrings() { if (_alreadyUpdating) { return; } SwingUtilities.invokeLater(() -> { _alreadyUpdating = true; onConfigurationChanged(null); setMappedStrings(null); _mappedStringsPropertyWidget.fireValueChanged(); _alreadyUpdating = false; }); }
Source:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQueryBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); when(storIOSQLite.internal()).thenReturn(internal); final PreparedGet<TestItem> preparedGet = storIOSQLite .get() .object(TestItem.class) .withQuery(Query.builder().table("test_table").build()) .prepare(); try { preparedGet.executeAsBlocking(); failBecauseExceptionWasNotThrown(StorIOException.class); } catch (StorIOException expected) { assertThat(expected).hasCauseInstanceOf(IllegalStateException.class); } verify(storIOSQLite).get(); verify(storIOSQLite).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).query(any(Query.class)); verifyNoMoreInteractions(storIOSQLite, internal); }

Target:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQueryBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); when(storIOSQLite.internal()).thenReturn(internal); final PreparedGet<TestItem> preparedGet = storIOSQLite .get() .object(TestItem.class) .withQuery(Query.builder().table("test_table").build()) .prepare(); try { preparedGet.executeAsBlocking(); failBecauseExceptionWasNotThrown(StorIOException.class); } catch (StorIOException expected) { assertThat(expected).hasCauseInstanceOf(IllegalStateException.class); assertThat(expected.getCause()).hasMessage("This type does not have type mapping: " + "type = " + TestItem.class + "," + "db was not touched by this operation, please add type mapping for this type"); } verify(storIOSQLite).get(); verify(storIOSQLite).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).query(any(Query.class)); verifyNoMoreInteractions(storIOSQLite, internal); }
Source:
final public double calcOutput(Double in) { double c = 0.0; if (in == null) { log.warn("calcOutput(null)"); return c; } boolean willCalculate = (minX != null && maxX != null && minY != null && maxY != null); if (minInput != null && in < minInput) { log.warn("clipping input to {}", in, minInput); in = minInput; } if (maxInput != null && in > maxInput) { log.warn("clipping input to {}", in, maxInput); in = maxInput; } if (willCalculate) { if (maxX - minX == 0) { log.error("maxX - minX divide by zero error in calcOutput"); return 0.0; } if (!inverted) { c = minY + ((in - minX) * (maxY - minY)) / (maxX - minX); } else { c = minY + ((in - maxX) * (maxY - minY)) / (minX - maxX); } } else { log.error("mapping values are not set - will not calculate"); } if (minOutput != null && c < minOutput) { log.warn("clipping output to {}", c, minOutput); return minOutput; } if (maxOutput != null && c > maxOutput) { log.warn("clipping output to {}", c, maxOutput); return maxOutput; } return c; }

Target:
final public Double calcOutput(Double in) { double c = 0.0; if (in == null) { log.warn("calcOutput(null)"); return c; } boolean willCalculate = (minX != null && maxX != null && minY != null && maxY != null); if (willCalculate) { if (maxX - minX == 0) { log.error("maxX - minX divide by zero error in calcOutput"); return 0.0; } if (!inverted) { c = minY + ((in - minX) * (maxY - minY)) / (maxX - minX); } else { c = minY + ((in - maxX) * (maxY - minY)) / (minX - maxX); } } else { log.error("mapping values are not set - will not calculate"); } if (this.min != null && c < this.min) { log.warn("clipping output to {}", c, this.min); return this.min; } if (this.max != null && c > this.max) { log.warn("clipping output to {}", c, this.max); return this.max; } return c; }
Source:
public static boolean stIsValid(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { return GeometryJtsUtils.deserialize(input).isValid(); }

Target:
public static boolean stIsValid(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { return JtsGeometryUtils.deserialize(input).isValid(); }
Source:
public Stand get(final String name) { try { return new RestStand( new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath( String.format( "/page/stands/stand[name='%s']/links/link[@rel='edit']/@href", name ) ) .get(0), this.token ); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public Stand get(final String name) { try { return new RestStand( new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath( String.format( "/page/stands/stand[name='%s']/links/link[@rel='edit']/@href", name ) ) .get(0), this.token ); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
public static InternalObjectNode fromObjectToInternalObjectNode(Object cosmosItem) { if (cosmosItem instanceof InternalObjectNode) { return new InternalObjectNode(((InternalObjectNode) cosmosItem).toJson()); } else if (cosmosItem instanceof byte[]) { return new InternalObjectNode((byte[]) cosmosItem); } else { try { return new InternalObjectNode(InternalObjectNode.MAPPER.writeValueAsString(cosmosItem)); } catch (IOException e) { throw new IllegalArgumentException("Can't serialize the object into the json string", e); } } }

Target:
public static InternalObjectNode fromObjectToInternalObjectNode(Object cosmosItem) { if (cosmosItem instanceof InternalObjectNode) { return (InternalObjectNode) cosmosItem; } else if (cosmosItem instanceof byte[]) { return new InternalObjectNode((byte[]) cosmosItem); } else { try { return new InternalObjectNode(InternalObjectNode.MAPPER.writeValueAsString(cosmosItem)); } catch (IOException e) { throw new IllegalArgumentException("Can't serialize the object into the json string", e); } } }
Source:
public static DeleteRecord deserializeDeleteRecord(CrcInputStream crcStream) throws IOException, MessageFormatException { DataInputStream dataStream = new DataInputStream(crcStream); short accountId = dataStream.readShort(); short containerId = dataStream.readShort(); int deletionTimeInSecs = dataStream.readInt(); long actualCRC = crcStream.getValue(); long expectedCRC = dataStream.readLong(); if (actualCRC != expectedCRC) { logger.error( "corrupt data while parsing delete record V2 Expected CRC " + expectedCRC + " Actual CRC " + actualCRC); throw new MessageFormatException("delete record data is corrupt", MessageFormatErrorCodes.Data_Corrupt); } return new DeleteRecord(accountId, containerId, deletionTimeInSecs); }

Target:
public static DeleteRecord deserializeDeleteRecord(CrcInputStream crcStream) throws IOException, MessageFormatException { DataInputStream dataStream = new DataInputStream(crcStream); short accountId = dataStream.readShort(); short containerId = dataStream.readShort(); long deletionTimeInMs = dataStream.readLong(); long actualCRC = crcStream.getValue(); long expectedCRC = dataStream.readLong(); if (actualCRC != expectedCRC) { throw new MessageFormatException("delete record data is corrupt (mismatch in CRC) ", MessageFormatErrorCodes.Data_Corrupt); } return new DeleteRecord(accountId, containerId, deletionTimeInMs); }
Source:
public boolean canTake(BuildableItem item) { Node node = getNode(); if (node==null) return false; if(node.canTake(item)!=null) return false; for (QueueTaskDispatcher d : QueueTaskDispatcher.all()) if (d.canTake(node,item)!=null) return false; return isAvailable(); }

Target:
public boolean canTake(BuildableItem item) { return getCauseOfBlockage(item) == null; }
Source:
private boolean segmentsFilePredicate( String fileName ) { return fileName.contains( "segments_" ); }

Target:
private boolean segmentsFilePredicate( String fileName ) { return FilenameUtils.getName( fileName ).startsWith( IndexFileNames.SEGMENTS ); }
Source:
public void processElement(ProcessContext c) { KV<KV<String, String>, KV<Double, Integer>> result = c.element(); String call1 = result.getKey().getKey(); String call2 = result.getKey().getValue(); Double sumOfRatios = result.getValue().getKey(); int numberOfRatios = result.getValue().getValue(); c.output(call1 + "\t" + call2 + "\t" + sumOfRatios / numberOfRatios + "\t" + sumOfRatios + "\t" + numberOfRatios); }

Target:
public void processElement(ProcessContext c) { KV<KV<String, String>, KV<Double, Integer>> result = c.element(); String call1 = result.getKey().getKey(); String call2 = result.getKey().getValue(); Double sumOfRatios = result.getValue().getKey(); int numberOfRatios = result.getValue().getValue(); c.output(Joiner.on('\t').join(call1, call2, sumOfRatios / numberOfRatios, sumOfRatios, numberOfRatios)); }
Source:
public void init(ServletConfig servletConfig) throws ServletException { CurrentInstance.clearAll(); if (getServletConfig() == null) { super.init(servletConfig); } ServletContext servletContext = getServletConfig().getServletContext(); if (new VaadinServletContext(servletContext) .getAttribute(Lookup.class) == null) { return; } if (servletService == null) { try { servletService = createServletService(); } catch (ServiceException e) { throw new ServletException("Could not initialize VaadinServlet", e); } servletService.setCurrentInstances(null, null); staticFileHandler = createStaticFileHandler(servletService); servletInitialized(); } CurrentInstance.clearAll(); }

Target:
public void init(ServletConfig servletConfig) throws ServletException { CurrentInstance.clearAll(); try { if (getServletConfig() == null) { super.init(servletConfig); } if (getServletConfig() != servletConfig) { throw new IllegalArgumentException( "Servlet config instance may not differ from the " + "instance which has been used for the initial method call"); } ServletContext servletContext = getServletConfig() .getServletContext(); if (servletService != null || new VaadinServletContext(servletContext) .getAttribute(Lookup.class) == null) { return; } try { servletService = createServletService(); } catch (ServiceException e) { throw new ServletException("Could not initialize VaadinServlet", e); } servletService.setCurrentInstances(null, null); staticFileHandler = createStaticFileHandler(servletService); servletInitialized(); } finally { CurrentInstance.clearAll(); } }
Source:
public void testMaxContainerResource() { final TaskExecutorProcessSpecContainerResourcePriorityAdapter adapter = new TaskExecutorProcessSpecContainerResourcePriorityAdapter( 1, Resource.newInstance(100, 1), Collections.emptyMap()); assertThat(adapter.getResource(TASK_EXECUTOR_PROCESS_SPEC_2).isPresent(), is(false)); assertThat(adapter.getPriority(TASK_EXECUTOR_PROCESS_SPEC_2).isPresent(), is(false)); }

Target:
public void testMaxContainerResource() { final TaskExecutorProcessSpecContainerResourcePriorityAdapter adapter = getAdapter(); assertThat(adapter.getPriorityAndResource(TASK_EXECUTOR_PROCESS_SPEC_EXCEED_MAX).isPresent(), is(false)); }
Source:
private void writeBatchRetryingUpToFiveTimes(PaxosStateLog<V> target, List<PaxosRound<V>> batch) { for (int retryCount = 0; retryCount < 5; retryCount++) { try { target.writeBatchOfRounds(batch); return; } catch (Exception e) { Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } } target.writeBatchOfRounds(batch); }

Target:
private void writeBatchRetryingUpToFiveTimes(PaxosStateLog<V> target, List<PaxosRound<V>> batch) { for (int retryCount = 0; retryCount < 5; retryCount++) { try { target.writeBatchOfRounds(batch); return; } catch (Exception e) { log.info("Failed to write a migration batch. Retrying after backoff.", e); Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } } target.writeBatchOfRounds(batch); }
Source:
public CloudDataNodeTest() { Properties props = new Properties(); props.setProperty("clustermap.host.name", "localhost"); props.setProperty("clustermap.cluster.name", "clusterName"); props.setProperty("clustermap.datacenter.name", "DC1"); props.setProperty("clustermap.ssl.enabled.datacenters", "DC0,DC1"); props.setProperty("clustermap.port", "12300"); clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); props = new Properties(); props.setProperty("vcr.ssl.port", "12301"); props.setProperty("vcr.cluster.name", "VCRCluster"); cloudConfig = new CloudConfig(new VerifiableProperties(props)); }

Target:
public CloudDataNodeTest() { Properties props = new Properties(); props.setProperty("clustermap.host.name", "localhost"); props.setProperty("clustermap.cluster.name", "clusterName"); props.setProperty("clustermap.datacenter.name", "DC1"); props.setProperty("clustermap.ssl.enabled.datacenters", "DC0,DC1"); props.setProperty("clustermap.port", "12300"); clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); props = new Properties(); cloudConfig = new CloudConfig(new VerifiableProperties(props)); }
Source:
public ChangeAssetOrder(final List<String> assetOrder) { super("changeAssetOrder"); this.assetOrder = assetOrder; }

Target:
private ChangeAssetOrder(final List<String> assetOrder) { super("changeAssetOrder"); this.assetOrder = assetOrder; }
Source:
private boolean showNotes(RevCommit c, NoteMap map, String label, boolean emptyLine) throws IOException { ObjectId blobId = map.get(c); if (blobId == null) return false; if (emptyLine) out.println(); out.print("Notes"); if (label != null) { out.print(" ("); out.print(label); out.print(")"); } out.println(":"); RawText rawText = new RawText(argWalk.getObjectReader().open(blobId) .getBytes()); for (int i = 0; i < rawText.size(); i++) { out.print(" "); out.println(rawText.getString(i)); } return true; }

Target:
private boolean showNotes(RevCommit c, NoteMap map, String label, boolean emptyLine) throws IOException { ObjectId blobId = map.get(c); if (blobId == null) return false; if (emptyLine) out.println(); out.print("Notes"); if (label != null) { out.print(" ("); out.print(label); out.print(")"); } out.println(":"); try { RawText rawText = new RawText(argWalk.getObjectReader() .open(blobId).getCachedBytes(Integer.MAX_VALUE)); for (int i = 0; i < rawText.size(); i++) { out.print(" "); out.println(rawText.getString(i)); } } catch (LargeObjectException e) { out.println(MessageFormat.format( CLIText.get().noteObjectTooLargeToPrint, blobId.name())); } return true; }
Source:
public void assertContinue() throws StoreCopyFailedException { long currentTime = clock.millis(); if ( timeHasExpired( previousCheck, currentTime ) ) { tries++; } previousCheck = currentTime; if ( tries >= maxRetries ) { throw new StoreCopyFailedException( "Maximum allowed retries exceeded: " + maxRetries ); } }

Target:
public void assertContinue() throws StoreCopyFailedException { long currentTime = clock.millis(); if ( timeHasExpired( previousCheck, currentTime ) ) { tries++; previousCheck = currentTime; } if ( tries >= maxRetries ) { throw new StoreCopyFailedException( "Maximum allowed retries exceeded: " + maxRetries ); } }
Source:
protected void doCall() { long locateTimeoutNs; if (operationTimeoutNs > 0) { locateTimeoutNs = remainingTimeNs(); if (locateTimeoutNs <= 0) { completeExceptionally(); return; } } else { locateTimeoutNs = -1L; } if (loc == null) { addListener(conn.getLocator() .getRegionLocation(tableName, row, replicaId, RegionLocateType.CURRENT, locateTimeoutNs), (loc, error) -> { if (error != null) { onError(error, () -> "Locate '" + Bytes.toStringBinary(row) + "' in " + tableName + " failed", err -> { }); return; } call(loc); }); } else { call(this.loc); } }

Target:
protected void doCall() { long locateTimeoutNs; if (operationTimeoutNs > 0) { locateTimeoutNs = remainingTimeNs(); if (locateTimeoutNs <= 0) { completeExceptionally(); return; } } else { locateTimeoutNs = -1L; } addListener(conn.getLocator().getRegionLocation(tableName, row, replicaId, RegionLocateType.CURRENT, locateTimeoutNs), (loc, error) -> { if (error != null) { onError(error, () -> "Locate '" + Bytes.toStringBinary(row) + "' in " + tableName + " failed", err -> { }); return; } call(loc); }); }
Source:
private <T> T getService(Class<T> clazz) { @SuppressWarnings("unchecked") T service = (T) services.get(clazz); return service; }

Target:
private <T> T getService(Class<T> clazz) { T service = clazz.cast(services.get(clazz)); return service; }
Source:
protected Map<String, String> getExclusiveLocks() { if (!getParameters().isNested()) { return Collections.singletonMap(getVdsGroupId().toString(), LockingGroup.GLUSTER.name()); } return super.getExclusiveLocks(); }

Target:
protected Map<String, String> getExclusiveLocks() { if (!isInternalExecution()) { return Collections.singletonMap(getVdsGroupId().toString(), LockingGroup.GLUSTER.name()); } return super.getExclusiveLocks(); }
Source:
protected String getTraceCannotExecuteHelpText(ITmfTrace trace) { return "Cannot perform the analysis on this trace because the trace does not have the required characteristics"; }

Target:
protected String getTraceCannotExecuteHelpText(ITmfTrace trace) { return Messages.TmfAbstractAnalysisModule_AnalysisCannotExecute; }
Source:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { CoordinatorStats stats = new CoordinatorStats(); if (params.hasDeletionWaitTimeElapsed()) { DruidCluster cluster = params.getDruidCluster(); Map<String, VersionedIntervalTimeline<String, DataSegment>> timelines = Maps.newHashMap(); for (NavigableSet<ServerHolder> serverHolders : cluster.getSortedHistoricalsByTier()) { for (ServerHolder serverHolder : serverHolders) { ImmutableDruidServer server = serverHolder.getServer(); for (ImmutableDruidDataSource dataSource : server.getDataSources()) { VersionedIntervalTimeline<String, DataSegment> timeline = timelines.get(dataSource.getName()); if (timeline == null) { timeline = new VersionedIntervalTimeline<>(Comparators.comparable()); timelines.put(dataSource.getName(), timeline); } for (DataSegment segment : dataSource.getSegments()) { timeline.add( segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(segment) ); } } } } for (DataSegment dataSegment : params.getAvailableSegments()) { VersionedIntervalTimeline<String, DataSegment> timeline = timelines.get(dataSegment.getDataSource()); if (timeline != null && timeline.isOvershadowed(dataSegment.getInterval(), dataSegment.getVersion())) { coordinator.removeSegment(dataSegment); stats.addToGlobalStat("overShadowedCount", 1); } } } return params.buildFromExisting() .withCoordinatorStats(stats) .build(); }

Target:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { CoordinatorStats stats = new CoordinatorStats(); if (params.hasDeletionWaitTimeElapsed()) { DruidCluster cluster = params.getDruidCluster(); Map<String, VersionedIntervalTimeline<String, DataSegment>> timelines = Maps.newHashMap(); for (SortedSet<ServerHolder> serverHolders : cluster.getSortedHistoricalsByTier()) { for (ServerHolder serverHolder : serverHolders) { ImmutableDruidServer server = serverHolder.getServer(); for (ImmutableDruidDataSource dataSource : server.getDataSources()) { VersionedIntervalTimeline<String, DataSegment> timeline = timelines.get(dataSource.getName()); if (timeline == null) { timeline = new VersionedIntervalTimeline<>(Comparators.comparable()); timelines.put(dataSource.getName(), timeline); } for (DataSegment segment : dataSource.getSegments()) { timeline.add( segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(segment) ); } } } } for (DataSegment dataSegment : params.getAvailableSegments()) { VersionedIntervalTimeline<String, DataSegment> timeline = timelines.get(dataSegment.getDataSource()); if (timeline != null && timeline.isOvershadowed(dataSegment.getInterval(), dataSegment.getVersion())) { coordinator.removeSegment(dataSegment); stats.addToGlobalStat("overShadowedCount", 1); } } } return params.buildFromExisting() .withCoordinatorStats(stats) .build(); }
Source:
private IncrementalIndex makeIncIndex() { return new OnheapIncrementalIndex.Builder() .setIncrementalIndexSchema( new IncrementalIndexSchema.Builder() .withMinTimestamp(0) .withQueryGranularity(Granularities.NONE) .withMetrics(aggs) .withRollup(IncrementalIndexSchema.DEFAULT_ROLLUP) .build() ) .setDeserializeComplexMetrics(false) .setReportParseExceptions(false) .setMaxRowCount(maxRows) .build(); }

Target:
private IncrementalIndex makeIncIndex() { return new IncrementalIndex.Builder() .setSimpleTestingIndexSchema(aggs) .setDeserializeComplexMetrics(false) .setReportParseExceptions(false) .setMaxRowCount(maxRows) .buildOnheap(); }
Source:
public void testLayerSwitchTriggeredColorChange() { EmbroideryWorkSpace workSpace = Mockito.mock(DSTWorkSpace.class); ArrayList<StitchPoint> pointList = Mockito.spy(new ArrayList<>()); Mockito.when(pointList.isEmpty()).thenReturn(false); Mockito.when(stream.getPointList()).thenReturn(pointList); StitchCommand previousCommand = new DSTStitchCommand(1, 1, layer - 1, Mockito.mock(Sprite.class)); StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, Mockito.mock(Sprite.class)); command.act(workSpace, stream, previousCommand); Mockito.verify(stream, Mockito.times(1)).addColorChange(); Mockito.verify(stream, Mockito.times(1)).addJump(); Mockito.verify(stream, Mockito.times(3)).addStitchPoint(Mockito.eq(1.0f), Mockito.eq(1.0f)); Mockito.verify(stream, Mockito.times(1)).addStitchPoint(Mockito.eq(xCoord), Mockito.eq(yCoord)); }

Target:
public void testLayerSwitchTriggeredColorChange() { ArrayList<StitchPoint> pointList = new ArrayList<>(); pointList.add(mock(StitchPoint.class)); when(stream.getPointList()).thenReturn(pointList); StitchCommand previousCommand = new DSTStitchCommand(1, 1, layer - 1, mock(Sprite.class)); StitchCommand command = new DSTStitchCommand(xCoord, yCoord, layer, mock(Sprite.class)); command.act(workSpace, stream, previousCommand); InOrder inOrder = inOrder(stream); inOrder.verify(stream, times(1)).addColorChange(); inOrder.verify(stream, times(1)).addStitchPoint(eq(1.0f), eq(1.0f)); inOrder.verify(stream, times(1)).addJump(); inOrder.verify(stream, times(2)).addStitchPoint(eq(1.0f), eq(1.0f)); inOrder.verify(stream, times(1)).addStitchPoint(eq(xCoord), eq(yCoord)); }
Source:
public void setup() { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("test").build(); }

Target:
public void setup() { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("test").build(); context.restoreAuthSystemState(); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sink_to_swim_tutorials); tutorialView = (ImageView) findViewById(R.id.tut); startButton = (ImageView) findViewById(R.id.start_button); startButton.setEnabled(false); curTutorialImage = 1; tutorialView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(curTutorialImage == PowerUpUtils.SWIM_TUTS.length){ } else if (curTutorialImage == PowerUpUtils.SWIM_TUTS.length-1){ tutorialView.setImageDrawable(getResources().getDrawable(PowerUpUtils.SWIM_TUTS[curTutorialImage])); curTutorialImage++; startButton.setVisibility(View.VISIBLE); startButton.setEnabled(true); } else { tutorialView.setImageDrawable(getResources().getDrawable(PowerUpUtils.SWIM_TUTS[curTutorialImage])); curTutorialImage++; } } }); startButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (startButton.isEnabled()){ Intent intent = new Intent(SinkToSwimTutorials.this,SinkToSwimGame.class); finish(); startActivity(intent); } } }); public void goToMap(){ new GameActivity().gameActivityInstance.finish(); Intent intent = new Intent(this, MapActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } @Override public void onBackPressed() { super.onBackPressed(); goToMap() } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sink_to_swim_tutorials); tutorialView = (ImageView) findViewById(R.id.tut); startButton = (ImageView) findViewById(R.id.start_button); startButton.setEnabled(false); curTutorialImage = 1; tutorialView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(curTutorialImage == PowerUpUtils.SWIM_TUTS.length){ } else if (curTutorialImage == PowerUpUtils.SWIM_TUTS.length-1){ tutorialView.setImageDrawable(getResources().getDrawable(PowerUpUtils.SWIM_TUTS[curTutorialImage])); curTutorialImage++; startButton.setVisibility(View.VISIBLE); startButton.setEnabled(true); } else { tutorialView.setImageDrawable(getResources().getDrawable(PowerUpUtils.SWIM_TUTS[curTutorialImage])); curTutorialImage++; } } }); startButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (startButton.isEnabled()){ Intent intent = new Intent(SinkToSwimTutorials.this,SinkToSwimGame.class); finish(); startActivity(intent); } } }); }
Source:
public void defaultConfiguration() { loadConfig(DefaultLdapConfig.class); LdapAuthenticationProvider provider = ldapProvider(); LdapAuthoritiesPopulator authoritiesPopulator = getAuthoritiesPopulator(provider); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupRoleAttribute", "cn"); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupSearchBase", ""); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupSearchFilter", "(uniqueMember={0})"); assertThat(ReflectionTestUtils.getField(getAuthoritiesMapper(provider), "prefix")).isEqualTo("ROLE_"); }

Target:
public void defaultConfiguration() { this.spring.register(DefaultLdapConfig.class).autowire(); LdapAuthenticationProvider provider = ldapProvider(); LdapAuthoritiesPopulator authoritiesPopulator = getAuthoritiesPopulator(provider); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupRoleAttribute", "cn"); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupSearchBase", ""); assertThat(authoritiesPopulator).hasFieldOrPropertyWithValue("groupSearchFilter", "(uniqueMember={0})"); assertThat(ReflectionTestUtils.getField(getAuthoritiesMapper(provider), "prefix")).isEqualTo("ROLE_"); }
Source:
public Status getJobStatus(String jobId) throws IOException { Preconditions.checkArgument(isConnectionOpen(), "Connection must be opened first"); String jobInfoString = SshExecUtils.readCommandOutput( SshExecUtils.sshExec(sshClient, buildOozieJobCommand(jobId, "info"))); return oozieCmdLineParser.readStatusFromJobInfo(jobInfoString); }

Target:
public Status getJobStatus(String jobId) { SshSimpleConnection sshConnection = sshConnectionManager.getConnection(); Command execResults = sshConnection.execute(buildOozieJobCommand(jobId, "info")); String jobInfoString = SshExecUtils.readCommandOutput(execResults); return oozieCmdLineParser.readStatusFromJobInfo(jobInfoString); }
Source:
public View getView(int position, View convertView, ViewGroup parent) { ThemeViewHolder holder; if (convertView == null || convertView.getTag() == null) { convertView = mInflater.inflate(R.layout.theme_grid_item, parent, false); holder = new ThemeViewHolder(convertView); convertView.setTag(holder); } else { holder = (ThemeViewHolder) convertView.getTag(); } configureThemeImageSize(parent); ThemeModel theme = mThemes.get(position); String screenshotURL = theme.getScreenshotUrl(); String themeId = theme.getThemeId(); boolean isPremium = !theme.isFree(); boolean isCurrent = theme.getActive(); holder.nameView.setText(theme.getName()); if (isPremium) { holder.priceView.setText(theme.getPriceText()); holder.priceView.setVisibility(View.VISIBLE); } else { holder.priceView.setVisibility(View.GONE); } if (!screenshotURL.startsWith(ThemeWebActivity.THEME_HTTP_PREFIX)) { if (screenshotURL.startsWith(" screenshotURL = screenshotURL.substring(2); } screenshotURL = ThemeWebActivity.THEME_HTTPS_PROTOCOL + screenshotURL; } configureImageView(holder, screenshotURL, themeId, isCurrent); configureImageButton(holder, themeId, isPremium, isCurrent); configureCardView(holder, isCurrent); ThemeSectionHeader header = mHeaders.get(position); if (header != null) { holder.headerView.setVisibility(View.VISIBLE); holder.headerText.setText(header.text); holder.headerCount.setText(Integer.toString(header.count)); } else { holder.headerView.setVisibility(View.GONE); } return convertView; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { ThemeViewHolder holder; if (convertView == null || convertView.getTag() == null) { convertView = mInflater.inflate(R.layout.theme_grid_item, parent, false); holder = new ThemeViewHolder(convertView); convertView.setTag(holder); } else { holder = (ThemeViewHolder) convertView.getTag(); } configureThemeImageSize(parent); ThemeModel theme = mThemes.get(position); String screenshotURL = theme.getScreenshotUrl(); String themeId = theme.getThemeId(); boolean isPremium = !theme.isFree(); boolean isCurrent = theme.getActive(); holder.nameView.setText(theme.getName()); if (isPremium) { holder.priceView.setText(theme.getPriceText()); holder.priceView.setVisibility(View.VISIBLE); } else { holder.priceView.setVisibility(View.GONE); } if (!screenshotURL.startsWith(ThemeWebActivity.THEME_HTTP_PREFIX)) { if (screenshotURL.startsWith(" screenshotURL = screenshotURL.substring(2); } screenshotURL = ThemeWebActivity.THEME_HTTPS_PROTOCOL + screenshotURL; } configureImageView(holder, screenshotURL, themeId, isCurrent); configureImageButton(holder, themeId, isPremium, isCurrent); configureCardView(holder, isCurrent); ThemeSectionHeader header = mHeaders.get(position); if (header != null) { holder.headerView.setVisibility(View.VISIBLE); holder.headerText.setText(header.text); holder.headerCount.setText(String.valueOf(header.count)); } else { holder.headerView.setVisibility(View.GONE); } return convertView; }
Source:
public TJobExecutionStatus forStatus(String status) { try { TezStatus tezStatus = TezStatus.valueOf(status); switch (tezStatus) { case SUBMITTED: case INITING: case RUNNING: return TJobExecutionStatus.IN_PROGRESS; default: return TJobExecutionStatus.COMPLETE; } } catch (IllegalArgumentException ex) { LOG.debug("Could not understand the status from tez execution engine : " + status); return TJobExecutionStatus.NOT_AVAILABLE; } }

Target:
public TJobExecutionStatus forStatus(String status) { if (StringUtils.isEmpty(status)) { return TJobExecutionStatus.NOT_AVAILABLE; } TezStatus tezStatus = TezStatus.valueOf(status); switch (tezStatus) { case SUBMITTED: case INITING: case RUNNING: return TJobExecutionStatus.IN_PROGRESS; default: return TJobExecutionStatus.COMPLETE; } }
Source:
private List<ExternalDiscoveredHost> runDiscoveredHostListMethod(HttpMethod httpMethod) { try{ runHttpMethod(httpClient, httpMethod); ForemanDiscoveredHostWrapper fdw = objectMapper.readValue(httpMethod.getResponseBody(), ForemanDiscoveredHostWrapper.class); return mapDiscoveredHosts(Arrays.asList(fdw.getResults())); } catch (JsonParseException e) { handleException(e); } catch (JsonMappingException e) { handleException(e); } catch (IOException e) { handleException(e); } return null; }

Target:
private List<ExternalDiscoveredHost> runDiscoveredHostListMethod(HttpMethod httpMethod) { try{ runHttpMethod(httpClient, httpMethod); ForemanDiscoveredHostWrapper fdw = objectMapper.readValue(httpMethod.getResponseBody(), ForemanDiscoveredHostWrapper.class); return mapDiscoveredHosts(Arrays.asList(fdw.getResults())); } catch (IOException e) { handleException(e); } return null; }