Skip to content

Commit 81fb44d

Browse files
#796 - Changed to File.createTempFile()
1 parent 202d486 commit 81fb44d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/com/marklogic/client/example/cookbook/datamovement/BulkExportOpticResultsToWriter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.marklogic.client.example.cookbook.datamovement;
22

3+
import java.io.File;
34
import java.io.FileWriter;
45
import java.io.IOException;
56
import java.text.DateFormat;
@@ -59,7 +60,7 @@ public class BulkExportOpticResultsToWriter {
5960
private int batchSize = 3;
6061
private int threadCount = 3;
6162
private String schemaDB = "Schemas";
62-
private String outputFile = System.getProperty("java.io.tmpdir") + "opticExampleOutput.txt";
63+
private String outputFileName = "opticExampleOutput";
6364
private String customerTemplateFile = "/opticExample/customer.tdex";
6465
private String orderTemplateFile = "/opticExample/order.tdex";
6566
private DatabaseClient schemaDBclient = DatabaseClientSingleton.getAdmin(schemaDB);
@@ -199,7 +200,8 @@ private void exportWithOptic(int productID) throws IOException {
199200
// Create a Row manager to construct plans and query on
200201
// rows projected from the documents
201202
RowManager rowMgr = client.newRowManager();
202-
System.out.println("Writing the results to " + outputFile);
203+
File outputFile = File.createTempFile(outputFileName, ".txt");
204+
System.out.println("Writing the results to " + outputFile.getAbsolutePath());
203205
try (FileWriter writer = new FileWriter(outputFile)) {
204206
// Create a Function to pass to the OpticExportToWriterListener which
205207
// would take each batch and do the necessary optic operations and return

0 commit comments

Comments
 (0)