auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void writeHeadersWhenWhiteList() { WhiteListedAllowFromStrategy whitelist = new WhiteListedAllowFromStrategy(Collections.singletonList("example.com")); XFrameOptionsHeaderWriter writer = new XFrameOptionsHeaderWriter(whitelist); writer.writeHeaders(this.request, this.response); assertThat(this.response.getHeaderValue(XFrameOptionsHeaderWriter.XFRAME_OPTIONS_HEADER)).isEqualTo("DENY"); }

Target:
public void writeHeadersWhenWhiteList() { WhiteListedAllowFromStrategy whitelist = new WhiteListedAllowFromStrategy(Arrays.asList("example.com")); XFrameOptionsHeaderWriter writer = new XFrameOptionsHeaderWriter(whitelist); writer.writeHeaders(this.request, this.response); assertThat(this.response.getHeaderValue(XFrameOptionsHeaderWriter.XFRAME_OPTIONS_HEADER)).isEqualTo("DENY"); }
Source:
private static void resetBytesMessageProperties( Message message, List<Object> out ) { if (out.isEmpty()) { return; } try { BytesMessage bytesMessage = (BytesMessage) message; byte[] body = new byte[(int) bytesMessage.getBodyLength()]; bytesMessage.reset(); bytesMessage.readBytes(body); message.clearBody(); resetProperties(message, out); bytesMessage.writeBytes(body); bytesMessage.reset(); } catch (JMSException e) { propagateIfFatal(e); log(e, "unable to reset BytesMessage body {0}", message, e); } }

Target:
private static void resetBytesMessageProperties( Message message, List<Object> out ) { try { BytesMessage bytesMessage = (BytesMessage) message; byte[] body = new byte[(int) bytesMessage.getBodyLength()]; bytesMessage.reset(); bytesMessage.readBytes(body); message.clearBody(); resetProperties(message, out); bytesMessage.writeBytes(body); } catch (JMSException e) { propagateIfFatal(e); log(e, "unable to reset BytesMessage body {0}", message, e); } }
Source:
public E[] get() { if (result == null) { synchronized (this) { if (result == null) { if (acc == null){ result = loadServices(service, classLoader); } else { result = AccessController.doPrivileged((PrivilegedAction<E[]>) () -> loadServices(service, classLoader), acc); } } } } return result.clone(); }

Target:
public E[] get() { if (result == null) { synchronized (this) { if (result == null) { if (WildFlySecurityManager.isChecking()) { result = AccessController.doPrivileged((PrivilegedAction<E[]>) () -> loadServices(service, classLoader), acc); } else { result = loadServices(service, classLoader); } } } } return result.clone(); }
Source:
public void rollback() { for (Path file : tempFiles) { try { if (fileSystem.exists(file) && !fileSystem.delete(file, false)) { throw new IOException("Delete failed"); } } catch (IOException e) { log.warn(e, "Failed to delete temporary file: " + file); } } outputWriter.rollback(); }

Target:
public void rollback() { for (Path file : tempFiles) { try { fileSystem.delete(file, false); if (fileSystem.exists(file)) { throw new IOException("Delete failed"); } } catch (IOException e) { log.warn(e, "Failed to delete temporary file: " + file); } } outputWriter.rollback(); }
Source:
public void testVFE3() { try { T_iget_13 t = new T_iget_13(); t.run(); fail("expected a NoSuchFieldError exception"); } catch (NoSuchFieldError e) { } }

Target:
public void testVFE3() { try { new T_iget_13().run(); fail("expected a NoSuchFieldError exception"); } catch (NoSuchFieldError e) { } }
Source:
public void open(IndexWriterParams params) throws IOException { host = params.get(KafkaConstants.HOST); port = params.getInt(KafkaConstants.PORT, 9092); keySerializer = params.get(KafkaConstants.KEY_SERIALIZER, "org.apache.kafka.common.serialization.ByteArraySerializer"); valueSerializer = params.get(KafkaConstants.VALUE_SERIALIZER, "org.apache.kafka.connect.json.JsonSerializer"); topic = params.get(KafkaConstants.TOPIC); if (StringUtils.isBlank(host)) { String message = "Missing host. It should be set in index-writers.xml"; message += "\n" + describe(); LOG.error(message); throw new RuntimeException(message); } Properties configProperties = new Properties(); configProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, host + ":" + port); configProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, keySerializer); configProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, valueSerializer); producer = new KafkaProducer<String, JsonNode>(configProperties); }

Target:
public void open(IndexWriterParams params) throws IOException { host = params.get(KafkaConstants.HOST); port = params.getInt(KafkaConstants.PORT, 9092); keySerializer = params.get(KafkaConstants.KEY_SERIALIZER, "org.apache.kafka.common.serialization.ByteArraySerializer"); valueSerializer = params.get(KafkaConstants.VALUE_SERIALIZER, "org.apache.kafka.connect.json.JsonSerializer"); topic = params.get(KafkaConstants.TOPIC); maxDocCount = params.getInt(KafkaConstants.MAX_DOC_COUNT, 100); inputDocs = new ArrayList<ProducerRecord<String, JsonNode>>(maxDocCount); if (StringUtils.isBlank(host)) { String message = "Missing host. It should be set in index-writers.xml"; message += "\n" + describe(); LOG.error(message); throw new RuntimeException(message); } Properties configProperties = new Properties(); configProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, host + ":" + port); configProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, keySerializer); configProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, valueSerializer); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); producer = new KafkaProducer<String, JsonNode>(configProperties); }
Source:
public static void addEventLogger(Map<String, Object> conf, StormTopology topology) { Integer numExecutors = ObjectReader.getInt(conf.get(Config.TOPOLOGY_EVENTLOGGER_EXECUTORS), ObjectReader.getInt(conf.get(Config.TOPOLOGY_WORKERS))); if(numExecutors==null || numExecutors==0) return; HashMap<String, Object> componentConf = new HashMap<>(); componentConf.put(Config.TOPOLOGY_TASKS, numExecutors); componentConf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, ObjectReader.getInt(conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS))); Bolt eventLoggerBolt = Thrift.prepareSerializedBoltDetails( eventLoggerInputs(topology), new EventLoggerBolt(), null, numExecutors, componentConf); for (Object component : allComponents(topology).values()) { ComponentCommon common = getComponentCommon(component); common.put_to_streams(EVENTLOGGER_STREAM_ID, Thrift.outputFields(eventLoggerBoltFields())); } topology.put_to_bolts(EVENTLOGGER_COMPONENT_ID, eventLoggerBolt); }

Target:
public static void addEventLogger(Map<String, Object> conf, StormTopology topology) { Integer numExecutors = ObjectReader.getInt(conf.get(Config.TOPOLOGY_EVENTLOGGER_EXECUTORS), ObjectReader.getInt(conf.get(Config.TOPOLOGY_WORKERS))); if (numExecutors==null || numExecutors==0) { return; } HashMap<String, Object> componentConf = new HashMap<>(); componentConf.put(Config.TOPOLOGY_TASKS, numExecutors); componentConf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, ObjectReader.getInt(conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS))); Bolt eventLoggerBolt = Thrift.prepareSerializedBoltDetails( eventLoggerInputs(topology), new EventLoggerBolt(), null, numExecutors, componentConf); for (Object component : allComponents(topology).values()) { ComponentCommon common = getComponentCommon(component); common.put_to_streams(EVENTLOGGER_STREAM_ID, Thrift.outputFields(eventLoggerBoltFields())); } topology.put_to_bolts(EVENTLOGGER_COMPONENT_ID, eventLoggerBolt); }
Source:
public ServiceBuilder<?> build(ServiceTarget target) { String containerName = this.configuration.getContainerName(); ServiceName deploymentUnitServiceName = this.context.getDeploymentUnitServiceName(); ServiceBuilder<?> builder = target.addService(this.getServiceName()); Consumer<BeanManagerFactory<I, T, TransactionBatch>> factory = builder.provides(this.getServiceName()); this.cache = builder.requires(InfinispanCacheRequirement.CACHE.getServiceName(this.support, containerName, InfinispanBeanManagerFactoryServiceConfiguratorFactory.getCacheName(deploymentUnitServiceName))); this.affinityFactory = builder.requires(InfinispanRequirement.KEY_AFFINITY_FACTORY.getServiceName(this.support, containerName)); this.repository = builder.requires(deploymentUnitServiceName.append("marshalling")); this.scheduler = builder.requires(deploymentUnitServiceName.append(this.name, "expiration")); this.dispatcherFactory = builder.requires(ClusteringRequirement.COMMAND_DISPATCHER_FACTORY.getServiceName(this.support, containerName)); this.registry = builder.requires(ClusteringCacheRequirement.REGISTRY.getServiceName(this.support, containerName, BeanManagerFactoryServiceConfiguratorConfiguration.CLIENT_MAPPINGS_CACHE_NAME)); this.group = builder.requires(ClusteringCacheRequirement.GROUP.getServiceName(this.support, containerName, BeanManagerFactoryServiceConfiguratorConfiguration.CLIENT_MAPPINGS_CACHE_NAME)); Service service = Service.newInstance(factory, new InfinispanBeanManagerFactory<>(this)); return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND); }

Target:
public ServiceBuilder<?> build(ServiceTarget target) { ServiceBuilder<?> builder = target.addService(this.getServiceName()); new CompositeDependency(this.cache, this.affinityFactory, this.repository, this.scheduler, this.group, this.registry, this.dispatcherFactory).register(builder); Consumer<BeanManagerFactory<I, T, TransactionBatch>> factory = builder.provides(this.getServiceName()); Service service = Service.newInstance(factory, new InfinispanBeanManagerFactory<>(this)); return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND); }
Source:
public static TissuePieceType to(@Nonnull TissuePieceTypeDto from) { TissuePieceType to = new TissuePieceType(); if (from.getId() != null) to.setId(from.getId()); setString(to::setName, from.getName()); setString(to::setAbbreviation, from.getAbbreviation()); setBoolean(to::setArchived, from.isArchived(), true); return to; }

Target:
public static TissuePieceType to(@Nonnull TissuePieceTypeDto from) { TissuePieceType to = new TissuePieceType(); if (from.getId() != null) to.setId(from.getId()); setString(to::setName, from.getName()); setString(to::setAbbreviation, from.getAbbreviation()); setBoolean(to::setArchived, from.isArchived(), false); return to; }
Source:
public Builder<RelayConfiguration> configure(OperationContext context, ModelNode model) throws OperationFailedException { this.siteName = SITE.resolveModelAttribute(context, model).asString(); PathAddress address = context.getCurrentAddress(); Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); List<ValueDependency<RemoteSiteConfiguration>> list = new ArrayList<>(); for (Resource.ResourceEntry entry : resource.getChildren(RemoteSiteResourceDefinition.WILDCARD_PATH.getKey())) { InjectedValueDependency<RemoteSiteConfiguration> remoteSiteConfigurationInjectedValueDependency = new InjectedValueDependency<>(new RemoteSiteServiceNameProvider(address, entry.getPathElement()), RemoteSiteConfiguration.class); list.add(remoteSiteConfigurationInjectedValueDependency); } this.sites = list; return super.configure(context, model); }

Target:
public Builder<RelayConfiguration> configure(OperationContext context, ModelNode model) throws OperationFailedException { this.siteName = SITE.resolveModelAttribute(context, model).asString(); PathAddress address = context.getCurrentAddress(); Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); final Set<Resource.ResourceEntry> set = resource.getChildren(RemoteSiteResourceDefinition.WILDCARD_PATH.getKey()); List<ValueDependency<RemoteSiteConfiguration>> list = new ArrayList<>(set.size()); for (Resource.ResourceEntry entry : set) { list.add(new InjectedValueDependency<>(new RemoteSiteServiceNameProvider(address, entry.getPathElement()), RemoteSiteConfiguration.class)); } this.sites = list; return super.configure(context, model); }
Source:
private BlobId getBlobIdFromString(String blobIdString) throws CoordinatorException { if (blobIdString == null || blobIdString.length() == 0) { logger.error("BlobIdString argument is null or zero length: {}", blobIdString); throw new CoordinatorException("BlobId is empty.", CoordinatorError.InvalidBlobId); } BlobId blobId; try { blobId = new BlobId(blobIdString, clusterMap); } catch (IOException e) { logger.error("Caller passed in invalid BlobId " + blobIdString); throw new CoordinatorException("BlobId is invalid.", CoordinatorError.InvalidBlobId); } catch (IllegalArgumentException e) { logger.error("Caller passed in invalid BlobId " + blobIdString); throw new CoordinatorException("BlobId is invalid. ", CoordinatorError.InvalidBlobId); } return blobId; }

