Skip to content
Snippets Groups Projects
Commit ae3bde73 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

big refactoring: cleanup

parent 309e69c2
No related branches found
No related tags found
No related merge requests found
Pipeline #812 passed
Showing
with 19 additions and 32 deletions
......@@ -33,6 +33,7 @@ public class Main extends SpringBootServletInitializer implements ApplicationRun
prepare(new String[0]);
}
@SuppressWarnings("ConstantConditions")
private static Path prepare(String[] args)
{
Localization.setDelegate(new Localization.LocalizationDelegate()
......
......@@ -8,17 +8,10 @@ import org.springframework.security.config.annotation.method.configuration.Enabl
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.DefaultRedirectStrategy;
import org.springframework.security.web.RedirectStrategy;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Configuration
@EnableWebSecurity
......
......@@ -90,12 +90,7 @@ public class DatabaseService
Database database = new Database(categories, accounts, filteredTransactions);
LOGGER.debug("Created database JSON with " + database.getTransactions().size() + " transactions, " + database.getCategories().size() + " categories and " + database.getAccounts().size() + " accounts");
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().registerTypeAdapter(DateTime.class, new JsonSerializer<DateTime>(){
@Override
public JsonElement serialize(DateTime json, Type typeOfSrc, JsonSerializationContext context) {
return new JsonPrimitive(ISODateTimeFormat.date().print(json));
}
}).create();
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().registerTypeAdapter(DateTime.class, (JsonSerializer<DateTime>) (json, typeOfSrc, context) -> new JsonPrimitive(ISODateTimeFormat.date().print(json))).create();
return gson.toJson(database);
}
......
......@@ -2,7 +2,6 @@ package de.deadlocker8.budgetmaster.repeating.endoption;
import com.google.gson.annotations.Expose;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import javax.persistence.*;
import java.util.List;
......
......@@ -20,7 +20,7 @@ public enum ColumnType
private String name;
private float proportion;
private ColumnType(String name, float proportion)
ColumnType(String name, float proportion)
{
this.name = name;
this.proportion = proportion;
......
......@@ -45,6 +45,7 @@ public class ReportGeneratorService
return chapter;
}
@SuppressWarnings({"SameParameterValue", "ConstantConditions"})
private PdfPTable generateTable(ReportConfiguration reportConfiguration, int tableWidth, AmountType amountType)
{
List<ReportColumn> columns = reportConfiguration.getReportSettings().getColumnsSortedAndFiltered();
......@@ -278,6 +279,7 @@ public class ReportGeneratorService
}
}
@SuppressWarnings("SameParameterValue")
private BaseColor getBaseColor(Color color)
{
return new BaseColor((float) color.getRed(), (float) color.getGreen(), (float) color.getBlue());
......
......@@ -161,12 +161,7 @@ public class HelpersService
return years;
}
/**
* Replaces line breaks and tabs with spaces
*
* @param text
* @return String
*/
// Replaces line breaks and tabs with spaces
public String getFlatText(String text)
{
text = text.replace("\n", " ");
......
......@@ -60,7 +60,7 @@ public class ImportService
existingCategory = categoryRepository.findByNameAndColorAndType(category.getName(), category.getColor(), category.getType());
}
int newCategoryID = -1;
int newCategoryID;
if(existingCategory == null)
{
//category does not exist --> create it
......
......@@ -134,6 +134,7 @@ public class TransactionController extends BaseController
return "transactions/newTransaction";
}
@SuppressWarnings("ConstantConditions")
@RequestMapping(value = "/transactions/newTransaction", method = RequestMethod.POST)
public String post(Model model, @CookieValue("currentDate") String cookieDate,
@ModelAttribute("NewTransaction") Transaction transaction, BindingResult bindingResult,
......@@ -176,6 +177,7 @@ public class TransactionController extends BaseController
transaction.setTags(new ArrayList<>());
for(Tag currentTag : tags)
{
//noinspection ConstantConditions
transaction = addTagForTransaction(currentTag.getName(), transaction);
}
}
......
......@@ -11,9 +11,9 @@
<div class="col l4 offset-l4 m6 offset-m3 s10 offset-s1">
<div class="card background-color">
<div class="card-content">
<span class="card-title">
<div class="card-title">
<div id="logo-container" class="center-align"><@header.logo "logo" ""/></div>
</span>
</div>
<div class="row">
<div class="col s12 center-align">
<h1>🔒 403</h1>
......
......@@ -11,9 +11,9 @@
<div class="col l4 offset-l4 m6 offset-m3 s10 offset-s1">
<div class="card background-color">
<div class="card-content">
<span class="card-title">
<div class="card-title">
<div id="logo-container" class="center-align"><@header.logo "logo" ""/></div>
</span>
</div>
<div class="row">
<div class="col s12 center-align">
<h1>😔 404</h1>
......
......@@ -11,9 +11,9 @@
<div class="col l4 offset-l4 m6 offset-m3 s10 offset-s1">
<div class="card background-color">
<div class="card-content">
<span class="card-title">
<div class="card-title">
<div id="logo-container" class="center-align"><@header.logo "logo" ""/></div>
</span>
</div>
<div class="row">
<div class="col s12 center-align">
<img id="teapot" src="<@s.url '/images/teapot.png'/>">
......
......@@ -11,9 +11,9 @@
<div class="col l4 offset-l4 m6 offset-m3 s10 offset-s1">
<div class="card background-color">
<div class="card-content">
<span class="card-title">
<div class="card-title">
<div id="logo-container" class="center-align"><@header.logo "logo" ""/></div>
</span>
</div>
<div class="row">
<div class="col s12 center-align">
<h1>😔 500</h1>
......
......@@ -11,9 +11,9 @@
<div class="col l4 offset-l4 m6 offset-m3 s10 offset-s1">
<div class="card" id="card-login">
<div class="card-content">
<span class="card-title">
<div class="card-title">
<div id="logo-container" class="center-align"><@header.logo "logo" ""/></div>
</span>
</div>
<form action="<@s.url '/login'/>" method="post">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<input type="hidden" name="username" value="Default">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment