Project

General

Profile

11156a.patch

Dănuț Filimon, 09/23/2026 08:02 AM

Download (11.9 KB)

View differences:

new/src/com/goldencode/p2j/cfg/Configuration.java 2026-09-23 11:59:59 +0000
139 139
**     DDF 20260205          Moved the ArtifactManager initialization to Configuration.
140 140
** 036 TG  20260728          Added CFG_BINARY_AST constant.
141 141
** 037 DDF 20260922          Fix unused ArtifactCollection.
142
**     DDF 20260923          Replaced isJarMode() with getAbsolutePath().
142 143
*/
143 144

  
144 145
/*
......
888 889
            {
889 890
               try
890 891
               {
891
                  col = processFileSet(cfg.getFileSet(),
892
                                       ArtifactManager.isJarMode());
892
                  col = processFileSet(cfg.getFileSet(), isCaseSensitive());
893 893
                  if (col == null || col.isEmpty())
894 894
                  {
895 895
                     continue;
new/src/com/goldencode/p2j/pattern/ServiceSupport.java 2026-09-23 09:59:20 +0000
50 50
**     DDF 20260406 Log inexistent service files and ensure the correct path is looked up for rest.
51 51
**     DDF 20260407 <wsad:Name/> nodes can contain paths that need to be resolved.
52 52
** 016 AOG 20260729 Added synchronization as this worker is used during multi-threaded conversion.
53
** 017 DDF 20260923 Replaced getCanonicalPath() with getAbsolutePath().
53 54
*/
54 55

  
55 56
/*
......
535 536
   private static List<LegacyProxyConfig> parseProxyProgram(File file)
536 537
   throws Exception
537 538
   {
538
      Artifact artifact = ArtifactManager.addArtifact(file.getCanonicalPath());
539
      Artifact artifact = ArtifactManager.addArtifact(file.getAbsolutePath());
539 540
      Document dom = XmlHelper.parse(new FileInputStream(file));
540 541
      
541 542
      Element root = dom.getDocumentElement();
......
892 893
      String defaultService = cfg.getConfig("Name");
893 894
      wsdl.addService(defaultService, null);
894 895
      
895
      Artifact key = ArtifactManager.addArtifact(f.getCanonicalPath());
896
      Artifact key = ArtifactManager.addArtifact(f.getAbsolutePath());
896 897
      ArtifactCollection value = new ArtifactCollection();
897 898
      WorkArea wa = context.get();
898 899
      wa.soapArtifacts.putIfAbsent(key, value);
......
1052 1053
      {
1053 1054
         wa.restArtifacts = new HashMap<>();
1054 1055
      }
1055
      Artifact key = ArtifactManager.addArtifact(file.getCanonicalPath());
1056
      Artifact key = ArtifactManager.addArtifact(file.getAbsolutePath());
1056 1057
      ArtifactCollection value = new ArtifactCollection();
1057 1058
      wa.restArtifacts.putIfAbsent(key, value);
1058 1059
      
new/src/com/goldencode/p2j/preproc/BuiltinVariable.java 2026-09-23 10:30:07 +0000
33 33
** 012 DDF 20251022          Moved normalizeFilename() to ArtifactWorker
34 34
**     DDF 20251208          Used wildcards for imports.
35 35
** 013 AL2 20260717          Skip canonical-path resolution for a runtime include (no server file).
36
** 014 DDF 20260923          FILE-NAME uses getAbsolutePath(), strips basepath only if the file is under it.
36 37
*/
37 38

  
38 39
/*
......
292 293
            return fs.getFileName();
293 294
         }
294 295

  
295
         String base = env.getOpt().getBasepath();
296

  
297
         try
296
         // normalize the base path the same way as the filename, so both use the same separators
297
         String base = ArtifactManager.normalizeFilename(env.getOpt().getBasepath()) + File.separator;
298
         normalized = ArtifactManager.normalizeFilename(fs.getFile().getAbsolutePath());
299
         if (normalized.startsWith(base))
298 300
         {
299
            // take the base-path relative part of the filename.
300
            normalized = ArtifactManager.normalizeFilename(fs.getFile().getCanonicalPath());
301 301
            normalized = normalized.substring(base.length());
302
            if (normalized.startsWith(File.separator))
303
            {
304
               normalized = normalized.substring(1);
305
            }
306
         }
307
         
308
         catch (IOException e)
309
         {
310
            env.eprint("Exception caught in &{FILE_NAME} builtin variable",
311
                       env.getLex().getLine(),
312
                       env.getLex().getColumn());
313
            LOG.log(Level.INFO, "", e);
314
            normalized = fs.getFileName();
315 302
         }
316 303
   
317 304
         return normalized;
new/src/com/goldencode/p2j/preproc/FileScope.java 2026-09-23 11:53:21 +0000
65 65
** 025 DDF 20251022          Moved normalizeFilename() to ArtifactWorker.
66 66
**     DDF 20251208          Used wildcards for imports.
67 67
** 026 AL2 20260716          Made normalizeArguments protected for the RuntimeFileScope subclass.
68
** 027 DDF 20260923          Replaced canonicalizePath() with replaceSeparator(), make use of absolutePath().
69
**                           findCaseInsensitively() no longer follows symbolic links.
68 70
*/
69 71

  
70 72
/*
......
129 131
import com.goldencode.p2j.util.Utils;
130 132

  
131 133
import java.nio.charset.*;
134
import java.nio.file.*;
132 135
import java.util.*;
133 136
import java.io.*;
134 137

  
......
452 455
      
453 456
      boolean hit = false;
454 457
      
455
      try
456
      {
457
         String fileSep = env.getOpt().getFileSeparator();
458
         
459
         File file = new File(fileName);
460
         
461
         // locate the file using given paths
462
         if (file.isAbsolute() || paths == null)
463
         {
464
            fullname = Utils.canonicalizePath(fileName, File.separator, fileSep);
458
      String fileSep = env.getOpt().getFileSeparator();
459
      
460
      File file = new File(fileName);
461
      
462
      // locate the file using given paths
463
      if (file.isAbsolute() || paths == null)
464
      {
465
         fullname = Utils.replaceSeparator(file.getAbsolutePath(), File.separator, fileSep);
466
         if ((new File(fullname)).canRead())
467
         {
468
            hit = true;
469
         }
470
      }
471
      else
472
      {
473
         for (int i = 0; !hit && i < paths.length; i ++)
474
         {
475
            StringBuilder sb = new StringBuilder(paths[i]);
476
            sb.append(File.separator).append(fileName);
477
            String path = sb.toString();
478
            fullname = Utils.replaceSeparator(new File(path).getAbsolutePath(), File.separator, fileSep);
479
            
465 480
            if ((new File(fullname)).canRead())
466 481
            {
467 482
               hit = true;
468 483
            }
469 484
         }
470
         else
471
         {
472
            for (int i = 0; !hit && i < paths.length; i ++)
473
            {
474
               StringBuilder sb = new StringBuilder(paths[i]);
475
               sb.append(File.separator).append(fileName);
476
               String path = sb.toString();
477
               fullname = Utils.canonicalizePath(path, File.separator, fileSep);
478
               
479
               if ((new File(fullname)).canRead())
480
               {
481
                  hit = true;
482
               }
483
            }
484
         }
485
      }
486
      catch (IOException exc)
487
      {
488
         CharScanner lex = env.getLex();
489
         env.eprint("Error canonicalizing filename '" +
490
                    fileName +
491
                    "';  " +
492
                    exc.getMessage(),
493
                    lex.getLine(), lex.getColumn());
494 485
      }
495 486
      
496 487
      // special processing for files originating on a case-insensitive file
497 488
      // system, when processing them on a case-sensitive file system
498 489
      if (!hit && !env.getOpt().isCaseSensitive())
499 490
      {
500
         File file = new File(fileName);
501
         
502 491
         // locate the file using given paths
503 492
         if (file.isAbsolute() || paths == null)
504 493
         {
......
817 806
      try
818 807
      {
819 808
         String fileSep = env.getOpt().getFileSeparator();
820
         List<File> list =
821
            com.goldencode.p2j.util.Utils.getCaseInsensitiveFilenameMatches(filename, fileSep);
809

  
810
         String path = Utils.replaceSeparator(filename, fileSep, File.separator);
811
         path = new File(path).getAbsoluteFile().toPath().normalize().toString();
812

  
813
         List<File> list = Utils.getCaseInsensitiveFilenameMatches(path);
822 814
         
823 815
         int matches = list.size();
824 816
         if (matches >= 1)
......
842 834
            return list.get(0);
843 835
         }
844 836
      }
845
      catch (IOException exc)
837
      catch (IOException | InvalidPathException exc)
846 838
      {
847 839
         CharScanner lex = env.getLex();
848 840
         env.eprint("Error searching for include file \"" +
new/src/com/goldencode/p2j/uast/AstGenerator.java 2026-09-23 10:13:46 +0000
225 225
**     RAA 20260713          Register generated .w as original instead of rewriting the .htm tree.
226 226
** 071 TG  20260728          Added useBinaryAst parameter c'tor on XmlFilePlugin.
227 227
** 072 AOG 20250819          Added resetIds flag value to brainwash method call.
228
** 073 DDF 20260923          Replaced getCanonicalPath() with getAbsolutePath().
228 229
*/
229 230

  
230 231
/*
......
1658 1659
         
1659 1660
         // persist schema dictionary state
1660 1661
         File schemaFile = createUniqueFile(artifact.getRelativePath(), FileExtensions.DICT_POSTFIX);
1661
         Artifact schemaArtifact = ArtifactManager.addArtifact(schemaFile.getCanonicalPath());
1662
         Artifact schemaArtifact = ArtifactManager.addArtifact(schemaFile.getAbsolutePath());
1662 1663
         try
1663 1664
         {
1664 1665
            sym.persistSchemaData(artifact, schemaArtifact);
......
1867 1868
   private void persistAst(Artifact artifact, Aast ast)
1868 1869
   throws AstException
1869 1870
   {
1870
      File   target = createUniqueFile(artifact.getRelativePath(), FileExtensions.AST_POSTFIX);
1871
      Artifact fname  = null;
1872
      
1873
      try
1874
      {
1875
         fname = ArtifactManager.addArtifact(target.getCanonicalPath());
1876
      }
1877
      
1878
      catch (IOException ioe)
1879
      {
1880
         throw new AstException("Invalid filename " + artifact.getRelativePath(), ioe);
1881
      }
1882
      
1871
      File target = createUniqueFile(artifact.getRelativePath(), FileExtensions.AST_POSTFIX);
1872
      Artifact fname = ArtifactManager.addArtifact(target.getAbsolutePath());
1883 1873
      AstManager.get().saveTree(ast, fname, false);
1884 1874
   }   
1885 1875
   
......
1919 1909
   throws AstException
1920 1910
   {
1921 1911
      File source = createUniqueFile(artifact.getRelativePath(), FileExtensions.AST_POSTFIX);
1922
      
1923
      Artifact fname  = null;
1924
      
1925
      try
1926
      {
1927
         fname = ArtifactManager.addArtifact(source.getCanonicalPath());
1928
      }
1929
      
1930
      catch (IOException ioe)
1931
      {
1932
         throw new AstException("Invalid filename " + artifact.getRelativePath(), ioe);
1933
      }
1934
      
1912
      Artifact fname = ArtifactManager.addArtifact(source.getAbsolutePath());
1935 1913
      return AstManager.get().loadTree(fname);
1936 1914
   }   
1937 1915
   
new/src/com/goldencode/p2j/uast/SymbolResolver.java 2026-09-23 10:14:10 +0000
584 584
**     DDF 20260406          getOriginalArtifact() returns the given artifact when it fails.
585 585
** 119 AOG 20250819          Added synchronization as this class is used in multithreaded conversion.
586 586
**     AOG 20250924          Replaced HashSet with LinkedHashSet for consistent ordering of field set.
587
** 120 DDF 20260923          Replaced getCanonicalPath() with getAbsolutePath().
587 588
*/  
588 589

  
589 590
/*
......
10228 10229
      // quick out: does the exact match exist?
10229 10230
      if (file.exists())
10230 10231
      {
10231
         try
10232
         {
10233
            return file.getCanonicalPath();
10234
         }
10235
         catch (IOException e)
10236
         {
10237
            // ignore
10238
         }
10232
         return file.getAbsolutePath();
10239 10233
      }
10240 10234
      
10241 10235
      if (!caseSens)