auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
MonitoringHandler createHandler( String parserId, String eventId, String ruleContent ) { String appName = this.agentInterface.getApplicationName(); String rootInstanceName = this.agentInterface.getRootInstance().getName(); MonitoringHandler result = null; if( PARSER_FILE.equalsIgnoreCase( parserId )) result = new FileHandler( eventId, appName, rootInstanceName, ruleContent ); else if( PARSER_NAGIOS.equalsIgnoreCase( parserId )) result = new NagiosHandler( eventId, appName, rootInstanceName, ruleContent ); return result; }

Target:
MonitoringHandler createHandler( String parserId, String eventId, String ruleContent ) { String appName = this.agentInterface.getApplicationName(); String rootInstanceName = this.agentInterface.getRootInstance().getName(); MonitoringHandler result = null; if( PARSER_FILE.equalsIgnoreCase( parserId )) result = new FileHandler( eventId, appName, rootInstanceName, ruleContent ); else if( PARSER_NAGIOS.equalsIgnoreCase( parserId )) result = new NagiosHandler( eventId, appName, rootInstanceName, ruleContent ); else if(PARSER_REST.equalsIgnoreCase( parserId )) result = new RestHandler( eventId, appName, rootInstanceName, ruleContent ); return result; }
Source:
static ByteBuf encodeMetadataHeader( ByteBufAllocator allocator, String customMime, int metadataLength) { ByteBuf mimeBuffer = allocator.buffer(customMime.length()); mimeBuffer.writeCharSequence(customMime, CharsetUtil.UTF_8); if (!ByteBufUtil.isText(mimeBuffer, CharsetUtil.US_ASCII)) { throw new IllegalArgumentException("custom mime type must be US_ASCII characters only"); } int ml = mimeBuffer.readableBytes(); if (ml < 1 || ml > 128) { throw new IllegalArgumentException( "custom mime type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128"); } ml--; ByteBuf mimeLength = allocator.buffer(1, 1); mimeLength.writeByte((byte) ml); ByteBuf metadataLengthBuffer = allocator.buffer(3, 3); NumberUtils.encodeUnsignedMedium(metadataLengthBuffer, metadataLength); return allocator .compositeBuffer() .addComponents(true, mimeLength, mimeBuffer, metadataLengthBuffer); }

