auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AutoCompletionCandidates doAutoCompleteJobName(@AncestorInPath Item project, @QueryParameter String value) { if (!project.hasPermission(Item.CONFIGURE) && project.hasPermission(Item.EXTENDED_READ)) { return new AutoCompletionCandidates(); } project.checkPermission(Item.CONFIGURE); ItemGroup parent = project.getParent(); AutoCompletionCandidates candidates = new AutoCompletionCandidates(); List<AbstractProject> jobs = getAllProjects(); for (AbstractProject job: jobs) { if (job.getFullName().startsWith(value) || job.getRelativeNameFrom(parent).startsWith(value)) { if (job.hasPermission(Item.READ)) { candidates.add(job.getFullName()); } } } return candidates; }

Target:
public AutoCompletionCandidates doAutoCompleteJobName(@AncestorInPath Item project, @QueryParameter String value) { if (!project.hasPermission(Item.CONFIGURE)) { return new AutoCompletionCandidates(); } project.checkPermission(Item.CONFIGURE); ItemGroup parent = project.getParent(); AutoCompletionCandidates candidates = new AutoCompletionCandidates(); List<AbstractProject> jobs = Jenkins.getInstance().getAllItems(AbstractProject.class); for (AbstractProject job: jobs) { if (job.getFullName().contains(value)) { if (job.hasPermission(Item.READ)) { candidates.add(job.getFullName()); } } } return candidates; }
Source:
public void write(StreamsDatum streamsDatum) { if(streamsDatum == null || streamsDatum.getDocument() == null) return; LOGGER.debug("Update Document: {}", streamsDatum.getDocument()); Map<String, Object> metadata = streamsDatum.getMetadata(); LOGGER.debug("Update Metadata: {}", metadata); String index = null; String type = null; String id = streamsDatum.getId(); if( metadata != null && metadata.containsKey("index")) index = (String) streamsDatum.getMetadata().get("index"); if( metadata != null && metadata.containsKey("type")) type = (String) streamsDatum.getMetadata().get("type"); if( id == null && metadata != null && metadata.containsKey("id")) id = (String) streamsDatum.getMetadata().get("id"); if(index == null || (config.getForceUseConfig() != null && config.getForceUseConfig())) { index = config.getIndex(); } if(type == null || (config.getForceUseConfig() != null && config.getForceUseConfig())) { type = config.getType(); } String json; try { json = OBJECT_MAPPER.writeValueAsString(streamsDatum.getDocument()); LOGGER.debug("Attempt Update: ({},{},{}) {}", index, type, id, json); update(index, type, id, json); } catch (Throwable e) { LOGGER.warn("Unable to Update Document in ElasticSearch: {}", e.getMessage()); } }

Target:
public void write(StreamsDatum streamsDatum) { if(streamsDatum == null || streamsDatum.getDocument() == null) return; LOGGER.debug("Update Document: {}", streamsDatum.getDocument()); Map<String, Object> metadata = streamsDatum.getMetadata(); LOGGER.debug("Update Metadata: {}", metadata); String index = getIndex(metadata, config); String type = getType(metadata, config); String id = getId(streamsDatum); String json; try { json = OBJECT_MAPPER.writeValueAsString(streamsDatum.getDocument()); LOGGER.debug("Attempt Update: ({},{},{}) {}", index, type, id, json); update(index, type, id, json); } catch (Throwable e) { LOGGER.warn("Unable to Update Document in ElasticSearch: {}", e.getMessage()); } }
Source:
public Iterable<ServerDetails> listNodesByIds(final Iterable<String> ids) { return Iterables.filter(listNodes(), new Predicate<ServerDetails>() { @Override public boolean apply(ServerDetails server) { return Iterables.contains(ids, server.getId()); } }); }

Target:
public Iterable<ServerDetails> listNodesByIds(final Iterable<String> ids) { return filter(listNodes(), new Predicate<ServerDetails>() { @Override public boolean apply(ServerDetails server) { return contains(ids, server.getId()); } }); }
Source:
private void createShallowFile(ObjectId... shallowCommits) throws IOException { final File shallow = new File(rw.repository.getDirectory(), "shallow"); final PrintWriter writer = new PrintWriter(shallow); try { for (ObjectId commit : shallowCommits) writer.println(commit.getName()); } finally { writer.close(); } }

Target:
private void createShallowFile(ObjectId... shallowCommits) throws IOException { final StringBuilder builder = new StringBuilder(); for (ObjectId commit : shallowCommits) builder.append(commit.getName() + "\n"); JGitTestUtil.write(new File(rw.repository.getDirectory(), "shallow"), builder.toString()); }
Source:
public Mapping buildMapping() { return new Mapping() { public IdentifierGeneratorFactory getIdentifierGeneratorFactory() { return identifierGeneratorFactory; } public Type getIdentifierType(String entityName) throws MappingException { PersistentClass pc = classes.get( entityName ); if ( pc == null ) { throw new MappingException( "persistent class not known: " + entityName ); } return pc.getIdentifier().getType(); } public String getIdentifierPropertyName(String entityName) throws MappingException { final PersistentClass pc = classes.get( entityName ); if ( pc == null ) { throw new MappingException( "persistent class not known: " + entityName ); } if ( !pc.hasIdentifierProperty() ) { return null; } return pc.getIdentifierProperty().getName(); } public Type getReferencedPropertyType(String entityName, String propertyName) throws MappingException { final PersistentClass pc = classes.get( entityName ); if ( pc == null ) { throw new MappingException( "persistent class not known: " + entityName ); } Property prop = pc.getReferencedProperty( propertyName ); if ( prop == null ) { throw new MappingException( "property not known: " + entityName + '.' + propertyName ); } return prop.getType(); } }; }

