GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix unclosed opened stream · mojohaus/mrm@ce8e541

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • mrm-servlet/src
    • main/java/org/codehaus/mojo/mrm/impl/maven
      • ArtifactStoreFileSystem.java
    • test/java/org/codehaus/mojo/mrm/impl/maven
      • ArtifactStoreFileSystemTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎mrm-servlet/src/main/java/org/codehaus/mojo/mrm/impl/maven/ArtifactStoreFileSystem.java‎

Copy file name to clipboardExpand all lines: mrm-servlet/src/main/java/org/codehaus/mojo/mrm/impl/maven/ArtifactStoreFileSystem.java
+9-13Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ public ArtifactStoreFileSystem( ArtifactStore store )
126126
this.store = store;
127127
}
128128

129-
/**
130-
* {@inheritDoc}
131-
*/
129+
@Override
132130
public Entry[] listEntries( DirectoryEntry directory )
133131
{
134132
if ( getRoot().equals( directory ) )
@@ -164,7 +162,6 @@ public Entry[] listEntries( DirectoryEntry directory )
164162
String groupId = path.replace( '/', '.' );
165163

166164
// get all the groupId's that start with this groupId
167-
String groupIdPrefix = groupId + ".";
168165
Set<String> groupIds = new TreeSet<>( store.getGroupIds( groupId ) );
169166
for ( String name : groupIds )
170167
{
@@ -223,9 +220,7 @@ public Entry[] listEntries( DirectoryEntry directory )
223220
return result.toArray(new Entry[0]);
224221
}
225222

226-
/**
227-
* {@inheritDoc}
228-
*/
223+
@Override
229224
protected Entry get( DirectoryEntry parent, String name )
230225
{
231226
String path = "/";
@@ -299,7 +294,8 @@ else if ( ARCHETYPE_CATALOG.matcher( path ).matches() )
299294
matcher.group( 10 ) );
300295
try
301296
{
302-
store.get( artifact );
297+
// check if artifact exist
298+
store.getSize( artifact );
303299
return new ArtifactFileEntry( this, parent, artifact, store );
304300
}
305301
catch ( IOException | ArtifactNotFoundException e )
@@ -325,7 +321,8 @@ else if ( ARCHETYPE_CATALOG.matcher( path ).matches() )
325321
matcher.group( 10 ), timestamp, buildNumber );
326322
try
327323
{
328-
store.get( artifact );
324+
// check if artifact exist
325+
store.getSize( artifact );
329326
return new ArtifactFileEntry( this, parent, artifact, store );
330327
}
331328
catch ( IOException | ArtifactNotFoundException e )
@@ -360,7 +357,8 @@ else if ( ARCHETYPE_CATALOG.matcher( path ).matches() )
360357
Artifact artifact = new Artifact( groupId, artifactId, version, classifier, type );
361358
try
362359
{
363-
store.get( artifact );
360+
// check if artifact exist
361+
store.getSize( artifact );
364362
return new ArtifactFileEntry( this, parent, artifact, store );
365363
}
366364
catch ( ArtifactNotFoundException | IOException e )
@@ -376,9 +374,7 @@ else if ( ARCHETYPE_CATALOG.matcher( path ).matches() )
376374
}
377375
}
378376

379-
/**
380-
* {@inheritDoc}
381-
*/
377+
@Override
382378
public long getLastModified( DirectoryEntry entry )
383379
throws IOException
384380
{
Collapse file

‎mrm-servlet/src/test/java/org/codehaus/mojo/mrm/impl/maven/ArtifactStoreFileSystemTest.java‎

Copy file name to clipboardExpand all lines: mrm-servlet/src/test/java/org/codehaus/mojo/mrm/impl/maven/ArtifactStoreFileSystemTest.java
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public class ArtifactStoreFileSystemTest
4040

4141
@Test
4242
public void testGroupMetadataRegex()
43-
throws Exception
4443
{
4544
Matcher matcher = ArtifactStoreFileSystem.METADATA.matcher( "/commons/maven-metadata.xml" );
4645
assertTrue( matcher.matches() );
@@ -56,7 +55,6 @@ public void testGroupMetadataRegex()
5655

5756
@Test
5857
public void testArtifactRegex()
59-
throws Exception
6058
{
6159
Matcher matcher = ArtifactStoreFileSystem.ARTIFACT.matcher( "/commons/maven-metadata.xml" );
6260
assertFalse( matcher.matches() );
@@ -109,7 +107,6 @@ public void testArtifactRegex()
109107

110108
@Test
111109
public void testSnapshotArtifactRegex()
112-
throws Exception
113110
{
114111
Matcher matcher = ArtifactStoreFileSystem.SNAPSHOT_ARTIFACT.matcher( "/commons/maven-metadata.xml" );
115112
assertFalse( matcher.matches() );
@@ -159,7 +156,7 @@ public void testSnapshotArtifactRegex()
159156
public void testSiteXmlReleaseVersion() throws Exception
160157
{
161158
ArtifactStore store = mock( ArtifactStore.class );
162-
when( store.get( isA( Artifact.class ) ) ).thenThrow( ArtifactNotFoundException.class );
159+
when( store.getSize( isA( Artifact.class ) ) ).thenThrow( ArtifactNotFoundException.class );
163160
ArtifactStoreFileSystem system = new ArtifactStoreFileSystem( store );
164161
FileEntry entry = (FileEntry) system.get( "/localhost/mmockrm-5/1/mmockrm-5-1-site_en.xml" );
165162
assertNull( entry );
@@ -169,7 +166,7 @@ public void testSiteXmlReleaseVersion() throws Exception
169166
public void testSiteXmlSnapshotVersion() throws Exception
170167
{
171168
ArtifactStore store = mock( ArtifactStore.class );
172-
when( store.get( isA( Artifact.class ) ) ).thenThrow( ArtifactNotFoundException.class );
169+
when( store.getSize( isA( Artifact.class ) ) ).thenThrow( ArtifactNotFoundException.class );
173170
ArtifactStoreFileSystem system = new ArtifactStoreFileSystem( store );
174171
FileEntry entry = (FileEntry) system.get( "/localhost/mmockrm-5/1.0-SNAPSHOT/mmockrm-5-1.0-SNAPSHOT-site_en.xml" );
175172
assertNull( entry );

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.