Target:
private BlobId getBlobIdFromString(String blobIdString) throws CoordinatorException { if (blobIdString == null || blobIdString.length() == 0) { logger.error("BlobIdString argument is null or zero length: {}", blobIdString); throw new CoordinatorException("BlobId is empty.", CoordinatorError.InvalidBlobId); } BlobId blobId; try { blobId = new BlobId(blobIdString, clusterMap); } catch (Exception e) { logger.error("Caller passed in invalid BlobId " + blobIdString); throw new CoordinatorException("BlobId is invalid " + blobIdString, CoordinatorError.InvalidBlobId); } return blobId; }
Source:
public void onBlockBreak(BlockBreakEvent e) { if (SlimefunTag.CAVEMAN_TALISMAN_TRIGGERS.isTagged(e.getBlock().getType())) { Talisman.tryActivate(e, SlimefunItems.TALISMAN_WISE); } }

Target:
public void onBlockBreak(BlockBreakEvent e) { if (SlimefunTag.CAVEMAN_TALISMAN_TRIGGERS.isTagged(e.getBlock().getType())) { Talisman.tryActivate(e, SlimefunItems.TALISMAN_CAVEMAN); } }
Source:
public void onTickEnd(TickEvent.WorldTickEvent event) { if(event.phase == TickEvent.Phase.END) { int dim = event.world.provider.dimensionId; if(blockSwappers.containsKey(dim)) { List<BlockSwapper> swappers = blockSwappers.get(dim); Iterator<BlockSwapper> iter = swappers.listIterator(); while(iter.hasNext()) { BlockSwapper next = iter.next(); if(!next.tick()) iter.remove(); } } } }

Target:
public void onTickEnd(TickEvent.WorldTickEvent event) { if(event.phase == Phase.END) { int dim = event.world.provider.dimensionId; if(blockSwappers.containsKey(dim)) { List<BlockSwapper> swappers = blockSwappers.get(dim); Iterator<BlockSwapper> iter = swappers.listIterator(); while(iter.hasNext()) { BlockSwapper next = iter.next(); if(!next.tick()) iter.remove(); } } } }
Source:
public List<CommentAttributes> getCommentsForReceiverVisibleToInstructor( String courseId, CommentParticipantType recipientType, String receiverEmail, String instructorEmail) throws EntityDoesNotExistException { verifyIsCoursePresent(courseId, "get"); verifyIsInstructorOfCourse(courseId, instructorEmail); List<CommentAttributes> commentsFromLogic = commentsDb.getCommentsForReceiver(courseId, recipientType, receiverEmail); Iterator<CommentAttributes> iterator = commentsFromLogic.iterator(); List<CommentAttributes> comments = new LinkedList<CommentAttributes>(); HashSet<String> commentsVisitedSet = new HashSet<String>(); while (iterator.hasNext()) { CommentAttributes c = iterator.next(); if (c.giverEmail.equals(instructorEmail)) { comments.add(c); preventAppendingThisCommentAgain(commentsVisitedSet, c); iterator.remove(); } } removeNonVisibleCommentsForInstructor(commentsFromLogic, commentsVisitedSet, comments); return comments; }

