Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Can't write configuration" error if -printconfiguration config parameter is used without a value #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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