Target:
static ByteBuf encodeMetadataHeader( ByteBufAllocator allocator, String customMime, int metadataLength) { ByteBuf metadataHeader = allocator.buffer(4 + customMime.length()); int writerIndexInitial = metadataHeader.writerIndex(); metadataHeader.writerIndex(writerIndexInitial + 1); int customMimeLength = ByteBufUtil.writeUtf8(metadataHeader, customMime); if (!ByteBufUtil.isText(metadataHeader, CharsetUtil.US_ASCII)) { metadataHeader.release(); throw new IllegalArgumentException("custom mime type must be US_ASCII characters only"); } if (customMimeLength < 1 || customMimeLength > 128) { metadataHeader.release(); throw new IllegalArgumentException( "custom mime type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128"); } metadataHeader.markWriterIndex(); metadataHeader.writerIndex(writerIndexInitial); metadataHeader.writeByte(customMimeLength - 1); metadataHeader.resetWriterIndex(); NumberUtils.encodeUnsignedMedium(metadataHeader, metadataLength); return metadataHeader; }
Source:
public void testList() throws StripeException { Map<String, Object> listParams = new HashMap<String, Object>(); listParams.put("limit", 1); ApplicationFeeCollection resources = ApplicationFee.list(listParams); assertNotNull(resources); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/application_fees") ); }

Target:
public void testList() throws StripeException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("limit", 1); final ApplicationFeeCollection fees = ApplicationFee.list(params); assertNotNull(fees); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/application_fees"), params ); }
Source:
public void setup() throws ResourceUnavailableException { MockitoAnnotations.initMocks(this); ipAddressVO = new IPAddressVO(new Ip("192.0.0.1"), 1L, 1L, 1L,false); ipAddressVO.setAllocatedToAccountId(1L); account = new AccountVO("admin", 1L, null, (short) 1, 1L, "c65a73d5-ebbd-11e7-8f45-107b44277808"); account.setId(1L); NetworkOfferingVO networkOfferingVO = Mockito.mock(NetworkOfferingVO.class); networkOfferingVO.setSharedSourceNat(false); Mockito.when(_networkOfferingDao.findById(Mockito.anyLong())).thenReturn(networkOfferingVO); }

Target:
public void setup() throws ResourceUnavailableException { ipAddressVO = new IPAddressVO(new Ip("192.0.0.1"), 1L, 1L, 1L,false); ipAddressVO.setAllocatedToAccountId(1L); account = new AccountVO("admin", 1L, null, (short) 1, 1L, "c65a73d5-ebbd-11e7-8f45-107b44277808"); account.setId(1L); NetworkOfferingVO networkOfferingVO = Mockito.mock(NetworkOfferingVO.class); networkOfferingVO.setSharedSourceNat(false); Mockito.when(networkOfferingDao.findById(Mockito.anyLong())).thenReturn(networkOfferingVO); }
Source:
private TreeMap<EntityType, List<Entity>> getEntityList(String extensionName, String jobName, List<FormDataBodyPart> feedForms, List<FormDataBodyPart> processForms, InputStream config) throws FalconException, IOException{ List<Entity> processes = getProcesses(processForms); List<Entity> feeds = getFeeds(feedForms); ExtensionType extensionType = getExtensionType(extensionName); List<Entity> entities; TreeMap<EntityType, List<Entity>> entityMap = new TreeMap<>(); if (ExtensionType.TRUSTED.equals(extensionType)) { entities = generateEntities(extensionName, config); List<Entity> trustedFeeds = new ArrayList<>(); List<Entity> trustedProcesses = new ArrayList<>(); for (Entity entity : entities) { if (EntityType.FEED.equals(entity.getEntityType())) { trustedFeeds.add(entity); } else { trustedProcesses.add(entity); } } entityMap.put(EntityType.PROCESS, trustedProcesses); entityMap.put(EntityType.FEED, trustedFeeds); return entityMap; } else { EntityUtil.applyTags(extensionName, jobName, processes); EntityUtil.applyTags(extensionName, jobName, feeds); entityMap.put(EntityType.PROCESS, processes); entityMap.put(EntityType.FEED, feeds); return entityMap; } }

Target:
private SortedMap<EntityType, List<Entity>> getEntityList(String extensionName, String jobName, List<FormDataBodyPart> feedForms, List<FormDataBodyPart> processForms, InputStream config) throws FalconException, IOException{ List<Entity> processes = getProcesses(processForms); List<Entity> feeds = getFeeds(feedForms); ExtensionType extensionType = getExtensionType(extensionName); List<Entity> entities; TreeMap<EntityType, List<Entity>> entityMap = new TreeMap<>(); if (ExtensionType.TRUSTED.equals(extensionType)) { entities = generateEntities(extensionName, config); List<Entity> trustedFeeds = new ArrayList<>(); List<Entity> trustedProcesses = new ArrayList<>(); for (Entity entity : entities) { if (EntityType.FEED.equals(entity.getEntityType())) { trustedFeeds.add(entity); } else { trustedProcesses.add(entity); } } entityMap.put(EntityType.PROCESS, trustedProcesses); entityMap.put(EntityType.FEED, trustedFeeds); return entityMap; } else { EntityUtil.applyTags(extensionName, jobName, processes); EntityUtil.applyTags(extensionName, jobName, feeds); entityMap.put(EntityType.PROCESS, processes); entityMap.put(EntityType.FEED, feeds); return entityMap; } }
Source:
private NonBlockingSemaphoreLike getFreeConnectionsForHost(Object partitionKey) { if (maxConnectionsPerHostEnabled) { return freeChannelsPerHost.computeIfAbsent(partitionKey, pk -> new NonBlockingSemaphore(config.getMaxConnectionsPerHost())); } else { return NonBlockingSemaphoreInfinite.I; } }

Target:
private NonBlockingSemaphoreLike getFreeConnectionsForHost(Object partitionKey) { return maxConnectionsPerHostEnabled ? freeChannelsPerHost.computeIfAbsent(partitionKey, pk -> new NonBlockingSemaphore(config.getMaxConnectionsPerHost())) : NonBlockingSemaphoreInfinite.INSTANCE; }
Source:
public void swapSlotContents( final int slotA, final int slotB ) { final Slot a = this.getSlot( slotA ); final Slot b = this.getSlot( slotB ); if( a == null || b == null ) { return; } final ItemStack isA = a.getStack(); final ItemStack isB = b.getStack(); if( isA.isEmpty() && isB.isEmpty() ) { return; } if( !isA.isEmpty() && !a.canTakeStack( this.getInventoryPlayer().player ) ) { return; } if( !isB.isEmpty() && !b.canTakeStack( this.getInventoryPlayer().player ) ) { return; } if( !isB.isEmpty() && !a.isItemValid( isB ) ) { return; } if( !isA.isEmpty() && !b.isItemValid( isA ) ) { return; } ItemStack testA = isB.isEmpty() ? ItemStack.EMPTY : isB.copy(); ItemStack testB = isA.isEmpty() ? ItemStack.EMPTY : isA.copy(); if( !testA.isEmpty() && testA.getCount() > a.getSlotStackLimit() ) { if( !testB.isEmpty() ) { return; } final int totalA = testA.getCount(); testA.setCount( a.getSlotStackLimit() ); testB = testA.copy(); testB.setCount( totalA - testA.getCount() ); } if( !testB.isEmpty() && testB.getCount() > b.getSlotStackLimit() ) { if( !testA.isEmpty() ) { return; } final int totalB = testB.getCount(); testB.setCount( b.getSlotStackLimit() ); testA = testB.copy(); testA.setCount( totalB - testA.getCount() ); } a.putStack( testA ); b.putStack( testB ); b.putStack( testB ); }

Target:
public void swapSlotContents( final int slotA, final int slotB ) { final Slot a = this.getSlot( slotA ); final Slot b = this.getSlot( slotB ); if( a == null || b == null ) { return; } final ItemStack isA = a.getStack(); final ItemStack isB = b.getStack(); if( isA.isEmpty() && isB.isEmpty() ) { return; } if( !isA.isEmpty() && !a.canTakeStack( this.getInventoryPlayer().player ) ) { return; } if( !isB.isEmpty() && !b.canTakeStack( this.getInventoryPlayer().player ) ) { return; } if( !isB.isEmpty() && !a.isItemValid( isB ) ) { return; } if( !isA.isEmpty() && !b.isItemValid( isA ) ) { return; } ItemStack testA = isB.isEmpty() ? ItemStack.EMPTY : isB.copy(); ItemStack testB = isA.isEmpty() ? ItemStack.EMPTY : isA.copy(); if( !testA.isEmpty() && testA.getCount() > a.getSlotStackLimit() ) { if( !testB.isEmpty() ) { return; } final int totalA = testA.getCount(); testA.setCount( a.getSlotStackLimit() ); testB = testA.copy(); testB.setCount( totalA - testA.getCount() ); } if( !testB.isEmpty() && testB.getCount() > b.getSlotStackLimit() ) { if( !testA.isEmpty() ) { return; } final int totalB = testB.getCount(); testB.setCount( b.getSlotStackLimit() ); testA = testB.copy(); testA.setCount( totalB - testA.getCount() ); } a.putStack( testA ); b.putStack( testB ); }
Source:
void stopContainer() { if (containerController.isStarted(COORDINATOR_CONTAINER)) { LRALogger.logger.info("STOPPING CONTAINER%n"); deployer.undeploy(COORDINATOR_DEPLOYMENT); containerController.stop(COORDINATOR_CONTAINER); containerController.kill(COORDINATOR_CONTAINER); } }

Target:
void stopContainer() { if (containerController.isStarted(COORDINATOR_CONTAINER)) { LRALogger.logger.debug("Stopping container"); deployer.undeploy(COORDINATOR_DEPLOYMENT); containerController.stop(COORDINATOR_CONTAINER); containerController.kill(COORDINATOR_CONTAINER); } }
Source:
public void should_include_asset_matching_one_of_include_patterns() throws Exception { final Filter<ArchivePath> filter = createComposedFilter("org.arquillian.extension.jacoco.client.*, org.arquillian.extension.integration.*", null); final boolean include = filter.include(ArchivePaths.create("org/arquillian/extension/jacoco/client/ManifestAsset.class")); assertThat(include).isTrue(); }

Target:
public void should_include_asset_matching_one_of_include_patterns() throws Exception { final Filter<ArchivePath> filter = FilterTestUtils.createComposedFilter("org.jboss.arquillian.extension.jacoco.client.*, org.jboss.arquillian.extension.integration.*", null); final boolean include = filter.include(FilterTestUtils.convertFromClass(ManifestAsset.class)); assertThat(include).isTrue(); }
Source:
public void should_serialize_and_deserialize_parameterized_class_mocked_with_deep_stubs() throws Exception { assumeTrue(ClassFileVersion.ofThisVm().isLessThan(ClassFileVersion.JAVA_V9)); ListContainer deep_stubbed = mock(ListContainer.class, withSettings().defaultAnswer(RETURNS_DEEP_STUBS).serializable()); when(deep_stubbed.iterator().next().add("yes")).thenReturn(true); ListContainer deserialized_deep_stub = serializeAndBack(deep_stubbed); assertThat(deserialized_deep_stub.iterator().next().add("not stubbed but mock already previously resolved")).isEqualTo(false); assertThat(deserialized_deep_stub.iterator().next().add("yes")).isEqualTo(true); }

Target:
public void should_serialize_and_deserialize_parameterized_class_mocked_with_deep_stubs() throws Exception { ListContainer deep_stubbed = mock(ListContainer.class, withSettings().defaultAnswer(RETURNS_DEEP_STUBS).serializable()); when(deep_stubbed.iterator().next().add("yes")).thenReturn(true); ListContainer deserialized_deep_stub = serializeAndBack(deep_stubbed); assertThat(deserialized_deep_stub.iterator().next().add("not stubbed but mock already previously resolved")).isEqualTo(false); assertThat(deserialized_deep_stub.iterator().next().add("yes")).isEqualTo(true); }
Source:
private QueryStateInfo getQueryStateInfo(QueryInfo queryInfo) { Optional<ResourceGroupId> groupId = queryManager.getQueryResourceGroup(queryInfo.getQueryId()); if (queryInfo.getState() == QUEUED) { return createQueuedQueryStateInfo( queryInfo, groupId, groupId.map(resourceGroupManager::getPathToRoot)); } return createRunningQueryStateInfo(queryInfo, groupId); }

Target:
private QueryStateInfo getQueryStateInfo(QueryInfo queryInfo) { Optional<ResourceGroupId> groupId = queryManager.getQueryResourceGroup(queryInfo.getQueryId()); if (queryInfo.getState() == QUEUED) { return createQueuedQueryStateInfo( queryInfo, groupId, groupId.map(resourceGroupManager::getPathToRoot)); } return createQueryStateInfo(queryInfo, groupId); }
Source:
private ObjectType getSuperType(FunctionType type) { ObjectType proto = type.getPrototype(); if (proto == null) return null; ObjectType implicitProto = proto.getImplicitPrototype(); if (implicitProto == null) return null; return implicitProto.getDisplayName().equals("Object") ? null : implicitProto; }

Target:
private ObjectType getSuperType(FunctionType type) { ObjectType proto = type.getPrototype(); if (proto == null) return null; ObjectType implicitProto = proto.getImplicitPrototype(); if (implicitProto == null) return null; return "Object".equals(implicitProto.getDisplayName()) ? null : implicitProto; }
Source:
private boolean validateNoRunningJobs(Guid vdsId) { List<Step> steps = stepDao.getStartedStepsByStepSubjectEntity(new SubjectEntity(VdcObjectType.EXECUTION_HOST, vdsId)); if (!steps.isEmpty()) { return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_HOST_WITH_RUNNING_JOBS, String.format("$jobs %1$s", steps.stream() .map(s -> s.getDescription()) .collect(Collectors.joining(System.lineSeparator())))); } return true; }

Target:
private boolean validateNoRunningJobs(Guid vdsId) { List<Step> steps = stepDao.getStartedStepsByStepSubjectEntity(new SubjectEntity(VdcObjectType.EXECUTION_HOST, vdsId)); if (!steps.isEmpty()) { ReplacementUtils.replaceWith("jobs", steps.stream().map(s -> s.getDescription()).collect(Collectors.toSet())); return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_HOST_WITH_RUNNING_JOBS, String.format("$jobs %1$s", steps.stream() .map(s -> s.getDescription()) .collect(Collectors.joining(System.lineSeparator())))); } return true; }
Source:
private static void checkParameterTypes(String methodName, Class<?>[] parameterTypes, String methodAnnotation, String[] parameterNames) { int totalLength = parameterTypes.length; int tmp = totalLength; for (Class parameterType : parameterTypes) { if (INJECTED_TYPES.contains(parameterType)) { totalLength--; } } if (tmp != totalLength) { isInjected = true; } if (parameterNames.length == 0) { boolean invalid = (totalLength != 0) || (!validParameters(methodAnnotation, parameterTypes)); if (invalid) { String annotation = methodAnnotation; if (!methodAnnotation.startsWith("@")) { annotation = "@" + methodAnnotation; } String errPrefix; if (mapping.containsKey(methodAnnotation)) { errPrefix = "Can inject only one of " + prettyFormat(mapping.get(methodAnnotation)) + " into a " + annotation + " annotated " + methodName; } else { errPrefix = "Cannot inject " + annotation + " annotated Method [" + methodName + "] with " + Arrays.toString(parameterTypes); } throw new TestNGException(errPrefix + ".\nFor more information on native dependency injection please refer to " + "<LINK_0>" ); } } if (parameterNames.length != totalLength) { throw new TestNGException( "Method " + methodName + " requires " + parameterTypes.length + " parameters but " + parameterNames.length + " were supplied in the " + methodAnnotation + " annotation."); } }