Target:
public List<CommentAttributes> getCommentsForReceiverVisibleToInstructor( String courseId, CommentParticipantType recipientType, String receiverEmail, String instructorEmail) throws EntityDoesNotExistException { verifyIsCoursePresent(courseId, "get"); verifyIsInstructorOfCourse(courseId, instructorEmail); List<CommentAttributes> commentsFromDb = commentsDb.getCommentsForReceiver(courseId, recipientType, receiverEmail); Iterator<CommentAttributes> iterator = commentsFromDb.iterator(); List<CommentAttributes> comments = new LinkedList<CommentAttributes>(); HashSet<String> commentsVisitedSet = new HashSet<String>(); boolean canViewCommentsFromOthers = canViewCommentsFromOthers(courseId, recipientType, receiverEmail, instructorEmail); while (iterator.hasNext()) { CommentAttributes c = iterator.next(); if (c.giverEmail.equals(instructorEmail)) { comments.add(c); preventAppendingThisCommentAgain(commentsVisitedSet, c); iterator.remove(); } else if (!canViewCommentsFromOthers) { iterator.remove(); } } removeNonVisibleCommentsForInstructor(commentsFromDb, commentsVisitedSet, comments); iterator = comments.iterator(); while (iterator.hasNext()) { CommentAttributes c = iterator.next(); String firstRecipient = null; if (!c.recipients.isEmpty()) { firstRecipient = c.recipients.iterator().next(); } if (firstRecipient == null || Const.DISPLAYED_NAME_FOR_ANONYMOUS_COMMENT_PARTICIPANT.equals(firstRecipient)) { iterator.remove(); } } return comments; }
Source:
public void awaitAllFutures() { Future<?> future = null; while ((future = futures.poll()) != null) { try { future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Encountered an error while awaiting an errant record future's " + "completition."); throw new ConnectException(e); } } }

Target:
public void awaitAllFutures() { Future<?> future; while ((future = futures.poll()) != null) { try { future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Encountered an error while awaiting an errant record future's completion."); throw new ConnectException(e); } } }
Source:
public void testBytes() { assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex WHERE ship_day < 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day > 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day is null"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day = 1 AND ship_month = 1"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_month is null"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_day is not null AND ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day > 15 AND ship_month < 5 AND (ship_day + ship_month) < 20"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day_month[2] = 12"); assertQueryUsingH2Cte("SELECT ship_day_month_nulls FROM lineitem_ex WHERE ship_day_month_nulls[1] is NOT NULL AND ship_day_month[1] > 3"); }

Target:
public void testBytes() { assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex WHERE ship_day < 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day > 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day is null"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day = 1 AND ship_month = 1"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_month is null"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_day is not null AND ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day > 15 AND ship_month < 5 AND (ship_day + ship_month) < 20"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day_month[2] = 12"); }
Source:
public ParametersBuilder addPersistedWithoutHibernate(int yearWhenPersistedWithoutHibernate, int monthWhenPersistedWithoutHibernate, int dayWhenPersistedWithoutHibernate, int hour, int minute, int second, int nanosecond, ZoneId defaultTimeZone) { if ( isNanosecondPrecisionSupported() ) { nanosecond = 0; } return add( defaultTimeZone, hour, minute, second, nanosecond, yearWhenPersistedWithoutHibernate, monthWhenPersistedWithoutHibernate, dayWhenPersistedWithoutHibernate ); }

Target:
public ParametersBuilder addPersistedWithoutHibernate(int yearWhenPersistedWithoutHibernate, int monthWhenPersistedWithoutHibernate, int dayWhenPersistedWithoutHibernate, int hour, int minute, int second, int nanosecond, ZoneId defaultTimeZone) { if ( !isNanosecondPrecisionSupported() ) { nanosecond = 0; } return add( defaultTimeZone, hour, minute, second, nanosecond, yearWhenPersistedWithoutHibernate, monthWhenPersistedWithoutHibernate, dayWhenPersistedWithoutHibernate ); }
Source:
public void switchFromDashboardIframeToIde(int timeout) { new WebDriverWait(this, timeout) .until(visibilityOfElementLocated(By.id("ide-application-iframe"))); new WebDriverWait(this, ATTACHING_ELEM_TO_DOM_SEC) .until( (ExpectedCondition<Boolean>) driver -> (((JavascriptExecutor) driver) .executeScript("return angular.element('body').scope().showIDE")) .toString() .equals("true")); new WebDriverWait(this, timeout) .until(frameToBeAvailableAndSwitchToIt(By.id("ide-application-iframe"))); }

Target:
public void switchFromDashboardIframeToIde(int timeout) { wait(timeout).until(visibilityOfElementLocated(By.id("ide-application-iframe"))); wait(ATTACHING_ELEM_TO_DOM_SEC) .until( (ExpectedCondition<Boolean>) driver -> (((JavascriptExecutor) driver) .executeScript("return angular.element('body').scope().showIDE")) .toString() .equals("true")); wait(timeout).until(frameToBeAvailableAndSwitchToIt(By.id("ide-application-iframe"))); }
Source:
private static void minimizeTestSuite( CompilationUnit cu, String packageName, File file, String classpath, Map<String, String> expectedOutput, int timeoutLimit, boolean verboseOutput) { for (TypeDeclaration type : cu.getTypes()) { for (BodyDeclaration member : type.getMembers()) { if (member instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration) member; for (AnnotationExpr annotationExpr : method.getAnnotations()) { if (annotationExpr.toString().equals("@Test")) { minimizeMethod( method, cu, packageName, file, classpath, expectedOutput, timeoutLimit); if (verboseOutput) { System.out.println("Minimized method " + method.getName() + "."); } break; } } } } } }

Target:
private static void minimizeTestSuite( CompilationUnit cu, String packageName, File file, String classpath, Map<String, String> expectedOutput, int timeoutLimit, boolean verboseOutput) { for (TypeDeclaration type : cu.getTypes()) { for (BodyDeclaration member : type.getMembers()) { if (member instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration) member; if (isTestMethod(method)) { minimizeMethod(method, cu, packageName, file, classpath, expectedOutput, timeoutLimit); if (verboseOutput) { System.out.println("Minimized method " + method.getName() + "."); } } } } } }
Source:
protected boolean canDoAction() { if (getDisk() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (getDiskType() == DiskStorageType.IMAGE) { if (((DiskImage) getDisk()).getImageStatus() == ImageStatus.LOCKED) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED); } else if (((DiskImage) getDisk()).getImageStatus() != ImageStatus.OK) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_ILLEGAL); } } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_IS_NOT_VM_DISK); } if (isImageExclusiveLockNeeded() && getVm().isRunningOrPaused()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } if (getVdsIdInPool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_VDS_IN_POOL); } if (!validate(new StoragePoolValidator(getStoragePoolDao().get(getStoragePoolId())).isUp())) { return false; } return true; }

Target:
protected boolean canDoAction() { if (getDisk() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (getDiskType() == DiskStorageType.IMAGE) { DiskImagesValidator diskImagesValidator = new DiskImagesValidator(Arrays.asList((DiskImage) getDisk())); if (!validate(diskImagesValidator.diskImagesNotLocked()) || !validate(diskImagesValidator.diskImagesNotIllegal())) { return false; } } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_IS_NOT_VM_DISK); } if (isImageExclusiveLockNeeded() && getVm().isRunningOrPaused()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } if (getVdsIdInPool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_VDS_IN_POOL); } if (!validate(new StoragePoolValidator(getStoragePoolDao().get(getStoragePoolId())).isUp())) { return false; } return true; }
Source:
public ActivityModel(ActivityDto activityDto){ this.id = activityDto.getActivityId(); this.title = activityDto.getTitle(); this.webActivityUrl = activityDto.getWebActivityUrl(); this.appActivityUrl = activityDto.getAppActivityUrl(); this.description = activityDto.getDescription(); this.webPictureUrl = activityDto.getWebPictureUrl(); this.appPictureUrl = activityDto.getAppPictureUrl(); this.expiredTime = activityDto.getExpiredTime(); this.source = activityDto.getSource(); }

Target:
public ActivityModel(ActivityDto activityDto){ this.title = activityDto.getTitle(); this.webActivityUrl = activityDto.getWebActivityUrl(); this.appActivityUrl = activityDto.getAppActivityUrl(); this.description = activityDto.getDescription(); this.webPictureUrl = activityDto.getWebPictureUrl(); this.appPictureUrl = activityDto.getAppPictureUrl(); this.expiredTime = activityDto.getExpiredTime(); this.source = activityDto.getSource(); }
Source:
public void configureMachine( TargetHandlerParameters parameters, String machineId, Instance scopedInstance ) throws TargetException { String ip = acquireIpAddress(); if(! Utils.isEmptyOrWhitespaces(ip)) { try { sendConfiguration(ip, parameters); } catch (IOException e) { throw new TargetException(e); } this.machineIdToRunning.put(machineId, ip); } else { scopedInstance.data.put( Instance.READY_FOR_CFG_MARKER, "true" ); } }

