git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms
@ 2009-05-04 23:30 Shawn O. Pearce
  2009-05-04 23:30 ` [JGIT PATCH 2/7] Silence FindBugs "dubious use of GC" in PackFile.mmap Shawn O. Pearce
  2009-05-06 11:18 ` [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms Sohn, Matthias
  0 siblings, 2 replies; 8+ messages in thread
From: Shawn O. Pearce @ 2009-05-04 23:30 UTC (permalink / raw)
  To: Robin Rosenberg, Matthias Sohn; +Cc: git

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 org.spearce.jgit/.fbprefs |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/.fbprefs b/org.spearce.jgit/.fbprefs
index e97968b..d6f94c3 100644
--- a/org.spearce.jgit/.fbprefs
+++ b/org.spearce.jgit/.fbprefs
@@ -119,7 +119,7 @@ detectorWrongMapIterator=WrongMapIterator|true
 detectorXMLFactoryBypass=XMLFactoryBypass|true
 detector_threshold=2
 effort=default
-excludefilter0=findBugs\\FindBugsExcludeFilter.xml
+excludefilter0=findBugs/FindBugsExcludeFilter.xml
 filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,MT_CORRECTNESS,PERFORMANCE,STYLE|false
 filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY,EXPERIMENTAL|
 run_at_full_build=true
-- 
1.6.3.rc4.206.g03e16

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [JGIT PATCH 2/7] Silence FindBugs "dubious use of GC" in PackFile.mmap
  2009-05-04 23:30 [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms Shawn O. Pearce
@ 2009-05-04 23:30 ` Shawn O. Pearce
  2009-05-04 23:30   ` [JGIT PATCH 3/7] Fix FindBugs String == is bad form Shawn O. Pearce
  2009-05-06 11:18 ` [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms Sohn, Matthias
  1 sibling, 1 reply; 8+ messages in thread
From: Shawn O. Pearce @ 2009-05-04 23:30 UTC (permalink / raw)
  To: Robin Rosenberg, Matthias Sohn; +Cc: git

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../findBugs/FindBugsExcludeFilter.xml             |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/org.spearce.jgit/findBugs/FindBugsExcludeFilter.xml b/org.spearce.jgit/findBugs/FindBugsExcludeFilter.xml
index 526eb01..2af9348 100644
--- a/org.spearce.jgit/findBugs/FindBugsExcludeFilter.xml
+++ b/org.spearce.jgit/findBugs/FindBugsExcludeFilter.xml
@@ -6,4 +6,13 @@
        <Method name="refreshPackedRefs" />
        <Bug pattern="DM_STRING_CTOR" />
      </Match>
+
+     <!-- Silence PackFile.mmap calls GC, we need to force it to remove stale
+          memory mapped segments if the JVM heap is out of address space.
+       -->
+     <Match>
+       <Class name="org.spearce.jgit.lib.PackFile" />
+       <Method name="mmap" />
+       <Bug pattern="DM_GC" />
+     </Match>
 </FindBugsFilter>
-- 
1.6.3.rc4.206.g03e16

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [JGIT PATCH 3/7] Fix FindBugs String == is bad form
  2009-05-04 23:30 ` [JGIT PATCH 2/7] Silence FindBugs "dubious use of GC" in PackFile.mmap Shawn O. Pearce
@ 2009-05-04 23:30   ` Shawn O. Pearce
  2009-05-04 23:30     ` [JGIT PATCH 4/7] Fix FindBugs load known null value Shawn O. Pearce
  0 siblings, 1 reply; 8+ messages in thread
From: Shawn O. Pearce @ 2009-05-04 23:30 UTC (permalink / raw)
  To: Robin Rosenberg, Matthias Sohn; +Cc: git

We only used "a == b" to test for both values == null, as we can't
use a.equalsIgnoreCase if a is null.  Instead test for that null
case, and fall through for everything else.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../src/org/spearce/jgit/lib/RepositoryConfig.java |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
index 87fc254..cb287ee 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
@@ -1102,7 +1102,7 @@ boolean match(final String aBase, final String aExtendedBase,
 		}
 
 		private static boolean eq(final String a, final String b) {
-			if (a == b)
+			if (a == null && b == null)
 				return true;
 			if (a == null || b == null)
 				return false;
-- 
1.6.3.rc4.206.g03e16

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [JGIT PATCH 4/7] Fix FindBugs load known null value
  2009-05-04 23:30   ` [JGIT PATCH 3/7] Fix FindBugs String == is bad form Shawn O. Pearce
@ 2009-05-04 23:30     ` Shawn O. Pearce
  2009-05-04 23:30       ` [JGIT PATCH 5/7] FindBugs: Fix use of byte[].toString() in error messages Shawn O. Pearce
  0 siblings, 1 reply; 8+ messages in thread
From: Shawn O. Pearce @ 2009-05-04 23:30 UTC (permalink / raw)
  To: Robin Rosenberg, Matthias Sohn; +Cc: git

We know its null, so use the null constant instead of the null
variable here.  Either way is pretty clear to the reader, but
this form makes FindBugs be quiet.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../src/org/spearce/jgit/lib/ObjectDirectory.java  |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
index bcbdbb0..d3c43da 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java
@@ -314,9 +314,8 @@ private static boolean inList(final PackFile[] list, final PackFile pack) {
 
 	private PackFile[] packs() {
 		PackFile[] r = packList.get();
-		if (r == null) {
-			r = scanPacks(r);
-		}
+		if (r == null)
+			r = scanPacks(null);
 		return r;
 	}
 
-- 
1.6.3.rc4.206.g03e16

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [JGIT PATCH 5/7] FindBugs: Fix use of byte[].toString() in error messages
  2009-05-04 23:30     ` [JGIT PATCH 4/7] Fix FindBugs load known null value Shawn O. Pearce
@ 2009-05-04 23:30       ` Shawn O. Pearce
  2009-05-04 23:30         ` [JGIT PATCH 6/7] Make TransportLocal.StreamRewritingThread static Shawn O. Pearce
  0 siblings, 1 reply; 8+ messages in thread
From: Shawn O. Pearce @ 2009-05-04 23:30 UTC (permalink / raw)
  To: Robin Rosenberg, Matthias Sohn; +Cc: git

We meant to use typeString here, not encodedTypeString, as we want
a human-readable string form of the object type for display into
an exception message.  FindBugs caught us using a byte[] here and
not a string, resulting in a useless portion of the message text.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../src/org/spearce/jgit/transport/IndexPack.java  |    2 +-
 .../jgit/transport/WalkFetchConnection.java        |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
index 7881124..b2bcbb7 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
@@ -744,7 +744,7 @@ private void verifySafeObject(final AnyObjectId id, final int type,
 				objCheck.check(type, data);
 			} catch (CorruptObjectException e) {
 				throw new IOException("Invalid "
-						+ Constants.encodedTypeString(type) + " " + id.name()
+						+ Constants.typeString(type) + " " + id.name()
 						+ ":" + e.getMessage());
 			}
 		}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java
index 06b2c87..4d14305 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java
@@ -602,7 +602,7 @@ private void verifyLooseObject(final AnyObjectId id, final byte[] compressed)
 		if (!AnyObjectId.equals(id, idBuffer)) {
 			throw new TransportException("Incorrect hash for " + id.name()
 					+ "; computed " + idBuffer.name() + " as a "
-					+ Constants.encodedTypeString(uol.getType()) + " from "
+					+ Constants.typeString(uol.getType()) + " from "
 					+ compressed.length + " bytes.");
 		}
 		if (objCheck != null) {
@@ -610,7 +610,7 @@ private void verifyLooseObject(final AnyObjectId id, final byte[] compressed)
 				objCheck.check(uol.getType(), uol.getCachedBytes());
 			} catch (CorruptObjectException e) {
 				throw new TransportException("Invalid "
-						+ Constants.encodedTypeString(uol.getType()) + " "
+						+ Constants.typeString(uol.getType()) + " "
 						+ id.name() + ":" + e.getMessage());
 			}
 		}
-- 
1.6.3.rc4.206.g03e16

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [JGIT PATCH 6/7] Make TransportLocal.StreamRewritingThread static
  2009-05-04 23:30       ` [JGIT PATCH 5/7] FindBugs: Fix use of byte[].toString() in error messages Shawn O. Pearce
@ 2009-05-04 23:30         ` Shawn O. Pearce
  2009-05-04 23:30           ` [JGIT PATCH 7/7] FindBugs: Disable clone() idiom tests Shawn O. Pearce
  0 siblings, 1 reply; 8+ messages in thread
From: Shawn O. Pearce @ 2009-05-04 23:30 UTC (permalink / raw)
  To: Robin Rosenberg, Matthias Sohn; +Cc: git

This thread doesn't need access to the outer instance.

Noticed by FindBugs.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../org/spearce/jgit/transport/TransportLocal.java |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportLocal.java b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportLocal.java
index dae8951..cffdba1 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportLocal.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportLocal.java
@@ -363,7 +363,7 @@ public void close() {
 		}
 	}
 
-	class StreamRewritingThread extends Thread {
+	static class StreamRewritingThread extends Thread {
 		private final InputStream in;
 
 		StreamRewritingThread(final String cmd, final InputStream in) {
-- 
1.6.3.rc4.206.g03e16

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [JGIT PATCH 7/7] FindBugs: Disable clone() idiom tests
  2009-05-04 23:30         ` [JGIT PATCH 6/7] Make TransportLocal.StreamRewritingThread static Shawn O. Pearce
@ 2009-05-04 23:30           ` Shawn O. Pearce
  0 siblings, 0 replies; 8+ messages in thread
From: Shawn O. Pearce @ 2009-05-04 23:30 UTC (permalink / raw)
  To: Robin Rosenberg, Matthias Sohn; +Cc: git

We tend not to implement Cloneable, but instead define our own
form of clone() on objects that we want to permit making clones
of.  This is because Cloneable is a rather poor interface in
the JVM with its implicit field copying, but the method name
is the right name for us.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 org.spearce.jgit/.fbprefs |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/org.spearce.jgit/.fbprefs b/org.spearce.jgit/.fbprefs
index d6f94c3..81a0767 100644
--- a/org.spearce.jgit/.fbprefs
+++ b/org.spearce.jgit/.fbprefs
@@ -1,5 +1,5 @@
 #FindBugs User Preferences
-#Mon May 04 20:17:32 CEST 2009
+#Mon May 04 16:24:13 PDT 2009
 detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
 detectorBadAppletConstructor=BadAppletConstructor|false
 detectorBadResultSetAccess=BadResultSetAccess|true
@@ -10,7 +10,7 @@ detectorBooleanReturnNull=BooleanReturnNull|true
 detectorCallToUnsupportedMethod=CallToUnsupportedMethod|true
 detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
 detectorCheckTypeQualifiers=CheckTypeQualifiers|true
-detectorCloneIdiom=CloneIdiom|true
+detectorCloneIdiom=CloneIdiom|false
 detectorComparatorIdiom=ComparatorIdiom|true
 detectorConfusedInheritance=ConfusedInheritance|true
 detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
-- 
1.6.3.rc4.206.g03e16

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms
  2009-05-04 23:30 [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms Shawn O. Pearce
  2009-05-04 23:30 ` [JGIT PATCH 2/7] Silence FindBugs "dubious use of GC" in PackFile.mmap Shawn O. Pearce
@ 2009-05-06 11:18 ` Sohn, Matthias
  1 sibling, 0 replies; 8+ messages in thread
From: Sohn, Matthias @ 2009-05-06 11:18 UTC (permalink / raw)
  To: Shawn O. Pearce, Robin Rosenberg; +Cc: git

Shawn O. Pearce [mailto:spearce@spearce.org] wrote:
> Subject: [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX
> platforms
Thanks, I missed this. I reported this problem to FindBugs :
https://sourceforge.net/tracker/index.php?func=detail&aid=2787728&group_id=96405&atid=614693

--
Matthias

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-05-06 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-04 23:30 [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms Shawn O. Pearce
2009-05-04 23:30 ` [JGIT PATCH 2/7] Silence FindBugs "dubious use of GC" in PackFile.mmap Shawn O. Pearce
2009-05-04 23:30   ` [JGIT PATCH 3/7] Fix FindBugs String == is bad form Shawn O. Pearce
2009-05-04 23:30     ` [JGIT PATCH 4/7] Fix FindBugs load known null value Shawn O. Pearce
2009-05-04 23:30       ` [JGIT PATCH 5/7] FindBugs: Fix use of byte[].toString() in error messages Shawn O. Pearce
2009-05-04 23:30         ` [JGIT PATCH 6/7] Make TransportLocal.StreamRewritingThread static Shawn O. Pearce
2009-05-04 23:30           ` [JGIT PATCH 7/7] FindBugs: Disable clone() idiom tests Shawn O. Pearce
2009-05-06 11:18 ` [JGIT PATCH 1/7] Fix FindBugs exclude filter to work on UNIX platforms Sohn, Matthias

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).