Target:
private static void checkParameterTypes(String methodName, Class<?>[] parameterTypes, String methodAnnotation, String[] parameterNames) { int totalLength = parameterTypes.length; for (Class parameterType : parameterTypes) { if (INJECTED_TYPES.contains(parameterType)) { totalLength--; } } if (parameterNames.length == 0) { boolean invalid = (totalLength != 0) || (!validParameters(methodAnnotation, parameterTypes)); if (invalid) { String annotation = methodAnnotation; if (!methodAnnotation.startsWith("@")) { annotation = "@" + methodAnnotation; } String errPrefix; if (mapping.containsKey(methodAnnotation)) { errPrefix = "Can inject only one of " + prettyFormat(mapping.get(methodAnnotation)) + " into a " + annotation + " annotated " + methodName; } else { errPrefix = "Cannot inject " + annotation + " annotated Method [" + methodName + "] with " + Arrays.toString(parameterTypes); } throw new TestNGException(errPrefix + ".\nFor more information on native dependency injection please refer to " + "<LINK_0>" ); } } if (parameterNames.length != totalLength) { throw new TestNGException( "Method " + methodName + " requires " + parameterTypes.length + " parameters but " + parameterNames.length + " were supplied in the " + methodAnnotation + " annotation."); } }
Source:
public void testVpnMeterednessWithNonNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = getWifiNetwork(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = new ArrayList<>(1); underlyingNetworks.add(wifi); String allowedApps = mPackageName; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, false ); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertEquals(isNetworkMetered(wifi), isNetworkMetered(mNetwork)); assertEquals(isNetworkMetered(mNetwork), mCM.isActiveNetworkMetered()); }

Target:
public void testVpnMeterednessWithNonNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = getWifiNetwork(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = new ArrayList<>(1); underlyingNetworks.add(wifi); String allowedApps = mPackageName; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, false ); assertEquals(mNetwork, mCM.getActiveNetwork()); assertVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertEquals(isNetworkMetered(wifi), isNetworkMetered(mNetwork)); assertEquals(isNetworkMetered(mNetwork), mCM.isActiveNetworkMetered()); }
Source:
public Object intercept(InvocationContext context) throws Throwable { WebDriver browser = context.getGrapheneContext().getWebDriver(); if (indexOfFrame != -1) { browser.switchTo().frame(indexOfFrame); } else if (nameOrIdOfFrame != null) { browser.switchTo().frame(nameOrIdOfFrame); } Object result = context.invoke(); if(result instanceof GrapheneProxyInstance) { ((GrapheneProxyInstance) result).registerInterceptor(this); } browser.switchTo().defaultContent(); return result; }

Target:
public Object intercept(InvocationContext context) throws Throwable { WebDriver browser = context.getGrapheneContext().getWebDriver(); if (indexOfFrame != -1) { browser.switchTo().frame(indexOfFrame); } else if (nameOrIdOfFrame != null) { browser.switchTo().frame(nameOrIdOfFrame); } Object result = null; try { result = context.invoke(); } finally { browser.switchTo().defaultContent(); } if (result instanceof GrapheneProxyInstance) { ((GrapheneProxyInstance) result).registerInterceptor(this); } return result; }
Source:
private Map<String, CourseSummaryBundle> getCourseSummaryWithoutStatsForInstructor( List<InstructorAttributes> instructorAttributesList) { HashMap<String, CourseSummaryBundle> courseSummaryList = new HashMap<>(); List<String> courseIdList = new ArrayList<>(); for (InstructorAttributes ia : instructorAttributesList) { if (!coursesDb.getCourse(ia.courseId).isCourseDeleted()) { courseIdList.add(ia.courseId); } } List<CourseAttributes> courseList = coursesDb.getCourses(courseIdList); if (courseIdList.size() > courseList.size()) { for (CourseAttributes ca : courseList) { courseIdList.remove(ca.getId()); } log.severe("Course(s) was deleted but the instructor still exists: " + System.lineSeparator() + courseIdList.toString()); } for (CourseAttributes ca : courseList) { courseSummaryList.put(ca.getId(), getCourseSummaryWithoutStats(ca)); } return courseSummaryList; }

Target:
private Map<String, CourseSummaryBundle> getCourseSummaryWithoutStatsForInstructor( List<InstructorAttributes> instructorAttributesList) { HashMap<String, CourseSummaryBundle> courseSummaryList = new HashMap<>(); List<String> courseIdList = instructorAttributesList.stream() .filter(instructor -> !coursesDb.getCourse(instructor.courseId).isCourseDeleted()) .map(InstructorAttributes::getCourseId) .collect(Collectors.toList()); List<CourseAttributes> courseList = coursesDb.getCourses(courseIdList); if (courseIdList.size() > courseList.size()) { for (CourseAttributes ca : courseList) { courseIdList.remove(ca.getId()); } log.severe("Course(s) was deleted but the instructor still exists: " + System.lineSeparator() + courseIdList.toString()); } for (CourseAttributes ca : courseList) { courseSummaryList.put(ca.getId(), getCourseSummaryWithoutStats(ca)); } return courseSummaryList; }
Source:
public static Optional<DateTime> getLightsOutTime(final List<Event> lightEvents) { for (final Event event : lightEvents) { if (event.getType() == Event.Type.LIGHTS_OUT) { final DateTime lightsOutTime = new DateTime(event.getEndTimestamp(), DateTimeZone.UTC).plusMillis(event.getTimezoneOffset()); final int lightsOutHour = lightsOutTime.getHourOfDay(); if (lightsOutHour > 19 || lightsOutHour < 4) { return Optional.of(lightsOutTime.minusMinutes(10)); } break; } } return Optional.absent(); }

Target:
public static Optional<DateTime> getLightsOutTime(final List<Event> lightEvents) { for (final Event event : lightEvents) { if (event.getType() == Event.Type.LIGHTS_OUT) { final DateTime lightsOutTime = new DateTime(event.getEndTimestamp(), DateTimeZone.UTC).plusMillis(event.getTimezoneOffset()); final int lightsOutHour = lightsOutTime.getHourOfDay(); if (lightsOutHour > LIGHTS_OUT_START_THRESHOLD || lightsOutHour < LIGHTS_OUT_END_THRESHOLD) { return Optional.of(lightsOutTime.minusMinutes(LIGHTS_OUT_TOLERANCE)); } break; } } return Optional.absent(); }
Source:
public void process(TypedTransactionBase tx, Bytes row, Column col) { String newContent = tx.get().row(row).col(col).toString(); String currentContent = tx.get().row(row).fam("content").qual("current").toString(""); Map<String, Long> newWordCounts = getWordCounts(newContent); Map<String, Long> currentWordCounts = getWordCounts(currentContent); Map<String, Long> changes = new HashMap<>(); for (Entry<String, Long> entry : newWordCounts.entrySet()) { String word = entry.getKey(); long newCount = entry.getValue(); long currentCount = currentWordCounts.getOrDefault(word, 0l); changes.put(word, newCount - currentCount); } for (Entry<String, Long> entry : currentWordCounts.entrySet()) { String word = entry.getKey(); long currentCount = entry.getValue(); if (!newWordCounts.containsKey(word)) { changes.put(word, -1 * currentCount); } } wcm.update(tx, changes); tx.mutate().row(row).fam("content").qual("current").set(newContent); }

