Kaydet (Commit) 1fba1fea authored tarafından rbuj's avatar rbuj Kaydeden (comit) Noel Grandin

scripting: the assigned value is never used

Change-Id: I61dcf285ecc6d0affdb949ca03d686f96601d884
Reviewed-on: https://gerrit.libreoffice.org/11319Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst ce53d3d2
...@@ -187,7 +187,7 @@ public class UCBStreamHandler extends URLStreamHandler { ...@@ -187,7 +187,7 @@ public class UCBStreamHandler extends URLStreamHandler {
private InputStream getFileStreamFromJarStream(String file, InputStream is) private InputStream getFileStreamFromJarStream(String file, InputStream is)
throws IOException throws IOException
{ {
ZipEntry entry = null; ZipEntry entry;
ZipInputStream zis = new ZipInputStream(is); ZipInputStream zis = new ZipInputStream(is);
......
...@@ -361,54 +361,55 @@ public abstract class ScriptProvider ...@@ -361,54 +361,55 @@ public abstract class ScriptProvider
public ScriptMetaData getScriptData( /*IN*/String scriptURI ) throws ScriptFrameworkErrorException public ScriptMetaData getScriptData( /*IN*/String scriptURI ) throws ScriptFrameworkErrorException
{ {
ParsedScriptUri details = null;
try try
{ {
details = m_container.parseScriptUri( scriptURI ); ParsedScriptUri details = m_container.parseScriptUri( scriptURI );
ScriptMetaData scriptData = m_container.findScript( details ); try
if ( scriptData == null ) {
ScriptMetaData scriptData = m_container.findScript(details);
if (scriptData == null)
{ {
throw new ScriptFrameworkErrorException( details.function + " does not exist", throw new ScriptFrameworkErrorException(details.function + " does not exist",
null, details.function, language, ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); null, details.function, language, ScriptFrameworkErrorType.NO_SUCH_SCRIPT);
} }
return scriptData; return scriptData;
} }
catch ( com.sun.star.lang.IllegalArgumentException ila ) catch (com.sun.star.container.NoSuchElementException nse)
{
// TODO specify the correct error Type
ScriptFrameworkErrorException e2 =
new ScriptFrameworkErrorException(
ila.getMessage(), null, scriptURI, language,
ScriptFrameworkErrorType.UNKNOWN );
e2.initCause( ila );
throw e2;
}
catch ( com.sun.star.container.NoSuchElementException nse )
{ {
ScriptFrameworkErrorException e2 = ScriptFrameworkErrorException e2
new ScriptFrameworkErrorException( = new ScriptFrameworkErrorException(
nse.getMessage(), null, details.function, language, nse.getMessage(), null, details.function, language,
ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); ScriptFrameworkErrorType.NO_SUCH_SCRIPT);
e2.initCause( nse ); e2.initCause(nse);
throw e2; throw e2;
} }
catch ( com.sun.star.lang.WrappedTargetException wta ) catch (com.sun.star.lang.WrappedTargetException wta)
{ {
// TODO specify the correct error Type // TODO specify the correct error Type
Exception wrapped = (Exception)wta.TargetException; Exception wrapped = (Exception) wta.TargetException;
String message = wta.getMessage(); String message = wta.getMessage();
if ( wrapped != null ) if (wrapped != null)
{ {
message = wrapped.getMessage(); message = wrapped.getMessage();
} }
ScriptFrameworkErrorException e2 = ScriptFrameworkErrorException e2
new ScriptFrameworkErrorException( = new ScriptFrameworkErrorException(
message, null, details.function, language, message, null, details.function, language,
ScriptFrameworkErrorType.UNKNOWN ); ScriptFrameworkErrorType.UNKNOWN);
e2.initCause( wta ); e2.initCause(wta);
throw e2;
}
}
catch (com.sun.star.lang.IllegalArgumentException ila)
{
// TODO specify the correct error Type
ScriptFrameworkErrorException e2
= new ScriptFrameworkErrorException(
ila.getMessage(), null, scriptURI, language,
ScriptFrameworkErrorType.UNKNOWN);
e2.initCause(ila);
throw e2; throw e2;
} }
} }
......
...@@ -61,10 +61,9 @@ public class ScriptProviderForBeanShell ...@@ -61,10 +61,9 @@ public class ScriptProviderForBeanShell
throws com.sun.star.uno.RuntimeException, throws com.sun.star.uno.RuntimeException,
ScriptFrameworkErrorException ScriptFrameworkErrorException
{ {
ScriptMetaData scriptData = null; ScriptMetaData scriptData = getScriptData( scriptURI );
try try
{ {
scriptData = getScriptData( scriptURI );
ScriptImpl script = new ScriptImpl( m_xContext, scriptData, m_xModel, m_xInvocContext ); ScriptImpl script = new ScriptImpl( m_xContext, scriptData, m_xModel, m_xInvocContext );
return script; return script;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment