[mapguide-commits] r10241 - in branches/4.0/MgDev: Bindings/src/Test/DotNet/src/TestCommon/ResourceService Bindings/src/Test/Java/src/org/osgeo/mapguide/test/platform/operations/resource Bindings/src/Test/Php Common/Foundation/System

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Nov 2 08:29:43 PST 2026


Author: jng
Date: 2026-11-02 08:29:42 -0800 (Mon, 02 Nov 2026)
New Revision: 10241

Modified:
   branches/4.0/MgDev/Bindings/src/Test/DotNet/src/TestCommon/ResourceService/Operations.cs
   branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/platform/operations/resource/ApplyResourcePackage.java
   branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceAPI.php
   branches/4.0/MgDev/Common/Foundation/System/ByteSourceFileImpl.cpp
Log:
#2493: Fix cause of ApplyResourcePackage test failure on bad filename on Linux

Modified: branches/4.0/MgDev/Bindings/src/Test/DotNet/src/TestCommon/ResourceService/Operations.cs
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/DotNet/src/TestCommon/ResourceService/Operations.cs	2026-11-02 15:30:53 UTC (rev 10240)
+++ branches/4.0/MgDev/Bindings/src/Test/DotNet/src/TestCommon/ResourceService/Operations.cs	2026-11-02 16:29:42 UTC (rev 10241)
@@ -618,18 +618,11 @@
         {
             try
             {
-                if (CommonUtility.IsWindows())
-                {
-                    MgByteReader reader = param.TryGetByteReader("PACKAGE", false);
-    
-                    _resourceService.ApplyResourcePackage(reader);
-    
-                    return TestResult.FromByteReader(null);
-                }
-                else
-                {
-                    throw new Exception("FIXME: ApplyResourcePackage will kill the mgserver on invalid package files");
-                }
+                MgByteReader reader = param.TryGetByteReader("PACKAGE", false);
+
+                _resourceService.ApplyResourcePackage(reader);
+
+                return TestResult.FromByteReader(null);
             }
             catch (MgException ex)
             {

Modified: branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/platform/operations/resource/ApplyResourcePackage.java
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/platform/operations/resource/ApplyResourcePackage.java	2026-11-02 15:30:53 UTC (rev 10240)
+++ branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/platform/operations/resource/ApplyResourcePackage.java	2026-11-02 16:29:42 UTC (rev 10241)
@@ -25,16 +25,11 @@
             if (param.get("PACKAGE") != null)
                 packagePath = param.get("PACKAGE");
 
-            if (CommonUtility.IsWindows()) {
-                //Console.WriteLine("\t\tPackage Path: " + packagePath);
-                MgByteReader reader = CommonUtility.GetByteReaderFromPath(packagePath, false);
+            MgByteReader reader = CommonUtility.GetByteReaderFromPath(packagePath, false);
 
-                _resourceService.applyResourcePackage(reader);
+            _resourceService.applyResourcePackage(reader);
 
-                return TestResult.Ok();
-            } else {
-                throw new RuntimeException("FIXME: ApplyResourcePackage will kill the mgserver on invalid package files");
-            }
+            return TestResult.Ok();
         }
         catch (MgException ex)
         {

Modified: branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceAPI.php
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceAPI.php	2026-11-02 15:30:53 UTC (rev 10240)
+++ branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceAPI.php	2026-11-02 16:29:42 UTC (rev 10241)
@@ -789,16 +789,12 @@
             $packageParam = $this->unitTestParamVm->GetString("ParamValue");
             $arrayParam['PACKAGE']=$this->testContext->resolveDataFilePath($packageParam);
 
-            if (Utils::IsWindows()) {
-                $packageSource = new MgByteSource($arrayParam["PACKAGE"]);
-                $package = $packageSource->GetReader();
+            $packageSource = new MgByteSource($arrayParam["PACKAGE"]);
+            $package = $packageSource->GetReader();
 
-                $byteReader = $this->resourceSrvc->ApplyResourcePackage($package);
+            $byteReader = $this->resourceSrvc->ApplyResourcePackage($package);
 
-                return Utils::GetResponse($byteReader);
-            } else {
-                return new Result("FIXME: ApplyResourcePackage will kill the mgserver on invalid package files", "text/plain");
-            }
+            return Utils::GetResponse($byteReader);
         }
         catch (MgException $e)
         {

Modified: branches/4.0/MgDev/Common/Foundation/System/ByteSourceFileImpl.cpp
===================================================================
--- branches/4.0/MgDev/Common/Foundation/System/ByteSourceFileImpl.cpp	2026-11-02 15:30:53 UTC (rev 10240)
+++ branches/4.0/MgDev/Common/Foundation/System/ByteSourceFileImpl.cpp	2026-11-02 16:29:42 UTC (rev 10241)
@@ -113,6 +113,20 @@
 
 void ByteSourceFileImpl::LoadFile(CREFSTRING filename)
 {
+    // A directory opens successfully on POSIX, but it cannot be read (EISDIR) and the length
+    // SEEK_END reports for it is meaningless - LLONG_MAX on some filesystems, -1 on others.
+    // A reader built over one therefore declares an impossible length when it is serialized,
+    // and the peer reading that stream waits for data that will never arrive. Windows fails the
+    // open outright, so reject a directory on both platforms to keep the behaviour identical.
+    if (MgFileUtil::IsDirectory(filename))
+    {
+        MgStringCollection arguments;
+        arguments.Add(filename);
+
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"ByteSourceFileImpl.LoadFile",
+            __LINE__, __WFILE__, &arguments, L"", NULL);
+    }
+
     //Use ACE open insted of _wfopen to allow Linux compatibility
     m_file = ACE_OS::open(MG_WCHAR_TO_TCHAR(filename), 0, ACE_DEFAULT_OPEN_PERMS, 0);
     if(m_file == ACE_INVALID_HANDLE)



More information about the mapguide-commits mailing list