Target:
public void process(TypedTransactionBase tx, Bytes row, Column col) { String newContent = tx.get().row(row).col(col).toString(); String currentContent = tx.get().row(row).fam("content").qual("current").toString(""); Map<String, Long> newWordCounts = getWordCounts(newContent); Map<String, Long> currentWordCounts = getWordCounts(currentContent); Map<String, Long> changes = new HashMap<>(); for (Entry<String, Long> entry : newWordCounts.entrySet()) { String word = entry.getKey(); long newCount = entry.getValue(); long currentCount = currentWordCounts.getOrDefault(word, 0L); changes.put(word, newCount - currentCount); } for (Entry<String, Long> entry : currentWordCounts.entrySet()) { String word = entry.getKey(); long currentCount = entry.getValue(); if (!newWordCounts.containsKey(word)) { changes.put(word, -1 * currentCount); } } wcm.update(tx, changes); tx.mutate().row(row).fam("content").qual("current").set(newContent); }
Source:
private ServerErrorCode validateRequest(PartitionId partition, boolean checkPartitionState) { try { storeManager.getStore(partition); } catch (StoreException e) { if (e.getErrorCode() == StoreErrorCodes.Store_Not_Started) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } else if (e.getErrorCode() == StoreErrorCodes.Partition_Not_Found) { metrics.partitionUnknownError.inc(); return ServerErrorCode.Partition_Unknown; } } List<ReplicaId> replicaIds = partition.getReplicaIds(); for (ReplicaId replica : replicaIds) { if (replica.getDataNodeId().getHostname() == currentNode.getHostname() && replica.getDataNodeId().getPort() == currentNode.getPort()) { if (replica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } } } if (checkPartitionState && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } return ServerErrorCode.No_Error; }

Target:
private ServerErrorCode validateRequest(PartitionId partition, boolean checkPartitionState) { if (storageManager.getStore(partition) == null) { boolean partitionPresent = false; for (ReplicaId replica : partition.getReplicaIds()) { if (replica.getDataNodeId().equals(currentNode)) { partitionPresent = true; break; } } if (partitionPresent) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } else { metrics.partitionUnknownError.inc(); return ServerErrorCode.Partition_Unknown; } } List<ReplicaId> replicaIds = partition.getReplicaIds(); for (ReplicaId replica : replicaIds) { if (replica.getDataNodeId().getHostname() == currentNode.getHostname() && replica.getDataNodeId().getPort() == currentNode.getPort()) { if (replica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } } } if (checkPartitionState && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } return ServerErrorCode.No_Error; }
Source:
public void setUp() throws Exception { resourceFactory = (ResourceFactory<String, String>) EasyMock.createMock(ResourceFactory.class); EasyMock.replay(resourceFactory); pool = new ResourcePool<String, String>( resourceFactory, new ResourcePoolConfig(2, 14400000000l) ); EasyMock.verify(resourceFactory); EasyMock.reset(resourceFactory); }

Target:
public void setUp() throws Exception { resourceFactory = (ResourceFactory<String, String>) EasyMock.createMock(ResourceFactory.class); EasyMock.replay(resourceFactory); pool = new ResourcePool<String, String>( resourceFactory, new ResourcePoolConfig(2, TimeUnit.MINUTES.toMillis(4)) ); EasyMock.verify(resourceFactory); EasyMock.reset(resourceFactory); }
Source:
public DataSetPreProcessor getPreProcessor() { throw new UnsupportedOperationException(); }

Target:
public DataSetPreProcessor getPreProcessor() { return preProcessor; }
Source:
public StructuredRecord getCurrentValue(StructuredRecord.Builder recordBuilder) throws IOException, InterruptedException { StructuredRecord ret = recordTransformer.transform(recordBuilder, delegate.getCurrentValue(), schema, pathField); AvroReadSupport.setAvroReadSchema(job.getConfiguration(), new org.apache.avro.Schema.Parser().parse (ret.getSchema().toString())); return ret; }

Target:
public StructuredRecord getCurrentValue(StructuredRecord.Builder recordBuilder) throws IOException, InterruptedException { return recordTransformer.transform(recordBuilder, delegate.getCurrentValue(), schema, pathField); }
Source:
public IndexReader select( IndexReader[] instances, IndexQuery... predicates ) { if ( predicates.length > 1 ) { return instances[LUCENE]; } IndexQuery predicate = predicates[0]; if ( predicate instanceof ExactPredicate ) { ExactPredicate exactPredicate = (ExactPredicate) predicate; return select( instances, exactPredicate.value() ); } if ( predicate instanceof IndexQuery.RangePredicate ) { switch ( predicate.valueGroup() ) { case NUMBER: return instances[NUMBER]; case GEOMETRY: return instances[SPATIAL]; case DATE: case LOCAL_DATE_TIME: case ZONED_DATE_TIME: case LOCAL_TIME: case ZONED_TIME: case DURATION: return instances[TEMPORAL]; default: } } if ( predicate instanceof ExistsPredicate ) { return null; } return instances[LUCENE]; }

Target:
public IndexReader select( IndexReader[] instances, IndexQuery... predicates ) { if ( predicates.length > 1 ) { return instances[LUCENE]; } IndexQuery predicate = predicates[0]; if ( predicate instanceof ExactPredicate ) { ExactPredicate exactPredicate = (ExactPredicate) predicate; return select( instances, exactPredicate.value() ); } if ( predicate instanceof RangePredicate ) { switch ( predicate.valueGroup() ) { case NUMBER: return instances[NUMBER]; case GEOMETRY: return instances[SPATIAL]; case DATE: case LOCAL_DATE_TIME: case ZONED_DATE_TIME: case LOCAL_TIME: case ZONED_TIME: case DURATION: return instances[TEMPORAL]; default: } } if ( predicate instanceof ExistsPredicate ) { return null; } return instances[LUCENE]; }
Source:
public void run() throws OperationException { if (TransactionHelper.isTransactionMarkedRollback()) { return; } try { TransactionHelper.runInNewTransaction(() -> { try (OperationContext subctx = ctx.getSubContext(isolate)) { try { service.run(subctx, chainId, chainParameters); } catch (OperationException e) { if (rollbackGlobalOnError) { throw new NuxeoException(e); } else { log.error("Error while executing operation " + chainId, e); } } } catch (OperationException cause) { throw new NuxeoException(cause); } }); } catch (NuxeoException cause) { if (cause.getCause() instanceof OperationException) { throw (OperationException) cause.getCause(); } throw cause; } }

Target:
public void run() throws OperationException { if (TransactionHelper.isTransactionMarkedRollback()) { return; } try { TransactionHelper.runInNewTransaction(() -> { try (OperationContext subctx = ctx.getSubContext(isolate)) { try { service.run(subctx, chainId, chainParameters); } catch (OperationException e) { if (rollbackGlobalOnError) { throw new NuxeoException(e); } else { log.error("Error while executing operation " + chainId, e); } } } catch (OperationException e) { throw new NuxeoException(e); } }); } catch (NuxeoException e) { if (e.getCause() instanceof OperationException) { throw (OperationException) e.getCause(); } throw e; } }
Source:
private void checkSecurityOr403(Request request, Response response) { if (Arrays.asList("PATCH", "PUT", "DELETE").contains(request.requestMethod().toUpperCase())) { apiAuthenticationHelper.checkAdminUserAnd403(request, response); return; } apiAuthenticationHelper.checkUserAnd403(request, response); }

Target:
private void checkSecurityOr403(Request request, Response response) { if (Arrays.asList("GET", "HEAD").contains(request.requestMethod().toUpperCase())) { apiAuthenticationHelper.checkUserAnd403(request, response); return; } apiAuthenticationHelper.checkAdminUserAnd403(request, response); }
Source:
public HttpResponse doResourceBundle(StaplerRequest request) { String baseName = request.getParameter("baseName"); if (baseName == null) { return HttpResponses.errorJSON("Mandatory parameter 'baseName' not specified."); } String language = request.getParameter("language"); String country = request.getParameter("country"); String variant = request.getParameter("variant"); if (country == null && language.length()>2) { country = language.substring(3,5); if (variant == null && language.length()>5) { variant = language.substring(6); } language = language.substring(0,2); } try { Locale locale = request.getLocale(); if (language != null && country != null && variant != null) { locale = new Locale(language, country, variant); } else if (language != null && country != null) { locale = new Locale(language, country); } else if (language != null) { locale = new Locale(language); } return HttpResponses.okJSON(ResourceBundleUtil.getBundle(baseName, locale)); } catch (Exception e) { return HttpResponses.errorJSON(e.getMessage()); } }

Target:
public HttpResponse doResourceBundle(StaplerRequest request) { String baseName = request.getParameter("baseName"); if (baseName == null) { return HttpResponses.errorJSON("Mandatory parameter 'baseName' not specified."); } String language = request.getParameter("language"); String country = request.getParameter("country"); String variant = request.getParameter("variant"); if (language != null) { String[] languageTokens = language.split("-|_"); language = languageTokens[0]; if (country == null && languageTokens.length > 1) { country = languageTokens[1]; if (variant == null && languageTokens.length > 2) { variant = languageTokens[2]; } } } try { Locale locale = request.getLocale(); if (language != null && country != null && variant != null) { locale = new Locale(language, country, variant); } else if (language != null && country != null) { locale = new Locale(language, country); } else if (language != null) { locale = new Locale(language); } return HttpResponses.okJSON(ResourceBundleUtil.getBundle(baseName, locale)); } catch (Exception e) { return HttpResponses.errorJSON(e.getMessage()); } }
Source:
private Weighting createWeighting(FlagEncoder encoder, double uTurnCosts) { TurnWeighting result = new TurnWeighting(new FastestWeighting(encoder), tcs); if (!Double.isInfinite(uTurnCosts)) { result.setUTurnCost(uTurnCosts); } return result; }

Target:
private Weighting createWeighting(FlagEncoder encoder, double uTurnCosts) { return new TurnWeighting(new FastestWeighting(encoder), tcs, uTurnCosts); }
Source:
public boolean isSymbolicLink() { if (context.getLayout() == StorageFileLayout.OBJECT_ID) { return path.getFileName().endsWith(".bai") || path.getFileName().endsWith(".tbi"); } return false; }

Target:
public boolean isSymbolicLink() { if (context.getLayout() == StorageFileLayout.OBJECT_ID) { return IndexFileType.isIndexFile(path.getFileName().toString()); } return false; }
Source:
TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor, Gson gson, TypeToken<?> type, JsonAdapter annotation) { Class<?> value = annotation.value(); Class<?> rawType = type.getRawType(); TypeAdapter<?> typeAdapter; if (TypeAdapter.class.isAssignableFrom(value)) { Map<Class, TypeAdapter> adapters = activeJsonAdapterClasses.get(); typeAdapter = adapters.get(rawType); if (typeAdapter == null) { Class<TypeAdapter<?>> typeAdapterClass = (Class<TypeAdapter<?>>) value; typeAdapter = constructorConstructor.get(TypeToken.get(typeAdapterClass)).construct(); adapters.put(rawType, typeAdapter); } } else if (TypeAdapterFactory.class.isAssignableFrom(value)) { TypeAdapterFactory factory = getTypeAdapterFactory(rawType, annotation, constructorConstructor); typeAdapter = factory == null ? null : factory.create(gson, type); } else { throw new IllegalArgumentException( "@JsonAdapter value must be TypeAdapter, TypeAdapterFactory, JsonSerializer or JsonDeserializer reference."); } if (typeAdapter != null) { typeAdapter = typeAdapter.nullSafe(); } return typeAdapter; }

