auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Observable<List<Server>> refreshServerCache() { return serverSource .compose(ChangeNotifications.<Server>buffers()) .compose(ChangeNotifications.<Server>snapshots()) .materialize() .concatMap(new Func1<Notification<LinkedHashSet<Server>>, Observable<? extends List<Server>>>() { @Override public Observable<? extends List<Server>> call(Notification<LinkedHashSet<Server>> rxNotification) { switch (rxNotification.getKind()) { case OnNext: LinkedHashSet<Server> servers = rxNotification.getValue(); if (servers.isEmpty()) { return Observable.never(); } else { logger.info("Populating the serverCache with servers", servers.size()); List<Server> newServerCache = new ArrayList<>(servers); Collections.sort(newServerCache); serverCacheRef.set(newServerCache); } break; case OnCompleted: break; case OnError: return Observable.error(rxNotification.getThrowable()); } return Observable.just(serverCacheRef.get()); } }) .timeout(warmUpTimeout, timeUnit) .onErrorResumeNext(new Func1<Throwable, Observable<? extends List<Server>>>() { @Override public Observable<? extends List<Server>> call(Throwable throwable) { if (!(throwable instanceof TimeoutException)) { logger.warn("Exception thrown when connecting the serverCache to the serverSource, using backup values", throwable); } return Observable.just(serverCacheRef.get()); } }) .take(1); }

Target:
private Observable<List<Server>> refreshServerCache() { return serverSource .compose(ChangeNotifications.<Server>buffers()) .compose(ChangeNotifications.<Server>snapshots()) .materialize() .concatMap(new Func1<Notification<LinkedHashSet<Server>>, Observable<? extends List<Server>>>() { @Override public Observable<? extends List<Server>> call(Notification<LinkedHashSet<Server>> rxNotification) { switch (rxNotification.getKind()) { case OnNext: LinkedHashSet<Server> servers = rxNotification.getValue(); if (servers.isEmpty()) { return Observable.never(); } else { logger.info("Populating the serverCache with servers", servers.size()); List<Server> newServerCache = new ArrayList<>(servers); Collections.sort(newServerCache); serverCacheRef.set(newServerCache); } break; case OnCompleted: break; case OnError: return Observable.error(rxNotification.getThrowable()); } return Observable.just(serverCacheRef.get()); } }) .timeout(cacheRefreshTimeout, timeUnit) .onErrorResumeNext(new Func1<Throwable, Observable<? extends List<Server>>>() { @Override public Observable<? extends List<Server>> call(Throwable throwable) { if (!(throwable instanceof TimeoutException)) { logger.warn("Exception thrown when connecting the serverCache to the serverSource, using backup values", throwable); } return Observable.just(serverCacheRef.get()); } }) .take(1); }
Source:
private static String getResponseBody(String path) throws IOException { return ByteSources .asByteSource(GlacierClientMockTest.class.getResourceAsStream(path)) .asCharSource(UTF_8) .read(); }

Target:
private static String getResponseBody(String path) throws IOException { return Resources.toString(Resources.getResource(GlacierClientMockTest.class, path), UTF_8); }
Source:
public void setValue(float val) { if(val < 0f) { value = 0; return; } else if (val > 1f) { value = 1.0f; return; } value = val; }

Target:
public void setValue(float val) { value = SolMath.clamp(val); }
Source:
public Message readFrom(final Class<Message> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { try { Method newBuilder = newBuilderMethodCache.get(type); if (newBuilder == null) { newBuilder = type.getMethod("newBuilder"); } final Message.Builder builder = (Message.Builder) newBuilder .invoke(type); return builder.mergeFrom(entityStream).build(); } catch (Exception e) { throw new WebApplicationException(e); } }

Target:
public Message readFrom(final Class<Message> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { try { Method newBuilder = newBuilderMethodCache.get(type); if (newBuilder == null) { newBuilder = type.getMethod("newBuilder"); newBuilderMethodCache.put(type, newBuilder); } final Message.Builder builder = (Message.Builder) newBuilder .invoke(type); return builder.mergeFrom(entityStream).build(); } catch (Exception e) { throw new WebApplicationException(e); } }
Source:
public static void initializeCarbonContext() { if (System.getProperty("carbon.home") == null) { File file = new File("src/test/resources"); if (file.exists()) { System.setProperty(CARBON_HOME, file.getAbsolutePath()); } } PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId( org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID); }

Target:
public static void initializeCarbonContext() { if (System.getProperty(CARBON_HOME) == null) { File file = new File("src/test/resources"); if (file.exists()) { System.setProperty(CARBON_HOME, file.getAbsolutePath()); } } PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId( org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID); }
Source:
private String getParameterValue(RestRequest restRequest, String name) { List<String> values = restRequest.parameters().get(name); if (values == null) return null; return values.iterator().next(); }

Target:
private String getParameterValue(RestRequest restRequest, String name) { List<String> values = restRequest.parameters().get(name); return values == null ? null : values.iterator().next(); }
Source:
public void missingGrandparentSuperclass() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "class Parent extends Missing {}", "", "class TestClass extends Parent {}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Override void runAssertions() { TypeElement testClassElement = processingEnv.getElementUtils().getTypeElement("test.TestClass"); assertThat(SuperficialValidation.validateElement(testClassElement)).isFalse(); } }) .failsToCompile(); }

Target:
public void missingGrandparentSuperclass() { JavaFileObject parentJavaFileObject = JavaFileObjects.forSourceLines( "test.Parent", "package test;", "", "class Parent extends Missing {}"); JavaFileObject testClassJavaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "class TestClass extends Parent {}"); assertAbout(javaSources()) .that(ImmutableList.of(parentJavaFileObject, testClassJavaFileObject)) .processedWith(new AssertingProcessor() { @Override void runAssertions() { TypeElement testClassElement = processingEnv.getElementUtils().getTypeElement("test.TestClass"); assertThat(SuperficialValidation.validateElement(testClassElement)).isFalse(); } }) .failsToCompile(); }
Source:
public void TestParserMoreFieldsOnlyPOJOPortConnected() { parser.parsedOutput.setSink(null); parser.beginWindow(0); parser.in.process( "1234,98233,adxyz,0.2,2015-03-08 03:37:12,11/12/2012,12,y,OPTIMIZATION,CAMP_AD,Y,yes,ExtraField".getBytes()); parser.endWindow(); Assert.assertEquals(0, objectPort.collectedTuples.size()); Assert.assertEquals(0, pojoPort.collectedTuples.size()); Assert.assertEquals(1, error.collectedTuples.size()); }

Target:
public void TestParserMoreFieldsOnlyPOJOPortConnected() { String input = "1234,98233,adxyz,0.2,2015-03-08 03:37:12,11/12/2012,12,y,OPTIMIZATION,CAMP_AD,Y,yes,ExtraField"; parser.parsedOutput.setSink(null); parser.beginWindow(0); parser.in.process(input.getBytes()); parser.endWindow(); Assert.assertEquals(0, objectPort.collectedTuples.size()); Assert.assertEquals(0, pojoPort.collectedTuples.size()); Assert.assertEquals(1, error.collectedTuples.size()); KeyValPair<String, String> errorTuple = (KeyValPair<String, String>)error.collectedTuples.get(0); Assert.assertEquals(input, errorTuple.getKey()); }
Source:
void deleteServiceIntegrationSecrets( final String serviceKey, final String siteId, final User user) throws DotSecurityException, DotDataException { final Optional<ServiceDescriptor> serviceDescriptorOptional = serviceIntegrationAPI .getServiceDescriptor(serviceKey, user); if (!serviceDescriptorOptional.isPresent()) { throw new DotDataException( String.format(" Couldn't find a descriptor under key `%s` for host `%s` ", serviceKey, siteId)); } final Host host = hostAPI.find(siteId, user, false); if (null == host) { throw new DotDataException( String.format(" Couldn't find any site with identifier `%s` ", siteId)); } serviceIntegrationAPI.deleteSecrets(serviceKey, host, user); }

Target:
void deleteServiceIntegrationSecrets( final String serviceKey, final String siteId, final User user) throws DotSecurityException, DotDataException { final Optional<ServiceDescriptor> serviceDescriptorOptional = serviceIntegrationAPI .getServiceDescriptor(serviceKey, user); if (!serviceDescriptorOptional.isPresent()) { throw new DoesNotExistException( String.format(" Couldn't find a descriptor under key `%s` for host `%s` ", serviceKey, siteId)); } final Host host = hostAPI.find(siteId, user, false); if (null == host) { throw new DotDataException( String.format(" Couldn't find any site with identifier `%s` ", siteId)); } serviceIntegrationAPI.deleteSecrets(serviceKey, host, user); }
Source:
private void printer() { long threadId = Thread.currentThread().getId(); long time = System.currentTimeMillis(); int hashCode = hashCode(); InvocationTracker tracker = new InvocationTracker(time, threadId, hashCode); MyFactory.tracker.add(tracker); }

Target:
private void printer() { long threadId = Thread.currentThread().getId(); long time = System.currentTimeMillis(); int hashCode = hashCode(); InvocationTracker tracker = new InvocationTracker(time, threadId, hashCode); MyFactory.TRACKER.add(tracker); }
Source:
public void testThrowingRuntimeExceptionPercolatesOriginal() throws Exception { Handle h = db.openHandle(); try { h.inTransaction((handle, status) -> { throw new IllegalArgumentException(); }); } catch (JdbiException e) { fail("Should have thrown a straight RuntimeException"); } catch (IllegalArgumentException e) { assertThat(e).isNotNull(); } catch (Exception e) { fail("Should have been caught at IllegalArgumentException"); } }

Target:
public void testThrowingRuntimeExceptionPercolatesOriginal() throws Exception { db.openHandle().inTransaction((handle, status) -> { throw new IllegalArgumentException(); }); }
Source:
public Contentlet fire(final String wfActionId, final Map<String, Object> properties, final User user) throws DotSecurityException, DotDataException { final MapToContentletPopulator mapToContentletPopulator = MapToContentletPopulator.INSTANCE; Contentlet contentlet = new Contentlet(); contentlet = mapToContentletPopulator.populate(contentlet, properties); final boolean ALLOW_FRONT_END_SAVING = Config .getBooleanProperty("WORKFLOW_TOOL_ALLOW_FRONT_END_SAVING", false); List<Category> cats = categoryAPI.getCategoriesFromContent(contentlet, user, ALLOW_FRONT_END_SAVING); Map<Relationship, List<Contentlet>> relationships = (Map<Relationship, List<Contentlet>>) contentlet.get(RELATIONSHIP_KEY); final ContentletDependencies contentletDependencies = new ContentletDependencies.Builder() .workflowActionId(wfActionId) .respectAnonymousPermissions(ALLOW_FRONT_END_SAVING) .modUser(user).categories(cats) .relationships(relationshipAPI.getContentletRelationshipsFromMap(contentlet, relationships)) .indexPolicy(IndexPolicyProvider.getInstance().forSingleContent()) .build(); return wapi.fireContentWorkflow(contentlet, contentletDependencies); }

Target:
public Contentlet fire(final String wfActionId, final Map<String, Object> properties, final User user) throws DotSecurityException, DotDataException { final MapToContentletPopulator mapToContentletPopulator = MapToContentletPopulator.INSTANCE; Contentlet contentlet = new Contentlet(); contentlet = mapToContentletPopulator.populate(contentlet, properties); final boolean ALLOW_FRONT_END_SAVING = Config .getBooleanProperty("WORKFLOW_TOOL_ALLOW_FRONT_END_SAVING", false); final List<Category> cats = categoryAPI.getCategoriesFromContent(contentlet, user, ALLOW_FRONT_END_SAVING); final Map<Relationship, List<Contentlet>> relationships = (Map<Relationship, List<Contentlet>>) contentlet.get(RELATIONSHIP_KEY); final ContentletDependencies contentletDependencies = new ContentletDependencies.Builder() .workflowActionId(wfActionId) .respectAnonymousPermissions(ALLOW_FRONT_END_SAVING) .modUser(user).categories(cats) .relationships(relationshipAPI.getContentletRelationshipsFromMap(contentlet, relationships)) .indexPolicy(IndexPolicyProvider.getInstance().forSingleContent()) .build(); return workflowAPI.fireContentWorkflow(contentlet, contentletDependencies); }
Source:
public BaseArrayProvider( DimensionSelector dimSelector, TopNQuery query, Capabilities capabilities ) { this.dimSelector = dimSelector; this.query = query; this.capabilities = capabilities; previousStop = null; ignoreAfterThreshold = false; ignoreFirstN = 0; keepOnlyN = dimSelector.getValueCardinality(); }

Target:
public BaseArrayProvider( DimensionSelector dimSelector, TopNQuery query, Capabilities capabilities ) { this.dimSelector = dimSelector; this.idLookup = dimSelector.idLookup(); this.query = query; this.capabilities = capabilities; previousStop = null; ignoreAfterThreshold = false; ignoreFirstN = 0; keepOnlyN = dimSelector.getValueCardinality(); if (keepOnlyN < 0) { throw new IAE("Cannot operate on a dimension with no dictionary"); } }
Source:
public int hashCode() { return className.hashCode(); }

Target:
@Override public int hashCode() { int result = className.hashCode(); result = 31 * result + methodName.hashCode(); return result; }
Source:
public Map<String, String> getFields() { Map<String, String> map = fFields; if (map == null) { Builder<@NonNull String, @NonNull String> builder = ImmutableMap.<@NonNull String, @NonNull String> builder() .put("Version", String.valueOf(fVersion)) .put("Header Length", String.valueOf(getHeaderLength()) + " bytes") .put("Differentiated Services Field", String.format("%s%02x", "0x", fDSCP)) .put("Explicit Congestion Notification", String.format("%s%02x", "0x", fExplicitCongestionNotification)) .put("Total Length", String.valueOf(fTotalLength) + " bytes") .put("Identification", String.format("%s%04x", "0x", fIdentification)) .put("Don't Fragment Flag", String.valueOf(fDontFragmentFlag)) .put("More Fragment Flag", String.valueOf(fMoreFragmentFlag)) .put("Fragment Offset", String.valueOf(fFragmentOffset)) .put("Time to live", String.valueOf(fTimeToLive)) .put("Protocol", IPProtocolNumberHelper.toString(fIpDatagramProtocol) + " (" + String.valueOf(fIpDatagramProtocol) + ")") .put("Checksum", String.format("%s%04x", "0x", fHeaderChecksum)) .put("Source IP Address", fSourceIpAddress.getHostAddress()) .put("Destination IP Address", fDestinationIpAddress.getHostAddress()); byte[] options = fOptions; if (options == null) { builder.put("Options", EMPTY_STRING); } else { builder.put("Options", ConversionHelper.bytesToHex(options, true)); } fFields = checkNotNull(builder.build()); return fFields; } return map; }

Target:
public Map<String, String> getFields() { Map<String, String> map = fFields; if (map == null) { Builder<@NonNull String, @NonNull String> builder = ImmutableMap.<@NonNull String, @NonNull String> builder() .put("Version", String.valueOf(fVersion)) .put("Header Length", String.valueOf(getHeaderLength()) + " bytes") .put("Differentiated Services Field", String.format("%s%02x", "0x", fDSCP)) .put("Explicit Congestion Notification", String.format("%s%02x", "0x", fExplicitCongestionNotification)) .put("Total Length", String.valueOf(fTotalLength) + " bytes") .put("Identification", String.format("%s%04x", "0x", fIdentification)) .put("Don't Fragment Flag", String.valueOf(fDontFragmentFlag)) .put("More Fragment Flag", String.valueOf(fMoreFragmentFlag)) .put("Fragment Offset", String.valueOf(fFragmentOffset)) .put("Time to live", String.valueOf(fTimeToLive)) .put("Protocol", IPProtocolNumberHelper.toString(fIpDatagramProtocol) + " (" + String.valueOf(fIpDatagramProtocol) + ")") .put("Checksum", String.format("%s%04x", "0x", fHeaderChecksum)) .put("Source IP Address", nullToEmptyString(fSourceIpAddress.getHostAddress())) .put("Destination IP Address", nullToEmptyString(fDestinationIpAddress.getHostAddress())); byte[] options = fOptions; if (options == null) { builder.put("Options", EMPTY_STRING); } else { builder.put("Options", ConversionHelper.bytesToHex(options, true)); } fFields = checkNotNull(builder.build()); return fFields; } return map; }
Source:
public QualifiedName getQualifiedName() { if (qualifiedName != null) { return qualifiedName; } ASTClassOrInterfaceDeclaration parent = this.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class); ASTFormalParameters params = this.getFirstDescendantOfType(ASTFormalParameters.class); int numParams = params.jjtGetNumChildren(); String[] types = new String[numParams]; for (int i = 0; i < numParams; i++) { types[i] = params.jjtGetChild(i).getFirstDescendantOfType(ASTType.class).getTypeImage(); } qualifiedName = QualifiedName.makeOperationOf(parent.getQualifiedName(), parent.getImage(), types); return qualifiedName; }

Target:
public QualifiedName getQualifiedName() { if (qualifiedName == null) { qualifiedName = QualifiedName.makeOperationOf(this); } return qualifiedName; }
Source:
public void launchCommentCodeFeature() { Actions action = actionsFactory.createAction(seleniumWebDriver); action.keyDown(CONTROL).sendKeys("/").keyUp(CONTROL).perform(); }

Target:
public void launchCommentCodeFeature() { actionsFactory .createAction(seleniumWebDriver) .keyDown(CONTROL) .sendKeys("/") .keyUp(CONTROL) .perform(); }
Source:
public DMNElement getParentDRDElement() { if( this instanceof DRGElement || (this instanceof Artifact) || (this instanceof ItemDefinition && parent != null && parent instanceof Definitions)) { return (DMNElement) this; } else if( parent != null ) { return parent.getParentDRDElement(); } else { return null; } }

Target:
public DMNModelInstrumentedBase getParentDRDElement() { if( this instanceof DRGElement || (this instanceof Artifact) || (this instanceof ItemDefinition && parent != null && parent instanceof Definitions)) { return this; } else if( parent != null ) { return parent.getParentDRDElement(); } else { return null; } }
Source:
private void growup() { if (values.length == rows * columns) { throw new IllegalStateException("This matrix can't grow up."); } int min = rows * columns; min = min < 0 ? Integer.MAX_VALUE : min; int capacity = Math.min(min, (cardinality * 3) / 2 + 1); double $values[] = new double[capacity]; int $rowIndices[] = new int[capacity]; System.arraycopy(values, 0, $values, 0, cardinality); System.arraycopy(rowIndices, 0, $rowIndices, 0, cardinality); values = $values; rowIndices = $rowIndices; }

Target:
private void growup() { if (values.length == capacity()) { throw new IllegalStateException("This matrix can't grow up."); } int min = rows * columns; min = min < 0 ? Integer.MAX_VALUE : min; int capacity = Math.min(min, (cardinality * 3) / 2 + 1); double $values[] = new double[capacity]; int $rowIndices[] = new int[capacity]; System.arraycopy(values, 0, $values, 0, cardinality); System.arraycopy(rowIndices, 0, $rowIndices, 0, cardinality); values = $values; rowIndices = $rowIndices; }
Source:
public void prepareRun(BatchSourceContext context) throws Exception { Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); ConfigHelper.setInputColumnFamily(conf, config.keyspace, config.columnFamily); ConfigHelper.setInputInitialAddress(conf, config.initialAddress); ConfigHelper.setInputPartitioner(conf, config.partitioner); ConfigHelper.setInputRpcPort(conf, (config.port == null) ? "9160" : Integer.toString(config.port)); Preconditions.checkArgument(!(Strings.isNullOrEmpty(config.username) ^ Strings.isNullOrEmpty(config.password)), "You must either set both username and password or neither username nor password. " + "Currently, they are username: " + config.username + " and password: " + config.password); if (!Strings.isNullOrEmpty(config.username)) { ConfigHelper.setInputKeyspaceUserNameAndPassword(conf, config.username, config.password); } if (!Strings.isNullOrEmpty(config.properties)) { for (String pair : config.properties.split(",")) { conf.set(CharMatcher.WHITESPACE.trimFrom(pair.split(":")[0]), CharMatcher.WHITESPACE.trimFrom(pair.split(":")[1])); } } CqlConfigHelper.setInputCql(conf, config.query); context.setInput(Input.of("Cassandra", new SourceInputFormatProvider(CqlInputFormat.class, conf))); }

Target:
public void prepareRun(BatchSourceContext context) throws Exception { Configuration conf = new Configuration(); conf.clear(); ConfigHelper.setInputColumnFamily(conf, config.keyspace, config.columnFamily); ConfigHelper.setInputInitialAddress(conf, config.initialAddress); ConfigHelper.setInputPartitioner(conf, config.partitioner); ConfigHelper.setInputRpcPort(conf, (config.port == null) ? "9160" : Integer.toString(config.port)); Preconditions.checkArgument(!(Strings.isNullOrEmpty(config.username) ^ Strings.isNullOrEmpty(config.password)), "You must either set both username and password or neither username nor password. " + "Currently, they are username: " + config.username + " and password: " + config.password); if (!Strings.isNullOrEmpty(config.username)) { ConfigHelper.setInputKeyspaceUserNameAndPassword(conf, config.username, config.password); } if (!Strings.isNullOrEmpty(config.properties)) { for (String pair : config.properties.split(",")) { conf.set(CharMatcher.WHITESPACE.trimFrom(pair.split(":")[0]), CharMatcher.WHITESPACE.trimFrom(pair.split(":")[1])); } } CqlConfigHelper.setInputCql(conf, config.query); context.setInput(Input.of(config.referenceName, new SourceInputFormatProvider(CqlInputFormat.class, conf))); }
Source:
public Stream<BuiltInProcedures.SchemaIndexInfo> createIndex( String indexSpecification, String providerName ) throws ProcedureException { String statusMessage = "index created"; return createIndex( indexSpecification, providerName, statusMessage, ( schemaWrite, descriptor, provider ) -> schemaWrite.indexCreate( descriptor, Optional.of( provider ), Optional.empty() ) ); }

Target:
public Stream<BuiltInProcedures.SchemaIndexInfo> createIndex( String indexSpecification, String providerName ) throws ProcedureException { return createIndex( indexSpecification, providerName, "index created", ( schemaWrite, descriptor, provider ) -> schemaWrite.indexCreate( descriptor, Optional.of( provider ), Optional.empty() ) ); }
Source:
public void verifyAddedDiffs(ArrayList<String> targets) { waitForElementVisibleByElement(reviewDialogIFrame); driver.switchTo().frame(reviewDialogIFrame); boolean isNewArticle = driver.findElements(By.cssSelector(".ve-ui-mwSaveDialog-viewer.WikiaArticle pre")).size() > 0; if (isNewArticle) { verifyNewArticleDiffs(targets); } else { verifyArticleDiffs(targets, INSERT); } waitForElementNotVisibleByElement(reviewDialogIFrame); driver.switchTo().defaultContent(); }

Target:
public void verifyAddedDiffs(ArrayList<String> targets) { waitForElementVisibleByElement(reviewDialogIFrame); driver.switchTo().frame(reviewDialogIFrame); if (checkIfElementOnPage(wikiaAritlceFirstPreview)) { verifyNewArticleDiffs(targets); } else { verifyArticleDiffs(targets, INSERT); } waitForElementNotVisibleByElement(reviewDialogIFrame); driver.switchTo().defaultContent(); }
Source:
public void testInvokePOSTResourceBeforeAddingPOSTResource() throws Exception { String exceptionMessage = ""; try { HttpRequestUtil.doPost(new URL(API_BASE_URL + API_CONTEXT + "/" + API_VERSION_1_0_0 + API_POST_ENDPOINT_METHOD), "id=25", requestHeadersPost); } catch (Exception e) { exceptionMessage = e.getMessage(); } finally { assertTrue(exceptionMessage.contains("java.io.IOException: Server returned HTTP response code:" + " 403 for URL: http://localhost:8280/testAPI1/1.0.0/customers/name/"), "Not Return IOException " + "with 403 when accessing a POST resource which is not define yet"); } }

Target:
public void testInvokePOSTResourceBeforeAddingPOSTResource() throws APIManagerIntegrationTestException { String exceptionMessage = ""; try { HttpRequestUtil.doPost(new URL(postEndPointURL), "id=25", requestHeadersPost); } catch (Exception e) { exceptionMessage = e.getMessage(); } finally { assertTrue(exceptionMessage.contains("java.io.IOException: Server returned HTTP response code:" + " 403 for URL: " + postEndPointURL), "Not Return IOException " + "with 403 when accessing a POST resource which is not define yet"); } }
Source:
public static TimeDatum createTime(Datum datum, @Nullable TimeZone tz) { switch (datum.type()) { case INT8: return new TimeDatum(datum.asInt8()); case CHAR: case VARCHAR: case TEXT: TimeMeta tm = DateTimeFormat.parseDateTime(datum.asChars(), "HH24:MI:SS.MS"); if (tz != null) { DateTimeUtil.toUTCTimezone(tm, tz); } return new TimeDatum(DateTimeUtil.toTime(tm)); case TIME: return (TimeDatum) datum; default: throw new TajoRuntimeException(Errors.ResultCode.INVALID_CAST, datum.type().name(), Type.TIME.name()); } }

Target:
public static TimeDatum createTime(Datum datum, @Nullable TimeZone tz) { switch (datum.type()) { case INT8: return new TimeDatum(datum.asInt8()); case CHAR: case VARCHAR: case TEXT: TimeMeta tm = DateTimeFormat.parseDateTime(datum.asChars(), "HH24:MI:SS.MS"); if (tz != null) { DateTimeUtil.toUTCTimezone(tm, tz); } return new TimeDatum(DateTimeUtil.toTime(tm)); case TIME: return (TimeDatum) datum; default: throw new TajoRuntimeException(new InvalidCastException(datum.type(), Type.TIME)); } }
Source:
public String renderAttributeAsString(IAttributeType attributeType, Artifact artifact, PresentationType presentationType, final String defaultValue) throws OseeCoreException { String returnValue = defaultValue; if (presentationType.matches(RENDER_AS_HUMAN_READABLE_TEXT)) { if (artifact == null) { returnValue = "Artifact not found, possibly deleted"; } else { Attribute<Object> soleAttribute = artifact.getSoleAttribute(attributeType); if (soleAttribute == null) { returnValue = "Attribute not found, possibly deleted"; } else { returnValue = soleAttribute.getDisplayableString(); } } } return returnValue; }

Target:
public String renderAttributeAsString(IAttributeType attributeType, Artifact artifact, PresentationType presentationType, final String defaultValue) throws OseeCoreException { String returnValue = defaultValue; if (presentationType.matches(RENDER_AS_HUMAN_READABLE_TEXT)) { if (artifact == null) { returnValue = "DELETED"; } else { Attribute<Object> soleAttribute = artifact.getSoleAttribute(attributeType); if (soleAttribute == null) { returnValue = "DELETED"; } else { returnValue = soleAttribute.getDisplayableString(); } } } return returnValue; }
Source:
public Properties trackProfilePhotoSet(boolean fromCamera) { final SegmentAnalyticsEvent aEvent = new SegmentAnalyticsEvent(); aEvent.properties.putValue(Keys.NAME, Values.PROFILE_PHOTO_SET); aEvent.setAppNameContext(); aEvent.properties = addCategoryToBiEvents(aEvent.properties, Values.PROFILE, fromCamera ? "camera" : "library"); tracker.track(Events.PROFILE_PHOTO_SET, aEvent.properties); return aEvent.properties; }

Target:
public Properties trackProfilePhotoSet(boolean fromCamera) { final SegmentAnalyticsEvent aEvent = new SegmentAnalyticsEvent(); aEvent.properties.putValue(Keys.NAME, Values.PROFILE_PHOTO_SET); aEvent.setAppNameContext(); aEvent.properties = addCategoryToBiEvents(aEvent.properties, Values.PROFILE, fromCamera ? Values.CAMERA : Values.LIBRARY); tracker.track(Events.PROFILE_PHOTO_SET, aEvent.properties); return aEvent.properties; }
Source:
private boolean fileOnlyContainsOurEmployeeCustomerIndicator(ConcurRequestExtractFile requestExtractFile) { if ( (requestExtractFile.getRequestDetails() == null) || (requestExtractFile.getRequestDetails().isEmpty()) ) { LOG.error("There are no Request Detail lines in the file."); return false; } else { String ourCustomerProfile = getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_CUSTOMER_PROFILE_GROUP_ID); if (StringUtils.isNotEmpty(ourCustomerProfile) && ourCustomerProfileIsOnAllRequestDetailLines(requestExtractFile, ourCustomerProfile)) { return true; } else { LOG.error("File contains Request Detail lines that do not match the employee customer profile group of: " + getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_CUSTOMER_PROFILE_GROUP_ID)); return false; } } }

Target:
private boolean fileOnlyContainsOurEmployeeCustomerIndicator(ConcurRequestExtractFile requestExtractFile) { if ( (requestExtractFile.getRequestDetails() == null) || (requestExtractFile.getRequestDetails().isEmpty()) ) { LOG.error("fileOnlyContainsOurEmployeeCustomerIndicator: There are no Request Detail lines in the file."); return false; } else { String ourCustomerProfile = getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_CUSTOMER_PROFILE_GROUP_ID); if (StringUtils.isNotEmpty(ourCustomerProfile) && ourCustomerProfileIsOnAllRequestDetailLines(requestExtractFile, ourCustomerProfile)) { return true; } else { LOG.error("fileOnlyContainsOurEmployeeCustomerIndicator: File contains Request Detail lines that do not match the employee customer profile group of: " + getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_CUSTOMER_PROFILE_GROUP_ID)); return false; } } }
Source:
public void testSetManagedMemoryWeight() { final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); final DataStream<Integer> source = env.fromElements(1, 2, 3).name("source"); source.getTransformation().declareManagedMemoryUseCase(ManagedMemoryUseCase.BATCH_OP, 123); source.print().name("sink"); final StreamGraph streamGraph = env.getStreamGraph(); for (StreamNode streamNode : streamGraph.getStreamNodes()) { if (streamNode.getOperatorName().contains("source")) { assertThat(streamNode.getManagedMemoryUseCaseWeights().get(ManagedMemoryUseCase.BATCH_OP), is(123)); } else { assertThat(streamNode.getManagedMemoryUseCaseWeights().size(), is(0)); } } }

Target:
public void testSetManagedMemoryWeight() { final int weight = 123; final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); final DataStream<Integer> source = env.fromElements(1, 2, 3).name("source"); source.getTransformation().declareManagedMemoryUseCase(ManagedMemoryUseCase.BATCH_OP, weight); source.print().name("sink"); final StreamGraph streamGraph = env.getStreamGraph(); for (StreamNode streamNode : streamGraph.getStreamNodes()) { if (streamNode.getOperatorName().contains("source")) { assertThat(streamNode.getManagedMemoryUseCaseWeights().get(ManagedMemoryUseCase.BATCH_OP), is(weight)); } else { assertThat(streamNode.getManagedMemoryUseCaseWeights().size(), is(0)); } } }
Source:
public <T> T create(final Class<T> service) { Utils.validateServiceInterface(service); if (validateEagerly) { eagerlyValidateMethods(service); } return (T) Proxy.newProxyInstance(service.getClassLoader(), new Class<?>[] { service }, new InvocationHandler() { private final Platform platform = Platform.get(); private final Object[] emptyArgs = new Object[0]; @Override public Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable { if (method.getDeclaringClass() == Object.class) { return method.invoke(this, args); } if (platform.isDefaultMethod(method)) { return platform.invokeDefaultMethod(method, service, proxy, args); } else if (Modifier.isStatic(method.getModifiers())) { return method.invoke(null, args); } return loadServiceMethod(method).invoke(args != null ? args : emptyArgs); } }); }

Target:
public <T> T create(final Class<T> service) { Utils.validateServiceInterface(service); if (validateEagerly) { eagerlyValidateMethods(service); } return (T) Proxy.newProxyInstance(service.getClassLoader(), new Class<?>[] { service }, new InvocationHandler() { private final Platform platform = Platform.get(); private final Object[] emptyArgs = new Object[0]; @Override public Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable { if (method.getDeclaringClass() == Object.class) { return method.invoke(this, args); } if (platform.isDefaultMethod(method)) { return platform.invokeDefaultMethod(method, service, proxy, args); } return loadServiceMethod(method).invoke(args != null ? args : emptyArgs); } }); }
Source:
private void updateAuditLog(AuditLogType auditLogType) { addCustomValue("DiskId", getImageId().toString()); addCustomValue("UserName", getUserName()); AuditLogDirector.log(this, auditLogType); }

Target:
private void updateAuditLog(AuditLogType auditLogType) { addCustomValue("DiskAlias", getImage().getDiskAlias()); AuditLogDirector.log(this, auditLogType); }
Source:
public final Map<String, Object> getGeocodedData(final String ip) { InetAddress ipAddress = null; Map<String, Object> geoData = getDefaultMap(); try { ipAddress = InetAddress.getByName(ip); } catch (UnknownHostException hEx) { return geoData; } CityResponse response = null; try { response = databaseReader.city(ipAddress); } catch (IOException iEx) { return geoData; } catch (GeoIp2Exception gEx) { return geoData; } if (response == null) return geoData; Continent continent = response.getContinent(); if (continent != null && continent.getName() != null) geoData.put(CONTINENT, continent.getName()); Country country = response.getCountry(); if (country != null && country.getIsoCode() != null) { geoData.put(COUNTRY_CODE, country.getIsoCode()); geoData.put(COUNTRY, country.getName()); } City city = response.getCity(); if (city != null && city.getName() != null) geoData.put(CITY, city.getName()); Postal postal = response.getPostal(); if (postal != null && postal.getCode() != null) geoData.put(POSTAL_CODE, postal.getCode()); Location location = response.getLocation(); if (location != null) { geoData.put(LATITUDE, location.getLatitude()); geoData.put(LONGITUDE, location.getLongitude()); if (location.getTimeZone() != null) geoData.put(TIME_ZONE, location.getTimeZone()); } return geoData; }

Target:
public final Map<String, Object> getGeocodedData(final String ip) { InetAddress ipAddress = null; Map<String, Object> geoData = getDefaultMap(); try { ipAddress = InetAddress.getByName(ip); } catch (UnknownHostException hEx) { Log.warn(hEx); return geoData; } CityResponse response = null; try { response = databaseReader.city(ipAddress); } catch (IOException iEx) { Log.warn(iEx); return geoData; } catch (GeoIp2Exception gEx) { Log.warn(gEx); return geoData; } if (response == null) return geoData; Continent continent = response.getContinent(); if (continent != null && continent.getName() != null) geoData.put(CONTINENT, continent.getName()); Country country = response.getCountry(); if (country != null && country.getIsoCode() != null) { geoData.put(COUNTRY_CODE, country.getIsoCode()); geoData.put(COUNTRY, country.getName()); } List<Subdivision> subdivisions = response.getSubdivisions(); if (subdivisions != null && subdivisions.size() > 0) { geoData.put(SUB_DIVISION, subdivisions.get(0).getName()); } City city = response.getCity(); if (city != null && city.getName() != null) geoData.put(CITY, city.getName()); Postal postal = response.getPostal(); if (postal != null && postal.getCode() != null) geoData.put(POSTAL_CODE, postal.getCode()); Location location = response.getLocation(); if (location != null) { geoData.put(LATITUDE, location.getLatitude()); geoData.put(LONGITUDE, location.getLongitude()); if (location.getTimeZone() != null) geoData.put(TIME_ZONE, location.getTimeZone()); } return geoData; }
Source:
public synchronized ArrayList getStorageDelay() { return storageDelay; }

Target:
public ArrayList getStorageDelay() { return storageDelay; }
Source:
protected boolean amendDiskRequested() { boolean isBaseSnapshotDisk = getNewDisk().isDiskSnapshot() && ((DiskImage) getNewDisk()).getImage().getVolumeFormat() == VolumeFormat.RAW; if (getNewDisk().getDiskStorageType() == DiskStorageType.IMAGE && !isBaseSnapshotDisk) { QcowCompat qcowCompat = ((DiskImage) getNewDisk()).getQcowCompat(); return getDiskImages(getOldDisk().getId()).stream().anyMatch(disk -> disk.isQcowFormat() && disk.getQcowCompat() != qcowCompat); } return false; }

Target:
protected boolean amendDiskRequested() { if (getNewDisk().getDiskStorageType() == DiskStorageType.IMAGE && !isBaseSnapshotDisk()) { QcowCompat qcowCompat = ((DiskImage) getNewDisk()).getQcowCompat(); return getDiskImages(getOldDisk().getId()).stream().anyMatch(disk -> disk.isQcowFormat() && disk.getQcowCompat() != qcowCompat); } return false; }
Source:
private void writeSome(AccumuloClient c, String table, long count) throws Exception { int iterations = 5; long[] attempts = new long[iterations]; for (int attempt = 0; attempt < iterations; attempt++) { long now = System.currentTimeMillis(); try (BatchWriter bw = c.createBatchWriter(table)) { for (int i = 1; i < count + 1; i++) { Mutation m = new Mutation("" + i); m.put("", "", ""); bw.addMutation(m); if (i % (Math.max(1, count / 100)) == 0) { bw.flush(); } } } attempts[attempt] = System.currentTimeMillis() - now; } Arrays.sort(attempts); log.info("Attempt durations: {}", Arrays.toString(attempts)); }

Target:
private void writeSome(AccumuloClient c, String table, long count) throws Exception { try (BatchWriter bw = c.createBatchWriter(table)) { for (int i = 1; i < count + 1; i++) { Mutation m = new Mutation("" + i); m.put("", "", ""); bw.addMutation(m); if (i % (Math.max(1, count / 100)) == 0) { bw.flush(); } } } }
Source:
private static List<PathElement> parsePath(String path) { SubfieldPathTokenizer tokenizer = new SubfieldPathTokenizer(path); List<PathElement> elements = new ArrayList<>(); while (tokenizer.hasNext()) { elements.add(tokenizer.next()); } return elements; }

Target:
private static List<PathElement> parsePath(String path) { SubfieldPathTokenizer tokenizer = new SubfieldPathTokenizer(path); List<PathElement> elements = new ArrayList<>(); tokenizer.forEachRemaining(elements::add); return elements; }
Source:
private void initialize() { viewModel = new ParseTexResultViewModel(texParserResult); referenceListView.itemsProperty().setValue(viewModel.getReferenceList()); EasyBind.subscribe(referenceListView.getSelectionModel().selectedItemProperty(), reference -> { if (reference != null) { viewModel.getCitationList().setAll(reference.getCitationList()); } }); referenceListView.getSelectionModel().selectFirst(); new ViewModelListCellFactory<ReferenceWrapper>() .withText(ReferenceWrapper::getDisplayText) .install(referenceListView); citationListView.setItems(viewModel.getCitationList()); new ViewModelListCellFactory<Citation>() .withGraphic(this::citationToGraphic) .install(citationListView); }

Target:
private void initialize() { viewModel = new ParseTexResultViewModel(texParserResult); referenceListView.setItems(viewModel.getReferenceList()); EasyBind.subscribe(referenceListView.getSelectionModel().selectedItemProperty(), viewModel::activeReferenceChanged); referenceListView.getSelectionModel().selectFirst(); new ViewModelListCellFactory<ReferenceViewModel>() .withText(ReferenceViewModel::getDisplayText) .install(referenceListView); citationListView.setItems(viewModel.getCitationListByReference()); new ViewModelListCellFactory<Citation>() .withGraphic(this::citationToGraphic) .install(citationListView); }
Source:
public RetrofitApiServiceImpl(File cacheFolder, Gson gson, PlatformIdentifier platformId, String baseUrl) { mGson = gson; mPlatformIdentifier = platformId; Retrofit restAdapter = new Retrofit.Builder() .baseUrl(baseUrl) .client(getOkHttpClient(cacheFolder)) .addConverterFactory(GsonConverterFactory.create(mGson)) .build(); this.version = RetrofitApiTransport.BACKEND_VERSION; if (version == 0) { mApiServiceV0 = restAdapter.create(RetrofitApiServiceV0.class); mApiServiceV1 = null; mApiServiceV2 = null; } else if (version == 1) { mApiServiceV0 = null; mApiServiceV1 = restAdapter.create(RetrofitApiServiceV1.class); ; mApiServiceV2 = null; } else if (version == 2) { mApiServiceV0 = null; mApiServiceV1 = null; mApiServiceV2 = restAdapter.create(RetrofitApiServiceV2.class); } else { mApiServiceV0 = null; mApiServiceV1 = null; mApiServiceV2 = null; throw new IllegalArgumentException("Sorry, only available beackend versions are 0, 1, 2"); } }

Target:
public RetrofitApiServiceImpl(File cacheFolder, Gson gson, PlatformIdentifier platformId, String baseUrl) { mGson = gson; mPlatformIdentifier = platformId; Retrofit restAdapter = new Retrofit.Builder() .baseUrl(baseUrl) .client(getOkHttpClient(cacheFolder)) .addConverterFactory(GsonConverterFactory.create(mGson)) .build(); this.version = RetrofitApiTransport.BACKEND_VERSION; if (version == 0) { mApiServiceV0 = restAdapter.create(RetrofitApiServiceV0.class); mApiServiceV1 = null; mApiServiceV2 = null; } else if (version == 1) { mApiServiceV0 = null; mApiServiceV1 = restAdapter.create(RetrofitApiServiceV1.class); mApiServiceV2 = null; } else if (version == 2) { mApiServiceV0 = null; mApiServiceV1 = null; mApiServiceV2 = restAdapter.create(RetrofitApiServiceV2.class); } else { mApiServiceV0 = null; mApiServiceV1 = null; mApiServiceV2 = null; throw new IllegalArgumentException("Sorry, only available beackend versions are 0, 1, 2"); } }
Source:
private static OptionalLong fromMetastoreDistinctValuesCount(OptionalLong distinctValuesCount, OptionalLong nullsCount) { if (distinctValuesCount.isPresent() && nullsCount.isPresent()) { if (distinctValuesCount.getAsLong() > 0 && nullsCount.getAsLong() > 0) { return OptionalLong.of(distinctValuesCount.getAsLong() - 1); } return distinctValuesCount; } return OptionalLong.empty(); }

Target:
private static OptionalLong fromMetastoreDistinctValuesCount(OptionalLong distinctValuesCount, OptionalLong nullsCount) { if (distinctValuesCount.isPresent() && nullsCount.isPresent() && distinctValuesCount.getAsLong() > 0 && nullsCount.getAsLong() > 0) { return OptionalLong.of(distinctValuesCount.getAsLong() - 1); } return distinctValuesCount; }
Source:
public static void main(String args[]) { if (args.length != 3) { System.out.println("Usage: LogChopper zxid_to_chop_to txn_log_to_chop chopped_filename"); System.out.println(" this program will read the txn_log_to_chop file and copy all the transactions"); System.out.println(" from it up to (and including) the given zxid into chopped_filename."); System.exit(1); } long zxid = Long.decode(args[0]); String txnLog = args[1]; String choppedLog = args[2]; int rc = 2; try ( InputStream is = new BufferedInputStream(new FileInputStream(txnLog)); OutputStream os = new BufferedOutputStream(new FileOutputStream(choppedLog)) ) { if (chop(is, os, zxid)) { rc = 0; } } catch (Exception e) { System.out.println("Got exception: " + e.getMessage()); } System.exit(rc); }

Target:
public static void main(String args[]) { ExitCode rc = ExitCode.INVALID_INVOCATION; if (args.length != 3) { System.out.println("Usage: LogChopper zxid_to_chop_to txn_log_to_chop chopped_filename"); System.out.println(" this program will read the txn_log_to_chop file and copy all the transactions"); System.out.println(" from it up to (and including) the given zxid into chopped_filename."); System.exit(rc.getValue()); } String txnLog = args[1]; String choppedLog = args[2]; try ( InputStream is = new BufferedInputStream(new FileInputStream(txnLog)); OutputStream os = new BufferedOutputStream(new FileOutputStream(choppedLog)) ) { long zxid = Long.decode(args[0]); if (chop(is, os, zxid)) { rc = ExitCode.EXECUTION_FINISHED; } } catch (Exception e) { System.out.println("Got exception: " + e.getMessage()); } System.exit(rc.getValue()); }
Source:
public String format(List<Ref> refsToMerge, Ref target) { StringBuilder sb = new StringBuilder(); sb.append("Merge "); List<String> branches = new ArrayList<String>(); List<String> remoteBranches = new ArrayList<String>(); List<String> tags = new ArrayList<String>(); List<String> commits = new ArrayList<String>(); for (Ref ref : refsToMerge) { if (ref.getName().startsWith(Constants.R_HEADS)) { branches.add("'" + getShortName(ref.getName()) + "'"); } else if (ref.getName().startsWith(Constants.R_REMOTES)) { remoteBranches.add("'" + getShortName(ref.getName()) + "'"); } else if (ref.getName().startsWith(Constants.R_TAGS)) { tags.add("'" + getShortName(ref.getName()) + "'"); } else { commits.add("'" + ref.getName() + "'"); } } List<String> listings = new ArrayList<String>(); if (!branches.isEmpty()) { listings.add(joinNames(branches, "branch", "branches")); } if (!remoteBranches.isEmpty()) { listings.add(joinNames(remoteBranches, "remote branch", "remote branches")); } if (!tags.isEmpty()) { listings.add(joinNames(tags, "tag", "tags")); } if (!commits.isEmpty()) { listings.add(joinNames(commits, "commit", "commits")); } sb.append(join(listings, ", ")); String targetShortName = getShortName(target.getName()); if (!targetShortName.equals("master")) { sb.append(" into " + targetShortName); } return sb.toString(); }

Target:
public String format(List<Ref> refsToMerge, Ref target) { StringBuilder sb = new StringBuilder(); sb.append("Merge "); List<String> branches = new ArrayList<String>(); List<String> remoteBranches = new ArrayList<String>(); List<String> tags = new ArrayList<String>(); List<String> commits = new ArrayList<String>(); List<String> others = new ArrayList<String>(); for (Ref ref : refsToMerge) { if (ref.getName().startsWith(Constants.R_HEADS)) branches.add("'" + getShortName(ref.getName()) + "'"); else if (ref.getName().startsWith(Constants.R_REMOTES)) remoteBranches.add("'" + getShortName(ref.getName()) + "'"); else if (ref.getName().startsWith(Constants.R_TAGS)) tags.add("'" + getShortName(ref.getName()) + "'"); else if (ref.getName().equals(ref.getObjectId().getName())) commits.add("'" + ref.getName() + "'"); else others.add(ref.getName()); } List<String> listings = new ArrayList<String>(); if (!branches.isEmpty()) listings.add(joinNames(branches, "branch", "branches")); if (!remoteBranches.isEmpty()) listings.add(joinNames(remoteBranches, "remote branch", "remote branches")); if (!tags.isEmpty()) listings.add(joinNames(tags, "tag", "tags")); if (!commits.isEmpty()) listings.add(joinNames(commits, "commit", "commits")); if (!others.isEmpty()) listings.add(StringUtils.join(others, ", ", " and ")); sb.append(StringUtils.join(listings, ", ")); if (!target.getName().equals(Constants.R_HEADS + Constants.MASTER)) { String targetShortName = getShortName(target.getName()); sb.append(" into " + targetShortName); } return sb.toString(); }
Source:
protected boolean isStereotypedElement(final View view) { boolean result = false; if (view.getElement() instanceof Element && !((Element) view.getElement()).getAppliedStereotypes().isEmpty()) { result = true; } return result; }

Target:
protected boolean isStereotypedElement(final View view) { return (view.getElement() instanceof Element && !((Element) view.getElement()).getAppliedStereotypes().isEmpty()); }