[RESOLVED] Code Style Wrapping

The code style doesn't seem to force wrapping in all cases.

If I take the code from here as an example
http://www.javacoffeebreak.com/articles/javarmi/javarmi.html
e.g.

     // Calculate the power of a number
    public BigInteger power ( int num1, int num2)
    throws RemoteException
    {
        String numrep = String.valueOf(num1);
        BigInteger bi = new BigInteger (numrep);
bi = bi.pow(num2);
return bi;
    }
    public static void main ( String args[] ) throws Exception
    {
        // Assign a security manager, in the event that dynamic
// classes are loaded
        if (System.getSecurityManager() == null)
            System.setSecurityManager ( new RMISecurityManager() );
        // Create an instance of our power service server ...
        PowerServiceServer svr = new PowerServiceServer();
        // ... and bind it with the RMI Registry
        Naming.bind ("PowerService", svr);
        System.out.println ("Service bound....");
    }


I can reformat it so that it aligns nicely and braces are forced (see if statements in second method).
However, I can't seem to force the throws statement onto the same line as the method (see first method)

    // Calculate the power of a number
    public BigInteger power(int num1, int num2)
            throws RemoteException {
        String numrep = String.valueOf(num1);
        BigInteger bi = new BigInteger(numrep);
        bi = bi.pow(num2);
        return bi;
    }
    public static void main(String args[]) throws Exception {
        // Assign a security manager, in the event that dynamic
        // classes are loaded
        if (System.getSecurityManager() == null) {
            System.setSecurityManager(new RMISecurityManager());
        }
        // Create an instance of our power service server ...
        PowerServiceServer svr = new PowerServiceServer();
        // ... and bind it with the RMI Registry
        Naming.bind("PowerService", svr);
        System.out.println("Service bound....");
    }

0
3 comments

Taking a more straightforward example from here
http://www.novell.com/documentation/extend52/Docs/help/MP/jms/tutorial/pointToPoint-1.htm

I would expect this

        // lookup the queue connection factory
        QueueConnectionFactory connFactory = (QueueConnectionFactory) ctx.
                lookup("queue/connectionFactory");


to be reformatted like this

        // lookup the queue connection factory
        QueueConnectionFactory connFactory = (QueueConnectionFactory) ctx.lookup("queue/connectionFactory");


Is that not a reasonable expectation?

0
Avatar
Permanently deleted user

Your right margin setting is too low.

When right margin is set to 200 for example :

    TransactionRolledbackException t = (TransactionRolledbackException)
       new HashMap().get(
         new TransactionRolledbackException());



gets reformatted to :


TransactionRolledbackException t = (TransactionRolledbackException) new HashMap().get(new TransactionRolledbackException());


PS : the code doesn't work, just needed a long line

0

That combined with removing Keep When Reformating "Line breaks"  in Alignement and Braces fixed it.
Thanks.

0

Please sign in to leave a comment.