Skip to content

Commit 53e89dd

Browse files
authored
Merge branch 'master' into publicMessageQueue
2 parents b3800bc + e612ee6 commit 53e89dd

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

quickfixj-core/src/main/doc/usermanual/usage/configuration.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ <H3>QuickFIX Settings</H3>
283283
<TD> Valid XML data dictionary file, QuickFIX/J comes with the following defaults in the <code>etc</code> directory:
284284
FIXT11.xml, FIX50.xml, FIX44.xml, FIX43.xml, FIX42.xml, FIX41.xml, FIX40.xml.
285285
</TD>
286-
<TD>If DataDictionary is not specified and UserDataDictionary=Y, then QuickFIX/J will look for a
286+
<TD>If DataDictionary is not specified and UseDataDictionary=Y, then QuickFIX/J will look for a
287287
default dictionary based on the session's BeginString (e.g., FIX.4.2 = FIX42.xml). The DataDictionary
288288
file search strategy is to use a URL, then the file system, and then the thread context classloader (if any),
289289
and then the DataDictionary instance's classloader. Default data dictionary files
@@ -1267,7 +1267,7 @@ <H3>QuickFIX Settings</H3>
12671267
<TR ALIGN="left" VALIGN="middle">
12681268
<TD> <I>ResendRequestChunkSize</I> </TD>
12691269
<TD> Setting to limit the size of a resend request in case of missing messages.
1270-
This is useful when the remote FIX engine does not allow to ask for more than n message for a ResendRequest.
1270+
This is useful when the remote FIX engine does not allow to ask for more than n message for a ResendRequest. It also allows you to prevent a 'self-DDOS' by accidentally requesting a huge flood of messages your system isn't capable of processing if you are substantially behind for some reason.
12711271
<P>
12721272
E.g. if the ResendRequestChunkSize is set to 5 and a gap of 7 messages is detected,
12731273
a first resend request will be sent for 5 messages.

quickfixj-core/src/main/java/quickfix/FileUtil.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
import java.io.FileNotFoundException;
2525
import java.io.IOException;
2626
import java.io.InputStream;
27+
import java.net.HttpURLConnection;
2728
import java.net.URL;
29+
import java.net.URLConnection;
30+
2831

2932
public class FileUtil {
3033
public static String fileAppendPath(String pathPrefix, String pathSuffix) {
@@ -141,7 +144,18 @@ public static InputStream open(Class<?> clazz, String name, Location... location
141144
break;
142145
case URL:
143146
try {
144-
in = new URL(name).openStream();
147+
URL url = new URL(name);
148+
URLConnection urlConnection = url.openConnection();
149+
if (urlConnection instanceof HttpURLConnection) {
150+
HttpURLConnection httpURLConnection = (HttpURLConnection)urlConnection;
151+
httpURLConnection.setRequestProperty("User-Agent", "Java-QuickFIXJ-FileUtil");
152+
httpURLConnection.connect();
153+
in = httpURLConnection.getInputStream();
154+
} else {
155+
if (urlConnection != null) {
156+
in = urlConnection.getInputStream();
157+
}
158+
}
145159
} catch (IOException e) {
146160
// ignore
147161
}

quickfixj-core/src/test/java/quickfix/FileUtilTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ public void testURLLocation() throws Exception {
6767
}
6868
}
6969

70+
@Test
71+
public void testJARURLLocation() throws Exception {
72+
// just test that we don't run into a ClassCastException
73+
InputStream in = FileUtil.open(Message.class, "jar:file:/foo.bar!/");
74+
if (in != null) {
75+
in.close();
76+
}
77+
}
78+
7079
@Test
7180
// QFJ-775
7281
public void testSessionIDFileName() {

0 commit comments

Comments
 (0)