Skip to content

Commit 1488fd4

Browse files
committed
set user-agent as intended #146
The initialization of the Wiki.java session in Session.java was overwritten by the one in Main.java. This change removes the initialization in Session.java entierly. Side effects: - added logging of the user agent
1 parent b5117ad commit 1488fd4

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/pattypan/Main.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public static void main(String[] args) {
8585
);
8686

8787
Session.WIKI = Wiki.newSession(wiki, scriptPath, protocol);
88+
Session.WIKI.setUserAgent(Settings.USERAGENT);
89+
Session.LOGGER.log(Level.INFO, "User-Agent: {0}", Session.WIKI.getUserAgent());
8890
launch(args);
8991
}
9092
}

src/pattypan/Session.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,12 @@ public final class Session {
4646

4747
public static Logger LOGGER = new LogManager().logger;
4848

49+
public static Wiki WIKI;
50+
4951
public static String METHOD = "template";
5052
public static String TEMPLATE = "Artwork";
5153
public static String WIKICODE = "";
5254
public static ArrayList<String> VARIABLES = new ArrayList<>(Arrays.asList("path", "name"));
5355

54-
public static Wiki WIKI = Wiki.newSession("commons.wikimedia.org");
5556
public static ArrayList<UploadElement> FILES_TO_UPLOAD = new ArrayList<>();
56-
57-
static {
58-
WIKI.setUserAgent(Settings.USERAGENT);
59-
}
6057
}

0 commit comments

Comments
 (0)