tracker issue : CF-3744955

select a category, or use search below
(searches all categories and all time range)
Title:

import doesn't help when creating new object

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce

Reporter/Name(from Bugbase): Jork Zijlstra / Jork Zijlstra (Jork Zijlstra)

Created: 04/17/2014

Components: Core Runtime

Versions: 10.0

Failure Type: Usability Issue

Found In Build/Fixed In Build: Final /

Priority/Frequency: Minor / Some users will encounter

Locale/System: English / Linux Ubuntu 10.10

Vote Count: 0

Problem Description:
When you have multiple component classes with the same name in the same codebase, you use the import statement, the create new 'class' just picks one out of all with the same name. This is not necessarily the one that is specified on the import on top of the class.

Steps to Reproduce:
// use zip file attached
// create /testUtils as mapping (or change import statement in Testimport.cfc)
// go to index.cfm

This zip file attached is a simplified version. It contains 2 classes called "Naming". This problem even exists when one of the Naming classed is located in another part of the codebase.

Actual Result:
The method test1 was not found

Expected Result:
The import select the correct class.

Any Workarounds:
1) Use FQDN when creating new objects, just like createObject.
2) Have a unqiue file name in your entire codebase

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3744955

External Customer Info:
External Company:  
External Customer Name: Jork Zijlstra
External Customer Email:  
External Test Config: My Hardware and Environment details:

Ubuntu 12.04 - CF10

Attachments:

  1. April 17, 2014 00:00:00: 1_naming.zip
  2. May 06, 2014 00:00:00: 2_namingclasses.zip

Comments:

I don't see the behavior you are talking about. I extracted the zip you have attached and changed the import statement in TestImport.cfc to specify the correct path and it works fine. I extracted all the files in a folder called 'naming' in the webroot and the import statement now looks like -------- import naming.name1.Naming; -------- It is getting resolved fine and I don't see any issue. As per the bug statement, import does not work which is definitely not true.
Comment by Rupesh K.
12616 | May 02, 2014 07:22:08 PM GMT
Weird. We have several environments that have this issue. On Windows 7 and on Ubuntu with CF10. Any ideas on what to test next?
Comment by External U.
12617 | May 06, 2014 01:57:33 AM GMT
Actually I was checking this on ColdFusion 11. Can you test this on ColdFusion 11 and confirm? we did fix an issue related to cfimport in ColdFusion 11.
Comment by Rupesh K.
12618 | May 06, 2014 03:30:54 AM GMT
I have attached the generated class files and stacktrace. The class fiels seems to import the correct path, so I'm not sure why this error happens
Comment by External U.
12619 | May 06, 2014 05:26:24 AM GMT
I cant think of any reason why it is not working. It is working fine at my end. I have now tried on both ColdFusion 10 & 11 and it works fine.
Comment by Rupesh K.
12620 | May 06, 2014 06:57:27 AM GMT
As there is no response from the user, Closing the bug as Cannot Reproduce. If you are still facing the issue, please provide the repro case, will re-open the bug.
Comment by Suchika S.
12621 | December 03, 2014 12:15:02 AM GMT
I ran into this bea couple of weeks ago on cf11, and cf2016. And whether it's a bug or not is probably up for debate. There are 3 components: some.path.SameName, other.path.SameName, and some.path.Example. In some.path.Example, you import other.path.SameName, and then call new SameName(). The object that gets created is some.path.SameName, instead of other.path.SameName. CF appears to be searching for components in the same directory before searching import paths.
Comment by Tim C.
30215 | February 10, 2019 12:11:43 AM GMT
Hi Tim, Nice find. IMO, CF should search import paths before searching for components in the same directory. So, IMO, you found a bug. But I'm interested to hear Adobe's explanation. Adobe, could you please explain? Should a bug be filed? Thanks!, -Aaron
Comment by Aaron N.
30234 | February 12, 2019 10:45:14 AM GMT