Skip to content
Snippets Groups Projects
Commit dc9787ae authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

use sonar maven plugin at dockerhost:9000 + many fixes according to sonar report

parent 5b264a65
No related branches found
No related tags found
No related merge requests found
......@@ -180,6 +180,9 @@
<asciidoctor.maven.plugin.version>1.5.3</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>1.5.0-alpha.11</asciidoctorj.pdf.version>
<asciidoctorj.version>1.5.4</asciidoctorj.version>
<sonar.host.url>http://dockerhost:9000</sonar.host.url>
<sonar.projectName>MIP Backend</sonar.projectName>
<sonar.sources>src/main/java/</sonar.sources>
</properties>
<build>
......@@ -264,6 +267,11 @@
</attributes>
</configuration>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.0.1</version>
</plugin>
</plugins>
</build>
......
sonar.projectName=MIP Backend - stable
sonar.projectVersion=1.0
sonar.projectKey=mip:backend:stable
sonar.sources=./src/main/java/
\ No newline at end of file
......@@ -166,11 +166,10 @@ public class MIPApplication extends WebSecurityConfigurerAdapter {
try {
String userJSON = mapper.writeValueAsString(getUser());
Cookie cookie = new Cookie("user", URLEncoder.encode(userJSON, "UTF-8"));
cookie.setSecure(true);
cookie.setPath("/");
response.addCookie(cookie);
} catch (JsonProcessingException e) {
LOGGER.trace(e);
} catch (UnsupportedEncodingException e) {
} catch (JsonProcessingException | UnsupportedEncodingException e) {
LOGGER.trace(e);
}
return principal;
......
......@@ -96,6 +96,7 @@ public class ExperimentApi {
transaction.commit();
session.close();
} catch (DataException e) {
LOGGER.trace(e);
throw e;
}
......@@ -263,6 +264,7 @@ public class ExperimentApi {
transaction.commit();
session.close();
} catch (DataException e) {
LOGGER.trace(e);
throw e;
}
......@@ -447,7 +449,8 @@ public class ExperimentApi {
if (modelSlug == null || "".equals(modelSlug)) {
hibernateQuery = session.createQuery(baseQuery);
} else {
hibernateQuery = session.createQuery(baseQuery + " AND e.model.slug = :slug");
baseQuery += " AND e.model.slug = :slug";
hibernateQuery = session.createQuery(baseQuery);
hibernateQuery.setParameter("slug", modelSlug);
}
hibernateQuery.setParameter("user", user);
......@@ -469,6 +472,7 @@ public class ExperimentApi {
}
} catch (Exception e) {
// 404 here probably
LOGGER.trace(e);
throw e;
} finally {
if(session.getTransaction() != null)
......
......@@ -26,12 +26,12 @@ public class Article {
@NotNull
@Size(min = 1, max = 255)
private String title = null;
private String title;
private String status = null;
@Column(columnDefinition = "text")
private String _abstract = null;
@Column(columnDefinition = "text", name = "abstract")
private String abstractText = null;
@Column(columnDefinition = "text")
private String content = null;
......@@ -58,6 +58,7 @@ public class Article {
/*
* Empty constructor is needed by Hibernate
*/
title = "";
}
......@@ -90,11 +91,11 @@ public class Article {
@JsonProperty("abstract")
public String getAbstract() {
return _abstract;
return abstractText;
}
public void setAbstract(String _abstract) {
this._abstract = _abstract;
public void setAbstract(String abstractText) {
this.abstractText = abstractText;
}
......
......@@ -9,6 +9,7 @@ import java.io.IOException;
*/
public class CORSFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", "*");
......@@ -18,10 +19,12 @@ public class CORSFilter implements Filter {
chain.doFilter(req, res);
}
@Override
public void init(FilterConfig filterConfig) {
/* Nothing to do */
}
@Override
public void destroy() {
/* Nothing to do */
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment