mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-24 03:27:59 +01:00
LazyStringBuilder: Wrap NPE in RuntimeException
instead of using a Logger.
This commit is contained in:
parent
8086a11c6c
commit
5483e95920
1 changed files with 2 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2014-2017 Florian Schmaus
|
* Copyright 2014-2019 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,13 +19,9 @@ package org.jivesoftware.smack.util;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
public class LazyStringBuilder implements Appendable, CharSequence {
|
public class LazyStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(LazyStringBuilder.class.getName());
|
|
||||||
|
|
||||||
private final List<CharSequence> list;
|
private final List<CharSequence> list;
|
||||||
|
|
||||||
private String cache;
|
private String cache;
|
||||||
|
@ -80,8 +76,7 @@ public class LazyStringBuilder implements Appendable, CharSequence {
|
||||||
}
|
}
|
||||||
catch (NullPointerException npe) {
|
catch (NullPointerException npe) {
|
||||||
StringBuilder sb = safeToStringBuilder();
|
StringBuilder sb = safeToStringBuilder();
|
||||||
LOGGER.log(Level.SEVERE, "The following LazyStringBuilder threw a NullPointerException: " + sb, npe);
|
throw new RuntimeException("The following LazyStringBuilder threw a NullPointerException: " + sb, npe);
|
||||||
throw npe;
|
|
||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue