octoshape.osa2
Class Problem

java.lang.Object
  extended by octoshape.osa2.Problem

public final class Problem
extends java.lang.Object

This represents a problem.


Constructor Summary
Problem(octoshape.client.problem.Problem p)
           
 
Method Summary
 int getErrorCode()
          This is the Octoshape error code for this problem.
 java.lang.String getMessage()
          This returns a recommended English message to show to the user in case isNormal returns false.
 boolean hasProblemId(java.lang.String id)
          This can be used to probe about the nature of the problem.
 boolean isNormal()
          If this returns true, there is not anything wrong and no error should be reported to the user.
 java.lang.String toString()
          Converts a problem to a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Problem

public Problem(octoshape.client.problem.Problem p)
Method Detail

hasProblemId

public boolean hasProblemId(java.lang.String id)
This can be used to probe about the nature of the problem. Here are the things that can be detected from this:

Parameters:
id -
Returns:
true if the problem contains the argument id

isNormal

public boolean isNormal()
If this returns true, there is not anything wrong and no error should be reported to the user. You may receive a problem with this method returning true if stream stop was expected; see the StreamPlayer class


toString

public java.lang.String toString()
Converts a problem to a String. This method should not be used for generating an error message to present to end users. Please getMessage() use for that purpose. However, this information maybe requested by Octoshape Support for detailed problem analysis.

Overrides:
toString in class java.lang.Object

getErrorCode

public int getErrorCode()
This is the Octoshape error code for this problem. The error code will normally be 2-4 decimal digits. Please always include this error code in decimal format when notifying the user about the problem as this may simplify debugging and user support a lot. Also, please do not write program logic that depends on error codes as error codes may change between releases of Octoshape software.


getMessage

public java.lang.String getMessage()
This returns a recommended English message to show to the user in case isNormal returns false. If isNormal returns true, it returns null. In the current SDK this is implemented as follows:

if(this.isNormal()) { 
        return null; 
} else if(this.hasProblemId("admin")) { 
        if(this.hasProblemId("geofilter")) { 
                return "This stream is not allowed to be viewed in your area ("+this.getErrorCode()+")"; 
        } else { 
                return "You do not have permission to view this stream ("+this.getErrorCode()+")"; 
        } 
} else { 
        return "This stream is currently unavailable ("+this.getErrorCode()+")"; 
}
 
If you need to display messages to the user in a different language than English, please make your own similar implementation.