Target:
public Mapping buildMapping() { final Mapping delegate = super.buildMapping(); return new Mapping() { public IdentifierGeneratorFactory getIdentifierGeneratorFactory() { return identifierGeneratorFactory; } public Type getIdentifierType(String entityName) throws MappingException { return delegate.getIdentifierType( entityName ); } public String getIdentifierPropertyName(String entityName) throws MappingException { return delegate.getIdentifierPropertyName( entityName ); } public Type getReferencedPropertyType(String entityName, String propertyName) throws MappingException { return delegate.getReferencedPropertyType( entityName, propertyName ); } }; }
Source:
public Object visitGetKeysInGroupCommand(final InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { final String groupName = command.getGroupName(); if (!command.isGroupOwner()) { return invokeNextInterceptor(ctx, command); } final KeyFilter<Object> keyFilter = new CompositeKeyFilter<>(new GroupFilter<>(groupName, groupManager), new CollectionKeyFilter<>(ctx.getLookedUpEntries().keySet())); dataContainer.executeTask(keyFilter, new ParallelIterableMap.KeyValueAction<Object, InternalCacheEntry<Object, Object>>() { @Override public void apply(Object o, InternalCacheEntry<? super Object, ? super Object> internalCacheEntry) { synchronized (ctx) { entryFactory.wrapEntryForReading(ctx, o, internalCacheEntry).setSkipLookup(true); } } }); return invokeNextInterceptor(ctx, command); }

Target:
public Object visitGetKeysInGroupCommand(final InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { final String groupName = command.getGroupName(); if (!command.isGroupOwner()) { return invokeNextInterceptor(ctx, command); } final KeyFilter<Object> keyFilter = new CompositeKeyFilter<>(new GroupFilter<>(groupName, groupManager), new CollectionKeyFilter<>(ctx.getLookedUpEntries().keySet())); dataContainer.executeTask(keyFilter, new ParallelIterableMap.KeyValueAction<Object, InternalCacheEntry<Object, Object>>() { @Override public void apply(Object o, InternalCacheEntry<Object, Object> internalCacheEntry) { synchronized (ctx) { entryFactory.wrapEntryForReading(ctx, o, internalCacheEntry).setSkipLookup(true); } } }); return invokeNextInterceptor(ctx, command); }
Source:
private C3Donut createDonut() { String donutHoleTitle = displayerSettings.getDonutHoleTitle(); return factory.c3Donut(donutHoleTitle); }

Target:
protected C3Donut createDonut() { String donutHoleTitle = displayerSettings.getDonutHoleTitle(); return factory.c3Donut(donutHoleTitle); }
Source:
StreamEdge(StreamSpec streamSpec, boolean isIntermediate, boolean isBroadcast, Config config) { this.streamSpec = streamSpec; this.isIntermediate = isIntermediate; this.isBroadcast = isBroadcast || config.getBoolean(String.format("streams.%s.samza.broadcast", streamSpec.getId()), false);; this.config = config; if (isBroadcast && isIntermediate) { partitions = 1; } this.name = StreamUtil.getNameFromSystemStream(getSystemStream()); }

Target:
StreamEdge(StreamSpec streamSpec, boolean isIntermediate, boolean isBroadcast, Config config) { this.streamSpec = streamSpec; this.isIntermediate = isIntermediate; this.isBroadcast = isBroadcast || (config == null) ? false : new StreamConfig(config).getBroadcastEnabled(streamSpec.toSystemStream()); this.config = config; if (isBroadcast && isIntermediate) { partitions = 1; } this.name = StreamUtil.getNameFromSystemStream(getSystemStream()); }
Source:
private String createJaasFile(String kerberizedNimbusServiceName) { try { Path jaasFilePath = Files.createTempFile("jaas-", UUID.randomUUID().toString()); String filePath = jaasFilePath.toAbsolutePath().toString(); File jaasFile = new StormJaasCreator().create(filePath, kerberizedNimbusServiceName); return jaasFile.getAbsolutePath(); } catch (IOException e) { throw new RuntimeException("Can't create JAAS file for connecting secured nimbus", e); } }

Target:
private String createJaasFile(String kerberizedNimbusServiceName) { try { Path jaasFilePath = Files.createTempFile("jaas-", UUID.randomUUID().toString()); String filePath = jaasFilePath.toAbsolutePath().toString(); File jaasFile = new StormJaasCreator().create(filePath, kerberizedNimbusServiceName); return jaasFile.getAbsolutePath(); } catch (IOException e) { throw new RuntimeException("Can't create JAAS file to connect to secure nimbus", e); } }
Source:
public void setOrigin(BigInteger shift) { Preconditions.checkNotNull(shift, "shift"); this.origin = shift; }

Target:
public void setOrigin(BigInteger shift) { this.origin = Preconditions.checkNotNull(shift, "shift"); }
Source:
public MetricDescriptor addLabel(String descriptorType, String newLabel) { String descriptorName = projectResourceName + "/metricDescriptors/" + descriptorType; MetricDescriptor descriptor; log.info("Adding label '{}' to stackdriver descriptor '{}'. This may lose existing metric data", newLabel, descriptorName); try { descriptor = service.projects().metricDescriptors() .get(descriptorName) .execute(); } catch (IOException ioex) { log.error("Could not fetch descriptor " + descriptorType + ": " + ioex); return null; } for (LabelDescriptor labelDescriptor : descriptor.getLabels()) { if (labelDescriptor.getKey().equals(newLabel)) { log.info("{} already added to descriptor", newLabel); return descriptor; } } LabelDescriptor labelDescriptor = new LabelDescriptor(); labelDescriptor.setKey(newLabel); labelDescriptor.setValueType("STRING"); descriptor.getLabels().add(labelDescriptor); try { log.info("Deleting existing stackdriver descriptor {}", descriptorName); service.projects().metricDescriptors().delete(descriptorName).execute(); } catch (IOException ioex) { log.info("Ignoring error " + ioex); } try { log.info("Adding new definition for {}", descriptorName); return service.projects().metricDescriptors() .create(projectResourceName, descriptor) .execute(); } catch (IOException ioex) { log.error("Failed to update the descriptor definition: " + ioex); return null; } }

Target:
public MetricDescriptor addLabel(String descriptorType, String newLabel) { String descriptorName = projectResourceName + "/metricDescriptors/" + descriptorType; MetricDescriptor descriptor; log.info("Adding label '{}' to stackdriver descriptor '{}'. This may lose existing metric data", newLabel, descriptorName); try { descriptor = service.projects().metricDescriptors() .get(descriptorName) .execute(); } catch (IOException ioex) { log.error("Could not fetch descriptor " + descriptorType + ": " + ioex); return null; } for (LabelDescriptor labelDescriptor : descriptor.getLabels()) { if (labelDescriptor.getKey().equals(newLabel)) { log.info("{} already added to descriptor", newLabel); return descriptor; } } LabelDescriptor labelDescriptor = new LabelDescriptor(); labelDescriptor.setKey(newLabel); labelDescriptor.setValueType("STRING"); descriptor.getLabels().add(labelDescriptor); try { log.info("Deleting existing stackdriver descriptor {}", descriptorName); service.projects().metricDescriptors().delete(descriptorName).execute(); } catch (IOException ioex) { log.info("Ignoring error " + ioex); } try { log.info("Adding new descriptor for {}", descriptorName); return service.projects().metricDescriptors() .create(projectResourceName, descriptor) .execute(); } catch (IOException ioex) { log.error("Failed to update the descriptor definition: " + ioex); return null; } }
Source:
void subscribe(@Nonnull StreamListener streamListener, @Nonnull String namespace, @Nonnull List<TableSchema<K, V, M>> tablesOfInterest, long startAddress) { if (subscriptions.size() >= MAX_SUBSCRIBERS) { throw new StreamSubscriptionException( "subscribe: Max " + MAX_SUBSCRIBERS + " hit! Consider consolidating " + streamListener); } if (subscriptions.containsKey(streamListener)) { throw new StreamSubscriptionException( "StreamManager:subscriber already registered " + streamListener + ". Maybe call unregister first?"); } log.info("StreamManager::subscribe {}, startAddress {}, namespace {}, tables {}", streamListener, startAddress, namespace, tablesOfInterest.toString()); SubscriptionThread st = new SubscriptionThread(this, streamListener, namespace, tablesOfInterest, startAddress); subscriptions.put(streamListener, st); st.start(); }

Target:
void subscribe(@Nonnull StreamListener streamListener, @Nonnull String namespace, @Nonnull List<TableSchema<K, V, M>> tablesOfInterest, long startAddress) { if (subscriptions.containsKey(streamListener)) { throw new StreamSubscriptionException( "StreamManager:subscriber already registered " + streamListener + ". Maybe call unregister first?"); } if (subscriptions.size() >= MAX_SUBSCRIBERS) { log.error("StreamManager::subscribe has too many subscribers", streamListener, MAX_SUBSCRIBERS); throw new StreamSubscriptionException( "StreamManager: too many (" + MAX_SUBSCRIBERS + ") subscriptions"); } log.info("StreamManager::subscribe {}, startAddress {}, namespace {}, tables {}", streamListener, startAddress, namespace, tablesOfInterest.toString()); SubscriberTask task = new SubscriberTask(this, streamListener, namespace, tablesOfInterest, startAddress); final ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay( task, 0, DEFAULT_SLEEP_MILLIS, TimeUnit.MILLISECONDS); subscriptions.put(streamListener, new StreamSubscriber(task, scheduledFuture)); }
Source:
public void testGetKieText() { GAV gavEvaluation = new GAV("evaluation", "evaluation", "12.1.1-SNAPSHOT"); InputStream is = this.getClass().getResourceAsStream("evaluation-12.1.1.jar"); repo.deployArtifact(is, gavEvaluation, false); Collection<File> files = repo.listFiles(); for (File file : files) { String fileName = file.getName(); if (fileName.startsWith("evaluation-12.1.1") && fileName.endsWith(".jar")) { String path = file.getPath(); String jarPath = path.substring(repo.getM2RepositoryRootDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME).length()); String kieDeploymentDescriptorText = repo.getKieDeploymentDescriptorText(jarPath); assertNotNull(kieDeploymentDescriptorText); String kModuleText = repo.getKModuleText(jarPath); assertNotNull(kModuleText); break; } } }

Target:
public void testGetKieText() { GAV gavEvaluation = new GAV("evaluation", "evaluation", "12.1.1-SNAPSHOT"); InputStream is = this.getClass().getResourceAsStream("evaluation-12.1.1.jar"); repo.deployArtifact(is, gavEvaluation, false); Optional<File> file = repo.listFiles("evaluation-12.1.1", singletonList("jar")).stream().findFirst(); assertTrue(file.isPresent()); String path = file.get().getPath(); String jarPath = path.substring(repo.getM2RepositoryRootDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME).length()); String kieDeploymentDescriptorText = repo.getKieDeploymentDescriptorText(jarPath); assertNotNull(kieDeploymentDescriptorText); String kModuleText = repo.getKModuleText(jarPath); assertNotNull(kModuleText); }
Source:
protected void init(Set<String> allKeys, Set<String> usedKeys) { this.allKeys = new HashSet<String>(allKeys); this.usedKeys = new HashSet<String>(usedKeys); List<KeyValueLineModel> list = new ArrayList<KeyValueLineModel>(); KeyValueLineModel lineModel; disableEvent = true; for (String key : usedKeys) { lineModel = createNewLineModel(key); lineModel.getKeys().setSelectedItem(key); fillLineModel(lineModel, key); list.add(lineModel); } disableEvent = false; setItems(list); }

Target:
protected void init(Set<String> allKeys, Set<String> usedKeys) { this.allKeys = new HashSet<String>(allKeys); this.usedKeys = new HashSet<String>(usedKeys); List<KeyValueLineModel> list = new ArrayList<KeyValueLineModel>(); disableEvent = true; for (String key : usedKeys) { KeyValueLineModel lineModel = createNewLineModel(key); lineModel.getKeys().setSelectedItem(key); setValueByKey(lineModel, key); list.add(lineModel); } disableEvent = false; setItems(list); }
Source:
public static List<Field> getDeclaredFields(Class<?> in) { return new Ordering<Field>() { @Override public int compare(Field f1, Field f2) { Column a1 = f1.getAnnotation(Column.class); Column a2 = f2.getAnnotation(Column.class); if (a1 == null && a2 == null) { return f1.getName().compareTo(f2.getName()); } if (a1 == null) { return 1; } if (a2 == null) { return -1; } return a1.id() - a2.id(); } }.sortedCopy(Arrays.asList(in.getDeclaredFields())); }

Target:
public static List<Field> getDeclaredFields(Class<?> in) { return sort(Arrays.asList(in.getDeclaredFields())); }
Source:
private List<Contentlet> getRelatedChildren(final Contentlet contentlet, final Relationship rel, final User user, final boolean respectFrontendRoles) throws DotSecurityException, DotDataException { final List<Contentlet> result = new ArrayList<>(); final String relationshipName = rel.getRelationTypeValue().toLowerCase(); SearchResponse response = APILocator.getEsSearchAPI() .esSearchRelated(contentlet.getIdentifier(), relationshipName, false,false, user, respectFrontendRoles); if (response.getHits() == null) { return result; } for (SearchHit sh : response.getHits()) { try { Map<String, Object> sourceMap = sh.getSourceAsMap(); if (sourceMap.get(relationshipName) != null) { ((ArrayList<Map>) sourceMap.get(relationshipName)).stream().forEach(child -> { try { result.add(findContentletByIdentifierAnyLanguage( (String) child.get("identifier"))); } catch (Exception e) { throw new RuntimeException(e); } }); } } catch (Exception e) { Logger.error(this, e.getMessage(), e); } } return result; }

