Commit 19a38c8b authored by Luc Maisonobe's avatar Luc Maisonobe

Fixed findbugs warnings.

parent 81147053
......@@ -104,6 +104,12 @@
<Local name="HP" />
<Bug pattern="DLS_DEAD_LOCAL_STORE" />
</Match>
<Match>
<Class name="~.*\.OneAxisEllipsoid$"/>
<Method name="transform" />
<Local name="epsPhi" />
<Bug pattern="DLS_DEAD_LOCAL_STORE" />
</Match>
<!-- the approximate constants do belong to the models -->
<Match>
......@@ -176,6 +182,14 @@
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" />
</Match>
<!-- the following is a false positive as the inverseCrossProducts method either
returns eatly, throws an exception or sets the omega variable to non-null -->
<Match>
<Class name="~.*\.FieldAngularCoordinates$"/>
<Method name="inverseCrossProducts" />
<Bug pattern="NP_NULL_ON_SOME_PATH_EXCEPTION" />
</Match>
<!-- the following is a false positive as the Direction.next() always return non-null
and Direction is an enumerate that can't be changed -->
<Match>
......
......@@ -16,21 +16,20 @@
*/
package org.orekit.files.ccsds;
import org.hipparchus.util.FastMath;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.IERSConventions;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.hipparchus.util.FastMath;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.IERSConventions;
/**
* Base class for all CCSDS Orbit Data Message parsers.
*
......@@ -198,24 +197,11 @@ public abstract class ODMParser {
*/
public ODMFile parse(final String fileName)
throws OrekitException {
InputStream stream = null;
try {
stream = new FileInputStream(fileName);
try (InputStream stream = new FileInputStream(fileName)) {
return parse(stream, fileName);
} catch (FileNotFoundException e) {
} catch (IOException e) {
throw new OrekitException(OrekitMessages.UNABLE_TO_FIND_FILE, fileName);
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
// ignore
}
}
}
/** Parse a CCSDS Orbit Data Message.
......
......@@ -16,7 +16,6 @@
*/
package org.orekit.files.sp3;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
......@@ -39,10 +38,7 @@ import org.orekit.utils.TimeStampedPVCoordinates;
* @author Thomas Neidhart
* @author Evan Ward
*/
public class SP3File implements EphemerisFile, Serializable {
/** Serializable UID. */
private static final long serialVersionUID = 3333652174843017655L;
public class SP3File implements EphemerisFile {
/** File type indicator. */
public enum SP3FileType {
......
......@@ -20,6 +20,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
......@@ -128,11 +129,9 @@ public enum OceanLoadDeformationCoefficients {
int lineNumber = 0;
String line = null;
BufferedReader reader = null;
try {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {
// setup the reader
reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
lineNumber = 0;
int maxDegree = 0;
final Map<Integer, Double> map = new HashMap<Integer, Double>();
......@@ -160,14 +159,6 @@ public enum OceanLoadDeformationCoefficients {
lineNumber, RESOURCE_NAME, line);
} catch (IOException ioe) {
throw new OrekitException(ioe, new DummyLocalizable(ioe.getMessage()));
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException ioe) {
// ignored here
}
}
}
......
......@@ -182,12 +182,6 @@ public class FieldIntegratedEphemeris <T extends RealFieldElement<T>>
} else {
throw new OrekitException(oew.getException());
}
} catch (OrekitException oe) {
if (oe instanceof OrekitException) {
throw (OrekitException) oe;
} else {
throw new OrekitException(oe);
}
}
}
......
......@@ -313,14 +313,14 @@ public class FieldNumericalPropagator<T extends RealFieldElement<T>> extends Fie
if (mass.getReal() <= 0.0) {
throw new OrekitException(OrekitMessages.SPACECRAFT_MASS_BECOMES_NEGATIVE, mass);
}
final FieldOrbit<T> orbit = getOrbitType().mapArrayToOrbit(y, getPositionAngleType(), date, getMu(), getFrame());
final FieldOrbit<T> orbit = super.getOrbitType().mapArrayToOrbit(y, super.getPositionAngleType(), date, getMu(), getFrame());
final FieldAttitude<T> attitude = getAttitudeProvider().getAttitude(orbit, date, getFrame());
return new FieldSpacecraftState<T>(orbit, attitude, mass);
}
/** {@inheritDoc} */
public void mapStateToArray(final FieldSpacecraftState<T> state, final T[] y) {
getOrbitType().mapOrbitToArray(state.getOrbit(), getPositionAngleType(), y);
super.getOrbitType().mapOrbitToArray(state.getOrbit(), super.getPositionAngleType(), y);
y[6] = state.getMass();
}
......
......@@ -16,8 +16,6 @@
*/
package org.orekit.utils;
import java.io.Serializable;
import org.hipparchus.RealFieldElement;
import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
import org.orekit.time.TimeShiftable;
......@@ -39,10 +37,7 @@ import org.orekit.time.TimeShiftable;
* @see PVCoordinates
*/
public class FieldPVCoordinates<T extends RealFieldElement<T>>
implements TimeShiftable<FieldPVCoordinates<T>>, Serializable {
/** Serializable UID. */
private static final long serialVersionUID = 20140411L;
implements TimeShiftable<FieldPVCoordinates<T>> {
/** The position. */
private final FieldVector3D<T> position;
......
Markdown is supported
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