Package com.art.anette.exceptions

Examples of com.art.anette.exceptions.LoginFailedException


            if (t instanceof LoginFailedException) {
                throw (LoginFailedException) t;
            } else if (t instanceof DBDirtyException) {
                throw (DBDirtyException) t;
            } else {
                throw new LoginFailedException("Login response undefined!");
            }
        } else if (response instanceof DataResponse) {
            DataResponse dataResponse = (DataResponse) response;
            if (dataResponse.getObjects().size() != 1) {
                fireEvent(NetworkEvent.NEType.loginError);
                throw new LoginFailedException("Login response undefined!");
            }
            Object obj = dataResponse.getObjects().get(0);
            if (!(obj instanceof Employee)) {
                fireEvent(NetworkEvent.NEType.loginError);
                throw new LoginFailedException("Login response undefined!");
            }
            Employee employee = (Employee) obj;

            {
                final List<ClientLogRecord> list = SerializingReportHandler.getInstance().read();
                for (ClientLogRecord clientLogRecord : list) {
                    final Response o1 = synchroneousRequest(clientLogRecord);
                    if (!(o1 instanceof VoidResponse)) {
                        fireEvent(NetworkEvent.NEType.loginError);
                        throw new LoginFailedException("Problem sending exception to the server.");
                    }
                }
                SerializingReportHandler.getInstance().clear();
                if (!list.isEmpty()) {
                    logger.info(String.format("Sent %d exceptions to the server.", list.size()));
                }
            }
            setStreams();

            fireEvent(NetworkEvent.NEType.loggedIn, employee.getEmail());
            return employee;

        } else {
            fireEvent(NetworkEvent.NEType.loginError);
            throw new LoginFailedException("Login response undefined!");
        }
    }
View Full Code Here


                Employee e = new Employee(null, rs);
                rs.close();
                return e;
            } else {
                rs.close();
                throw new LoginFailedException("Incorrect login or password!");
            }

        } catch (SQLException ex) {
            logger.severe(null, ex);
            //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException
            throw new LoginFailedException("Error while checking logindata!");
        }
    }
View Full Code Here

                " tries to login; client version " + loginRequest.clientVersion);
        try {
            employee = LowLevelLogic.getInstance().login(loginRequest);
            if (employee.isDisabled()) {
                logger.info("User " + employee.getName() + " tried to login but is disabled");
                throw new LoginFailedException("Your account is disabled");
            }
            if (SDBCPool.getInstance().isOnline(employee.getId())) {
                ClientThread other = NetworkControl.getInstance().findClientByEmployee(employee);
                logger.info("There is another connection from " + other.socket.getInetAddress().getHostName());
                boolean alive = other.ping();
                if (alive) {
                    throw new LoginFailedException("Already logged in!");
                } else {
                    logger.info("The other connection is dead so let's continue.");
                }
                if (SDBCPool.getInstance().isOnline(employee.getId())) {
                    logger.severe("The other connection is still in the books.");
                    throw new LoginFailedException("Already logged in!");
                }
            }
            logger.info(loginRequest.email + " logged in.");
            sdbc = new ServerDBControl(employee, this, id);
        } catch (LoginFailedException lfe) {
View Full Code Here

TOP

Related Classes of com.art.anette.exceptions.LoginFailedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.