Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Component-SS7 Roadmap-Fix

New issue 265 by [email protected]: Isup stack not working
http://code.google.com/p/jss7/issues/detail?id=265

What steps will reproduce the problem?
1.create a circuit and try to send isup message
2.
3.

What is the expected output? What do you see instead?
IllegalArgumentException is thrown when trying to send isup message through the provider.
the fix of Issue 245 breaks the stack
https://code.google.com/p/jss7/source/detail?r=967ed7f325042d832cafcd585c06aa1441803006


What version of the product are you using? On what operating system?
mobicents-ss7-2.0.0.CR1 on any OS


Please provide any additional information below.
More specifically the followig check:
msg.getCircuitIdentificationCode().getCIC() != c.getDpc() in /isup/isup-impl/src/main/java/org/mobicents/protocols/ss7/isup/impl/ISUPProviderImpl.java

void sendOnCircuit(Circuit c,ISUPMessage msg) throws ParameterException, IOException {
            if(c == null ){
                        throw new NullPointerException();
                    }
                    if(msg == null){
                        throw new NullPointerException();
                    }
        
if(msg.getCircuitIdentificationCode() == null || msg.getCircuitIdentificationCode().getCIC() != c.getDpc()){
                        throw new IllegalArgumentException();
                    }
                    c.send(msg);
                }

Additional comment:

1. The following code:
if(c == null ){
     throw new NullPointerException();
}
is not necessary - it doesn't add value to this method, because NPE will be thrown anyway when we get to this line c.send(msg); A better solution is to change this 3 line check to java.util.Objects.requireNonNull(c, "Circuit should not be null");

Circuit (c) will be null if getCircuit(msg,dpc) returns null, so an even better solution would be to throw IllegalArgumentException with a meaningful message if a circuit with the given cic and dpc doesn't exist and we cannot send the message via it.

2.
the following check:
                    if(msg == null){
                        throw new NullPointerException();
                    }
also doesn't make sense, because if msg is null we will never get to this line and sendOnCircuit method at all, becuase NPE will be thrown before than in private Circuit getCircuit(ISUPMessage message, int dpc) method on the follwing line:
int cic = message.getCircuitIdentificationCode().getCIC();

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- You received this message because you are subscribed to the Google Groups "mobicents-all-issues-changes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to