Target:
private List<Contentlet> getRelatedChildren(final Contentlet contentlet, final Relationship rel, final User user, final boolean respectFrontendRoles) throws DotSecurityException, DotDataException { if (getRelatedContentFromDB){ return FactoryLocator.getRelationshipFactory().dbRelatedContent(rel, contentlet, true); } else{ final List<Contentlet> result = new ArrayList<>(); final String relationshipName = rel.getRelationTypeValue().toLowerCase(); SearchResponse response = APILocator.getEsSearchAPI() .esSearchRelated(contentlet.getIdentifier(), relationshipName, false,false, user, respectFrontendRoles); if (response.getHits() == null) { return result; } for (SearchHit sh : response.getHits()) { Map<String, Object> sourceMap = sh.getSourceAsMap(); if (sourceMap.get(relationshipName) != null) { ((ArrayList<String>) sourceMap.get(relationshipName)).stream().forEach(child -> { try { result.add(findContentletByIdentifierAnyLanguage( child)); } catch (Exception e) { throw new RuntimeException(e); } }); } } return result; } }
Source:
public CandlepinQuery<Owner> getOwnersByActiveProduct(Collection<String> productIds) { DetachedCriteria poolIdQuery = DetachedCriteria.forClass(Pool.class, "pool") .createAlias("pool.product", "products") .createAlias("products.providedProducts", "providedProducts") .add(CPRestrictions.in("providedProducts.id", productIds)) .setProjection(Property.forName("pool.id")); DetachedCriteria ownerIdQuery = DetachedCriteria.forClass(Entitlement.class, "e") .add(Subqueries.propertyIn("e.pool.id", poolIdQuery)) .createCriteria("pool").add(Restrictions.gt("endDate", new Date())) .setProjection(Property.forName("e.owner.id")); DetachedCriteria distinctQuery = DetachedCriteria.forClass(Owner.class, "o2") .add(Subqueries.propertyIn("o2.id", ownerIdQuery)) .setProjection(Projections.distinct(Projections.property("o2.key"))); DetachedCriteria criteria = DetachedCriteria.forClass(Owner.class, "o") .add(Subqueries.propertyIn("o.key", distinctQuery)); return this.cpQueryFactory.<Owner>buildQuery(this.currentSession(), criteria); }

Target:
public CandlepinQuery<Owner> getOwnersByActiveProduct(Collection<String> productIds) { DetachedCriteria poolIdQuery = DetachedCriteria.forClass(Pool.class, "pool") .createAlias("pool.product", "product") .createAlias("product.providedProducts", "providedProducts") .add(CPRestrictions.in("providedProducts.id", productIds)) .setProjection(Property.forName("pool.id")); DetachedCriteria ownerIdQuery = DetachedCriteria.forClass(Entitlement.class, "e") .add(Subqueries.propertyIn("e.pool.id", poolIdQuery)) .createCriteria("pool").add(Restrictions.gt("endDate", new Date())) .setProjection(Property.forName("e.owner.id")); DetachedCriteria distinctQuery = DetachedCriteria.forClass(Owner.class, "o2") .add(Subqueries.propertyIn("o2.id", ownerIdQuery)) .setProjection(Projections.distinct(Projections.property("o2.key"))); DetachedCriteria criteria = DetachedCriteria.forClass(Owner.class, "o") .add(Subqueries.propertyIn("o.key", distinctQuery)); return this.cpQueryFactory.<Owner>buildQuery(this.currentSession(), criteria); }
Source:
private void waitForTimeout(TimeLimit timeout) { Duration waitPeriod = Duration.ofMillis(timeout.getTimeMillis()); currentTime = currentTime.plus(waitPeriod); reaperExecutor.tick(waitPeriod.toMillis(), TimeUnit.MILLISECONDS); lockAcquirerExecutor.tick(waitPeriod.toMillis(), TimeUnit.MILLISECONDS); }

Target:
private void waitForTimeout(TimeLimit timeout) { Stopwatch timer = Stopwatch.createStarted(); long buffer = 250L; while (timer.elapsed(TimeUnit.MILLISECONDS) < timeout.getTimeMillis() + buffer) { Uninterruptibles.sleepUninterruptibly(buffer, TimeUnit.MILLISECONDS); } }
Source:
public MQTTDataGenerator connectToTopic(final String topic) { List<MQTTDataGenerator> dataGeneratorList = dataGeneratorListMap.get(topic); if (dataGeneratorList == null) { dataGeneratorList = new ArrayList<>(); dataGeneratorListMap.putIfAbsent(topic, dataGeneratorList); } final MQTTDataGenerator dataGenerator = new MQTTDataGenerator(this, topic); dataGeneratorListMap.get(topic).add(dataGenerator); return dataGenerator; }

Target:
public MQTTDataGenerator connectToTopic(final String topic) { Queue<MQTTDataGenerator> dataGeneratorList = dataGeneratorListMap.get(topic); if (dataGeneratorList == null) { dataGeneratorList = new ConcurrentLinkedQueue<>(); dataGeneratorListMap.put(topic, dataGeneratorList); } final MQTTDataGenerator dataGenerator = new MQTTDataGenerator(this, topic); dataGeneratorListMap.get(topic).add(dataGenerator); return dataGenerator; }
Source:
public DatasetDTO getDataset(final Integer datasetId) { final DatasetDTO datasetDTOS; try { final ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("project.projectId"), "datasetId"); projectionList.add(Projections.sqlProjection("value as datasetTypeId", new String[] {"datasetTypeId"}, new Type[] {Hibernate.INTEGER}),"datasetTypeId"); projectionList.add(Projections.property("project.name"), "name"); projectionList.add(Projections.property("pr.objectProject.projectId"), "parentDatasetId"); final Criteria criteria = this.getSession().createCriteria(DmsProject.class, "project"); criteria.createAlias("project.relatedTos", "pr"); criteria.createAlias("project.properties", "pp", CriteriaSpecification.INNER_JOIN, Restrictions.eq("pp.variableId", TermId.DATASET_TYPE.getId())); criteria.add(Restrictions.eq("project.projectId", datasetId)); criteria.add(Restrictions.eq("pr.typeId", TermId.BELONGS_TO_STUDY.getId())); criteria.setProjection(projectionList); criteria.setResultTransformer(Transformers.aliasToBean(DatasetDTO.class)); datasetDTOS = (DatasetDTO) criteria.uniqueResult(); } catch (final HibernateException e) { throw new MiddlewareQueryException("Error getting getDataset for datasetId =" + datasetId + ":" + e.getMessage(), e); } return datasetDTOS; }

Target:
public DatasetDTO getDataset(final Integer datasetId) { final DatasetDTO datasetDTO; try { final ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("project.projectId"), "datasetId"); projectionList.add(Projections.sqlProjection("value as datasetTypeId", new String[] {"datasetTypeId"}, new Type[] {Hibernate.INTEGER}),"datasetTypeId"); projectionList.add(Projections.property("project.name"), "name"); projectionList.add(Projections.property("pr.objectProject.projectId"), "parentDatasetId"); final Criteria criteria = this.getSession().createCriteria(DmsProject.class, "project"); criteria.createAlias("project.relatedTos", "pr"); criteria.createAlias("project.properties", "pp", CriteriaSpecification.INNER_JOIN, Restrictions.eq("pp.variableId", TermId.DATASET_TYPE.getId())); criteria.add(Restrictions.eq("project.projectId", datasetId)); criteria.add(Restrictions.eq("pr.typeId", TermId.BELONGS_TO_STUDY.getId())); criteria.setProjection(projectionList); criteria.setResultTransformer(Transformers.aliasToBean(DatasetDTO.class)); datasetDTO = (DatasetDTO) criteria.uniqueResult(); } catch (final HibernateException e) { final String errorMessage = "Error getting getDataset for datasetId =" + datasetId + ":" + e.getMessage(); DmsProjectDao.LOG.error(errorMessage, e); throw new MiddlewareQueryException(errorMessage, e); } return datasetDTO; }
Source:
public static Map<String, Object> jsonToMap(String jsonString) throws JsonParseException, JsonMappingException, IOException { final ObjectMapper mapper = new ObjectMapper(); final MapType type = mapper.getTypeFactory().constructMapType(Map.class, String.class, Object.class); final Map<String, Object> data = mapper.readValue(jsonString, type); return data; }

Target:
public static Map<String, Object> jsonToMap(String jsonString) throws IOException { ObjectMapper mapper = new ObjectMapper(); MapType type = mapper.getTypeFactory().constructMapType(Map.class, String.class, Object.class); Map<String, Object> data = mapper.readValue(jsonString, type); return data; }
Source:
public JSONObject toJSONObject() { JSONObject mainObj = new JSONObject(); try { mainObj.put("type", type.ordinal()); mainObj.put("actionID", actionID); } catch(Throwable t) { t.printStackTrace(); } return mainObj; }

Target:
public JSONObject toJSONObject() { JSONObject mainObj = new JSONObject(); try { mainObj.put("type", type.ordinal()); mainObj.put("actionId", actionID); } catch(Throwable t) { t.printStackTrace(); } return mainObj; }
Source:
public void testFilterExpressionRewrite() { tester().assertThat(zeroRewriter).on(p -> p.filter(new LongLiteral("1"), p.values())) .matches( filter("0", PlanMatchPattern.values())); }

Target:
public void testFilterExpressionRewrite() { tester().assertThat(zeroRewriter).on(p -> p.filter(new LongLiteral("1"), p.values())) .matches( filter("0", values())); }
Source:
private static void allStylesForRendering( LayerGroupInfo group, List<StyleInfo> styles, boolean root) { switch (group.getMode()) { case EO: styles.add(group.getRootLayerStyle()); break; case CONTAINER: if (root) { throw new UnsupportedOperationException( "LayerGroup mode " + Mode.CONTAINER.getName() + " can not be rendered"); } default: int size = group.getLayers().size(); for (int i = 0; i < size; i++) { PublishedInfo p = group.getLayers().get(i); StyleInfo s = group.getStyles().get(i); if (p instanceof LayerInfo) { StyleInfo styleInfo = group.getStyles().get(i); if (((LayerInfo) p).getResource() instanceof WMSLayerInfo) { WMSLayerInfo wmsLayerInfo = (WMSLayerInfo) ((LayerInfo) p).getResource(); styleInfo = processWMSLayer(wmsLayerInfo, styleInfo); } styles.add(styleInfo); } else if (p instanceof LayerGroupInfo) { allStylesForRendering((LayerGroupInfo) p, styles, false); } else if (p == null && s != null) { expandStyleGroup( s, group.getBounds() == null ? null : group.getBounds().getCoordinateReferenceSystem(), null, styles); } } } }

Target:
private static void allStylesForRendering( LayerGroupInfo group, List<StyleInfo> styles, boolean root) { switch (group.getMode()) { case EO: styles.add(group.getRootLayerStyle()); break; case CONTAINER: if (root) { throw new UnsupportedOperationException( "LayerGroup mode " + Mode.CONTAINER.getName() + " can not be rendered"); } default: int size = group.getLayers().size(); for (int i = 0; i < size; i++) { PublishedInfo p = group.getLayers().get(i); StyleInfo s = group.getStyles().get(i); if (p instanceof LayerInfo) { StyleInfo styleInfo = group.getStyles().get(i); if (((LayerInfo) p).getResource() instanceof WMSLayerInfo) { WMSLayerInfo wmsLayerInfo = (WMSLayerInfo) ((LayerInfo) p).getResource(); styleInfo = getRemoteWmsLayerStyle(wmsLayerInfo, styleInfo); } styles.add(styleInfo); } else if (p instanceof LayerGroupInfo) { allStylesForRendering((LayerGroupInfo) p, styles, false); } else if (p == null && s != null) { expandStyleGroup( s, group.getBounds() == null ? null : group.getBounds().getCoordinateReferenceSystem(), null, styles); } } } }
Source:
public void createOneUnAuthenticatedTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = CommunityBuilder.createCommunity(context) .withName("My commynity") .build(); EPerson eperson1 = EPersonBuilder.createEPerson(context) .withEmail("eperson1@mail.com") .withPassword("qwerty01") .build(); context.restoreAuthSystemState(); ObjectMapper mapper = new ObjectMapper(); ResourcePolicyRest resourcePolicyRest = new ResourcePolicyRest(); resourcePolicyRest.setPolicyType(ResourcePolicy.TYPE_SUBMISSION); resourcePolicyRest.setAction(Constants.actionText[Constants.ADMIN]); getClient().perform(post("/api/authz/resourcepolicies") .content(mapper.writeValueAsBytes(resourcePolicyRest)) .param("resource", community.getID().toString()) .param("eperson", eperson1.getID().toString()) .contentType(contentType)) .andExpect(status().isUnauthorized()); }

Target:
public void createOneUnAuthenticatedTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = CommunityBuilder.createCommunity(context) .withName("My commynity") .build(); EPerson eperson1 = EPersonBuilder.createEPerson(context) .withEmail("eperson1@mail.com") .withPassword("qwerty01") .build(); context.restoreAuthSystemState(); ObjectMapper mapper = new ObjectMapper(); ResourcePolicyRest resourcePolicyRest = new ResourcePolicyRest(); resourcePolicyRest.setPolicyType(ResourcePolicy.TYPE_SUBMISSION); resourcePolicyRest.setAction(Constants.actionText[Constants.ADMIN]); getClient().perform(post("/api/authz/resourcepolicies") .content(mapper.writeValueAsBytes(resourcePolicyRest)) .param("resource", community.getID().toString()) .param("eperson", eperson1.getID().toString()) .contentType(contentType)) .andExpect(status().isUnauthorized()); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(get("/api/authz/resourcepolicies/search/resource") .param("uuid", community.getID().toString()) .param("action", "ADMIN")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._links.self.href", Matchers.containsString("api/authz/resourcepolicies/search/resource"))) .andExpect(jsonPath("$.page.totalElements", is(0))); }
Source:
public void testBindInteger(final boolean fireUntilHalt) throws InterruptedException { final String drl = "import org.drools.compiler.oopath.*;\n" + "global java.util.List list\n" + "\n" + "rule R when\n" + " Adult( $age: /age )\n" + "then\n" + " list.add( $age );\n" + "end\n"; final KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL ) .build() .newKieSession(); if (fireUntilHalt) { new Thread(ksession::fireUntilHalt).start(); } final List<String> list = new ArrayList<>(); ksession.setGlobal( "list", list ); final Man bob = new Man( "Bob", 40 ); ksession.insert(bob); if (fireUntilHalt) { try { while (list.size() < 1) { Thread.sleep(100); } } finally { ksession.halt(); } } else { ksession.fireAllRules(); assertEquals( 1, list.size() ); } assertTrue( list.contains( 40 ) ); }

Target:
public void testBindInteger(final boolean fireUntilHalt) throws InterruptedException, ExecutionException { final String drl = "import org.drools.compiler.oopath.model.*;\n" + "global java.util.List list\n" + "\n" + "rule R when\n" + " Adult( $age: /age )\n" + "then\n" + " list.add( $age );\n" + "end\n"; final KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL ) .build() .newKieSession(); Future fireUntilHaltFuture = null; if (fireUntilHalt) { fireUntilHaltFuture = startFireUntilHaltThread(ksession); } final List<Integer> list = new ArrayList<>(); ksession.setGlobal( "list", list ); final Man bob = new Man( "Bob", 40 ); ksession.insert(bob); if (fireUntilHalt) { waitForResultAndStopFireUntilHalt(list, ksession, fireUntilHaltFuture); } else { ksession.fireAllRules(); Assertions.assertThat(list).hasSize(1); } Assertions.assertThat(list).contains(40); }
Source:
public String getFilterName() { return getClass().getName(); }

Target:
public String getFilterName() { return CheCorsFilter.class.getName(); }
Source:
private List<Contentlet> convertToFileAssets( final User user, final boolean respectFrontendRoles, final List<Map<String, Object>> queryResults) throws DotDataException { final List<Contentlet> files = new ArrayList<>(); for (final Map<String, Object> fileInfo : queryResults) { final String contentId = (String) fileInfo.get("inode"); try { final Contentlet file = APILocator.getContentletAPI().find(contentId, user, respectFrontendRoles); files.add(file); } catch (DotSecurityException e) { Logger.debug(FileAssetFactoryImpl.class, e.getMessage()); } } return files; }

Target:
private List<Contentlet> convertToFileAssets( final User user, final boolean respectFrontendRoles, final List<Map<String, Object>> queryResults) throws DotDataException { final ImmutableList.Builder builder = new ImmutableList.Builder(); for (final Map<String, Object> fileInfo : queryResults) { final String contentId = (String) fileInfo.get("inode"); try { final Contentlet file = APILocator.getContentletAPI().find(contentId, user, respectFrontendRoles); builder.add(file); } catch (DotSecurityException e) { Logger.debug(FileAssetFactoryImpl.class, e.getMessage()); } } return builder.build(); }
Source:
private void signInAndFetchBlogListWPOrg() { startProgress(getString(R.string.signing_in)); String url = EditTextUtils.getText(mUrlEditText).trim(); url = url.replace("\n", "").replace("\r", ""); mDispatcher.dispatch(AuthenticationActionBuilder.newDiscoverEndpointAction(url)); }

Target:
private void signInAndFetchBlogListWPOrg() { startProgress(getString(R.string.signing_in)); String url = EditTextUtils.getText(mUrlEditText).trim(); url = url.replaceAll("\r|\n", ""); mDispatcher.dispatch(AuthenticationActionBuilder.newDiscoverEndpointAction(url)); }
Source:
protected UploadModule getModule() { if (this.module == null) { this.module = getDescriptor().getModule(); } return this.module; }

Target:
protected synchronized UploadModule getModule() { if (this.module == null) { return getDescriptor().getModule(); } return this.module; }
Source:
public final Object asyncInvokeNext(InvocationContext ctx, VisitableCommand command, CompletionStage<?> delay) { if (delay == null || CompletionStages.isComplete(delay)) { return invokeNext(ctx, command); } return asyncValue(delay).thenApply(ctx, command, invokeNextFunction); }

Target:
public final Object asyncInvokeNext(InvocationContext ctx, VisitableCommand command, CompletionStage<?> delay) { if (delay == null || CompletionStages.isCompletedSuccessfully(delay)) { return invokeNext(ctx, command); } return asyncValue(delay).thenApply(ctx, command, invokeNextFunction); }
Source:
CommonFilesSearchNode(CommonFilesMetaData metaData) { super(Children.create(new CommonFilesChildren(metaData), true), Lookups.singleton(metaData)); children = this.getChildren(); }

Target:
CommonFilesSearchNode(CommonFilesMetaData metaData) { super(Children.create(new CommonFilesChildren(metaData), true), Lookups.singleton(metaData)); }
Source:
public void testInteropReadEncryptedParquetFiles() throws IOException { Path rootPath = new Path("submodules/parquet-testing/data"); LOG.info("======== testInteropReadEncryptedParquetFiles ========", rootPath.toString()); byte[] AADPrefix = AAD_PREFIX_STRING.getBytes(StandardCharsets.UTF_8); Map<DecryptionConfiguration, FileDecryptionProperties> decryptionPropertiesMap = getDecryptionConfigurations(AADPrefix); testReadEncryptedParquetFiles(rootPath, decryptionPropertiesMap); }