Target:
public void configureMachine( TargetHandlerParameters parameters, String machineId, Instance scopedInstance ) throws TargetException { scopedInstance.data.put( Instance.READY_FOR_CFG_MARKER, "true" ); String ip = acquireIpAddress(); if(! Utils.isEmptyOrWhitespaces(ip)) { try { sendConfiguration(ip, parameters); } catch (IOException e) { throw new TargetException(e); } this.machineIdToIp.put(machineId, ip); } }
Source:
private Collection<BeanDefinition> parseExtraConfigs(final String[] extraConfigRefs, final Element element, final ParserContext parserContext) { Collection<BeanDefinition> extraConfigs = new ManagedList<>(extraConfigRefs.length); for (String each : extraConfigRefs) { String attribute = element.getAttribute(each); if (!Strings.isNullOrEmpty(attribute)) { extraConfigs.add(parserContext.getRegistry().getBeanDefinition(attribute)); } } return extraConfigs; }

Target:
private Collection<BeanDefinition> parseExtraConfigs(final String[] extraConfigRefs, final Element element, final ParserContext parserContext) { Collection<BeanDefinition> result = new ManagedList<>(extraConfigRefs.length); for (String each : extraConfigRefs) { String attribute = element.getAttribute(each); if (!Strings.isNullOrEmpty(attribute)) { result.add(parserContext.getRegistry().getBeanDefinition(attribute)); } } return result; }
Source:
public Optional<String> determineLabelsOrTypeForLoading(Class<?> type) { Optional<String> labelsOrType; if (useStrictQuerying) { ClassInfo classInfo = metaData().classInfo(type); String result = null; if (classInfo != null) { result = classInfo.isRelationshipEntity() ? classInfo.neo4jName() : classInfo.staticLabels().stream().collect(Collectors.joining("`:`")); } labelsOrType = Optional.ofNullable(result); } else { labelsOrType = Optional.ofNullable(metaData.entityType(type.getName())); } return labelsOrType.map(String::trim).filter(s -> !s.isEmpty()); }

Target:
public Optional<String> determineLabelsOrTypeForLoading(Class<?> type) { Optional<String> labelsOrType; if (useStrictQuerying) { ClassInfo classInfo = metaData().classInfo(type); String result = null; if (classInfo != null) { result = classInfo.isRelationshipEntity() ? classInfo.neo4jName() : String.join("`:`", classInfo.staticLabels()); } labelsOrType = Optional.ofNullable(result); } else { labelsOrType = Optional.ofNullable(metaData.entityType(type.getName())); } return labelsOrType.map(String::trim).filter(s -> !s.isEmpty()); }
Source:
private boolean filterEventByFilterType(Event event, DocumentReference user, NotificationFormat format, NotificationPreferenceScopeFilterType scopeFilterType) { boolean hasRestriction = false; boolean matchRestriction = false; try { for (NotificationPreferenceScope scope : modelBridge.getNotificationPreferenceScopes(user, format, scopeFilterType)) { if (scope.getEventType().equals(event.getType())) { hasRestriction = true; if (event.getDocument().equals(scope.getScopeReference()) || event.getDocument().hasParent(scope.getScopeReference())) { if (scopeFilterType.equals(NotificationPreferenceScopeFilterType.EXCLUSIVE)) { return true; } matchRestriction = true; break; } } } } catch (NotificationException e) { logger.warn(ERROR, e); } if (scopeFilterType.equals(NotificationPreferenceScopeFilterType.INCLUSIVE)) { return hasRestriction && !matchRestriction; } else { return false; } }

Target:
private boolean filterEventByFilterType(Event event, DocumentReference user, NotificationFormat format, NotificationPreferenceScopeFilterType scopeFilterType) { boolean hasRestriction = false; boolean matchRestriction = false; try { for (NotificationPreferenceScope scope : modelBridge.getNotificationPreferenceScopes(user, format, scopeFilterType)) { if (scope.getEventType().equals(event.getType())) { hasRestriction = true; if (event.getDocument().equals(scope.getScopeReference()) || event.getDocument().hasParent(scope.getScopeReference())) { if (scopeFilterType.equals(NotificationPreferenceScopeFilterType.EXCLUSIVE)) { return true; } matchRestriction = true; break; } } } } catch (NotificationException e) { logger.warn(ERROR, e); } return (scopeFilterType.equals(NotificationPreferenceScopeFilterType.INCLUSIVE) && hasRestriction && !matchRestriction); }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { resultCode = intent != null ? intent.getIntExtra("result", 0) : 0; if (resultCode != 0) { Log.v(TAG, "onStart: #" + startId + " resultCode: " + resultCode + " = " + translateResultCode(resultCode)); } Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); return Service.START_NOT_STICKY; }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { int resultCode = intent != null ? intent.getIntExtra("result", 0) : 0; if (resultCode != 0) { Log.v(TAG, "onStart: #" + startId + " resultCode: " + resultCode + " = " + translateResultCode(resultCode)); } Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); return Service.START_NOT_STICKY; }
Source:
public void searchThemes(String searchTerm) { if (TextUtils.isEmpty(searchTerm)) { return; } ThemeStore.SearchThemesPayload payload = new ThemeStore.SearchThemesPayload(searchTerm); mDispatcher.dispatch(ThemeActionBuilder.newSearchThemesAction(payload)); }

