[jira] Created: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

2007-09-28 Thread Julian Reschke (JIRA)
JCR2SPI: several performance improvements pointed out by Findbugs
-

 Key: JCR-1150
 URL: https://issues.apache.org/jira/browse/JCR-1150
 Project: Jackrabbit
  Issue Type: Improvement
  Components: SPI
Reporter: Julian Reschke
Priority: Minor


FindBug report:

M P Bx: Method 
org.apache.jackrabbit.jcr2spi.nodetype.BitsetENTCacheImpl.getBitNumber(QName) 
invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead  
   src/main/java/org/apache/jackrabbit/jcr2spi/nodetype
BitsetENTCacheImpl.java line 1771190981544656   1666284
M P Bx: Method 
org.apache.jackrabbit.jcr2spi.query.RowIteratorImpl$RowImpl.getValue(String) 
invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead  
src/main/java/org/apache/jackrabbit/jcr2spi/query   
RowIteratorImpl.javaline 2471190981544671   1666292
M P Bx: Method 
org.apache.jackrabbit.jcr2spi.WorkspaceManager.onEventReceived(EventBundle[], 
InternalEventListener[]) invokes inefficient Integer(int) constructor; use 
Integer.valueOf(int) insteadsrc/main/java/org/apache/jackrabbit/jcr2spi 
WorkspaceManager.java   line 6161190981544640   1666279
M P WMI: Method 
org.apache.jackrabbit.jcr2spi.name.NamespaceCache.syncNamespaces(Map) makes 
inefficient use of keySet iterator instead of entrySet iterator 
src/main/java/org/apache/jackrabbit/jcr2spi/nameNamespaceCache.java 
line 1931190981544656   1666283
M P WMI: Method 
org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistryImpl.internalRegister(Map)
 makes inefficient use of keySet iterator instead of entrySet iterator 
src/main/java/org/apache/jackrabbit/jcr2spi/nodetype
NodeTypeRegistryImpl.java   line 5241190981544656   1666285
M P WMI: Method 
org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl.onEvent(EventBundle)
 makes inefficient use of keySet iterator instead of entrySet iterator 
src/main/java/org/apache/jackrabbit/jcr2spi/observation 
ObservationManagerImpl.java line 1891190981544656   1666286
M P WMI: Method 
org.apache.jackrabbit.jcr2spi.state.NodeState.persisted(ChangeLog) makes 
inefficient use of keySet iterator instead of entrySet iterator
src/main/java/org/apache/jackrabbit/jcr2spi/state   NodeState.java  line 
2751190981544671   1666297


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: [jira] Created: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

2007-09-28 Thread Thomas Mueller
Hi,

I like FindBugs, and it would be great to have a good configuration in
subversion.
The same for PMD and Checkstyle. People can then use it or not, but
don't have to duplicate the setup.

> Integer(int) constructor; use Integer.valueOf(int) instead

This is Java 1.5. But what you could do is:

public class ObjectUtils {
public static Integer getInteger(int x) {
return new Integer(x); // NOPMD
}
}

Then change the code so this method is called instead of creating
Integer objects directly. Then if we switch to JDK 1.5, of if we want
to build our own cache, we have to change it only there.

> makes inefficient use of keySet iterator instead of entrySet iterator

This should be changed if possible.

Thomas


Re: [jira] Created: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

2007-09-28 Thread Julian Reschke

Thomas Mueller wrote:

Hi,

I like FindBugs, and it would be great to have a good configuration in
subversion.
The same for PMD and Checkstyle. People can then use it or not, but
don't have to duplicate the setup.


Integer(int) constructor; use Integer.valueOf(int) instead


This is Java 1.5. But what you could do is:


Oops. Thanks for pointing this out. Will fix.


public class ObjectUtils {
public static Integer getInteger(int x) {
return new Integer(x); // NOPMD
}
}

Then change the code so this method is called instead of creating
Integer objects directly. Then if we switch to JDK 1.5, of if we want
to build our own cache, we have to change it only there.


makes inefficient use of keySet iterator instead of entrySet iterator


This should be changed if possible.


Best regards, Julian