Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed May 6, 2016
2 parents d4a42aa + 42aa8b4 commit 80a0604
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Expand Up @@ -28,6 +28,7 @@
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -223,13 +224,15 @@ public void onClick(AjaxRequestTarget target) {
public File getObject() {
String home = getPageBase().getMidpointConfiguration().getMidpointHome();
File f = new File(home, "result");
DataOutputStream dos;
DataOutputStream dos = null;
try {
dos = new DataOutputStream(new FileOutputStream(f));

dos.writeBytes(OperationResultPanel.this.getModel().getObject().getXml());
} catch (IOException e) {
LOGGER.error("Could not download result: {}", e.getMessage(), e);
} finally {
IOUtils.closeQuietly(dos);
}

return f;
Expand Down
6 changes: 5 additions & 1 deletion model/model-impl/pom.xml
Expand Up @@ -127,7 +127,11 @@
<artifactId>security-api</artifactId>
<version>3.4-SNAPSHOT</version>
</dependency>


<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand Down
Expand Up @@ -49,6 +49,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.midpoint.xml.ns._public.model.scripting_3.ScriptingExpressionType;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.Validate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
Expand Down Expand Up @@ -1531,12 +1532,13 @@ public void importFromResource(String shadowOid, Task task, OperationResult pare
@Override
public void importObjectsFromFile(File input, ImportOptionsType options, Task task,
OperationResult parentResult) throws FileNotFoundException {
OperationResult result = parentResult.createSubresult(IMPORT_OBJECTS_FROM_FILE);
FileInputStream fis;
try {
OperationResult result = parentResult.createSubresult(IMPORT_OBJECTS_FROM_FILE);
FileInputStream fis = null;
try {
fis = new FileInputStream(input);
} catch (FileNotFoundException e) {
String msg = "Error reading from file "+input+": "+e.getMessage();
IOUtils.closeQuietly(fis);
String msg = "Error reading from file " + input + ": " + e.getMessage();
result.recordFatalError(msg, e);
throw e;
}
Expand All @@ -1549,7 +1551,7 @@ public void importObjectsFromFile(File input, ImportOptionsType options, Task ta
try {
fis.close();
} catch (IOException e) {
LOGGER.error("Error closing file "+input+": "+e.getMessage(), e);
LOGGER.error("Error closing file " + input + ": " + e.getMessage(), e);
}
}
result.computeStatus();
Expand Down

0 comments on commit 80a0604

Please sign in to comment.