auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testOnSchedule() throws Exception { Mockito.doNothing(). when(scheduler).startExecutorMonitor(Mockito.anyInt(), Mockito.any(Process.class)); Process[] mockProcesses = new Process[3]; for (int i = 0; i < 3; i++) { mockProcesses[i] = Mockito.mock(Process.class); Mockito.doReturn(mockProcesses[i]).when(scheduler).startExecutorProcess(i); } PackingPlan packingPlan = Mockito.mock(PackingPlan.class); Set<PackingPlan.ContainerPlan> containers = new HashSet<>(); containers.add(PackingTestUtils.testContainerPlan(1)); containers.add(PackingTestUtils.testContainerPlan(2)); Mockito.when(packingPlan.getContainers()).thenReturn(containers); Assert.assertTrue(scheduler.onSchedule(packingPlan)); Assert.assertEquals(3, scheduler.getProcessToContainer().size()); for (int i = 0; i < 3; i++) { Mockito.verify(scheduler).startExecutor(i); Mockito.verify(scheduler).startExecutorProcess(i); Mockito.verify(scheduler).startExecutorMonitor(i, mockProcesses[i]); } }

Target:
public void testOnSchedule() throws Exception { Mockito.doNothing(). when(scheduler).startExecutorMonitor(Mockito.anyInt(), Mockito.any(Process.class)); Process[] mockProcesses = new Process[4]; for (int i = 0; i < 4; i++) { mockProcesses[i] = Mockito.mock(Process.class); Mockito.doReturn(mockProcesses[i]).when(scheduler).startExecutorProcess(i); } PackingPlan packingPlan = Mockito.mock(PackingPlan.class); Set<PackingPlan.ContainerPlan> containers = new HashSet<>(); containers.add(PackingTestUtils.testContainerPlan(1)); containers.add(PackingTestUtils.testContainerPlan(3)); Mockito.when(packingPlan.getContainers()).thenReturn(containers); Assert.assertTrue(scheduler.onSchedule(packingPlan)); verifyIdsOfLaunchedContainers(0, 1, 3); for (int i = 0; i < 4; i++) { if (i == 2) { continue; } Mockito.verify(scheduler).startExecutor(i); Mockito.verify(scheduler).startExecutorProcess(i); Mockito.verify(scheduler).startExecutorMonitor(i, mockProcesses[i]); } }
Source:
private static Bitmap getBitmapScaledToContainer(String imageFilepath, int containerHeight, int containerWidth) { BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeFile(imageFilepath, o); int imageHeight = o.outHeight; int imageWidth = o.outWidth; int heightScale = Math.round((float) imageHeight / containerHeight); int widthScale = Math.round((float) imageWidth / containerWidth); int scale = Math.max(widthScale, heightScale); if (scale == 0) { scale = 1; } return performSafeScaleDown(imageFilepath, scale, 0); }

Target:
private static Bitmap getBitmapScaledToContainer(String imageFilepath, int containerHeight, int containerWidth) { BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeFile(imageFilepath, o); int imageHeight = o.outHeight; int imageWidth = o.outWidth; return getBitmapScaledByTargetOrContainer(imageFilepath, imageHeight, imageWidth, -1, -1, containerHeight, containerWidth, true); }
Source:
public void handleGetFirmwareVersionResponse(DeviceMessageMetadata deviceMessageMetadata, ResponseMessageResultType deviceResult, OsgpException exception, List<FirmwareVersionDto> firmwareVersionList) { LOGGER.info("handleGetFirmwareVersionResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Replace Keys Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } final List<FirmwareVersion> firmwareVersions = this.configurationMapper.mapAsList(firmwareVersionList, FirmwareVersion.class); final FirmwareVersionResponse firmwareVersionResponse = new FirmwareVersionResponse(firmwareVersions); this.webServiceResponseMessageSender.send(new ResponseMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), deviceMessageMetadata.getDeviceIdentification(), result, exception, firmwareVersionResponse, deviceMessageMetadata.getMessagePriority()), deviceMessageMetadata.getMessageType()); }

Target:
public void handleGetFirmwareVersionResponse(DeviceMessageMetadata deviceMessageMetadata, ResponseMessageResultType deviceResult, OsgpException exception, List<FirmwareVersionDto> firmwareVersionList) { LOGGER.info("handleGetFirmwareVersionResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Get firmware version response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } final List<FirmwareVersion> firmwareVersions = this.configurationMapper.mapAsList(firmwareVersionList, FirmwareVersion.class); final FirmwareVersionResponse firmwareVersionResponse = new FirmwareVersionResponse(firmwareVersions); this.webServiceResponseMessageSender.send(new ResponseMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), deviceMessageMetadata.getDeviceIdentification(), result, exception, firmwareVersionResponse, deviceMessageMetadata.getMessagePriority()), deviceMessageMetadata.getMessageType()); }
Source:
public String reduce(String query, Map<String, String> responses) { LOG.info("Reducing query with responses from {}.", query, responses.keySet()); try { String path = getPath(query, LOG); if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.POSITION.toString())) { return JsonUtils.toJson(responses); } } catch (Exception e) { LOG.warn("Failed to reduce responses {}", responses, e); return null; } return null; }

Target:
public String reduce(String query, Map<String, String> responses) { LOG.info("Reducing query with responses from {}.", query, responses.keySet()); try { String path = getPath(query, LOG); if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.POSITION.toString())) { return JsonUtils.toJson(responses); } } catch (Exception e) { LOG.warn("Failed to reduce responses {}", responses, e); throw new DatastreamRuntimeException(e); } return null; }
Source:
public void shouldConcatenateSeveralLists() { final List<Integer> list1 = Collections.unmodifiableList( IntStream.range(0, 4).boxed().collect(Collectors.toList()) ); final List<Integer> list2 = Collections.unmodifiableList( IntStream.range(4, 8).boxed().collect(Collectors.toList()) ); final List<Integer> list3 = Collections.unmodifiableList( IntStream.range(8, 12).boxed().collect(Collectors.toList()) ); final List<Integer> list4 = Collections.unmodifiableList( IntStream.range(12, 16).boxed().collect(Collectors.toList()) ); final List<Integer> sortedCancatenatedList = new ArrayList<>(list1); sortedCancatenatedList.addAll(list2); sortedCancatenatedList.addAll(list3); sortedCancatenatedList.addAll(list4); Collections.sort(sortedCancatenatedList); final List<Integer> expected = sortedCancatenatedList; final List<Integer> actual = ListOps.concat(list1, list2, EMPTY_LIST, list3, list4); Collections.sort(actual); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }

Target:
public void shouldConcatenateSeveralLists() { final List<Integer> list1 = Collections.unmodifiableList( Arrays.asList(0, 1, 2, 3) ); final List<Integer> list2 = Collections.unmodifiableList( Arrays.asList(4, 5, 6, 7) ); final List<Integer> list3 = Collections.unmodifiableList( Arrays.asList(8, 9, 10, 11) ); final List<Integer> list4 = Collections.unmodifiableList( Arrays.asList(12, 13, 14, 15) ); final List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); final List<Integer> actual = ListOps.concat(list1, list2, EMPTY_LIST, list3, list4); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }
Source:
public void play() { driver.switchTo().frame(iframe); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } playTriggerButton.click(); driver.switchTo().defaultContent(); }

Target:
public void play() { waitForVideoReadyToPlay(); runInAdFrame(() -> playTriggerButton.click()); }
Source:
public void setReadingTimeNow() { Date formatted = Calendar.getInstance().getTime(); updateReadingSplitDateTime(formatted); }

Target:
public void setReadingTimeNow() { Date formatted = new Date(); updateReadingSplitDateTime(formatted); }
Source:
private void unmarshal(final InputStream inputStream) throws JAXBException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); Document document = null; try { dbf.setFeature("<LINK_0>", false); dbf.setFeature("<LINK_2>", false); dbf.setFeature("<LINK_1>", false); dbf.setExpandEntityReferences(false); DocumentBuilder db = dbf.newDocumentBuilder(); document = db.parse(inputStream); } catch (ParserConfigurationException e) { LOG.debug("Could not set features on {}", dbf); } catch (SAXException | IOException e) { LOG.warn("Error parsing input. Set log to DEBUG for more information."); LOG.debug("Error parsing input. {}", e); throw new JAXBException(e); } JAXBContext jc = JAXBContext.newInstance(Rpfs.class); Unmarshaller u = jc.createUnmarshaller(); rpfs = (Rpfs) u.unmarshal(document); }

Target:
private void unmarshal(final InputStream inputStream) throws JAXBException { JAXBContext jc = JAXBContext.newInstance(Rpfs.class); Unmarshaller u = jc.createUnmarshaller(); rpfs = (Rpfs) u.unmarshal(inputStream); }
Source:
public void tearDown() throws Exception { fixture = null; builder = null; }

Target:
public void tearDown() throws Exception { }
Source:
public synchronized void addNodeToDetect(DFSInputStream dfsInputStream, DatanodeInfo datanodeInfo) { HashSet<DatanodeInfo> datanodeInfos = suspectAndDeadNodes.get(dfsInputStream); if (datanodeInfos == null) { datanodeInfos = new HashSet<DatanodeInfo>(); datanodeInfos.add(datanodeInfo); suspectAndDeadNodes.putIfAbsent(dfsInputStream, datanodeInfos); } else { datanodeInfos.add(datanodeInfo); } LOG.warn("Add datanode to suspectAndDeadNodes", datanodeInfo); addSuspectNodeToDetect(datanodeInfo); }

Target:
public synchronized void addNodeToDetect(DFSInputStream dfsInputStream, DatanodeInfo datanodeInfo) { HashSet<DatanodeInfo> datanodeInfos = suspectAndDeadNodes.get(dfsInputStream); if (datanodeInfos == null) { datanodeInfos = new HashSet<DatanodeInfo>(); datanodeInfos.add(datanodeInfo); suspectAndDeadNodes.putIfAbsent(dfsInputStream, datanodeInfos); } else { datanodeInfos.add(datanodeInfo); } LOG.debug("Add datanode to suspectAndDeadNodes.", datanodeInfo); addSuspectNodeToDetect(datanodeInfo); }
Source:
public FormulaConstraints generateConstraint(MolecularFormulaRange range) { logger.debug("io.github.msdk.id.sirius.ConstraintsGenerator started processing"); int size = range.getIsotopeCount(); Element elements[] = Arrays.copyOf(defaultElements, defaultElements.length + size); int k = 0; for (IIsotope isotope: range.isotopes()) { int atomicNumber = isotope.getAtomicNumber(); final Element element = periodicTable.get(atomicNumber); elements[defaultElements.length + k++] = element; } FormulaConstraints constraints = new FormulaConstraints(new ChemicalAlphabet(elements)); for (IIsotope isotope: range.isotopes()) { int atomicNumber = isotope.getAtomicNumber(); final Element element = periodicTable.get(atomicNumber); int min = range.getIsotopeCountMin(isotope); int max = range.getIsotopeCountMax(isotope); constraints.setLowerbound(element, min); if (max!= maxNumberOfOneElements) constraints.setUpperbound(element, max); } logger.debug("io.github.msdk.id.sirius.ConstraintsGenerator finished"); return constraints; }

Target:
public FormulaConstraints generateConstraint(MolecularFormulaRange range) { logger.debug("ConstraintsGenerator started processing"); int size = range.getIsotopeCount(); Element elements[] = Arrays.copyOf(defaultElements, defaultElements.length + size); int k = 0; for (IIsotope isotope: range.isotopes()) { int atomicNumber = isotope.getAtomicNumber(); final Element element = periodicTable.get(atomicNumber); elements[defaultElements.length + k++] = element; } FormulaConstraints constraints = new FormulaConstraints(new ChemicalAlphabet(elements)); for (IIsotope isotope: range.isotopes()) { int atomicNumber = isotope.getAtomicNumber(); final Element element = periodicTable.get(atomicNumber); int min = range.getIsotopeCountMin(isotope); int max = range.getIsotopeCountMax(isotope); constraints.setLowerbound(element, min); if (max!= maxNumberOfOneElements) constraints.setUpperbound(element, max); } logger.debug("ConstraintsGenerator finished"); return constraints; }
Source:
public void postCollectionDefaultBitstreamReadGroupCreateDefaultBitstreamReadGroupUnAuthorized() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); getClient().perform(post("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); }

Target:
public void postCollectionDefaultBitstreamReadGroupCreateDefaultBitstreamReadGroupUnAuthorized() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); getClient().perform(post("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); Group anon = groupService.findByName(context, Group.ANONYMOUS); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(anon.getID(), anon.getName()))); }
Source:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.uuid != null ? this.uuid.hashCode() : 0); return hash; }

Target:
public int hashCode() { return Objects.hash(uuid); }
Source:
private List<Observation> createObservationGroups() { Concept concept1 = new Concept(); concept1.setUuid("child2Child1Uuid"); Observation child1 = new Observation(); child1.setConcept(concept1); child1.setValue(new Observation.ObservationValue("Yes")); child1.setObsDatetime(DATE); Concept concept2 = new Concept(); concept2.setUuid("child1Child1Uuid"); Observation child2 = new Observation(); child2.setConcept(concept2); child2.setValue(new Observation.ObservationValue("No")); child2.setObsDatetime(DATE); Concept concept3 = new Concept(); concept3.setUuid("child2Uuid"); Observation child3 = new Observation(); child3.setConcept(concept3); child3.setValue(new Observation.ObservationValue("2nd")); child3.setObsDatetime(DATE); Concept concept4 = new Concept(); concept4.setUuid("child3Uuid"); Observation child4 = new Observation(); child4.setConcept(concept4); child4.setValue(new Observation.ObservationValue("Maybe")); child4.setObsDatetime(DATE); Concept concept5 = new Concept(); concept5.setUuid("parentUuid"); Observation parentObservation = new Observation(); parentObservation.setObsDatetime(DATE); parentObservation.setConcept(concept5); parentObservation.setGroupMembers(Arrays.asList(child1, child2, child3, child4)); return Collections.singletonList(parentObservation); }

Target:
private List<Observation> createObservationGroups() { Concept concept1 = new Concept(); concept1.setUuid("child1Child1Uuid"); Observation childChild1 = new Observation(); childChild1.setConcept(concept1); childChild1.setValue(new Observation.ObservationValue("No")); childChild1.setObsDatetime(DATE); Concept concept2 = new Concept(); concept2.setUuid("child2Child1Uuid"); Observation childChild2 = new Observation(); childChild2.setConcept(concept2); childChild2.setValue(new Observation.ObservationValue("Yes")); childChild2.setObsDatetime(DATE); Concept concept3 = new Concept(); concept3.setUuid("child1Uuid"); Observation child1 = new Observation(); child1.setConcept(concept3); child1.setGroupMembers(Arrays.asList(childChild2, childChild1)); child1.setObsDatetime(DATE); Concept concept4 = new Concept(); concept4.setUuid("child2Uuid"); Observation child2 = new Observation(); child2.setConcept(concept4); child2.setValue(new Observation.ObservationValue("2nd")); child2.setObsDatetime(DATE); Concept concept5 = new Concept(); concept5.setUuid("child3Uuid"); Observation child3 = new Observation(); child3.setConcept(concept5); child3.setValue(new Observation.ObservationValue("Maybe")); child3.setObsDatetime(DATE); Concept concept6 = new Concept(); concept6.setUuid("parentUuid"); Observation parentObservation = new Observation(); parentObservation.setObsDatetime(DATE); parentObservation.setConcept(concept6); parentObservation.setGroupMembers(Arrays.asList(child1, child2, child3)); return Collections.singletonList(parentObservation); }
Source:
public static long currentTime(ConnectorSession session) { long millis = UTC_CHRONOLOGY.millisOfDay().get(session.getStartTime()); return packDateTimeWithZone(millis, session.getTimeZoneKey()); }

Target:
public static long currentTime(ConnectorSession session) { long millis = UTC_CHRONOLOGY.millisOfDay().get(session.getStartTime()); if (!session.isLegacyTimestamp()) { millis -= valueToSessionTimeZoneOffsetDiff(session.getStartTime(), getDateTimeZone(session.getTimeZoneKey())); } return packDateTimeWithZone(millis, session.getTimeZoneKey()); }
Source:
public void linkAccountSuccess(LinkAccountRequest input, LinkAccountResponse output) { if (output.status == StatusType.StatusTypeSuccess) { mLinkableAccount.resetForm(); PageType.ReadyToStartPageType.show(); } else if (output.error != null) { if (output.error.code == ApiError.InvalidDataAccountCredentials.getCode()) { mLinkableAccount.setUsernameError("AppleConnect account or password entered incorrectly"); mLinkableAccount.setPasswordError("AppleConnect account or password entered incorrectly"); mLinkableAccount.setFormErrors(); } else if (output.error.code == ApiError.InvalidDataAccountVendor.getCode()) { mLinkableAccount.setVendorError("AppleConnect vendor number entered incorrectly"); mLinkableAccount.setFormErrors(); } } preloader.hide(); }

Target:
public void linkAccountSuccess(LinkAccountRequest input, LinkAccountResponse output) { if (output.status == StatusType.StatusTypeSuccess) { mLinkableAccount.resetForm(); PageType.ReadyToStartPageType.show(); } else if (output.error != null) { if (output.error.code == ApiError.InvalidDataAccountCredentials.getCode()) { mLinkableAccount.setUsernameError("iTunes Connect username or password entered incorrectly"); mLinkableAccount.setPasswordError("iTunes Connect username or password entered incorrectly"); mLinkableAccount.setFormErrors(); } else if (output.error.code == ApiError.InvalidDataAccountVendor.getCode()) { mIosMacForm.setVendorError("iTunes Connect vendor number entered incorrectly"); mLinkableAccount.setFormErrors(); } } preloader.hide(); }
Source:
public void cleanup() { if (model != null) { model.cleanup(); model = null; } cleanupModelItems(); for (Pair<T, V> item : items) { T value = item.getFirst(); if (!isGhost(value)) { if (item instanceof HasCleanup) { ((HasCleanup) value).cleanup(); } } } cleanContentPanel(); }

Target:
public void cleanup() { if (model != null) { model.cleanup(); model = null; } cleanupModelItems(); cleanupNonGhostItems(); cleanContentPanel(); }
Source:
private InternalCacheEntry<K, V> getNext() { boolean initializedTime = false; long now = 0; while (it.hasNext()) { InternalCacheEntry<K, V> entry = it.next(); if (includeExpired || !entry.canExpire()) { log.tracef("Return next entry %s", entry); return entry; } else { if (!initializedTime) { now = timeService.wallClockTime(); initializedTime = true; } if (!entry.isExpired(now)) { return entry; } else { log.tracef("%s is expired", entry); } } } log.tracef("Return next null"); return null; }

Target:
private InternalCacheEntry<K, V> getNext() { boolean initializedTime = false; long now = 0; while (it.hasNext()) { InternalCacheEntry<K, V> entry = it.next(); if (includeExpired || !entry.canExpire()) { log.tracef("Return next entry %s", entry); return entry; } else { if (!initializedTime) { now = timeService.wallClockTime(); initializedTime = true; } if (!entry.isExpired(now)) { log.tracef("Return next entry %s", entry); return entry; } else { log.tracef("%s is expired", entry); } } } log.tracef("Return next null"); return null; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; if (getClass() != o.getClass()) return false; TestAutoSerializerObject2 test = (TestAutoSerializerObject2) o; return Objects.equals(data1, test.data1) && Objects.equals(data2, test.data2) && Objects.equals(numData3, test.numData3); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestAutoSerializerObject2 test = (TestAutoSerializerObject2) o; return Objects.equals(data1, test.data1) && Objects.equals(data2, test.data2) && Objects.equals(numData, test.numData); }
Source:
public void addAndRemoveMemberInNonSynchronizedGroup() throws Exception { System.out.println(CLASS_NAME + "addAndRemoveMemberInNonSynchronizedGroup"); vo = setUpVo(); setUpGroup(vo); Attribute synchroAttr = new Attribute(perun.getAttributesManager().getAttributeDefinition(sess, "urn:perun:group:attribute-def:def:synchronizationEnabled")); synchroAttr.setValue("false"); perun.getAttributesManager().setAttribute(sess, group, synchroAttr); Member member = setUpMember(vo); groupsManager.addMember(sess, group, member); List<Member> members = groupsManager.getGroupMembers(sess, group); assertTrue("List of members should contain member", members.contains(member)); groupsManager.removeMember(sess, group, member); members.clear(); members = groupsManager.getGroupMembers(sess, group); assertTrue("List of members should be empty", members.isEmpty()); }

Target:
public void addAndRemoveMemberInNonSynchronizedGroup() throws Exception { System.out.println(CLASS_NAME + "addAndRemoveMemberInNonSynchronizedGroup"); vo = setUpVo(); setUpGroup(vo); Attribute synchroAttr = new Attribute(perun.getAttributesManager().getAttributeDefinition(sess, GroupsManager.GROUPSYNCHROENABLED_ATTRNAME)); synchroAttr.setValue("false"); perun.getAttributesManager().setAttribute(sess, group, synchroAttr); Member member = setUpMember(vo); groupsManager.addMember(sess, group, member); List<Member> members = groupsManager.getGroupMembers(sess, group); assertTrue("List of members should contain member", members.contains(member)); groupsManager.removeMember(sess, group, member); members = groupsManager.getGroupMembers(sess, group); assertTrue("List of members should be empty", members.isEmpty()); }
Source:
public void verifyWrongBlurryWordValidation() { waitForElementByElement(WrongBlurryWordValidationError); }

Target:
public void verifyWrongBlurryWordValidation(){ waitForElementByElement(WrongBlurryWordValidationError); PageObjectLogging.log( "verifyWrongBlurryWordValidation ", "wrong blurry word validation verified", true, driver ); }
Source:
static BannerSize chartboostAdSizeFromLocalExtras(Context context, AdSize adSize) { if (context != null && adSize != null) { int LEADERBOARD_HEIGHT = BannerSize.getHeight(BannerSize.LEADERBOARD); int LEADERBOARD_WIDTH = BannerSize.getWidth(BannerSize.LEADERBOARD); int MEDIUM_HEIGHT = BannerSize.getHeight(BannerSize.MEDIUM); int MEDIUM_WIDTH = BannerSize.getWidth(BannerSize.MEDIUM); int STANDARD_HEIGHT = BannerSize.getHeight(BannerSize.STANDARD); int STANDARD_WIDTH = BannerSize.getWidth(BannerSize.STANDARD); ArrayList<AdSize> potentials = new ArrayList<>(); potentials.add(new AdSize(LEADERBOARD_WIDTH, LEADERBOARD_HEIGHT)); potentials.add(new AdSize(MEDIUM_WIDTH, MEDIUM_HEIGHT)); potentials.add(new AdSize(STANDARD_WIDTH, STANDARD_HEIGHT)); AdSize supportedAdSize = MediationUtils.findClosestSize(context, adSize, potentials); if (supportedAdSize == null) { return null; } int adHeight = supportedAdSize.getHeight(); int adWidth = supportedAdSize.getWidth(); if (adHeight >= LEADERBOARD_HEIGHT && adWidth >= LEADERBOARD_WIDTH) { return BannerSize.LEADERBOARD; } else if (adHeight >= MEDIUM_HEIGHT && adWidth >= MEDIUM_WIDTH) { return BannerSize.MEDIUM; } else { return BannerSize.STANDARD; } } return null; }

Target:
static BannerSize chartboostAdSizeFromLocalExtras(Context context, AdSize adSize) { int LEADERBOARD_HEIGHT = BannerSize.getHeight(BannerSize.LEADERBOARD); int LEADERBOARD_WIDTH = BannerSize.getWidth(BannerSize.LEADERBOARD); int MEDIUM_HEIGHT = BannerSize.getHeight(BannerSize.MEDIUM); int MEDIUM_WIDTH = BannerSize.getWidth(BannerSize.MEDIUM); int STANDARD_HEIGHT = BannerSize.getHeight(BannerSize.STANDARD); int STANDARD_WIDTH = BannerSize.getWidth(BannerSize.STANDARD); ArrayList<AdSize> potentials = new ArrayList<>(); potentials.add(new AdSize(LEADERBOARD_WIDTH, LEADERBOARD_HEIGHT)); potentials.add(new AdSize(MEDIUM_WIDTH, MEDIUM_HEIGHT)); potentials.add(new AdSize(STANDARD_WIDTH, STANDARD_HEIGHT)); AdSize supportedAdSize = MediationUtils.findClosestSize(context, adSize, potentials); if (supportedAdSize == null) { return null; } int adHeight = supportedAdSize.getHeight(); int adWidth = supportedAdSize.getWidth(); if (adHeight >= LEADERBOARD_HEIGHT && adWidth >= LEADERBOARD_WIDTH) { return BannerSize.LEADERBOARD; } else if (adHeight >= MEDIUM_HEIGHT && adWidth >= MEDIUM_WIDTH) { return BannerSize.MEDIUM; } else { return BannerSize.STANDARD; } }
Source:
public void testCreateUnpartitioned() { String tableName = "test_basic_statistics_unpartitioned_ctas_presto"; onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onPresto().executeQuery(format("CREATE TABLE %s AS SELECT * FROM nation", tableName)); try { BasicStatistics statistics = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsArePresent(statistics); assertThatStatisticsAreNonZero(statistics); assertThat(statistics.getNumRows().getAsLong()).isEqualTo(25); assertThat(statistics.getNumPartitions().getAsLong()).isEqualTo(0); } finally { onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); } }

