sqlite exception :- Attempt to write readonly database

I have created a java application having sqlite db (using netbeans). I have also created a .exe file and the database is there in the folder containing the executable file. But when I run the .exe file read operation is working fine. When I try updating or writing on to db , am running into the following error. Java.sql.SQLException: Attempt to write a readonly database.

me sale error Exception in thread “main” java.lang.NullPointerException (Imagen.java:130)

import java.util.Scanner;

/** * @author TwilightVelvet * */ public class Imagen { //Atributos

private  int anchoImagen;  private int largoImagen;  /**  *   */ private Matriz  matriz ; // metodos  //constructores  public Imagen () { this.matriz = null;   } /**  *   * @param nNombre  * @param nTamaño  * @param nColor  * @param nMatriz  */      public  Imagen (int nAnchoImagen, int nLargoImagen) {     this.anchoImagen =nAnchoImagen;     this.largoImagen = nLargoImagen;  } //fin constructores  //analizadores /**  * Devuelve el nombre de la imagen  * @return el nombre de la imagen  */   /**  *   */    /**  *   */    /**  *   */ public Matriz darMatriz() {     return this.matriz; }  /**  *   * @param nMatriz  */ public void modificarMatriz (Matriz nMatriz) { this.matriz = nMatriz;   } /**  *   */ public static void main (String [] params) {     Imagen laImagen = null;     //menu     boolean enEjecucion = true;      while (enEjecucion)     {          System.out.println("Elija la opcion deseada");            System.out.println("1. Dar el valor del largo y el ancho de la imagen");            System.out.println("2. La matriz de su imagen es:");            System.out.println("0. salir");             Scanner lector = new Scanner(System.in);             int imagenElegida = lector.nextInt();             switch (imagenElegida)            {            case 0:                 enEjecucion = false;                 break;              case 1:                 System.out.println("ingrese el ancho de la imagen ");                int anchoImagen = lector.nextInt( );                System.out.println(" Por favor ingrese el largo de la imagen ");                int largoImagen = lector.nextInt( );                Matriz nuevaImagen = new Matriz (anchoImagen, largoImagen);                nuevaImagen.BinarizarImagen();                laImagen.modificarMatriz(nuevaImagen);                break;             case 2:                System.out.println("mire aqui su matriz de la imagen ");                Matriz elTamaño = laImagen.darMatriz();                int [][] laMatriz = elTamaño.darTamañoImagen();                for(int i=0; i< Matriz.TAMANGO_MATRIZ; i++){                    for(int j=0; j< Matriz.TAMANGO_MATRIZ; j++){                        System.out.print(laMatriz[i][j]+"\t");                     }                    System.out.println("\n");            }     }            break; } } 

}

les comparto que apenas estoy aprendiendo y pues ese error me tiene bloqueado

Erro Internal Exception: java.sql.SQLSyntaxErrorException: ORA-01775: looping chain of synonyms

Alterei minha query no repository colocando um DISTICT e retirando alguns campos que não eram mais utilizados e ao rodar o projeto recebi o erro:

