Skip to content

Commit 7ab9293

Browse files
[MASSEMBLY-964] Fix initFile for FileLocation, UrlLocation
method FileLocation.initFile was private and can not be override in child class
1 parent 8fba93d commit 7ab9293

File tree

4 files changed

+99
-10
lines changed

4 files changed

+99
-10
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0"
21+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<groupId>org.apache.maven.plugins.assembly.it</groupId>
26+
<artifactId>massembly964</artifactId>
27+
<version>0.0.1-SNAPSHOT</version>
28+
<packaging>pom</packaging>
29+
30+
<properties>
31+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
32+
</properties>
33+
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>org.apache.maven.plugins</groupId>
38+
<artifactId>maven-assembly-plugin</artifactId>
39+
<version>@project.version@</version>
40+
<dependencies>
41+
<dependency>
42+
<groupId>org.apache.apache.resources</groupId>
43+
<artifactId>apache-source-release-assembly-descriptor</artifactId>
44+
<version>1.0.6</version>
45+
</dependency>
46+
</dependencies>
47+
<executions>
48+
<execution>
49+
<id>source-release-assembly</id>
50+
<phase>package</phase>
51+
<goals>
52+
<goal>single</goal>
53+
</goals>
54+
<configuration>
55+
<runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
56+
<descriptorRefs>
57+
<descriptorRef>source-release</descriptorRef>
58+
</descriptorRefs>
59+
<tarLongFileMode>posix</tarLongFileMode>
60+
</configuration>
61+
</execution>
62+
</executions>
63+
</plugin>
64+
</plugins>
65+
</build>
66+
</project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
def sourceRelease = new File( basedir, "target/massembly964-0.0.1-SNAPSHOT-source-release.zip" )
21+
22+
assert sourceRelease.isFile()
23+
assert sourceRelease.length() > 0

src/main/java/org/apache/maven/plugins/assembly/io/FileLocation.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class FileLocation
5858
this.specification = specification;
5959
}
6060

61-
/** {@inheritDoc} */
61+
@Override
6262
public void close()
6363
{
6464
if ( ( channel != null ) && channel.isOpen() )
@@ -86,7 +86,7 @@ public void close()
8686
}
8787
}
8888

89-
/** {@inheritDoc} */
89+
@Override
9090
public File getFile()
9191
throws IOException
9292
{
@@ -107,7 +107,7 @@ File unsafeGetFile()
107107
* initialize file.
108108
* @throws IOException in case of error
109109
*/
110-
private void initFile()
110+
protected void initFile()
111111
throws IOException
112112
{
113113
if ( file == null )
@@ -129,13 +129,13 @@ protected void setFile( File file )
129129
this.file = file;
130130
}
131131

132-
/** {@inheritDoc} */
132+
@Override
133133
public String getSpecification()
134134
{
135135
return specification;
136136
}
137137

138-
/** {@inheritDoc} */
138+
@Override
139139
public void open()
140140
throws IOException
141141
{
@@ -148,23 +148,23 @@ public void open()
148148
}
149149
}
150150

151-
/** {@inheritDoc} */
151+
@Override
152152
public int read( ByteBuffer buffer )
153153
throws IOException
154154
{
155155
open();
156156
return channel.read( buffer );
157157
}
158158

159-
/** {@inheritDoc} */
159+
@Override
160160
public int read( byte[] buffer )
161161
throws IOException
162162
{
163163
open();
164164
return channel.read( ByteBuffer.wrap( buffer ) );
165165
}
166166

167-
/** {@inheritDoc} */
167+
@Override
168168
public InputStream getInputStream()
169169
throws IOException
170170
{

src/main/java/org/apache/maven/plugins/assembly/io/URLLocation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class URLLocation
5959
this.tempFileDeleteOnExit = tempFileDeleteOnExit;
6060
}
6161

62-
/** {@inheritDoc} */
63-
void initFile()
62+
@Override
63+
protected void initFile()
6464
throws IOException
6565
{
6666
if ( unsafeGetFile() == null )

0 commit comments

Comments
 (0)