Skip to content

Commit e10c525

Browse files
Merge upstream 'master' branch from 'iipc/webarchive-commons'
2 parents 3628dda + 90d28d7 commit e10c525

15 files changed

+73
-278
lines changed

pom-cdh4.xml

Lines changed: 0 additions & 229 deletions
This file was deleted.

pom.xml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -135,30 +135,6 @@
135135
<artifactId>libidn</artifactId>
136136
<version>1.15</version>
137137
</dependency>
138-
<dependency>
139-
<groupId>it.unimi.dsi</groupId>
140-
<artifactId>dsiutils</artifactId>
141-
<version>2.7.3</version>
142-
<scope>compile</scope>
143-
<exclusions>
144-
<exclusion>
145-
<groupId>ch.qos.logback</groupId>
146-
<artifactId>logback-classic</artifactId>
147-
</exclusion>
148-
<!-- exclude the vulnerable commons-collections v3.2.1 -->
149-
<exclusion>
150-
<groupId>commons-collections</groupId>
151-
<artifactId>commons-collections</artifactId>
152-
</exclusion>
153-
</exclusions>
154-
</dependency>
155-
156-
<!-- explicitly require a patched commons-collections to avoid vulnerable v3.2.1 -->
157-
<dependency>
158-
<groupId>commons-collections</groupId>
159-
<artifactId>commons-collections</artifactId>
160-
<version>3.2.2</version>
161-
</dependency>
162138

163139
<dependency>
164140
<groupId>org.apache.httpcomponents</groupId>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// copied from fastutil, keeping the original package name to avoid breaking
2+
// compatibility with existing user code that implements this interface
3+
package it.unimi.dsi.fastutil.io;
4+
5+
/*
6+
* Copyright (C) 2005-2015 Sebastiano Vigna
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
* See the License for the specific language governing permissions and
18+
* limitations under the License.
19+
*/
20+
21+
22+
/** A basic interface specifying positioning methods for a byte stream.
23+
*
24+
* @author Sebastiano Vigna
25+
* @since 4.4
26+
*/
27+
28+
public interface RepositionableStream {
29+
30+
/** Sets the current stream position.
31+
*
32+
* @param newPosition the new stream position.
33+
*/
34+
void position( long newPosition ) throws java.io.IOException;
35+
36+
/** Returns the current stream position.
37+
*
38+
* @return the current stream position.
39+
*/
40+
long position() throws java.io.IOException;
41+
42+
}

src/main/java/org/archive/httpclient/HttpRecorderGetMethod.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@
7070
*
7171
* @author stack
7272
* @version $Revision$, $Date$
73+
* @deprecated Commons HttpClient 3 is end of life, this will be removed in webarchive-commons 2.0
7374
*/
75+
@Deprecated
7476
public class HttpRecorderGetMethod extends GetMethod {
7577

7678
protected static Logger logger =

src/main/java/org/archive/httpclient/HttpRecorderMethod.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
*
3535
* @author stack
3636
* @version $Revision$, $Date$
37+
* @deprecated Commons HttpClient 3 is end of life, this will be removed in webarchive-commons 2.0
3738
*/
39+
@Deprecated
3840
public class HttpRecorderMethod {
3941
protected static Logger logger =
4042
Logger.getLogger(HttpRecorderMethod.class.getName());

src/main/java/org/archive/httpclient/HttpRecorderPostMethod.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
*
3737
* @author stack
3838
* @version $Date$ $Revision$
39+
* @deprecated Commons HttpClient 3 is end of life, this will be removed in webarchive-commons 2.0
3940
*/
41+
@Deprecated
4042
public class HttpRecorderPostMethod extends PostMethod {
4143
/**
4244
* Instance of http recorder method.

src/main/java/org/archive/httpclient/SingleHttpConnectionManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
* with external mechanisms.
3333
*
3434
* @author gojomo
35+
* @deprecated Commons HttpClient 3 is end of life, this will be removed in webarchive-commons 2.0
3536
*/
37+
@Deprecated
3638
public class SingleHttpConnectionManager extends SimpleHttpConnectionManager {
3739

3840
public SingleHttpConnectionManager() {

src/main/java/org/archive/httpclient/ThreadLocalHttpConnectionManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
*
3737
* <b>Java &gt;= 1.4 is recommended.</b>
3838
*
39-
* @author Christian Kohlschuetter
39+
* @author Christian Kohlschuetter
40+
* @deprecated Commons HttpClient 3 is end of life, this will be removed in webarchive-commons 2.0
4041
*/
42+
@Deprecated
4143
public final class ThreadLocalHttpConnectionManager implements
4244
HttpConnectionManager {
4345

src/main/java/org/archive/io/ObjectPlusFilesOutputStream.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
*/
1919
package org.archive.io;
2020

21-
import java.io.File;
22-
import java.io.IOException;
23-
import java.io.ObjectOutputStream;
24-
import java.io.OutputStream;
21+
import java.io.*;
22+
import java.nio.file.Files;
2523
import java.util.LinkedList;
2624

2725
import org.archive.util.FileUtils;
@@ -116,19 +114,10 @@ public void snapshotAppendOnlyFile(File file) throws IOException {
116114
* @throws IOException
117115
*/
118116
private void hardlinkOrCopy(File file, File destination) throws IOException {
119-
// For Linux/UNIX, try a hard link first.
120-
Process link = Runtime.getRuntime().exec("ln "+file.getAbsolutePath()+" "+destination.getAbsolutePath());
121-
// TODO NTFS also supports hard links; add appropriate try
122117
try {
123-
link.waitFor();
124-
} catch (InterruptedException e) {
125-
// TODO Auto-generated catch block
126-
e.printStackTrace();
127-
}
128-
if(link.exitValue()!=0) {
129-
// hard link failed
118+
Files.createLink(destination.toPath(), file.toPath());
119+
} catch (UnsupportedEncodingException e) {
130120
FileUtils.copyFile(file,destination);
131121
}
132122
}
133-
134123
}

0 commit comments

Comments
 (0)