From: <prn...@us...> - 2011-09-04 20:01:42
|
Revision: 8493 http://octave.svn.sourceforge.net/octave/?rev=8493&view=rev Author: prnienhuis Date: 2011-09-04 20:01:36 +0000 (Sun, 04 Sep 2011) Log Message: ----------- Always allow interface rediscovery if no ods/xls support was found; fixed statement order in Java detection stanzas Modified Paths: -------------- trunk/octave-forge/main/io/inst/odsopen.m trunk/octave-forge/main/io/inst/xlsopen.m Modified: trunk/octave-forge/main/io/inst/odsopen.m =================================================================== --- trunk/octave-forge/main/io/inst/odsopen.m 2011-09-04 12:38:43 UTC (rev 8492) +++ trunk/octave-forge/main/io/inst/odsopen.m 2011-09-04 20:01:36 UTC (rev 8493) @@ -87,8 +87,10 @@ ## 2011-05-18 Creating new spreadsheet docs in UNO now works ## 2011-06-06 Tamed down interface verbosity on first startup ## " Multiple requested interfaces now possible +## 2011-09-03 Reset chkintf if no ods support was found to allow full interface rediscovery +## (otherwise javaclasspath additions will never be picked up) ## -## Latest change on subfunction below: 2011-05-07 +## Latest change on subfunction below: 2011-09-03 function [ ods ] = odsopen (filename, rw=0, reqinterface=[]) @@ -316,7 +318,7 @@ if (ods.changed == 1) ods.changed = 0; endif endif - if (~isempty (reqinterface)) + if (~isempty (reqinterface) || ~odssupport) # Reset all found interfaces for re-testing in the next call. Add interfaces if needed. chkintf = []; endif @@ -383,6 +385,8 @@ ## 2011-06-06 Fix for javaclasspath format in *nix w. java-1.2.8 pkg ## " Implemented more rigid Java check ## " Tamed down verbosity +## 2011-09-03 Fixed order of odsinterfaces.<member> statement in Java detection try-catch +## " Reset tmp1 (always allow interface rediscovery) for empty odsinterfaces arg function [odsinterfaces] = getodsinterfaces (odsinterfaces) @@ -390,8 +394,11 @@ persistent tmp1 = []; persistent jcp; if (isempty (odsinterfaces.OTK) && isempty (odsinterfaces.JOD) && isempty (odsinterfaces.UNO)) + # Assume no interface detection has happened yet printf ("Detected interfaces: "); + tmp1 = []; elseif (isempty (odsinterfaces.OTK) || isempty (odsinterfaces.JOD) || isempty (odsinterfaces.UNO)) + # At least one interface is requested by user tmp1 = []; endif deflt = 0; @@ -410,19 +417,19 @@ endif # Now check for proper entries in class path. Under *nix the classpath # must first be split up. In java 1.2.8+ javaclasspath is already a cell array - if (isunix && ~iscell (jcp)) jcp = strsplit (char (jcp), pathsep ()); endif + if (isunix && ~iscell (jcp)), jcp = strsplit (char (jcp), pathsep ()); endif tmp1 = 1; catch # No Java support - odsinterfaces.OTK = 0; - odsinterfaces.JOD = 0; - odsinterfaces.UNO = 0; if ~(isempty (odsinterfaces.OTK) && isempty (odsinterfaces.JOD) && isempty (odsinterfaces.UNO)) # Some Java-based interface requested but Java support is absent error ('No Java support found.'); else - # No specific Java-based interface requested. Just return (This is needed if - # ever a non-Java based interfaces will be implemented + # No specific Java-based interface requested. Just return (needed for if + # ever a non-Java based interfaces will be implemented) + odsinterfaces.OTK = 0; + odsinterfaces.JOD = 0; + odsinterfaces.UNO = 0; return; endif end_try_catch @@ -491,9 +498,6 @@ odsinterfaces.UNO = 0; # entries(1) = not a jar but a directory (<000_install_dir/program/>) jpchk = 0; entries = {'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'}; - # Only under *nix we might use brute force: e.g., strfind (javaclasspath, classname) - # as javaclasspath is one long string. Under Windows however classpath is a cell array - # so we need the following more subtle, platform-independent approach: for jj=1:numel (entries) for ii=1:numel (jcp) jcplst = strsplit (jcp{ii}, filesep); @@ -508,7 +512,7 @@ printf ("UNO"); if (deflt), printf ("; "); else, printf ("*; "); deflt = 1; endif else - warning ('\nOne or more UNO classes (.jar) missing in javaclasspath'); + warning ("\nOne or more UNO classes (.jar) missing in javaclasspath"); endif endif Modified: trunk/octave-forge/main/io/inst/xlsopen.m =================================================================== --- trunk/octave-forge/main/io/inst/xlsopen.m 2011-09-04 12:38:43 UTC (rev 8492) +++ trunk/octave-forge/main/io/inst/xlsopen.m 2011-09-04 20:01:36 UTC (rev 8493) @@ -100,8 +100,10 @@ ## 2011-05-18 Experimental UNO support added, incl. creating new spreadsheets ## 2011-05-22 Textual changes in header ## 2011-05-29 Cleanup of comments & messages +## 2011-09-03 Reset chkintf to [] if no xls support was discovered (to allow +## rediscovery of interfaces between xlsopen calls, e.g. javaclasspath changes) ## -## 2011-06-13 Latest subfunction update +## 2011-09-03 Latest subfunction update function [ xls ] = xlsopen (filename, xwrite=0, reqinterface=[]) @@ -292,7 +294,7 @@ if (xlsinterfaces.OXS && ~xlssupport) if (~chk1) - error ("OXS can only read reliably from .xls files") + error ("OXS can only read from .xls files") endif try wb = javaObject ('com.extentech.ExtenXLS.WorkBookHandle', filename); @@ -381,7 +383,7 @@ # Rounding up. If none of the xlsinterfaces is supported we're out of luck. - if (~isempty (reqinterface)) + if (~isempty (reqinterface) || ~xlssupport) # Reset found interfaces for re-testing in the next call. Add interfaces if needed. chkintf = []; endif @@ -418,7 +420,7 @@ ## - Java & Apache POI ## - Java & JExcelAPI ## - Java & OpenXLS (only JRE >= 1.4 needed) -## - Java & UNO bridge (native OpenOffice.org in background) +## - Java & UNO bridge (native OpenOffice.org in background) - EXPERIMENTAL!! ## ## Examples: ## @@ -441,15 +443,19 @@ ## 2011-05-29 Reduced verbosity ## 2011-06-06 Fix for javaclasspath format in *nix w java-1.2.8 pkg ## 2011-06-13 Fixed potentially faulty tests for java classlib presence +## 2011-09-03 Fixed order of xlsinterfaces.<member> statements in Java detection try-catch +## '' Reset tmp1 (always allow interface rediscovery) for empty xlsinterfaces arg function [xlsinterfaces] = getxlsinterfaces (xlsinterfaces) + # tmp1 = [] (not initialized), 0 (No java detected), or 1 (Working Java found) persistent tmp1 = []; persistent jcp; # Java class path if (isempty (xlsinterfaces.COM) && isempty (xlsinterfaces.POI) && isempty (xlsinterfaces.JXL) && isempty (xlsinterfaces.OXS)) printf ("Detected interfaces: "); + tmp1 = []; elseif (isempty (xlsinterfaces.COM) || isempty (xlsinterfaces.POI) || isempty (xlsinterfaces.JXL) || isempty (xlsinterfaces.OXS)) - tmp1 = []; # tmp1 = [] (not initialized), 0 (No java detected), or 1 (Working Java found) + tmp1 = []; endif deflt = 0; @@ -491,16 +497,16 @@ tmp1 = 1; catch # No Java support found - xlsinterfaces.POI = 0; - xlsinterfaces.JXL = 0; - xlsinterfaces.OXS = 0; - xlsinterfaces.UNO = 0; if ~(isempty (xlsinterfaces.POI) && isempty (xlsinterfaces.JXL)... && isempty (xlsinterfaces.OXS) && isempty (xlsinterfaces.UNO)) # Some Java-based interface requested but Java support is absent error (' No Java support found.'); else # No specific Java-based interface requested. Just return + xlsinterfaces.POI = 0; + xlsinterfaces.JXL = 0; + xlsinterfaces.OXS = 0; + xlsinterfaces.UNO = 0; return; endif tmp1 = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |