Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some build warnings essentially deprecated warnings #2857

Merged
merged 3 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ RUN --mount=type=cache,target=/home/gradle/.gradle \
COPY checkstyle_* ./
# '&& touch success || true' is a trick to be able to get out some artifacts
RUN --mount=type=cache,target=/home/gradle/.gradle \
(gradle :core:checkstyleMain :core:spotbugsMain :core:violations --stacktrace > /tmp/logs 2>&1) \
&& ( (gradle :core:build :core:explodedWar :core:libSourcesJar :core:libJavadocJar && touch success) || true)
(gradle :core:checkstyleMain :core:spotbugsMain :core:violations --stacktrace) \
&& ( (gradle :core:build :core:explodedWar :core:libSourcesJar :core:libJavadocJar > /tmp/logs 2>&1 && touch success) || true)

ARG GIT_HEAD
ENV GIT_HEAD=${GIT_HEAD}
Expand All @@ -39,6 +39,6 @@ RUN --mount=type=cache,target=/home/gradle/.gradle \

FROM builder AS test-builder

RUN cat /tmp/logs && [ -e success ] && [ -e success-publish ] && [ -e success-examples-docs ]
RUN cat /tmp/logs && ls success success-publish success-examples-docs

VOLUME [ "/src/core" ]
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.mapfish.print.wrapper.yaml.PYamlObject;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -331,8 +332,9 @@ private void encodeAttributeValue(
}
} else {
try {
value = typeOrComponentType.newInstance();
} catch (InstantiationException e) {
value = typeOrComponentType.getDeclaredConstructor().newInstance();
} catch (InvocationTargetException | NoSuchMethodException
| InstantiationException e) {
throw ExceptionUtils.getRuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,19 @@ public RequestDispatcher getNamedDispatcher(String name) {
}

@Override
@Deprecated
public Servlet getServlet(String name) {
return null;
}

@Override
@Deprecated
public Enumeration<Servlet> getServlets() {
return null;
}

@Override
@Deprecated
public Enumeration<String> getServletNames() {
return null;
}
Expand All @@ -104,6 +107,7 @@ public void log(String msg) {
}

@Override
@Deprecated
public void log(Exception exception, String msg) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.opengis.filter.expression.Function;
import org.opengis.filter.expression.Literal;

import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
Expand All @@ -30,10 +31,12 @@ public Function function(final String name, final List<Expression> args, final L
for (FunctionExpressionImpl template: FUNCTIONS) {
if (template.getName().equals(name)) {
try {
final FunctionExpressionImpl function = template.getClass().newInstance();
final FunctionExpressionImpl function = template.getClass().getDeclaredConstructor()
.newInstance();
function.setParameters(args);
return function;
} catch (InstantiationException | IllegalAccessException e) {
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException
| IllegalAccessException e) {
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ private static Object parseValue(
value = parseEnum(type, layer.getPath(fieldName), layer.getString(name));
} else {
try {
value = type.newInstance();
value = type.getDeclaredConstructor().newInstance();
PObject object = layer.getObject(name);
parse(errorOnExtraProperties, object, value, extraPropertyToIgnore);
} catch (InstantiationException e) {
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException e) {
throw new UnsupportedTypeException(type, e);
} catch (IllegalAccessException e) {
throw ExceptionUtils.getRuntimeException(e);
Expand Down Expand Up @@ -310,10 +310,10 @@ private static Object parseArrayValue(
value = parseEnum(type, array.getPath("" + i), array.getString(i));
} else {
try {
value = type.newInstance();
value = type.getDeclaredConstructor().newInstance();
PObject object = array.getObject(i);
parse(errorOnExtraProperties, object, value, extraPropertyToIgnore);
} catch (InstantiationException e) {
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException e) {
throw new UnsupportedTypeException(type, e);
} catch (IllegalAccessException e) {
throw ExceptionUtils.getRuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private Object getAttributeValue(final String attributeName, final Values values
final Field field;
try {
field = value.getClass().getField(part);
if (!field.isAccessible()) {
sbrunner marked this conversation as resolved.
Show resolved Hide resolved
if (!field.canAccess(value)) {
field.setAccessible(true);
}
value = field.get(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.sf.jasperreports.engine.type.HorizontalTextAlignEnum;
import net.sf.jasperreports.engine.type.ScaleImageEnum;
import net.sf.jasperreports.engine.type.StretchTypeEnum;
import net.sf.jasperreports.engine.type.TextAdjustEnum;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.xml.JRXmlWriter;

Expand Down Expand Up @@ -426,7 +427,7 @@ private String generateSubReport(
colHeaderField.setHeight(headerHeight);
colHeaderField.setHorizontalTextAlign(HorizontalTextAlignEnum.LEFT);
colHeaderField.setStyle(columnHeaderStyle);
colHeaderField.setStretchWithOverflow(true);
colHeaderField.setTextAdjust(TextAdjustEnum.STRETCH_HEIGHT);
colHeaderField.setStretchType(StretchTypeEnum.ELEMENT_GROUP_HEIGHT);

JRDesignExpression headerExpression = new JRDesignExpression();
Expand Down Expand Up @@ -495,7 +496,7 @@ private JRDesignTextField createTextField(final String columnName) {
JRDesignExpression expression = new JRDesignExpression();
expression.setText("$F{" + columnName + "}");
textField.setExpression(expression);
textField.setStretchWithOverflow(true);
textField.setTextAdjust(TextAdjustEnum.STRETCH_HEIGHT);
return textField;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ public final synchronized MapPrinter create(@Nullable final String app) throws N
}

if (configFile == null) {
LOGGER.error(
"There is no configurationFile registered in the {}" +
" bean with the id: '{}' from configurationFiles:\n {}",
getClass().getName(), finalApp,
String.join("\n", this.configurationFiles.keySet())
);
if (LOGGER.isErrorEnabled()) {
LOGGER.error(
"There is no configurationFile registered in the {}" +
" bean with the id: '{}' from configurationFiles:\n {}",
getClass().getName(), finalApp,
String.join("\n", this.configurationFiles.keySet())
);
}
throw new NoSuchAppException(
"There is no configurationFile registered in the " + getClass().getName() +
" bean with the id: '" + finalApp + "'");
Expand Down Expand Up @@ -285,4 +287,5 @@ protected boolean handleDirectory(
return depth < MAX_DEPTH;
}
}

}