Target:
public void testCreateUnpartitioned() { String tableName = "test_basic_statistics_unpartitioned_ctas_presto"; onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onPresto().executeQuery(format("CREATE TABLE %s AS SELECT * FROM nation", tableName)); try { BasicStatistics statistics = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsAreNonZero(statistics); assertThat(statistics.getNumRows().getAsLong()).isEqualTo(25); } finally { onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); } }
Source:
private static Path resolveRelativePath(String metadataEntry, Key key) { String prefix = "tables" + "/"; if (metadataEntry.startsWith("..")) { return new Path(prefix + metadataEntry.substring(2)); } else { TableId tableId = KeyExtent.tableIdOfMetadataRow(key.getRow()); return new Path(prefix + tableId.canonical() + metadataEntry); } }

Target:
private static Path resolveRelativePath(String metadataEntry, Key key) { String prefix = ServerConstants.TABLE_DIR + "/"; if (metadataEntry.startsWith("../")) { return new Path(prefix + metadataEntry.substring(3)); } else { TableId tableId = KeyExtent.tableOfMetadataRow(key.getRow()); return new Path(prefix + tableId.canonical() + metadataEntry); } }
Source:
public Response restoreAPIRevision(String apiId, String revisionId, MessageContext messageContext) { try { APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider(); apiProvider.restoreAPIRevision(apiId, revisionId); APIDTO apiToReturn = getAPIByID(apiId); return Response.ok().entity(apiToReturn).build(); } catch (APIManagementException e) { String errorMessage = "Error while restoring API Revision for API : " + apiId + ". Error: " + e; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }

Target:
public Response restoreAPIRevision(String apiId, String revisionId, MessageContext messageContext) throws APIManagementException { APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider(); apiProvider.restoreAPIRevision(apiId, revisionId); APIDTO apiToReturn = getAPIByID(apiId); return Response.ok().entity(apiToReturn).build(); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("AccessToken:").append(accessToken).append(" TokenType:").append(tokenType) .append(" RefreshToken:" + refreshToken).append(" Scope:").append(scope).append(" ExpiresIn:") .append(expiresIn).append(" State:").append(state).append(" Created:").append(created); return sb.toString(); }

Target:
public String toString() { return "AccessTokenResponse [accessToken=" + accessToken + ", tokenType=" + tokenType + ", expiresIn=" + expiresIn + ", refreshToken=" + refreshToken + ", scope=" + scope + ", state=" + state + ", createdOn=" + createdOn + "]"; }
Source:
public void testNonExistingLocalRepositoryException() throws IOException { String path = "/path/to/non-existing/repository.git"; try { Transport.open(db, path); } catch (Exception e) { assertTrue(e.getMessage().equals(path + " does not exist")); } }

Target:
public void testNonExistingLocalRepositoryException() throws IOException { String path = "/path/to/non-existing/repository.git"; try { Transport.open(db, path); } catch (Exception e) { assertEquals("Cannot find repository at " + path, e.getMessage()); } }
Source:
protected void verifyFindsPerson(int expectedCount, String name) throws Exception { long hitCount = Search.getSearchManager(cache) .search(Person.class) .where(f -> f.match().field("name").matching(name)) .fetchTotalHitCount(); assertEquals(expectedCount, hitCount); }

Target:
protected void verifyFindsPerson(int expectedCount, String name) throws Exception { QueryFactory queryFactory = Search.getQueryFactory(cache); String q = String.format("FROM %s where name:'%s'", Person.class.getName(), name); Query cacheQuery = queryFactory.create(q); assertEquals(expectedCount, cacheQuery.execute().hitCount().orElse(-1)); }
Source:
public void testChangeHeaderAfterWritingBody() { final File bcfOutputFile = VariantBaseTest.createTempFile("testWriteAndReadVCF.", ".bcf"); Tribble.indexFile(bcfOutputFile).deleteOnExit(); Set<VCFHeaderLine> metaData = new HashSet<VCFHeaderLine>(); Set<String> additionalColumns = new HashSet<String>(); final SAMSequenceDictionary sequenceDict = createArtificialSequenceDictionary(); final VCFHeader header = createFakeHeader(metaData, additionalColumns, sequenceDict); final VariantContextWriter writer3 = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(sequenceDict) .setOptions(EnumSet.of(Options.INDEX_ON_THE_FLY)) .build(); writer3.setVCFHeader(header); writer3.add(createVC(header)); writer3.setVCFHeader(header); writer3.close(); }

Target:
public void testChangeHeaderAfterWritingBody() throws IOException { final File bcfOutputFile = File.createTempFile("testWriteAndReadVCF.", ".bcf", tempDir); bcfOutputFile.deleteOnExit(); final VCFHeader header = createFakeHeader(); try (final VariantContextWriter writer = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(header.getSequenceDictionary()) .unsetOption(Options.INDEX_ON_THE_FLY) .build()) { writer.setVCFHeader(header); writer.add(createVC(header)); writer.setVCFHeader(header); } }
Source:
AzureCloudDestination(CloudConfig cloudConfig, AzureCloudConfig azureCloudConfig, String clusterName, VcrMetrics vcrMetrics, AzureMetrics azureMetrics, AzureReplicationFeed.FeedType azureReplicationFeedType, ClusterMap clusterMap) throws Exception { this.azureMetrics = azureMetrics; this.blobLayoutStrategy = new AzureBlobLayoutStrategy(clusterName, azureCloudConfig); this.azureBlobDataAccessor = new AzureBlobDataAccessor(cloudConfig, azureCloudConfig, blobLayoutStrategy, azureMetrics); this.queryBatchSize = azureCloudConfig.cosmosQueryBatchSize; this.cosmosDataAccessor = new CosmosDataAccessor(cloudConfig, azureCloudConfig, vcrMetrics, azureMetrics); this.azureStorageCompactor = new AzureStorageCompactor(azureBlobDataAccessor, cosmosDataAccessor, cloudConfig, vcrMetrics, azureMetrics); this.azureContainerCompactor = new AzureContainerCompactor(azureBlobDataAccessor, cosmosDataAccessor, cloudConfig, vcrMetrics, azureMetrics); this.azureReplicationFeed = getReplicationFeedObj(azureReplicationFeedType, cosmosDataAccessor, azureMetrics, queryBatchSize); this.cloudConfig = cloudConfig; isVcr = cloudConfig.cloudIsVcr; this.clusterMap = clusterMap; logger.info("Created Azure destination"); }

Target:
AzureCloudDestination(CloudConfig cloudConfig, AzureCloudConfig azureCloudConfig, String clusterName, VcrMetrics vcrMetrics, AzureMetrics azureMetrics, AzureReplicationFeed.FeedType azureReplicationFeedType, ClusterMap clusterMap) throws ReflectiveOperationException { this.azureMetrics = azureMetrics; this.blobLayoutStrategy = new AzureBlobLayoutStrategy(clusterName, azureCloudConfig); this.azureBlobDataAccessor = new AzureBlobDataAccessor(cloudConfig, azureCloudConfig, blobLayoutStrategy, azureMetrics); this.queryBatchSize = azureCloudConfig.cosmosQueryBatchSize; this.cosmosDataAccessor = new CosmosDataAccessor(cloudConfig, azureCloudConfig, vcrMetrics, azureMetrics); this.azureStorageCompactor = new AzureStorageCompactor(azureBlobDataAccessor, cosmosDataAccessor, cloudConfig, vcrMetrics, azureMetrics); this.azureContainerCompactor = new AzureContainerCompactor(azureBlobDataAccessor, cosmosDataAccessor, cloudConfig, vcrMetrics, azureMetrics); this.azureReplicationFeed = getReplicationFeedObj(azureReplicationFeedType, cosmosDataAccessor, azureMetrics, queryBatchSize); this.cloudConfig = cloudConfig; isVcr = cloudConfig.cloudIsVcr; this.clusterMap = clusterMap; logger.info("Created Azure destination"); }
Source:
public static byte[] encodeLength(int length) { if (length < 128) { return new byte[] {(byte) length}; } int numberOfBits = Integer.SIZE - Integer.numberOfLeadingZeros(length); int numberOfBytes = (numberOfBits + 7) / 8; byte[] encoded = new byte[1 + numberOfBytes]; encoded[0] = (byte) (numberOfBytes | 0x80); for (int i = 0; i < numberOfBytes; i++) { int byteToEncode = (numberOfBytes - i); int shiftSize = (byteToEncode - 1) * 8; encoded[i + 1] = (byte) (length >>> shiftSize); } return encoded; }

Target:
public static byte[] encodeLength(int length) { if (length < 128) { return new byte[] {(byte) length}; } int numberOfBits = 32 - Integer.numberOfLeadingZeros(length); int numberOfBytes = (numberOfBits + 7) / 8; byte[] encoded = new byte[1 + numberOfBytes]; encoded[0] = (byte) (numberOfBytes | 0x80); for (int i = 0; i < numberOfBytes; i++) { int byteToEncode = (numberOfBytes - i); int shiftSize = (byteToEncode - 1) * 8; encoded[i + 1] = (byte) (length >>> shiftSize); } return encoded; }
Source:
public void run() { for (int i=0 ; i<workers ; i++) { executor.submit(new Runnable() { public void run() { boolean empty; ByteBuffer sendBuffer; try { sendBuffer = bufferPool.borrow(); } catch(final InterruptedException e) { handler.handle(e); return; } while (!((empty = messages.isEmpty()) && shutdown)) { try { if (empty) { Thread.sleep(WAIT_SLEEP_MS); continue; } if (Thread.interrupted()) { return; } final String message = messages.poll(); if (message != null) { qSize.decrementAndGet(); final byte[] data = message.getBytes(MESSAGE_CHARSET); if (sendBuffer.capacity() < data.length) { throw new InvalidMessageException(MESSAGE_TOO_LONG, message); } if (sendBuffer.remaining() < (data.length + 1)) { outboundQueue.put(sendBuffer); sendBuffer = bufferPool.borrow(); } if (sendBuffer.position() > 0) { sendBuffer.put((byte) '\n'); } sendBuffer.put(data); if (null == messages.peek()) { outboundQueue.put(sendBuffer); sendBuffer = bufferPool.borrow(); } } } catch (final InterruptedException e) { if (shutdown) { return; } } catch (final Exception e) { handler.handle(e); } } endSignal.countDown(); } }); } boolean done = false; while(!done) { try { endSignal.await(); done = true; } catch (final InterruptedException e) { } } }

Target:
public void run() { for (int i = 0 ; i < workers ; i++) { executor.submit(new Runnable() { public void run() { boolean empty; ByteBuffer sendBuffer; try { sendBuffer = bufferPool.borrow(); } catch (final InterruptedException e) { handler.handle(e); return; } while (!((empty = messages.isEmpty()) && shutdown)) { try { if (empty) { Thread.sleep(WAIT_SLEEP_MS); continue; } if (Thread.interrupted()) { return; } final String message = messages.poll(); if (message != null) { qsize.decrementAndGet(); final byte[] data = message.getBytes(MESSAGE_CHARSET); if (sendBuffer.capacity() < data.length) { throw new InvalidMessageException(MESSAGE_TOO_LONG, message); } if (sendBuffer.remaining() < (data.length + 1)) { outboundQueue.put(sendBuffer); sendBuffer = bufferPool.borrow(); } if (sendBuffer.position() > 0) { sendBuffer.put((byte) '\n'); } sendBuffer.put(data); if (null == messages.peek()) { outboundQueue.put(sendBuffer); sendBuffer = bufferPool.borrow(); } } } catch (final InterruptedException e) { if (shutdown) { endSignal.countDown(); return; } } catch (final Exception e) { handler.handle(e); } } endSignal.countDown(); } }); } boolean done = false; while (!done) { try { endSignal.await(); done = true; } catch (final InterruptedException e) { } } }
Source:
public void finishCell() { Preconditions.checkState( nextValueIndex == -1 || nextValueIndex == value.length, "Inconsistent value found"); if (!Objects.equals(this.family, this.previousFamily)) { previousFamily = this.family; currentFamilyCells = new ArrayList<>(); cells.put(this.family, this.currentFamilyCells); } RowCell rowCell = new RowCell( ByteStringer.extract(this.currentKey), this.family.getBytes(), this.qualifier, TimestampConverter.bigtable2hbase(this.timestamp), this.value, this.labels); this.currentFamilyCells.add(rowCell); }

Target:
public void finishCell() { Preconditions.checkNotNull(currentKey, "row key cannot be null"); Preconditions.checkState(nextValueIndex == value.length, "Cell value too short"); if (!Objects.equals(this.family, this.previousFamily)) { previousFamily = this.family; currentFamilyCells = new ArrayList<>(); cells.put(this.family, this.currentFamilyCells); } RowCell rowCell = new RowCell( ByteStringer.extract(this.currentKey), this.family.getBytes(), this.qualifier, TimestampConverter.bigtable2hbase(this.timestamp), this.value, this.labels); this.currentFamilyCells.add(rowCell); }
Source:
public void startSchemaCompactor() throws SQLException { if ( this.config.maxSchemaDeltas == null ) return; MysqlSchemaCompactor compactor = new MysqlSchemaCompactor( this.config.maxSchemaDeltas, this.getMaxwellConnectionPool(), this.config.clientID, this.getServerID(), this.getCaseSensitivity() ); Thread compactorThread = new Thread(() -> { try { compactor.runLoop(); } catch (Exception e) { e.printStackTrace(); } }, "maxwell-schema-compactor"); compactorThread.start(); this.addTask(compactor); }

Target:
public void startSchemaCompactor() throws SQLException { if ( this.config.maxSchemaDeltas == null ) return; MysqlSchemaCompactor compactor = new MysqlSchemaCompactor( this.config.maxSchemaDeltas, this.getMaxwellConnectionPool(), this.config.clientID, this.getServerID(), this.getCaseSensitivity() ); this.startTask(compactor, "maxwell-schema-compactor"); }
Source:
private void checkMisssingQueuesFatal() { if (this.missingQueuesFatal == null) { try { ApplicationContext applicationContext = getApplicationContext(); if (applicationContext != null) { Properties properties = applicationContext.getBean("spring.amqp.global.properties", Properties.class); String missingQueuesFatal = properties.getProperty("smlc.missing.queues.fatal"); if (StringUtils.hasText(missingQueuesFatal)) { this.missingQueuesFatal = Boolean.parseBoolean(missingQueuesFatal); } } } catch (BeansException be) { if (logger.isDebugEnabled()) { logger.debug("No global properties bean"); } } } if (this.missingQueuesFatal == null) { this.missingQueuesFatal = Boolean.TRUE; } }

Target:
private void checkMisssingQueuesFatal() { if (!this.missingQueuesFatalSet) { try { ApplicationContext applicationContext = getApplicationContext(); if (applicationContext != null) { Properties properties = applicationContext.getBean("spring.amqp.global.properties", Properties.class); String missingQueuesFatal = properties.getProperty("smlc.missing.queues.fatal"); if (StringUtils.hasText(missingQueuesFatal)) { this.missingQueuesFatal = Boolean.parseBoolean(missingQueuesFatal); } } } catch (BeansException be) { if (logger.isDebugEnabled()) { logger.debug("No global properties bean"); } } } }
Source:
private int compareNestedRecords(String key, String value, StructuredRecord structuredRecord1, StructuredRecord structuredRecord2) { if (key.contains(FIELD_DELIMITER)) { String[] nestedRecord = key.split(FIELD_DELIMITER); Schema.Field field = structuredRecord1.getSchema().getField(nestedRecord[0].trim()); Schema.Type type = field.getSchema().getType(); if (type.equals(Schema.Type.RECORD)) { structuredRecord1 = structuredRecord1.get(nestedRecord[0].trim()); structuredRecord2 = structuredRecord2.get(nestedRecord[0].trim()); nestedRecord = (String[]) ArrayUtils.removeElement(nestedRecord, nestedRecord[0].trim()); return compareNestedRecords(Joiner.on(FIELD_DELIMITER).join(nestedRecord), value, structuredRecord1, structuredRecord2); } else { throw new IllegalArgumentException("Nested structured defined by -> should be of type RECORD"); } } else { return compareRecords(key, value, structuredRecord1, structuredRecord2); } }

Target:
private int compareNestedRecords(String key, String value, StructuredRecord structuredRecord1, StructuredRecord structuredRecord2) { if (key.contains(FIELD_DELIMITER)) { String[] nestedRecord = key.split(FIELD_DELIMITER); Schema.Field field = structuredRecord1.getSchema().getField(nestedRecord[0].trim()); Schema schema = field.getSchema(); Schema.Type type = schema.isNullableSimple() ? schema.getNonNullable().getType() : schema.getType(); if (type.equals(Schema.Type.RECORD)) { structuredRecord1 = structuredRecord1.get(nestedRecord[0].trim()); structuredRecord2 = structuredRecord2.get(nestedRecord[0].trim()); nestedRecord = (String[]) ArrayUtils.removeElement(nestedRecord, nestedRecord[0].trim()); key = Joiner.on(FIELD_DELIMITER).join(nestedRecord); int res = compareNull(key, structuredRecord1, structuredRecord2); if (res != DEFAULT_COMP_VALUE) { return res; } else { return compareNestedRecords(key, value, structuredRecord1, structuredRecord2); } } else { throw new IllegalArgumentException("Nested structured defined by \":\" should be of type RECORD"); } } else { return compareRecords(key, value, structuredRecord1, structuredRecord2); } }
Source:
public List<String> handleRequest(WebrequestData webrequest){ List<String> tags = new ArrayList(0); assert webrequest.getUriHost()!=null: webrequest; assert webrequest.getHttpStatus() != null: webrequest; assert webrequest.getUserAgent() != null: webrequest; if(Constants.PAGEVIEW_WORTHTY_HTTP_CODES.contains(webrequest.getHttpStatus()) && Constants.CONTENT_TYPES.contains(webrequest.getContentType())) { for (Tagger t : this.chain) { String tag = t.getTag(webrequest); if (!tag.equals(Tagger.EMPTY)) { tags.add(tag); } } } return tags; }

Target:
public List<String> handleRequest(WebrequestData webrequest){ List<String> tags = new ArrayList(0); assert webrequest.getUriHost()!=null: webrequest; assert webrequest.getHttpStatus() != null: webrequest; assert webrequest.getUserAgent() != null: webrequest; if(Webrequest.SUCCESS_HTTP_STATUSES.contains(webrequest.getHttpStatus()) && Webrequest.TEXT_HTML_CONTENT_TYPES.contains(webrequest.getContentType())) { for (Tagger t : this.chain) { String tag = t.getTag(webrequest); if (!tag.equals(Tagger.EMPTY)) { tags.add(tag); } } } return tags; }
Source:
public void setNode(Node selectedNode) { if (selectedNode == null) { return; } AbstractFile file = selectedNode.getLookup().lookup(AbstractFile.class); if (file == null) { return; } String mimeType = file.getMIMEType(); if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); try { FileTypeDetector fileTypeDetector = new FileTypeDetector(); mimeType = fileTypeDetector.detectFileType(file); } catch (FileTypeDetector.FileTypeDetectorInitException ex) { LOGGER.log(Level.SEVERE, "Failed to initialize FileTypeDetector.", ex); return; } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, String.format("Could not detect format using fileTypeDetector for file: %s", file), ex); return; } } if (mimeType.equalsIgnoreCase("application/octet-stream")) { return; } else { ContentViewer viewer = getSupportingViewer(mimeType); if (viewer != null) { lastViewer = viewer; viewer.setFile(file); this.removeAll(); this.add(viewer.getComponent()); this.repaint(); } } }

