I am trying to send TCAP Continue when I receive TCAP Begin InserSubsriberData. I dont tknow if this is the right procedure. Below is my code. I can see after receiving the TC_Begin print out got ISD and after diag.send() it prints out the invokeID,AC,dilog etc. But not sending the Continue package. Why TC_Cont not being sent. Any help is very much appreciated.
#Override
public void onInsertSubscriberDataRequest(InsertSubscriberDataRequest argISD) {
System.out.println("got ISD");
try {
MAPDialogMobility diag = argISD.getMAPDialog();
diag.addInsertSubscriberDataResponse(argISD.getInvokeId(), null, null, null, null, null);
System.out.println("sending Cont");
diag.send();
System.out.println(diag);
}
catch (MAPException e1) {
System.out.println(e1);
e1.printStackTrace();
}
}
Related
My method makes an update on the database, and then after it tries to send an email, the latter could go into exception, and when it goes into exception, the database is not updated. How can I solve? Thanks in advance
userRepository.save(user);
if (user.isAccepted()) {
try {
mailSender.sendEmail(user);
} catch (Exception e) {
throw new MailToNotFoundException(ex);
}
}
I'm with some trouble here
I did a main CRUD form, and one button at this form that when clicked it calls another form, this one responsible for makes a query at the database to order the dates and hours that were entered by the user and display at the screen... but here is the deal, when I click at the button "Listar Por Prioridade" to call this form "Trabalhos Prontos" it appears behind the first one "Registro de Novos Chamados"... I've tried to use:
private void btListarPrioridadeActionPerformed(java.awt.event.ActionEvent evt) {
try {
man = new MySQLDaoManager("root", "", "localhost", "atendimentos", 3306);
try {
FormTrabProntos frmTrbPrnt = new FormTrabProntos(man);
frmTrbPrnt.setVisible(true);
frmTrbPrnt.toFront();
FormNovaChamada frmNvCham = new FormNovaChamada(frmini, editavel);
frmNvCham.toBack();
} catch (DAOException ex) {
Logger.getLogger(FormGestor.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (SQLException ex) {
Logger.getLogger(FormGestor.class.getName()).log(Level.SEVERE, null, ex);
}
}
and nothing (see image below).. anyone knows how could I fix this problem and make the called screen appears at the front of the first one?! Thanks a lot
Finally i've solved it, the function stayed as follows:
private void btPriorityListActionPerformed(java.awt.event.ActionEvent evt) {
try {
man = new MySQLDaoManager("root", "", "localhost", "attendances", 3306);
try {
setVisible(false);
dispose();
FormTrabProntos frmTrbPrnt = new FormTrabProntos(man);
frmTrbPrnt.setVisible(true);
frmTrbPrnt.toFront();
frmTrbPrnt.requestFocus();
} catch (DAOException ex) {
Logger.getLogger(FormGestor.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (SQLException ex) {
Logger.getLogger(FormGestor.class.getName()).log(Level.SEVERE, null, ex);
}
}
Big thanks for the help!!!
-The array of appliances(clock,lamp or television) is displayed on an array of labels (pictures[]) in a 3x3 grid
-An example of outputting an appliance icon (which is when a device is added to the grid though a button labelled 'add device')
Television myTelevision = new Television();
appliance[count-1] = myTelevision;
pictures[count-1].setIcon(appliance[count-1].getPicture());
This is my code for saving the array of appliances (objects) to a file and reading them back in ( re-populating the appliance array):
if(e.getSource()==but3)
{
ObjectInputStream input
= null;
try {
input = new ObjectInputStream(
new FileInputStream("livingroom.bat"));
Appliance[] appliance = (Appliance[]) (input.readObject());
} catch (IOException ex) {
Logger.getLogger(HomeController.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex)
{
Logger.getLogger(HomeController.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
input.close();
} catch (IOException ex) {
Logger.getLogger(HomeController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
if(e.getSource()==but4)
{
ObjectOutputStream output
= null;
try {
output = new ObjectOutputStream(
new FileOutputStream("livingroom.bat", true));
output.writeObject(appliance);
} catch (IOException ex) {
Logger.getLogger(HomeController.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
output.close();
} catch (IOException ex) {
Logger.getLogger(HomeController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
After deserialization I am trying to display the imageicon for the appliances in the array (which has just been re-populated). However no matter how I try nothing seems to happen (the grid of pictures shows no change).
What I am asking for: Can anyone tell me a method of applying the image icons for the appliances to the grid of pictures once deserialization has taken place?
You are deserialising into a local variable whose scope ends with the try block it is declared in, and you don't do anything with the local variable, so nothing happens.
Presumably you should be deserialing into a member variable.
EDITED:
Im developing SMS application in java for reading SMS.Im sending AT commands to GSM mode for sending an SMS,messages is sending successfully ,but im not getting any response from the modem.If i send the AT commands through Hyperterminal im getting the response.Whats the exact problem?
InputStream inputStream;
OutputStream out;
this.inputStream = serialPort.getInputStream();
this.out = serialPort.getOutputStream();
out.write(("AT"+"\r").getBytes());
try {
Thread.sleep(1500);
} catch (InterruptedException ex) {
Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
}
out.write(("AT+CMGF=1"+"\r").getBytes());
try {
Thread.sleep(1500);
} catch (InterruptedException ex) {
Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
}
out.write(("AT+CMGS=\""+"+91xxxxxxxxxx"+"\""+"\r").getBytes());
try {
Thread.sleep(1500);
} catch (InterruptedException ex) {
Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
}
out.write(("TEST "+cntrlZ).getBytes());
try {
Thread.sleep(1500);
} catch (InterruptedException ex) {
Logger.getLogger(MainClass.class.getName()).log(Level.SEVERE, null, ex);
}
//Im using SerialPortEventListener to read the input from modem
int a = inputStream.available();
System.out.println(inputStream.available() + " BYTES AVAILABLE ");
inputStream.read(readBuffer, 0, a);
I also tried to read after sending each AT commands,but im not getting anything as a response from the modem.
Issues receving in RXTX
After setting the flow control for the serial port its working fine.
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN | SerialPort.FLOWCONTROL_RTSCTS_OUT);
Please make sure that you have installed all libraries required by SMSlib and your modem is on supported modems list. Having supported modem is not required, but can eliminate compatibility problem right off the bat.
Also you should verify if your modem is connected properly. You could perform some operations on it directly, via AT commands.
I know this site isn't made for questions like this but I've been searching for the answer to this I haven't found anything and I need a confirmations.
I have a singleton class which is the centre of my program, in some situations I try to save its state, however it seems it doesn't save properly, and I don't see why because It's not the first time I do this, however It is the first time I try to save a singleton, so is it possible to save a singleton object?
Here are my loading and saving codes of this object
public void Loading(String name) {
ObjectInputStream is = null;
//ignore this variable
game_loaded = 1;
try {
is = new ObjectInputStream(new FileInputStream(name + ".dat"));
//Logica is the singleton class,
//logi is the name of the variable where it is
logi = (Logica) is.readObject();
} catch (FileNotFoundException e1) {
JOptionPane.showOptionDialog(frame, "Game Invalid", "Load",
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE,
null, new String[] { "Ok" }, "Ok");
return;
} catch (IOException e1) {
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
is.close();
} catch (IOException e) {
// TODO Auto-generated catch block
}
JOptionPane.showOptionDialog(frame, "Game Loaded Sucessfully", "Load",
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE,
null, new String[] { "Ok" }, "Ok");
}
Save:
public void saving(String nome){
ObjectOutputStream os = null;
try {
os = new ObjectOutputStream(new FileOutputStream(nome+".dat"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
return;
} catch (IOException e) {
// TODO Auto-generated catch block
return;
}
try {
os.writeObject(Logica.getLogica(null));
} catch (IOException e) {
// TODO Auto-generated catch block
return;
}
JOptionPane.showOptionDialog(frame, "Game Saved sucessfully", "Load",
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE,
null, new String[] { "Ok" }, "Ok");
if (os != null)
try {
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
EDIT
Ok I may have explained corretcly, it doesn't give me any error loading, however it doesn't load the state I saved, it loads an new "Logica" as if I had created a new one
There's nothing about Singleton per se that says it can't be serialized; you can write incorrect serialization code for any class. It's not clear what's wrong, and I'm not willing to pore over your code to figure it out, but it should be possible to do.
You have an empty catch block for IOException. That's always a bad idea. You've swallowed the exception that might explain everything. Print the stack trace.
The situation you have described is not possible. Ergo you haven't described it correctly. Probably there is something wrong with your observations.
I strongly suspect an IOException or FileNotFoundException, despite your comment in another answer. You have posted code that ignores exceptions in at least four separate places. The presumption is overwhelming.
In fact your exception handling needs a lot of work. You aren't closing the file in case of exceptions for example. There are no finally blocks. You have multiple try/catch blocks where you should have one try and several catches.
Further questions along other lines of enquiry. Is the file being created? With non-zero length? Or else maybe the singleton class only has transient fields?