Skip to content

Commit

Permalink
Merge branch 'master' into dep-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
fluorumlabs authored Sep 3, 2021
2 parents e6b097b + f9f61e1 commit 1275b09
Show file tree
Hide file tree
Showing 38 changed files with 1,299 additions and 78 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ The `master` branch is the latest version (9.0) that targets the [Vaadin platfor
| 5.0 | 18.0.x | 5.x |
| 6.0 | 19.0.x | 6.x |
| 7.0 | 20.0.x (LATEST) | 7.x |
| 8.0 | 21.0.x (PRERELEASE until 01/09/2021) | 8.x |
| 8.0 | 21.0.x (PRERELEASE until 08/09/2021) | 8.x |
| master| 22.0.x (PRERELEASE) | 9.x |
4 changes: 2 additions & 2 deletions flow-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"sinon": "7.5.0",
"sinon-chai": "3.6.0",
"typescript": "4.0.3",
"webpack": "4.39.1",
"webpack-cli": "3.3.6",
"webpack": "4.46.0",
"webpack-cli": "3.3.12",
"workbox-core": "5.1.4",
"workbox-precaching": "5.1.4",
"xhr-mock": "2.5.0"
Expand Down
2 changes: 1 addition & 1 deletion flow-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<version>3.2.0</version>
<configuration>
<!-- Exclude all source files and classes so only the
compile result ends up in the JAR -->
Expand Down
6 changes: 3 additions & 3 deletions flow-plugins/flow-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<name>Flow Maven plugin</name>

<properties>
<maven.version>3.3.9</maven.version>
<maven.version>3.8.2</maven.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-plugin-core</artifactId>
<version>1.6</version>
<version>1.12.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -79,7 +79,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5.2</version>
<version>3.6.1</version>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion flow-push/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<version>3.0.0</version>
<executions>
<execution>
<id>compresspush</id>
Expand Down
20 changes: 1 addition & 19 deletions flow-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,7 @@
<dependency>
<groupId>com.helger</groupId>
<artifactId>ph-css</artifactId>
<version>6.1.1</version>
<exclusions>
<exclusion>
<groupId>com.helger</groupId>
<artifactId>ph-commons</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.helger</groupId>
<artifactId>ph-commons</artifactId>
<version>9.1.2</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
<version>6.3.4</version>
</dependency>

<!-- Byte code generation -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import com.vaadin.flow.function.DeploymentConfiguration;
import com.vaadin.flow.internal.ApplicationClassLoaderAccess;
import com.vaadin.flow.internal.CurrentInstance;
import com.vaadin.flow.internal.VaadinContextInitializer;
import com.vaadin.flow.internal.DevModeHandler;
import com.vaadin.flow.internal.DevModeHandlerManager;
import com.vaadin.flow.internal.VaadinContextInitializer;
import com.vaadin.flow.server.HandlerHelper.RequestType;
import com.vaadin.flow.server.startup.ApplicationConfiguration;
import com.vaadin.flow.shared.JsonConstants;
Expand Down Expand Up @@ -537,10 +537,10 @@ static URL getApplicationUrl(HttpServletRequest request)
@Override
public void destroy() {
super.destroy();
isServletInitialized = false;
if (getService() != null) {
getService().destroy();
}
isServletInitialized = false;
}

private VaadinServletContext initializeContext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ static Map<String, String> getDefaultDependencies() {

// Constructable style sheets is only implemented for chrome,
// polyfill needed for FireFox et.al. at the moment
defaults.put("construct-style-sheets-polyfill", "2.4.16");
defaults.put("construct-style-sheets-polyfill", "3.0.0");

return defaults;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
],
"repository": "vaadin/flow",
"name": "@vaadin/application-theme-plugin",
"version": "0.4.0",
"version": "0.4.1",
"main": "application-theme-plugin.js",
"author": "Vaadin Ltd",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/vaadin/flow/issues"
},
"dependencies": {
"mkdirp": "0.5.5",
"glob": "7.1.6"
},
"files": [
"application-theme-plugin.js",
"theme-generator.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ const injectGlobalCssMethod = `
export const injectGlobalCss = (css, target, first) => {
if(target === document) {
const hash = getHash(css);
if (window.Vaadin.Flow.injectedGlobalCss.indexOf(hash) !== -1) {
if (window.Vaadin.theme.injectedGlobalCss.indexOf(hash) !== -1) {
return;
}
window.Vaadin.Flow.injectedGlobalCss.push(hash);
window.Vaadin.theme.injectedGlobalCss.push(hash);
}
const sheet = new CSSStyleSheet();
sheet.replaceSync(createLinkReferences(css,target));
Expand Down Expand Up @@ -260,7 +260,8 @@ function generateThemeFile(themeFolder, themeName, themeProperties, productionMo
themeFile += imports.join('');
themeFile += `
window.Vaadin = window.Vaadin || {};
window.Vaadin.Flow.injectedGlobalCss = [];
window.Vaadin.theme = window.Vaadin.theme || {};
window.Vaadin.theme.injectedGlobalCss = [];
/**
* Calculate a 32 bit FNV-1a hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/vaadin/flow/issues"
},
"dependencies": {
"mkdirp": "0.5.5"
},
"files": [
"stats-plugin.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javax.servlet.http.HttpServletRequest;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;

import net.jcip.annotations.NotThreadSafe;
import org.junit.Assert;
Expand Down Expand Up @@ -323,6 +324,32 @@ public void createStaticFileHandler_delegateToStaticFileHandlerFactory() {
Assert.assertSame(handler, result);
}

@Test
public void destroy_servletConfigAvailableInServbiceDestroy()
throws ServletException {
VaadinServletService service = Mockito.mock(VaadinServletService.class);
VaadinServlet servlet = new VaadinServlet() {
@Override
public VaadinServletService getService() {
return service;
}
};

AtomicReference<ServletConfig> configDuringDestroy = new AtomicReference<>();
Mockito.doAnswer(invocation -> {
configDuringDestroy.set(servlet.getServletConfig());
return null;
}).when(service).destroy();

ServletConfig config = mockConfig();

servlet.init(config);

servlet.destroy();

Assert.assertSame(config, configDuringDestroy.get());
}

private ServletConfig mockConfig() {
ServletConfig config = Mockito.mock(ServletConfig.class);
ServletContext context = Mockito.mock(ServletContext.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,6 @@ public void multipleSameEmbedded_cssTargetingDocumentShouldOnlyAddElementsOneTim
Assert.assertEquals(
"Project contains 2 css injections to document and both should be hashed",
2l, getCommandExecutor().executeScript(
"return window.Vaadin.Flow.injectedGlobalCss.length"));
"return window.Vaadin.theme.injectedGlobalCss.length"));
}
}
10 changes: 8 additions & 2 deletions fusion-endpoint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<properties>
<spring.version>5.3.0</spring.version>
<spring.autoconfigure.version>2.2.0.RELEASE</spring.autoconfigure.version>
<javaparser.version>3.15.1</javaparser.version>
<javax.annotation.api.version>1.3.2</javax.annotation.api.version>
<javaparser.version>3.23.0</javaparser.version>
<swagger.codegen.version>3.0.2</swagger.codegen.version>
<swagger.codegen.generators.version>1.0.2</swagger.codegen.generators.version>
</properties>
Expand Down Expand Up @@ -83,6 +84,11 @@
<version>${spring.autoconfigure.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
Expand Down Expand Up @@ -166,7 +172,7 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>9.0.12</version>
<version>9.0.52</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import com.vaadin.flow.server.startup.ApplicationConfiguration;
import com.vaadin.fusion.EndpointRegistry.VaadinEndpointData;
import com.vaadin.fusion.auth.FusionAccessChecker;
import com.vaadin.fusion.endpointransfermapper.EndpointTransferMapper;
import com.vaadin.fusion.exception.EndpointException;
import com.vaadin.fusion.exception.EndpointValidationException;
import com.vaadin.fusion.exception.EndpointValidationException.ValidationErrorData;
Expand Down Expand Up @@ -112,6 +113,8 @@ public class FusionController {

EndpointRegistry endpointRegistry;

private static EndpointTransferMapper endpointTransferMapper = new EndpointTransferMapper();

/**
* A constructor used to initialize the controller.
*
Expand Down Expand Up @@ -322,6 +325,8 @@ private ResponseEntity<String> invokeVaadinEndpointMethod(
return handleMethodExecutionError(endpointName, methodName, e);
}

returnValue = endpointTransferMapper.toTransferType(returnValue);

String implicitNullError = this.explicitNullableTypeChecker
.checkValueForAnnotatedElement(returnValue, methodToInvoke);
if (implicitNullError != null) {
Expand Down Expand Up @@ -397,20 +402,28 @@ private Object[] getVaadinEndpointParameters(
Set<ConstraintViolation<Object>> constraintViolations = new LinkedHashSet<>();

for (int i = 0; i < javaParameters.length; i++) {
Type expectedType = javaParameters[i];
Type parameterType = javaParameters[i];
Type incomingType = parameterType;
try {
Class<?> mappedType = getTransferType(parameterType);
if (mappedType != null) {
incomingType = mappedType;
}
Object parameter = vaadinEndpointMapper
.readerFor(vaadinEndpointMapper.getTypeFactory()
.constructType(expectedType))
.constructType(incomingType))
.readValue(requestParameters.get(parameterNames[i]));

if (mappedType != null) {
parameter = endpointTransferMapper.toEndpointType(parameter,
(Class) parameterType);
}
endpointParameters[i] = parameter;

if (parameter != null) {
constraintViolations.addAll(validator.validate(parameter));
}
} catch (IOException e) {
String typeName = expectedType.getTypeName();
String typeName = parameterType.getTypeName();
getLogger().error(
"Unable to deserialize an endpoint '{}' method '{}' "
+ "parameter '{}' with type '{}'",
Expand All @@ -427,6 +440,14 @@ private Object[] getVaadinEndpointParameters(
errorParams, constraintViolations);
}

private Class<?> getTransferType(Type type) {
if (!(type instanceof Class)) {
return null;
}

return endpointTransferMapper.getTransferType((Class) type);
}

private EndpointValidationException getInvalidEndpointParametersException(
String methodName, String endpointName,
Map<String, String> deserializationErrors,
Expand Down
Loading

0 comments on commit 1275b09

Please sign in to comment.