@@ -31,7 +31,6 @@ public final class Utils {
31
31
private static final Pattern MAC_ADDRESS_PATTERN = Pattern .compile ("[0-9A-F]{2}([-:][0-9A-F]{2}){5}" , Pattern .CASE_INSENSITIVE );
32
32
33
33
private static JAXBContext jaxbContext = null ;
34
- private static Unmarshaller unmarshaller = null ;
35
34
36
35
/**
37
36
* Private Constructor, should not be instanced
@@ -149,7 +148,7 @@ public static String xpathAttributeFilter(String name, Collection<String> value)
149
148
* @param s1 first string
150
149
* @param s2 seconde string
151
150
* @return true if strings are equals or both blank, false otherwise
152
- * @see org.apache.commons.lang3. StringUtils#isBlank(CharSequence)
151
+ * @see StringUtils#isBlank(CharSequence)
153
152
*/
154
153
public static boolean equalsOrBothBlank (String s1 , String s2 ) {
155
154
return Objects .equals (s1 , s2 )
@@ -167,9 +166,9 @@ public static boolean equalsOrBothBlank(String s1, String s2) {
167
166
* @param s2 second String to compare
168
167
* @return when s1 and s2 are not blank, same result as {@link String#compare(CharSequence, CharSequence)},
169
168
* zero when s1 and s2 are both blanks, negative integer when s1 is blank and s2 is not, positive integer when s1 is not blank but s2 is.
170
- * @see java.util. Comparator#compare(Object, Object)
171
- * @see org.apache.commons.lang3. StringUtils#isBlank(CharSequence)
172
- * @see java.util. Comparator#nullsFirst(Comparator)
169
+ * @see Comparator#compare(Object, Object)
170
+ * @see StringUtils#isBlank(CharSequence)
171
+ * @see Comparator#nullsFirst(Comparator)
173
172
*/
174
173
public static int blanksFirstComparator (String s1 , String s2 ) {
175
174
if (StringUtils .isBlank (s1 )){
@@ -314,11 +313,12 @@ public static String toHex(long number, int length) {
314
313
* @return copy of the object
315
314
*/
316
315
public static <T > T copySclElement (T object , Class <T > clazz ) {
316
+ Unmarshaller unmarshaller ;
317
317
try {
318
318
if (jaxbContext == null ) {
319
319
jaxbContext = JAXBContext .newInstance ("org.lfenergy.compas.scl2007b4.model" );
320
- unmarshaller = jaxbContext .createUnmarshaller ();
321
320
}
321
+ unmarshaller = jaxbContext .createUnmarshaller ();
322
322
JAXBElement <T > contentObject = new JAXBElement <>(new QName (clazz .getSimpleName ()), clazz , object );
323
323
JAXBSource source = new JAXBSource (jaxbContext , contentObject );
324
324
return unmarshaller .unmarshal (source , clazz ).getValue ();
0 commit comments