Target:
public void testInteropReadEncryptedParquetFiles() throws IOException { Path rootPath = new Path(PARQUET_TESTING_PATH); LOG.info("======== testInteropReadEncryptedParquetFiles ========", rootPath.toString()); byte[] AADPrefix = AAD_PREFIX_STRING.getBytes(StandardCharsets.UTF_8); testInteropReadEncryptedParquetFiles(rootPath, true , LINEAR_DATA); }
Source:
public ConnectorPageSource createPageSource(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorSplit split, List<ColumnHandle> columns) { List<HiveColumnHandle> hiveColumns = columns.stream() .map(HiveColumnHandle.class::cast) .collect(toList()); HiveSplit hiveSplit = (HiveSplit) split; Path path = new Path(hiveSplit.getPath()); Configuration configuration = new Configuration(hdfsEnvironment.getConfiguration(new HdfsContext(session, hiveSplit.getDatabase(), hiveSplit.getTable()), path)); configuration.setBoolean(S3_SELECT_PUSHDOWN_ENABLED, hiveSplit.isS3SelectPushdownEnabled()); Optional<ConnectorPageSource> pageSource = createHivePageSource( cursorProviders, pageSourceFactories, configuration, session, path, hiveSplit.getBucketNumber(), hiveSplit.getStart(), hiveSplit.getLength(), hiveSplit.getFileSize(), hiveSplit.getSchema(), hiveSplit.getEffectivePredicate(), hiveColumns, hiveSplit.getPartitionKeys(), hiveStorageTimeZone, typeManager, hiveSplit.getColumnCoercions(), hiveSplit.getBucketConversion()); if (pageSource.isPresent()) { return pageSource.get(); } throw new RuntimeException("Could not find a file reader for split " + hiveSplit); }

Target:
public ConnectorPageSource createPageSource(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorSplit split, List<ColumnHandle> columns) { List<HiveColumnHandle> hiveColumns = columns.stream() .map(HiveColumnHandle.class::cast) .collect(toList()); HiveSplit hiveSplit = (HiveSplit) split; Path path = new Path(hiveSplit.getPath()); Configuration configuration = hdfsEnvironment.getConfiguration(new HdfsContext(session, hiveSplit.getDatabase(), hiveSplit.getTable()), path); Optional<ConnectorPageSource> pageSource = createHivePageSource( cursorProviders, pageSourceFactories, configuration, session, path, hiveSplit.getBucketNumber(), hiveSplit.getStart(), hiveSplit.getLength(), hiveSplit.getFileSize(), hiveSplit.getSchema(), hiveSplit.getEffectivePredicate(), hiveColumns, hiveSplit.getPartitionKeys(), hiveStorageTimeZone, typeManager, hiveSplit.getColumnCoercions(), hiveSplit.getBucketConversion(), hiveSplit.isS3SelectPushdownEnabled()); if (pageSource.isPresent()) { return pageSource.get(); } throw new RuntimeException("Could not find a file reader for split " + hiveSplit); }
Source:
public void testItValidatesMaxSizeOfPhotoShareByMessage() throws MalformedURLException { SharePhotoContent sharePhotoContent = new SharePhotoContent.Builder().addPhoto(buildSharePhoto("<LINK_2>")) .addPhoto(buildSharePhoto("<LINK_5>")) .addPhoto(buildSharePhoto("<LINK_6>")) .addPhoto(buildSharePhoto("<LINK_1>")) .addPhoto(buildSharePhoto("<LINK_0>")) .addPhoto(buildSharePhoto("<LINK_3>")) .addPhoto(buildSharePhoto("<LINK_4>")) .build(); ShareContentValidation.validateForMessage(sharePhotoContent); }

Target:
public void testItValidatesMaxSizeOfPhotoShareByMessage() { SharePhotoContent sharePhotoContent = new SharePhotoContent.Builder() .addPhoto(buildSharePhoto("<LINK_2>")) .addPhoto(buildSharePhoto("<LINK_5>")) .addPhoto(buildSharePhoto("<LINK_6>")) .addPhoto(buildSharePhoto("<LINK_1>")) .addPhoto(buildSharePhoto("<LINK_0>")) .addPhoto(buildSharePhoto("<LINK_3>")) .addPhoto(buildSharePhoto("<LINK_4>")) .build(); ShareContentValidation.validateForMessage(sharePhotoContent); }
Source:
public void validateTrip(Trip trip, Route route, List<StopTime> stopTimes, List<Stop> stops) { double maxSpeedKph = getMaxSpeedKph(route); int beginIndex = 0; while (missingBothTimes(stopTimes.get(beginIndex))) { beginIndex++; if (beginIndex == stopTimes.size()) return; } StopTime prevStopTime = stopTimes.get(beginIndex); Stop prevStop = stops.get(beginIndex); double distanceMeters = 0; for (int i = beginIndex + 1; i < stopTimes.size(); i++) { StopTime currStopTime = stopTimes.get(i); Stop currStop = stops.get(i); distanceMeters += fastDistance(currStop.stop_lat, currStop.stop_lon, prevStop.stop_lat, prevStop.stop_lon); if (missingBothTimes(currStopTime)) { continue; } if (currStopTime.departure_time < currStopTime.arrival_time) { registerError(currStopTime, DEPARTURE_BEFORE_ARRIVAL); } boolean bothTravelTimesRounded = areTravelTimesRounded(prevStopTime); double travelTimeSeconds = currStopTime.arrival_time - prevStopTime.departure_time; if (bothTravelTimesRounded && travelTimeSeconds == 0) travelTimeSeconds += 60; if (checkDistanceAndTime(distanceMeters, travelTimeSeconds, currStopTime)) { double kph = (distanceMeters / 1000D) / (travelTimeSeconds / 60D / 60D); if (kph < MIN_SPEED_KPH) { registerError(currStopTime, TRAVEL_TOO_SLOW, String.format("%2.1f km/h", kph)); } else if (kph > maxSpeedKph) { registerError(currStopTime, TRAVEL_TOO_FAST, String.format("%2.1f km/h", kph)); } } distanceMeters = 0; prevStopTime = currStopTime; prevStop = currStop; } }

