Skip to content

Commit

Permalink
[JENKINS-25889] Annotations related to an NPE.
Browse files Browse the repository at this point in the history
Originally-Committed-As: 54ac1d186d94dd7af10bd0dd11aed478ad1ffc65
  • Loading branch information
jglick committed Dec 3, 2014
1 parent 895de28 commit bfc249a
Showing 1 changed file with 7 additions and 5 deletions.
Expand Up @@ -32,6 +32,8 @@
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

/**
* Pause {@link FlowNode} Action.
Expand Down Expand Up @@ -96,7 +98,7 @@ public long getPauseDuration() {
}
}

public static PauseAction getCurrentPause(FlowNode node) {
public static @CheckForNull PauseAction getCurrentPause(@Nonnull FlowNode node) {
List<PauseAction> pauseActions = getPauseActions(node);

if (!pauseActions.isEmpty()) {
Expand All @@ -106,7 +108,7 @@ public static PauseAction getCurrentPause(FlowNode node) {
return null;
}

public static void endCurrentPause(FlowNode node) throws IOException {
public static void endCurrentPause(@Nonnull FlowNode node) throws IOException {
PauseAction currentPause = getCurrentPause(node);

if (currentPause != null) {
Expand All @@ -122,7 +124,7 @@ public static void endCurrentPause(FlowNode node) throws IOException {
* @param node The node to test.
* @return True if the node is pause node, otherwise false.
*/
public static boolean isPaused(FlowNode node) {
public static boolean isPaused(@Nonnull FlowNode node) {
PauseAction currentPause = getCurrentPause(node);

if (currentPause != null) {
Expand All @@ -137,7 +139,7 @@ public static boolean isPaused(FlowNode node) {
* @param node The node to be searched.
* @return The {@link PauseAction} instances for the supplied node. Returns an empty list if there are none.
*/
public static List<PauseAction> getPauseActions(FlowNode node) {
public static @Nonnull List<PauseAction> getPauseActions(@Nonnull FlowNode node) {
List<PauseAction> pauseActions = new ArrayList<PauseAction>();
List<Action> actions = node.getActions();

Expand All @@ -155,7 +157,7 @@ public static List<PauseAction> getPauseActions(FlowNode node) {
* @param node The node to calculate on.
* @return The pause duration in milliseconds.
*/
public static long getPauseDuration(FlowNode node) {
public static long getPauseDuration(@Nonnull FlowNode node) {
List<PauseAction> pauseActions = getPauseActions(node);
long pauseDuration = 0L;

Expand Down

0 comments on commit bfc249a

Please sign in to comment.