Target:
public void searchThemes(String searchTerm) { if (TextUtils.isEmpty(searchTerm)) { return; } SearchThemesPayload payload = new SearchThemesPayload(searchTerm); mDispatcher.dispatch(ThemeActionBuilder.newSearchThemesAction(payload)); }
Source:
public List<TestCase> getTestCases() { if (testCases.isEmpty()) { Class<? extends TestScript> clazz = getClass(); Method[] allMethods = clazz.getDeclaredMethods(); Map<Integer, Method> methodTree = new TreeMap<>(); Vector<Method> unsortedMethods = new Vector<>(); for (Method method : allMethods) { if (method.isAnnotationPresent(Test.class) && !method.isAnnotationPresent(Ignore.class)) { try { methodTree.put(method.getAnnotation(Order.class).value(), method); } catch (Exception ex) { unsortedMethods.add(method); } } } for (Method method : methodTree.values()) { addMethodAsTestCase(method); } unsortedMethods.forEach((n) -> addMethodAsTestCase(n)); } ArrayList<TestCase> testCaseList = new ArrayList<>(); testCaseList.add(getSetupTestCase()); testCaseList.addAll(testCases); testCaseList.add(getTearDownTestCase()); return testCaseList; }

Target:
public List<TestCase> getTestCases() { if (testCases.isEmpty()) { Class<? extends TestScript> clazz = getClass(); Method[] allMethods = clazz.getDeclaredMethods(); Map<Integer, Method> methodTree = new TreeMap<>(); Vector<Method> unsortedMethods = new Vector<>(); for (Method method : allMethods) { if (method.isAnnotationPresent(Test.class) && !method.isAnnotationPresent(Ignore.class)) { if (method.isAnnotationPresent(Order.class)) { try { methodTree.put(method.getAnnotation(Order.class).value(), method); } catch (Exception ex) { OseeCoreException.wrap(ex); } } else { try { unsortedMethods.add(method); } catch (Exception ex) { OseeCoreException.wrap(ex); } } } } for (Method method : methodTree.values()) { addMethodAsTestCase(method); } unsortedMethods.forEach((n) -> addMethodAsTestCase(n)); } ArrayList<TestCase> testCaseList = new ArrayList<>(); testCaseList.add(getSetupTestCase()); testCaseList.addAll(testCases); testCaseList.add(getTearDownTestCase()); return testCaseList; }
Source:
private void fireRESTCallForPageChange(@NonNull final OSInAppMessage message, @NonNull final OSInAppMessagePage page) { final String variantId = variantIdForMessage(message); if (variantId == null) return; final String pageId = page.getPageId(); if (message.getViewedPageIds().contains(pageId)) return; message.addPageId(page.getPageId()); try { JSONObject json = new JSONObject() {{ put("app_id", OneSignal.appId); put("player_id", OneSignal.getUserId()); put("variant_id", variantId); put("device_type", new OSUtils().getDeviceType()); put("page_id", pageId); }}; OneSignalRestClient.post("in_app_messages/" + message.messageId + "/pageImpression", json, new ResponseHandler() { @Override void onSuccess(String response) { printHttpSuccessForInAppMessageRequest("page impression", response); } @Override void onFailure(int statusCode, String response, Throwable throwable) { printHttpErrorForInAppMessageRequest("page impression", statusCode, response); message.getViewedPageIds().remove(page.getPageId()); } }); } catch (JSONException e) { e.printStackTrace(); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.ERROR, "Unable to execute in-app message impression HTTP request due to invalid JSON"); } }

Target:
private void fireRESTCallForPageChange(@NonNull final OSInAppMessage message, @NonNull final OSInAppMessagePage page) { final String variantId = variantIdForMessage(message); if (variantId == null) return; final String pageId = page.getPageId(); final String messagePrefixedPageId = message.messageId + pageId; if (viewedPageIds.contains(messagePrefixedPageId)) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.VERBOSE, "Already sent page impression for id: " + pageId); return; } viewedPageIds.add(messagePrefixedPageId); try { JSONObject json = new JSONObject() {{ put("app_id", OneSignal.appId); put("player_id", OneSignal.getUserId()); put("variant_id", variantId); put("device_type", new OSUtils().getDeviceType()); put("page_id", pageId); }}; OneSignalRestClient.post("in_app_messages/" + message.messageId + "/pageImpression", json, new ResponseHandler() { @Override void onSuccess(String response) { printHttpSuccessForInAppMessageRequest("page impression", response); saveViewedPageIdsToPrefs(); } @Override void onFailure(int statusCode, String response, Throwable throwable) { printHttpErrorForInAppMessageRequest("page impression", statusCode, response); viewedPageIds.remove(messagePrefixedPageId); } }); } catch (JSONException e) { e.printStackTrace(); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.ERROR, "Unable to execute in-app message impression HTTP request due to invalid JSON"); } }
Source:
public void muleApplicationGetClassifiers() { assertThat("The mule application classifiers are not the expected", asList(MULE_APPLICATION.getClassifiers()), containsInAnyOrder(Classifier.MULE_APPLICATION, Classifier.MULE_PLUGIN, MULE_APPLICATION_EXAMPLE, MULE_APPLICATION_TEMPLATE)); }

Target:
public void muleApplicationGetClassifiers() { assertThat("The mule application classifiers are not the expected", asList(PackagingType.MULE_APPLICATION.getClassifiers()), containsInAnyOrder(Classifier.MULE_APPLICATION, MULE_PLUGIN, MULE_APPLICATION_EXAMPLE, MULE_APPLICATION_TEMPLATE)); }
Source:
private void testUpdateInsertion(String updatedInsertion) throws Exception { String url = "/ats/program/" + getSawProgram().getArtId() + "/insertion"; JsonArray array = putAndCheck(url, Entity.entity(updatedInsertion, MediaType.APPLICATION_JSON_TYPE)); Assert.assertEquals(1, array.size()); JsonObject obj = getObjectNamed("Renamed Insertion", array); Assert.assertNotNull("Did not find value Renamed Insertion", obj); }

Target:
private void testUpdateInsertion(String updatedInsertion) throws Exception { String url = "/ats/program/" + getSawProgram().getUuid() + "/insertion"; JsonArray array = putAndCheck(url, Entity.entity(updatedInsertion, MediaType.APPLICATION_JSON_TYPE)); Assert.assertEquals(1, array.size()); JsonObject obj = getObjectNamed("Renamed Insertion", array); Assert.assertNotNull("Did not find value Renamed Insertion", obj); }
Source:
private static boolean isIncluded(String[] groups, Collection<String> includedGroups, boolean noGroupsSpecified) { if (noGroupsSpecified) { return isMemberOf(groups, includedGroups); } if (includedGroups.size() == 0) { return true; } else { return isMemberOf(groups, includedGroups); } }

Target:
private static boolean isIncluded(String[] groups, Collection<String> includedGroups, boolean noGroupsSpecified) { if (noGroupsSpecified) { return isMemberOf(groups, includedGroups); } return (includedGroups.isEmpty() || isMemberOf(groups, includedGroups)); }
Source:
public void testNoServices() { when(_nodeDiscovery.getNodes()).thenReturn(Maps.<String, Void>newHashMap()); assertEquals(0, Iterables.size(_discovery.getServices())); }

Target:
public void testNoServices() { setServices(); assertEquals(0, Iterables.size(_discovery.getServices())); }
Source:
public Response serve(IHTTPSession session) { HttpServe serve = methodServes.get(session.getMethod()); if(serve != null) { try { Response response = serve.serve(session); if(response == null) { return statusCode(Response.Status.NO_CONTENT); } return response; } catch (Exception e) { e.printStackTrace(); return statusCode(Response.Status.INTERNAL_ERROR); } } else { return statusCode(Response.Status.METHOD_NOT_ALLOWED); } }

Target:
public Response serve(IHTTPSession session) { HttpServe serve = methodServes.get(session.getMethod()); if (serve != null) { try { Response response = serve.serve(session); if (response == null) { return statusCode(Response.Status.NO_CONTENT); } return response; } catch (Exception e) { Timber.e(e, e.getMessage()); return statusCode(Response.Status.INTERNAL_ERROR); } } else { return statusCode(Response.Status.METHOD_NOT_ALLOWED); } }
Source:
public Mono<ClientResponse> filter(ClientRequest request, ExchangeFunction next) { Optional<OAuth2AuthorizedClient> attribute = request.attribute(OAUTH2_AUTHORIZED_CLIENT_ATTR_NAME) .map(OAuth2AuthorizedClient.class::cast); if (!attribute.isPresent()) { return Mono.just(request) .flatMap(this::mergeRequestAttributesFromContext) .filter(mergedRequest -> mergedRequest.attribute(OAUTH2_AUTHORIZED_CLIENT_ATTR_NAME).isPresent()) .flatMap(mergedRequest -> authorizedClient(mergedRequest, next, getOAuth2AuthorizedClient(mergedRequest.attributes()))) .map(authorizedClient -> bearer(request, authorizedClient)) .flatMap(next::exchange) .switchIfEmpty(next.exchange(request)); } else { return Mono.justOrEmpty(attribute) .flatMap(authorizedClient -> authorizedClient(request, next, authorizedClient)) .map(authorizedClient -> bearer(request, authorizedClient)) .flatMap(next::exchange) .switchIfEmpty(next.exchange(request)); } }

Target:
public Mono<ClientResponse> filter(ClientRequest request, ExchangeFunction next) { return Mono.just(request) .filter(req -> req.attribute(OAUTH2_AUTHORIZED_CLIENT_ATTR_NAME).isPresent()) .switchIfEmpty(mergeRequestAttributesFromContext(request)) .filter(req -> req.attribute(OAUTH2_AUTHORIZED_CLIENT_ATTR_NAME).isPresent()) .flatMap(req -> authorizedClient(req, next, getOAuth2AuthorizedClient(req.attributes()))) .map(authorizedClient -> bearer(request, authorizedClient)) .flatMap(next::exchange) .switchIfEmpty(next.exchange(request)); }
Source:
private static void checkSensibility(AnnotatedType<?> type) { if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) { MetadataLogger.LOG.noConstructor(type); } ArraySet<Class<?>> hierarchy = new ArraySet<Class<?>>(); for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) { hierarchy.add(clazz); hierarchy.addAll(clazz.getInterfaces()); } checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type); checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type); checkMembersBelongToHierarchy(type.getFields(), hierarchy, type); }

Target:
private static void checkSensibility(AnnotatedType<?> type) { if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) { MetadataLogger.LOG.noConstructor(type); } Set<Class<?>> hierarchy = new HashSet<Class<?>>(); for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) { hierarchy.add(clazz); WeldCollections.addAll(hierarchy, clazz.getInterfaces()); } checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type); checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type); checkMembersBelongToHierarchy(type.getFields(), hierarchy, type); }
Source:
protected void onConfigure(ISQLiteDatabase db) { db.enableWriteAheadLogging(); setFastInsertEnabled(true); }

Target:
protected void onConfigure(ISQLiteDatabase db) { db.enableWriteAheadLogging(); setPreparedInsertCacheEnabled(true); }
Source:
public Response intercept(Chain chain) throws IOException { Request request = chain.request(); if(expiringSAMLAuth==null) authorize(null); else if(Instant.now().getEpochSecond()>= threshold.getEpochSecond()){ authorize(expiringSAMLAuth.getExpiry()); } String samlHeaderValue = RESTServices.AUTHORIZATION_TYPE_SAML+ " "+ RESTServices.AUTHORIZATION_PARAM_TOKEN + "=" + authorizationTokenValue; Request authenticatedRequest = request.newBuilder().header(RESTServices.HEADER_AUTHORIZATION, samlHeaderValue).build(); return chain.proceed(authenticatedRequest); }

Target:
public Response intercept(Chain chain) throws IOException { Request request = chain.request(); if(expiringSAMLAuth==null) { authorize(null); } else if(threshold<=Instant.now().getEpochSecond()){ authorize(expiringSAMLAuth.getExpiry()); } String samlHeaderValue = RESTServices.AUTHORIZATION_TYPE_SAML+ " "+ RESTServices.AUTHORIZATION_PARAM_TOKEN + "=" + authorizationTokenValue; Request authenticatedRequest = request.newBuilder().header(RESTServices.HEADER_AUTHORIZATION, samlHeaderValue).build(); return chain.proceed(authenticatedRequest); }
Source:
public LdapReturnValueBase execute() { try { log.debugFormat("Running LDAP command: {0}", getClass().getName()); String loginNameForKerberos = LdapBrokerUtils.modifyLoginNameForKerberos(getLoginName(), getAuthenticationDomain()); LdapCredentials ldapCredentials = new LdapCredentials(loginNameForKerberos, getPassword()); DirectorySearcher directorySearcher = new DirectorySearcher(ldapCredentials); executeQuery(directorySearcher); } catch (RuntimeException e) { String msg = String.format("Failed to run command %s. Domain is %s. User is %s.", getClass().getSimpleName(), getDomain(), getLoginName()); log.errorFormat(msg); setSucceeded(false); _ldapReturnValue.setExceptionString(msg); } return _ldapReturnValue; }

Target:
public LdapReturnValueBase execute() { try { log.debugFormat("Running LDAP command: {0}", getClass().getName()); String loginNameForKerberos = LdapBrokerUtils.modifyLoginNameForKerberos(getLoginName(), getAuthenticationDomain()); LdapCredentials ldapCredentials = new LdapCredentials(loginNameForKerberos, getPassword()); DirectorySearcher directorySearcher = new DirectorySearcher(ldapCredentials); executeQuery(directorySearcher); } catch (RuntimeException e) { String msg = String.format("Failed to run command %s. Domain is %s. User is %s.", getClass().getSimpleName(), getDomain(), getLoginName()); log.errorFormat(msg); _ldapReturnValue.setExceptionString(msg); } return _ldapReturnValue; }
Source:
public void formatsHtml4DoctypeBody() throws IOException { MatcherAssert.assertThat( new RsPrint( new RsPrettyXML( new RsWithBody("<!DOCTYPE HTML " + "PUBLIC \"- + "\"<LINK_1>\">" + "<html xmlns=\"<LINK_0>\" " + "lang=\"en\"><head><a>foo</a></head>" + "<body>this is body</body></html>" ) ) ).printBody(), Matchers.is("<!DOCTYPE html\n " + "PUBLIC \"- + "\"<LINK_1>\">\n" + "<html xmlns=\"<LINK_0>\" " + "lang=\"en\">\n <head>\n " + "<meta http-equiv=\"Content-Type\" content=\"text/html; " + "charset=UTF-8\" /><a>foo</a></head>\n " + "<body>this is body</body>\n</html>" ) ); }

Target:
public void formatsHtml4DoctypeBody() throws IOException { final String pid = "PUBLIC \"- final String xhtml = "<html xmlns=\"<LINK_0>\" " .concat("lang=\"en\">"); MatcherAssert.assertThat( new RsPrint( new RsPrettyXML( new RsWithBody( Joiner.on("").appendTo( new StringBuilder("<!DOCTYPE HTML "), pid, "\"<LINK_1>\">", xhtml, "<head><a>foo</a></head>", "<body>this is body</body></html>" ) ) ) ).printBody(), Matchers.is( Joiner.on("").appendTo( new StringBuilder("<!DOCTYPE html\n "), pid, "\"<LINK_1>\">\n", xhtml, "\n <head>\n ", "<meta http-equiv=\"Content-Type\" content=\"text/html; ", "charset=UTF-8\" /><a>foo</a></head>\n ", "<body>this is body</body>\n</html>" ).toString() ) ); }
Source:
public List<ImportKeysListEntry> search(String name, ParcelableProxy proxy) throws QueryFailedException, QueryNeedsRepairException { Timber.d("Web Key Directory import: " + name + " using Proxy: " + proxy.getProxy()); List<ImportKeysListEntry> entry = new ArrayList<>(1); byte[] data = query(name, proxy); try { try { entry.add(getEntry(name, data)); } catch (UnsupportedOperationException e) { Timber.e("Parsing retrieved Web Key Directory key failed!"); } } catch (PgpGeneralException | IOException e) { Timber.e(e, "Failed parsing key from Web Key Directory during search"); throw new QueryFailedException("No valid key found on Web Key Directory"); } return entry; }

Target:
public List<ImportKeysListEntry> search(String name, ParcelableProxy proxy) throws QueryFailedException { URL webKeyDirectoryURL = toWebKeyDirectoryURL(name); if (webKeyDirectoryURL == null) { Timber.d("Name not supported by Web Key Directory Client: " + name); return Collections.emptyList(); } Timber.d("Web Key Directory import: " + name + " using Proxy: " + proxy.getProxy()); byte[] data = query(webKeyDirectoryURL, proxy.getProxy()); if (data == null) { Timber.d("No Web Key Directory endpoint for: " + name); return Collections.emptyList(); } try { UncachedKeyRing ring = UncachedKeyRing.decodeFromData(data); return Collections.singletonList(new ImportKeysListEntry(null, ring)); } catch (PgpGeneralException | IOException e) { Timber.e(e, "Failed parsing key from Web Key Directory during search"); throw new QueryFailedException("No valid key found on Web Key Directory"); } }
Source:
public void addCameraFootprint(FootPrint footprintToBeDraw) { final BaiduMap map = getBaiduMap(); if (map == null) return; PolygonOptions pathOptions = new PolygonOptions(); pathOptions.stroke(new Stroke(FOOTPRINT_DEFAULT_WIDTH, FOOTPRINT_DEFAULT_COLOR)); pathOptions.fillColor(FOOTPRINT_FILL_COLOR); final List<LatLng> pathPoints = new ArrayList<LatLng>(footprintToBeDraw.getVertexInGlobalFrame().size()); for (LatLong coord : footprintToBeDraw.getVertexInGlobalFrame()) { pathPoints.add(CoordToLatLang(coord)); } pathOptions.points(pathPoints); map.addOverlay(pathOptions); }

Target:
public void addCameraFootprint(FootPrint footprintToBeDraw) { final BaiduMap map = getBaiduMap(); if (map == null) return; PolygonOptions pathOptions = new PolygonOptions(); pathOptions.stroke(mFootprintStroke); pathOptions.fillColor(FOOTPRINT_FILL_COLOR); final List<LatLng> pathPoints = new ArrayList<LatLng>(footprintToBeDraw.getVertexInGlobalFrame().size()); for (LatLong coord : footprintToBeDraw.getVertexInGlobalFrame()) { pathPoints.add(CoordToLatLng(coord)); } pathOptions.points(pathPoints); map.addOverlay(pathOptions); }