From f2e60eb96f27903d7bedae38d1b1a796235ee78e Mon Sep 17 00:00:00 2001
From: Luc Maisonobe <luc@orekit.org>
Date: Wed, 11 May 2016 14:36:07 +0200
Subject: [PATCH] Fixed exception handling after Hipparchus migration.

---
 .../org/orekit/rugged/api/RuggedBuilder.java  |  5 +--
 .../orekit/rugged/errors/DumpReplayer.java    |  9 ++--
 .../rugged/errors/LocalizedException.java     | 45 -------------------
 .../orekit/rugged/errors/RuggedException.java |  1 +
 4 files changed, 6 insertions(+), 54 deletions(-)
 delete mode 100644 src/main/java/org/orekit/rugged/errors/LocalizedException.java

diff --git a/src/main/java/org/orekit/rugged/api/RuggedBuilder.java b/src/main/java/org/orekit/rugged/api/RuggedBuilder.java
index fb93088b..07cb65b1 100644
--- a/src/main/java/org/orekit/rugged/api/RuggedBuilder.java
+++ b/src/main/java/org/orekit/rugged/api/RuggedBuilder.java
@@ -16,6 +16,7 @@
  */
 package org.orekit.rugged.api;
 
+import org.hipparchus.exception.LocalizedCoreFormats;
 import org.hipparchus.geometry.euclidean.threed.Rotation;
 import org.hipparchus.geometry.euclidean.threed.Vector3D;
 import java.io.IOException;
@@ -628,9 +629,7 @@ public class RuggedBuilder {
             createInterpolatorIfNeeded();
             new ObjectOutputStream(storageStream).writeObject(scToBody);
         } catch (IOException ioe) {
-// TODO hipparchus migration : change to the appropriate message 
-//            throw new RuggedException(ioe, LocalizedFormats.SIMPLE_MESSAGE, ioe.getMessage());
-            throw new RuggedException(ioe, RuggedMessages.DEBUG_DUMP_ACTIVATION_ERROR, ioe.getLocalizedMessage());
+            throw new RuggedException(ioe, LocalizedCoreFormats.SIMPLE_MESSAGE, ioe.getMessage());
         }
     }
 
diff --git a/src/main/java/org/orekit/rugged/errors/DumpReplayer.java b/src/main/java/org/orekit/rugged/errors/DumpReplayer.java
index b552c7b4..4a0da842 100644
--- a/src/main/java/org/orekit/rugged/errors/DumpReplayer.java
+++ b/src/main/java/org/orekit/rugged/errors/DumpReplayer.java
@@ -17,6 +17,7 @@
 package org.orekit.rugged.errors;
 
 import org.hipparchus.analysis.differentiation.DerivativeStructure;
+import org.hipparchus.exception.LocalizedCoreFormats;
 import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
 import org.hipparchus.geometry.euclidean.threed.Rotation;
 import org.hipparchus.geometry.euclidean.threed.Vector3D;
@@ -277,9 +278,7 @@ public class DumpReplayer {
             }
             reader.close();
         } catch (IOException ioe) {
-// TODO hipparchus migration : change to the appropriate message 
-//            throw new RuggedException(ioe, LocalizedFormats.SIMPLE_MESSAGE, ioe.getLocalizedMessage());
-            throw new RuggedException(ioe, RuggedMessages.DEBUG_DUMP_ACTIVATION_ERROR, file.getAbsolutePath(), ioe.getLocalizedMessage());
+            throw new RuggedException(ioe, LocalizedCoreFormats.SIMPLE_MESSAGE, ioe.getLocalizedMessage());
         }
     }
 
@@ -390,9 +389,7 @@ public class DumpReplayer {
             return rugged;
 
         } catch (IOException ioe) {
-// TODO hipparchus migration : change to the appropriate message 
-//            throw new RuggedException(ioe, LocalizedFormats.SIMPLE_MESSAGE, ioe.getLocalizedMessage());
-            throw new RuggedException(ioe, RuggedMessages.DEBUG_DUMP_ACTIVATION_ERROR, ioe.getLocalizedMessage());
+            throw new RuggedException(ioe, LocalizedCoreFormats.SIMPLE_MESSAGE, ioe.getLocalizedMessage());
         } catch (SecurityException e) {
             // this should never happen
             throw RuggedException.createInternalError(e);
diff --git a/src/main/java/org/orekit/rugged/errors/LocalizedException.java b/src/main/java/org/orekit/rugged/errors/LocalizedException.java
deleted file mode 100644
index 5f70a0e2..00000000
--- a/src/main/java/org/orekit/rugged/errors/LocalizedException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright 2013-2016 CS Systèmes d'Information
- * Licensed to CS Systèmes d'Information (CS) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * CS licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.orekit.rugged.errors;
-
-import java.util.Locale;
-
-import org.hipparchus.exception.Localizable;
-
-/** This interface specified methods implemented by localized exception classes.
- * @author Luc Maisonobe
- */
-
-public interface LocalizedException {
-
-    /** Gets the message in a specified locale.
-     * @param locale Locale in which the message should be translated
-     * @return localized message
-     */
-    String getMessage(final Locale locale);
-
-    /** Get the localizable specifier of the error message.
-     * @return localizable specifier of the error message
-     */
-    Localizable getSpecifier();
-
-    /** Get the variable parts of the error message.
-     * @return a copy of the variable parts of the error message
-     */
-    Object[] getParts();
-
-}
diff --git a/src/main/java/org/orekit/rugged/errors/RuggedException.java b/src/main/java/org/orekit/rugged/errors/RuggedException.java
index c60ce311..dadc358e 100644
--- a/src/main/java/org/orekit/rugged/errors/RuggedException.java
+++ b/src/main/java/org/orekit/rugged/errors/RuggedException.java
@@ -17,6 +17,7 @@
 package org.orekit.rugged.errors;
 
 import org.hipparchus.exception.Localizable;
+import org.hipparchus.exception.LocalizedException;
 import org.hipparchus.exception.MathRuntimeException;
 
 import java.text.MessageFormat;
-- 
GitLab