Target:
public void setNode(Node selectedNode) { resetComponent(); if (selectedNode == null) { return; } AbstractFile file = selectedNode.getLookup().lookup(AbstractFile.class); if (file == null) { return; } String mimeType = file.getMIMEType(); if (Strings.isNullOrEmpty(mimeType)) { LOGGER.log(Level.INFO, "Mimetype not known for file: {0}", file.getName()); try { FileTypeDetector fileTypeDetector = new FileTypeDetector(); mimeType = fileTypeDetector.detectMIMEType(file); }catch (FileTypeDetector.FileTypeDetectorInitException ex) { LOGGER.log(Level.SEVERE, "Failed to initialize FileTypeDetector.", ex); return; } } if (mimeType.equalsIgnoreCase("application/octet-stream")) { return; } else { ContentViewer viewer = getSupportingViewer(mimeType); if (viewer != null) { lastViewer = viewer; viewer.setFile(file); this.removeAll(); this.add(viewer.getComponent()); this.repaint(); } } }
Source:
public String getServerURI() { if (getEmail().equals("iago@zulip.com")) { return "<LINK_0>"; } return settings.getString("server_url", "<LINK_1>"); }

Target:
public String getServerURI() { if (getEmail().equals("iago@zulip.com")) { return "<LINK_0>"; } return settings.getString("server_url", DEFAULT_SERVER_URL); }
Source:
public String getProperty(String propertyName) { String value = System.getProperty(propertyName); if (value != null && value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1, value.length() - 1); } return value; }

Target:
protected String getProperty(String propertyName) { String value = System.getProperty(propertyName); if (value != null && value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1, value.length() - 1); } return value; }
Source:
public void setPlayerState(PlayerState state) throws IllegalArgumentException { if (!this.state.isAllowedTransistionTo(state)) { throw new IllegalArgumentException( "The player is not allowed to switch from the current state (" + this.state.name() + ") to the specified state (" + state.name() + ")"); } this.state = state; }

Target:
void setPlayerState(PlayerState state) throws IllegalArgumentException { if (!this.state.isAllowedTransistionTo(state)) { throw new IllegalArgumentException( "The player is not allowed to switch from the current state (" + this.state.name() + ") to the specified state (" + state.name() + ")"); } this.state = state; }
Source:
protected void shutDown() throws Exception { LOG.info("Stopping service on address {}...", bindAddress); try { bootstrap.shutdown(); if (!channelGroup.close().await(CLOSE_CHANNEL_TIMEOUT, TimeUnit.SECONDS)) { LOG.warn("Timeout when closing all channels."); } } finally { resourceHandler.destroy(handlerContext); bootstrap.releaseExternalResources(); if (executionHandler != null) { executionHandler.releaseExternalResources(); Executor executor = executionHandler.getExecutor(); if (executor instanceof ExecutorService) { ((ExecutorService) executor).awaitTermination(CLOSE_CHANNEL_TIMEOUT, TimeUnit.SECONDS); } } } LOG.info("Done stopping service on address {}", bindAddress); }

Target:
protected void shutDown() throws Exception { LOG.info("Stopping service on address {}...", bindAddress); try { bootstrap.shutdown(); if (!channelGroup.close().await(CLOSE_CHANNEL_TIMEOUT, TimeUnit.SECONDS)) { LOG.warn("Timeout when closing all channels."); } } finally { resourceHandler.destroy(handlerContext); bootstrap.releaseExternalResources(); if (executionHandler != null) { executionHandler.releaseExternalResources(); ExecutorUtil.terminate(executionHandler.getExecutor()); } } LOG.info("Done stopping service on address {}", bindAddress); }