Target:
public void validateTrip(Trip trip, Route route, List<StopTime> stopTimes, List<Stop> stops) { double maxSpeedKph = getMaxSpeedKph(route); int beginIndex = 0; while (missingBothTimes(stopTimes.get(beginIndex))) { beginIndex++; if (beginIndex == stopTimes.size()) return; } StopTime prevStopTime = stopTimes.get(beginIndex); Stop prevStop = stops.get(beginIndex); double distanceMeters = 0; for (int i = beginIndex + 1; i < stopTimes.size(); i++) { StopTime currStopTime = stopTimes.get(i); Stop currStop = stops.get(i); distanceMeters += fastDistance(currStop.stop_lat, currStop.stop_lon, prevStop.stop_lat, prevStop.stop_lon); if (missingBothTimes(currStopTime)) { continue; } if (currStopTime.departure_time < currStopTime.arrival_time) { registerError(currStopTime, DEPARTURE_BEFORE_ARRIVAL); } boolean bothTravelTimesRounded = areTravelTimesRounded(prevStopTime); double travelTimeSeconds = currStopTime.arrival_time - prevStopTime.departure_time; if (bothTravelTimesRounded && travelTimeSeconds == 0) { travelTimeSeconds += 60; } if (checkDistanceAndTime(distanceMeters, travelTimeSeconds, currStopTime)) { double kph = (distanceMeters / 1000D) / (travelTimeSeconds / 60D / 60D); if (kph < MIN_SPEED_KPH) { registerError(currStopTime, TRAVEL_TOO_SLOW, String.format("%2.1f km/h", kph)); } else if (kph > maxSpeedKph) { registerError(currStopTime, TRAVEL_TOO_FAST, String.format("%2.1f km/h", kph)); } } distanceMeters = 0; prevStopTime = currStopTime; prevStop = currStop; } }
Source:
void start() { bossGroup = EventLoopGroups.newEventLoopGroup(1); EventLoopGroup workerGroup = CommonPools.workerGroup(); ServerBootstrap b = new ServerBootstrap(); channel = b.group(bossGroup, workerGroup) .channel(EventLoopGroups.serverChannelType(bossGroup)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) { ch.pipeline().addLast(new ScribeInboundHandler(scribe)); } }) .childOption(ChannelOption.AUTO_READ, true) .childOption(ChannelOption.SO_KEEPALIVE, true) .bind(port) .syncUninterruptibly() .channel(); }

Target:
void start() { bossGroup = EventLoopGroups.newEventLoopGroup(1); EventLoopGroup workerGroup = CommonPools.workerGroup(); ServerBootstrap b = new ServerBootstrap(); try { channel = b.group(bossGroup, workerGroup) .channel(EventLoopGroups.serverChannelType(bossGroup)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) { ch.pipeline().addLast(new ScribeInboundHandler(scribe)); } }) .childOption(ChannelOption.SO_BACKLOG, 1024) .bind(port) .syncUninterruptibly() .channel(); } catch (Throwable t) { throw new RuntimeException("Could not start scribe server.", t); } }
Source:
protected void applyUndoRecordUnsafe(SMRRecord record) { log.trace("Undo[{}] of {}@{} ({})", this, record.getSMRMethod(), Address.isAddress(record.getGlobalAddress()) ? record.getGlobalAddress() : "OPT", record.getUndoRecord()); IUndoFunction<T> undoFunction = undoFunctionMap.get(record.getSMRMethod()); if (undoFunction != null) { undoFunction.doUndo(object, record.getUndoRecord(), record.getSMRArguments()); return; } else if (resetSet.contains(record.getSMRMethod())) { object = (T) record.getUndoRecord(); record.clearUndoRecord(); return; } throw new RuntimeException("Unknown undo record in undo log"); }

Target:
private void applyUndoRecordUnsafe(SMRRecord record) { log.trace("Undo[{}] of {}@{} ({})", this, record.getSMRMethod(), Address.isAddress(record.getGlobalAddress()) ? record.getGlobalAddress() : "OPT", record.getUndoRecord()); IUndoFunction<T> undoFunction = undoFunctionMap.get(record.getSMRMethod()); if (undoFunction != null) { undoFunction.doUndo(object, record.getUndoRecord(), record.getSMRArguments()); return; } else if (resetSet.contains(record.getSMRMethod())) { object = (T) record.getUndoRecord(); record.clearUndoRecord(); return; } throw new RuntimeException("Unknown undo record in undo log"); }
Source:
protected boolean doHandleRequest(final Request request) { FileItemWrap value = getRequestValue(request); FileItemWrap current = getValue(); boolean changed = value != null || current != null; if (changed) { resetValidationState(); boolean validFileType; if (isSetFileTypes()) { validFileType = FileValidationUtil.validateFileType(value, getFileTypes()); addFileTypeValidation(validFileType, InternalMessages.DEFAULT_VALIDATION_ERROR_FILE_WRONG_TYPE, getFileTypes().toArray(new Object[getFileTypes().size()])); } else { validFileType = true; } boolean validFileSize; if (isSetFileSize()) { validFileSize = FileValidationUtil.validateFileSize(value, getMaxFileSize()); addFileSizeValidation(validFileSize, InternalMessages.DEFAULT_VALIDATION_ERROR_FILE_WRONG_SIZE, Util.readableFileSize(value.getSize()), Util.readableFileSize(getMaxFileSize())); } else { validFileSize = true; } if (validFileSize && validFileType) { setData(value); } else { changed = false; } } return changed; }

Target:
protected boolean doHandleRequest(final Request request) { FileItemWrap value = getRequestValue(request); FileItemWrap current = getValue(); boolean changed = value != null || current != null; if (changed) { resetValidationState(); final FileWidgetModel sharedModel = getComponentModel(); if (hasFileTypes()) { boolean validFileType = FileUtil.validateFileType(value, getFileTypes()); if (sharedModel.validFileType != validFileType) { final FileWidgetModel userModel = getOrCreateComponentModel(); userModel.validFileType = validFileType; } } if (hasMaxFileSize()) { boolean validFileSize = FileUtil.validateFileSize(value, getMaxFileSize()); if (sharedModel.validFileSize != validFileSize) { final FileWidgetModel userModel = getOrCreateComponentModel(); userModel.validFileSize = validFileSize; } } if (isFileSizeValid() && isFileTypeValid()) { setData(value); } else if (current == null) { changed = false; } else { changed = true; setData(null); } } return changed; }
Source:
public DeviceResource<WatchDog> getDeviceSubResource(String id) { return inject(new BackendWatchdogResource(new Guid(), this, updateType, getUpdateParametersProvider(), getRequiredUpdateFields())); }

Target:
public DeviceResource<WatchDog> getDeviceSubResource(String id) { return inject(new BackendWatchdogResource(asGuidOr404(id), this, updateType, getUpdateParametersProvider(), getRequiredUpdateFields())); }