Skip to content

Commit

Permalink
"Can't write configuration" error if -printconfiguration config param…
Browse files Browse the repository at this point in the history
…eter is used without a value Guardsquare#263
  • Loading branch information
eschava committed Jul 8, 2022
1 parent 3f8d783 commit 3fe3989
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 3 additions & 2 deletions base/src/main/java/proguard/ConfigurationWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.logging.log4j.Logger;
import proguard.classfile.*;
import proguard.classfile.util.ClassUtil;
import proguard.optimize.Optimizer;
import proguard.util.*;

import java.io.*;
Expand All @@ -51,6 +50,7 @@ public class ConfigurationWriter implements AutoCloseable

private final PrintWriter writer;
private File baseDir;
private File file;


/**
Expand All @@ -60,6 +60,7 @@ public ConfigurationWriter(File configurationFile) throws IOException
{
this(PrintWriterUtil.createPrintWriterOut(configurationFile));

file = configurationFile;
baseDir = configurationFile.getParentFile();
}

Expand All @@ -79,7 +80,7 @@ public ConfigurationWriter(PrintWriter writer) throws IOException
@Override
public void close() throws IOException
{
PrintWriterUtil.closePrintWriter(baseDir, writer);
PrintWriterUtil.closePrintWriter(file, writer);
}


Expand Down
5 changes: 1 addition & 4 deletions base/src/main/java/proguard/ProGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import proguard.configuration.ConfigurationLoggingAdder;
import proguard.evaluation.IncompleteClassHierarchyException;
import proguard.configuration.InitialStateInfo;
import proguard.io.ExtraDataEntryNameMap;
import proguard.logging.Logging;
import proguard.mark.Marker;
import proguard.obfuscate.NameObfuscationReferenceFixer;
Expand Down Expand Up @@ -273,9 +272,7 @@ private void checkGpl()
*/
private void printConfiguration() throws IOException
{
PrintWriter pw = PrintWriterUtil.createPrintWriterOut(configuration.printConfiguration);

try (ConfigurationWriter configurationWriter = new ConfigurationWriter(pw))
try (ConfigurationWriter configurationWriter = new ConfigurationWriter(configuration.printConfiguration))
{
configurationWriter.write(configuration);
}
Expand Down

0 comments on commit 3fe3989

Please sign in to comment.