Target:
TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor, Gson gson, TypeToken<?> type, JsonAdapter annotation) { Class<?> value = annotation.value(); boolean isTypeAdapter = TypeAdapter.class.isAssignableFrom(value); boolean isJsonSerializer = JsonSerializer.class.isAssignableFrom(value); boolean isJsonDeserializer = JsonDeserializer.class.isAssignableFrom(value); TypeAdapter<?> typeAdapter; if (isTypeAdapter || isJsonSerializer || isJsonDeserializer) { if (isTypeAdapter) { Class<TypeAdapter<?>> typeAdapterClass = (Class<TypeAdapter<?>>) value; typeAdapter = constructorConstructor.get(TypeToken.get(typeAdapterClass)).construct(); } else if (isJsonSerializer || isJsonDeserializer) { JsonSerializer serializer = null; if (isJsonSerializer) { Class<JsonSerializer<?>> serializerClass = (Class<JsonSerializer<?>>) value; serializer = constructorConstructor.get(TypeToken.get(serializerClass)).construct(); } JsonDeserializer deserializer = null; if (isJsonDeserializer) { Class<JsonDeserializer<?>> deserializerClass = (Class<JsonDeserializer<?>>) value; deserializer = constructorConstructor.get(TypeToken.get(deserializerClass)).construct(); } typeAdapter = new TreeTypeAdapter(serializer, deserializer, gson, type, null); } else { typeAdapter = null; } } else if (TypeAdapterFactory.class.isAssignableFrom(value)) { TypeAdapterFactory factory = getTypeAdapterFactory(annotation, constructorConstructor); typeAdapter = factory == null ? null : factory.create(gson, type); } else { throw new IllegalArgumentException( "@JsonAdapter value must be TypeAdapter, TypeAdapterFactory, JsonSerializer or JsonDeserializer reference."); } if (typeAdapter != null) { typeAdapter = typeAdapter.nullSafe(); } return typeAdapter; }
Source:
void processEvent(WatchedEvent event) { switch(event.getType()) { case None: { connectionEvent(event); break; } case NodeCreated: { for(ZKListener listener : listeners) { listener.nodeCreated(event.getPath()); } break; } case NodeDeleted: { for(ZKListener listener : listeners) { listener.nodeDeleted(event.getPath()); } break; } case NodeDataChanged: { for(ZKListener listener : listeners) { listener.nodeDataChanged(event.getPath()); } break; } case NodeChildrenChanged: { for(ZKListener listener : listeners) { listener.nodeChildrenChanged(event.getPath()); } break; } default: LOG.error("Invalid event of type received for path {}. Ignoring.", event.getState(), event.getPath()); } }

Target:
private void processEvent(WatchedEvent event) { switch(event.getType()) { case None: { connectionEvent(event); break; } case NodeCreated: { for(ZKListener listener : listeners) { listener.nodeCreated(event.getPath()); } break; } case NodeDeleted: { for(ZKListener listener : listeners) { listener.nodeDeleted(event.getPath()); } break; } case NodeDataChanged: { for(ZKListener listener : listeners) { listener.nodeDataChanged(event.getPath()); } break; } case NodeChildrenChanged: { for(ZKListener listener : listeners) { listener.nodeChildrenChanged(event.getPath()); } break; } default: LOG.error("Invalid event of type received for path {}. Ignoring.", event.getState(), event.getPath()); } }
Source:
public static String getNextTestThreadName() { String testName = getCurrentTestName(); TestResources resources = getTestResources(testName); String simpleName = resources.getSimpleName(); int nextThreadIndex = resources.addNode(); return "testng-" + simpleName + (nextThreadIndex != 0 ? "-" + nextThreadIndex : ""); }

Target:
public static String getNextTestThreadName() { String testName = getCurrentTestName(); TestResources resources = getTestResources(testName); String simpleName = resources.getSimpleName(); int nextThreadIndex = resources.addThread(); return "testng-" + simpleName + (nextThreadIndex != 0 ? "-" + nextThreadIndex : ""); }
Source:
public void defaultTrackerGeneratesTimestampMetrics() { try (TimestampTracker ignored = TimestampTracker.createWithDefaultTrackers(timelockService, cleaner)) { assertThat(AtlasDbMetrics.getMetricRegistry().getNames()) .contains(buildFullyQualifiedMetricName(IMMUTABLE_TIMESTAMP_NAME)) .contains(buildFullyQualifiedMetricName(FRESH_TIMESTAMP_NAME)) .contains(buildFullyQualifiedMetricName(UNREADABLE_TIMESTAMP_NAME)); } }

Target:
public void defaultTrackerGeneratesTimestampMetrics() { try (TimestampTrackerImpl ignored = createDefaultTracker()) { assertThat(AtlasDbMetrics.getMetricRegistry().getNames()) .containsExactlyInAnyOrder(buildFullyQualifiedMetricName(IMMUTABLE_TIMESTAMP_NAME), buildFullyQualifiedMetricName(FRESH_TIMESTAMP_NAME), buildFullyQualifiedMetricName(UNREADABLE_TIMESTAMP_NAME)); } }
Source:
public Idle(String name, boolean verbose, Subsystem... subsystems) { super(); setName(name); this.verbose = verbose; requirements = Set.of(subsystems); }

Target:
public Idle(String name, boolean verbose, Subsystem... subsystems) { super(); setName(name); this.verbose = verbose; addRequirements(subsystems); }
Source:
public ClassLoader getClassLoader(ObjectId rulesId) { Reference<? extends ClassLoader> ref = referMap.get(rulesId); if (ref != null) { ClassLoader cl = ref.get(); if (cl != null) { return cl; } synchronized(lock) { referMap.remove(rulesId); } ref.enqueue(); } cleanMap(); if (rulesId == null || rulesDir == null) { return null; } File jarFile = new File(rulesDir, "rules-" + rulesId.getName() + ".jar"); if (!jarFile.isFile()) { return null; } ClassLoader defaultLoader = getClass().getClassLoader(); URL url; try { url = jarFile.toURI().toURL(); } catch (MalformedURLException e) { return null; } URL[] urls = new URL[]{url}; ClassLoader urlLoader = new URLClassLoader(urls, defaultLoader); LoaderRef lRef = new LoaderRef(rulesId, urlLoader); synchronized(lock) { referMap.put(rulesId, lRef); } return urlLoader; }

Target:
public synchronized ClassLoader getClassLoader(ObjectId rulesId) { if (rulesId == null || rulesDir == null) { return null; } Reference<? extends ClassLoader> ref = classLoaderCache.get(rulesId); if (ref != null) { ClassLoader cl = ref.get(); if (cl != null) { return cl; } classLoaderCache.remove(rulesId); ref.enqueue(); } cleanCache(); File jarFile = new File(rulesDir, "rules-" + rulesId.getName() + ".jar"); if (!jarFile.isFile()) { return null; } ClassLoader defaultLoader = getClass().getClassLoader(); URL url; try { url = jarFile.toURI().toURL(); } catch (MalformedURLException e) { log.error("Path to rules jar is broken", e); return null; } URL[] urls = new URL[]{url}; ClassLoader urlLoader = new URLClassLoader(urls, defaultLoader); LoaderRef lRef = new LoaderRef(rulesId, urlLoader); classLoaderCache.put(rulesId, lRef); return urlLoader; }
Source:
public Object getParent(Object element) { final Object ret; if (element instanceof CompareInputAdapter) { Object parentNode = super.getParent(((Adapter)element).getTarget()); if (parentNode instanceof TreeNode) { final Iterable<CompareInputAdapter> cia = Iterables.filter( ((TreeNode)parentNode).eAdapters(), CompareInputAdapter.class); if (!Iterables.isEmpty(cia)) { ret = cia.iterator().next(); } else { ret = parentNode; } } else { ret = parentNode; } } else if (element instanceof ICompareInput) { ret = null; } else { ret = super.getParent(element); } return ret; }

Target:
public Object getParent(Object element) { final Object ret; if (element instanceof CompareInputAdapter) { Object parentNode = super.getParent(((Adapter)element).getTarget()); if (parentNode instanceof TreeNode) { final Optional<Adapter> cia = Iterators.tryFind( ((TreeNode)parentNode).eAdapters().iterator(), instanceOf(CompareInputAdapter.class)); if (cia.isPresent()) { ret = cia.get(); } else { ret = parentNode; } } else { ret = parentNode; } } else if (element instanceof ICompareInput) { ret = null; } else { ret = super.getParent(element); } return ret; }
Source:
public void testAddWebMessageListenerBasicUsage() throws Exception { mWebViewOnUiThread.addWebMessageListener(JS_OBJECT_NAME, new ArrayList<String>() { { add("*"); } }, mListener); loadPage(BASIC_USAGE); TestWebMessageListener.Data data = mListener.waitForOnPostMessage(); Assert.assertEquals("hello", data.mMessage.getData()); Assert.assertTrue(mListener.hasNoMoreOnPostMessage()); }

Target:
public void testAddWebMessageListenerBasicUsage() throws Exception { mWebViewOnUiThread.addWebMessageListener(JS_OBJECT_NAME, MATCH_EXAMPLE_COM, mListener); loadHtmlSync(BASIC_USAGE); TestWebMessageListener.Data data = mListener.waitForOnPostMessage(); Assert.assertEquals("hello", data.mMessage.getData()); Assert.assertTrue( "Should have no more message at this point.", mListener.hasNoMoreOnPostMessage()); }
Source:
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException { resp.addHeader(HttpHeaders.VARY, HttpHeaders.CONTENT_TYPE); ldfDelegate.doGet(req, resp); }

Target:
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException { resp.addHeader(HttpHeaders.VARY, HttpHeaders.ACCEPT); ldfDelegate.doGet(req, resp); }
Source:
public Object run(Stressor stressor, int iteration) { Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put(Queryable.QUERYABLE_FIELD, onField); paramMap.put(Queryable.MATCH_STRING, matching); paramMap.put(Queryable.IS_WILDCARD, isWildcardQuery); Object obj = stressor.makeRequest(iteration, Operation.QUERY, paramMap); resultObjects.add(obj); return obj; }

Target:
public Object run(Stressor stressor, int iteration) { Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put(Queryable.QUERYABLE_FIELD, onField); paramMap.put(Queryable.MATCH_STRING, matching); paramMap.put(Queryable.IS_WILDCARD, isWildcardQuery); List obj = (List) stressor.makeRequest(iteration, Operation.QUERY, paramMap); resultObjects.add(obj.size()); return obj; }
Source:
String execute(final HttpEntityEnclosingRequestBase request, final JSONObject jsonObject) { String result = StringUtils.EMPTY; try { request.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); request.setEntity(new StringEntity(jsonObject.toString())); result = execute(request); } catch (UnsupportedEncodingException|RemoteException x) { PageObjectLogging.log("Error while creating http post entity.", ExceptionUtils.getStackTrace(x), false); } return result; }

Target:
String execute(final HttpEntityEnclosingRequestBase request, final JSONObject jsonObject) { String result = StringUtils.EMPTY; try { request.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); request.setEntity(new StringEntity(jsonObject.toString())); result = execute(request); } catch (UnsupportedEncodingException | RemoteException ex) { PageObjectLogging.log("Error while creating http post entity.", ExceptionUtils.getStackTrace(ex), false); } return result; }
Source:
public void run() { while (isRunning()) { try { processResponses(); processRequests(); } catch (Exception e) { logger.error("Swallowing unexpected exception during processing of responses and requests", e); restServerMetrics.dequeuedRequestHandlerUnexpectedExceptionError.inc(); } } discardRequestsResponses(); logger.trace("AsyncHandlerWorker stopped"); shutdownLatch.countDown(); }

Target:
public void run() { while (isRunning()) { try { processRequests(); processResponses(); } catch (Exception e) { logger.error("Swallowing unexpected exception during processing of responses and requests", e); restServerMetrics.dequeuedRequestHandlerUnexpectedExceptionError.inc(); } } discardRequestsResponses(); logger.trace("AsyncHandlerWorker stopped"); shutdownLatch.countDown(); }
Source:
private void showRecyclerView() { recyclerView.setVisibility(View.VISIBLE); emptyTextView.setVisibility(View.VISIBLE); }

Target:
private void showRecyclerView() { recyclerView.setVisibility(View.VISIBLE); emptyTextView.setVisibility(View.GONE); }