mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
[core] Fix potential NPE in Java7ZlibInputOutputStream
The field XMPPInputOutputStream.flushMethod was not initialized, which could cause an NPE in the "switch (flushMethod)" found in Java7ZlibInputOutputStream.getOutputStream().
This commit is contained in:
parent
cbcf1d15f5
commit
33720e8d97
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2013-2018 Florian Schmaus
|
* Copyright 2013-2020 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.
|
||||||
|
@ -20,9 +20,11 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.util.Objects;
|
||||||
|
|
||||||
public abstract class XMPPInputOutputStream {
|
public abstract class XMPPInputOutputStream {
|
||||||
|
|
||||||
protected static FlushMethod flushMethod;
|
protected static FlushMethod flushMethod = FlushMethod.SYNC_FLUSH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the used flushed method when compressing data. The default is full flush which may not
|
* Set the used flushed method when compressing data. The default is full flush which may not
|
||||||
|
@ -33,7 +35,7 @@ public abstract class XMPPInputOutputStream {
|
||||||
* @param flushMethod TODO javadoc me please
|
* @param flushMethod TODO javadoc me please
|
||||||
*/
|
*/
|
||||||
public static void setFlushMethod(FlushMethod flushMethod) {
|
public static void setFlushMethod(FlushMethod flushMethod) {
|
||||||
XMPPInputOutputStream.flushMethod = flushMethod;
|
XMPPInputOutputStream.flushMethod = Objects.requireNonNull(flushMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FlushMethod getFlushMethod() {
|
public static FlushMethod getFlushMethod() {
|
||||||
|
|
Loading…
Reference in a new issue