Skip to content

Commit

Permalink
Merge branch 'release/1.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tizianolattisi committed Sep 28, 2018
2 parents b481ff2 + e882441 commit bc3fbe4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.axiastudio</groupId>
<artifactId>ooops</artifactId>
<version>0.9</version>
<version>1.0</version>

<build>
<plugins>
Expand Down
28 changes: 19 additions & 9 deletions src/main/java/com/axiastudio/ooops/Ooops.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ public OutputStream stream(){
return outStream;
} catch (com.sun.star.io.IOException ex) {
Logger.getLogger(Ooops.class.getName()).log(Level.SEVERE, null, ex);
} finally {
close();
}
return null;
}
Expand All @@ -403,6 +405,8 @@ public Boolean toUrl(String storeUrl){
return true;
} catch (com.sun.star.io.IOException ex) {
Logger.getLogger(Ooops.class.getName()).log(Level.SEVERE, null, ex);
} finally {
close();
}
return null;
}
Expand All @@ -413,26 +417,32 @@ public Boolean toStream(OutputStream outputStream){
return Boolean.TRUE;
} catch (java.io.IOException e) {
e.printStackTrace();
} finally {
close();
}
return Boolean.FALSE;
}

public byte[] toByteArray() {
OoopsOutputStream stream = (OoopsOutputStream) stream();
close();
return stream.toByteArray();
}


private void disposeComponent() {
XCloseable closeable = UnoRuntime.queryInterface(XCloseable.class, component);
if (closeable != null) {
try {
closeable.close(true);
} catch (CloseVetoException e) {
}
private void close() {
XModel model = UnoRuntime.queryInterface(XModel.class, component);
if (model!=null) {
XCloseable closeable = UnoRuntime.queryInterface(XCloseable.class, model);
if (closeable != null) {
try {
closeable.close(true);
} catch (CloseVetoException e) {

} else {
component.dispose();
}
} else {
component.dispose();
}
}
}

Expand Down

0 comments on commit bc3fbe4

Please sign in to comment.