0000004f SystemOut O Producer is producing a new PerfitEntityManager.org.eclipse.persistence.internal.jpa.EntityManagerImpl@1f86a1d8 0000004f SystemOut O [EL Warning]: Exception [EclipseLink-4002] (Eclipse Persistence Services – 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: ORA-01775: looping chain of synonyms

Error Code: 1775

0000004f ProcessDB E Error to process the interface: Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services – 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: ORA-01775: looping chain of synonyms

Pelas minhas pesquisas, vi que isso é uma coisa que ocorre no database oracle mas não consegui identificar uma solução uma vez que nada foi alterado no banco, alguma idéia ?

Desde já obrigado.

Exception in thread “main” java.lang.NullPointerException – I worked with java files and Java Arraylist to store my

When I was Working on Java users Registration project it showed me this Exception in thread “main” java.lang.NullPointerException error. I worked with Java files and java ArrayList to store my signed up users. I think the error came with this line if (arrayList.get(i).getName().equals(user.getName())) Here is my code. Thank you….

public void deleteUser(User user) { database = new Database();

    ArrayList<User> arrayList = database.getArrayList();     for (int i = 0; i < arrayList.size(); i++) {          if (arrayList.get(i).getName().equals(user.getName())){             arrayList.remove(i);             System.out.println("Deleted");             break;         }     }      try (BufferedWriter writer = new BufferedWriter(new FileWriter(this.file))) {         for (int i = 0; i < arrayList.size(); i++) {             User u = arrayList.get(i);             writer.write(u.getName() + ":" + u.getPassword() + ":" + u.getEmail());             writer.newLine();         }     } catch (IOException ex) {         System.out.println(ex.getMessage());     } } 

Distributed Cache: Unexpected exception in FeedCacheService.IsRepopulationNeeded: Failed to Decrypt data

I’m on SP2016 On-Prem August 2016 CU…

I got the following error message on timer job ‘User Profile Service Proxy – Feed Cache Repopulation Job’:

Unexpected exception in FeedCacheService.IsRepopulationNeeded: Failed to Decrypt data 

But only on one Search Server?!

What I’ve done:

  • Redeploy distributed cache
  • Change timeout settings
  • added the application pool account to the UPA

Doctest error al intentar capturar Exception Value error

Os reporto un error de testing. Intento capturar el error de introducir un valor negativo en una raíz cuadrada.

Mi código:

import math   def listaraicescuadradas(Listanumeros):     """      la funcion devuelve una lista con la raiz cuadrada     de los elementos pasados en otra lista por argumentos.     >>> lista = []     >>> for i in [4, -9, 16]:     ... lista.append(i)     >>> listaraicescuadradas(lista)     Traceback (most recent call last):         ...     ValueError: math domain error       """     return [math.sqrt(n) for n in Listanumeros ]  import doctest  doctest.testmod() 

El error que me dispara es:

ValueError: line 12 of the docstring for __main__.listaraicescuadradas has inconsistent leading whitespace: 'ValueError: math domain error 

Gracias adelantadas.

Exception Handling in Class

I have read a few sites on how to handle exceptions and I think I understand it better. Here is how I plan to handle it going forward. I used a lot of the guidelines here, https://isocpp.org/wiki/faq/exceptions.

Is this a sensible to handle it with c++14 as I’m using visual studio 2015. Would it be different with C++17?

#include <iostream> #include <exception> #include <string>  #define THROWFOORTE(what) throw FooRuntimeException(what, __FILE__, __func__, __LINE__) #define THROWFOORE(what) throw FooRangeError(what, __FILE__, __func__, __LINE__)  struct FooRuntimeException     : public std::runtime_error {     FooRuntimeException(const char* what,          const char* file, const char* func, int line)         : runtime_error(std::string(file) +":" +              std::string(func) + ":" + std::to_string(line)              + " " + std::string(what)) {} };  struct FooRangeError     : public std::range_error {     FooRangeError(const char* what,         const char* file, const char* func, int line)         : range_error(std::string(file) + ":" +             std::string(func) + ":" + std::to_string(line)             + " " + std::string(what)) {} };  class Foo { public:     Foo() = default;     ~Foo() {};      void throwRunTimeException()     {         THROWFOORTE("Runtime Error");     }     void throwRangeError()     {         THROWFOORE("Range Error");     } };  void HandleException() {     try { throw; }     catch (const FooRuntimeException &e)     {         std::cerr << e.what() << '\n'; // catches standard error message     }     catch (const FooRangeError&e)     {         std::cerr << e.what() << '\n';; // catches standard error message     }     return; }  int main() {     try     {         auto foo = Foo();         foo.throwRunTimeException();     }     catch (...) {         HandleException();     }        try     {         auto foo = Foo();         foo.throwRangeError();     }     catch (...) {         HandleException();     }      return 0; } 

Break iterations after an exception happens without data loss

I have this code that reads a file and after processing a few lines writes the output to a second file:

num_reads = 7 with open('data.txt') as read_file:     with open('new_data.txt', 'w') as write_file:          while (True):             lines = []             try:       # expect errors if the number of lines in the file are not a multiplication of num_reads                 for i in range(num_reads):                          lines.append(next(read_file))  # when the file finishes an exception occurs here                  #do sutff with the lines (exactly num_reads number of lines)                 processed = " ".join(list(map(lambda x: x.replace("\n", ''), lines)))                 write_file.write(processed + '\n')              except StopIteration:     # here we process the (possibly) insufficent last lines                 #do stuff with the lines (less that  num_reads)                 processed = " ".join(list(map(lambda x: x.replace("\n", ''), lines)))                 write_file.write(processed + '\n')                 break 

Assuming that I wish to do the same processing and writing procedure in both cases (when the number of elements is 7 and when the file finishes sooner). The above code violates DRY principle even if I define a new function and call it once in try block and once in except before break. Any other ordering that I could come up with was either causing an infinite loop or losing the final lines. I appreciate any comments on handling this issue, as it is not limited to this case and I had faced it in other cases as well.

Erro Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: -1

Pessoal eu estou fazendo um jogo da velha em java. Criei uma matriz de labels e adicionei evento de clique nessa matriz para que quando eu clicar, adicione um X ou O e mude a cor. Porém fica dando esse erro. se alguem souber o que pode ser. Segue o codigo e o erro.

Eu estou utilizando swing tambem para adicionar botoes e outras funcoes

public class Tabuleiro {

private JFrame frmJogoDaVelha; private JLabel[][] labels = new JLabel[3][3]; private JogoDaVelha jogo; private int numeroJogador=1; private JLabel label; private JButton button; String Simbolo;    /**  * Launch the application.  */ public static void main(String[] args) {     SwingUtilities.invokeLater(new Runnable() {         public void run() {             try {                 Tabuleiro window = new Tabuleiro();                 window.frmJogoDaVelha.setVisible(true);             } catch (Exception e) {                 e.printStackTrace();             }         }     }); } /**  * Create the application.  */ public Tabuleiro() {     initialize(); }  /**  * Initialize the contents of the frame.  */ private void initialize() {     jogo = new JogoDaVelha("joao", "maria");     frmJogoDaVelha = new JFrame();     frmJogoDaVelha.setResizable(false);     frmJogoDaVelha.setTitle("Jogo da Velha");     frmJogoDaVelha.setBounds(100, 100, 444, 436);     frmJogoDaVelha.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);     frmJogoDaVelha.getContentPane().setLayout(null);      JPanel panel = new JPanel();     panel.setBorder(new TitledBorder(null, "Tabuleiro", TitledBorder.LEADING, TitledBorder.TOP, null, null));     panel.setBounds(10, 11, 214, 386);     frmJogoDaVelha.getContentPane().add(panel);     panel.setLayout(null);      JPanel panelTabuleiro = new JPanel();     panelTabuleiro.setBounds(26, 37, 155, 192);     panel.add(panelTabuleiro);     panelTabuleiro.setLayout(new GridLayout(3, 3, 10, 10));      JButton btnNovoJogo = new JButton("Novo Jogo");     btnNovoJogo.setBounds(57, 248, 97, 28);     panel.add(btnNovoJogo);      JButton btnNewButton = new JButton("Resultado");     btnNewButton.setBounds(57, 300, 97, 28);     panel.add(btnNewButton);                    for(int i=0; i < 3; i++){                 for(int j=0; j < 3; j++){                           labels[i][j]=new JLabel("");                         frmJogoDaVelha.getContentPane().add(labels[i][j]);                         labels[i][j].setBounds(i*60, j*60, 50, 50); //x,y, width, height - 40x40                         labels[i][j].setBackground(SystemColor.controlHighlight);                         //labels[i][j].setBorder(new LineBorder(new Color(0, 0, 0)));                         labels[i][j].setOpaque(true);                         panelTabuleiro.add(labels[i][j]);                         labels[i][j].addMouseListener(new MouseAdapter(){                            public void mouseClicked(MouseEvent e){                             JLabel b = (JLabel)e.getSource();                             int indicex = b.getX()/40;                             int indicey = b.getY()/40;                              if(numeroJogador==1) {                                 //Simbolo = "X";                                 labels[indicex][indicey].setText("X");                                 labels[indicex][indicey].setBackground(Color.GREEN);                                 labels[indicex][indicey].removeMouseListener(this);                                 labels[indicex][indicey].disable();                             } else {                                 //Simbolo = "O";                                 labels[indicex][indicey].setText("X");                                 labels[indicex][indicey].setBackground(Color.BLUE);                                 labels[indicex][indicey].removeMouseListener(this);                                 labels[indicex][indicey].disable();                             }                              labels[indicex][indicey].setText(Simbolo);                             boolean jogadavalida = jogo.jogarJogador(numeroJogador, indicey, indicex);                               if(numeroJogador==1)                                  numeroJogador=2;                              else numeroJogador=1;                         }                     });                       } //segundo for             }         } 

}

Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: -1

Exception Not Working

I have an observer for sales_order_save_before

<?php      namespace Veratad\AgeVerification\Observer;      use Magento\Framework\ObjectManager\ObjectManager;     use Magento\Framework\Exception\CouldNotSaveException;      class ProcessOrder implements \Magento\Framework\Event\ObserverInterface {        protected $  _veratadCall;       protected $  customerSession;       protected $  _isExcluded;       private $  scopeConfig;        public function __construct(         \Veratad\AgeVerification\Model\Query\Api $  veratadCall,         \Veratad\AgeVerification\Model\Customer\Status $  isExcluded,         \Magento\Customer\Model\Session $  customerSession,         \Magento\Framework\App\Config\ScopeConfigInterface $  scopeConfig       ) {         $  this->_veratadCall = $  veratadCall;         $  this->_isExcluded = $  isExcluded;         $  this->customerSession = $  customerSession;         $  this->scopeConfig = $  scopeConfig;       }          public function execute(\Magento\Framework\Event\Observer $  observer ) {            /*           $  order = $  observer->getEvent()->getOrder();           $  customer = $  this->customerSession->getData();           $  billing = $  order->getBillingAddress()->getData();           $  shipping = $  order->getShippingAddress()->getData();           $  fail_text = $  this->scopeConfig->getValue('settings/content/agematch_fail', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);            $  writer = new \Zend\Log\Writer\Stream(BP . '/var/log/excluded.log');           $  logger = new \Zend\Log\Logger();           $  logger->addWriter($  writer);           //check to see if customer is excluded              $  excluded = $  this->_isExcluded->isExcluded($  customer);             $  logger->info($  excluded);            if(!$  excluded){             $  billing_verified = $  this->_veratadCall->veratadCaller($  billing);             $  logger->info('billing_verified' . $  billing_verified);             if (!$  billing_verified){               $  logger->info("billing not verified");             }         }         */              throw new \Magento\Framework\Exception\CouldNotSaveException(__('You can not place an order because you are not age verified.'));               //$  shipping_verified = $  this->_veratadCall->veratadCaller($  shipping);            //get billing shipping or both setting            //check attempts            //verify           }       } 

The custom message shows when the user is logged in, but throws the generic message if they are a guest. Does anyone know why this is happening?