Board index » jbuilder » JB9 Project.CreateProject() Problem

JB9 Project.CreateProject() Problem


2003-08-29 03:56:07 AM
jbuilder1
Hi, I have some code in an OpenTool that works fine for JB7 & 8 but not 9.
import com.borland.primetime.node.Project;
import com.borland.primetime.vfs.Url;
Project p = Project.createProject( "jpx" );
File file = new File("c:/temp/test.jpx");
Url url = new Url(file);
p.saveAs(url);
In JB 9 this throws InvalidUrl exception. Why? What further initialization
do I need to do before it will save correctly?
Unfortunately, there is no stack trace and no message with the
InvalidUrlException to give any clues.
Thanks.
- Frank
 
 

Re:JB9 Project.CreateProject() Problem

Good question -- it probably does not like the current Url but there is
no obvious reason why that check was added.
Why not just use Project.createProject(Url) instead? It would be
something like:
File file = new File("c:/temp/test.jpx");
Url url = new Url(file);
Project p = Project.createProject(url);
p.revert(); // ensure no memory cache in VFS
"Frank Leon Rose" < XXXX@XXXXX.COM >wrote in message
Quote
Hi, I have some code in an OpenTool that works fine for JB7 & 8 but
not 9.

import com.borland.primetime.node.Project;
import com.borland.primetime.vfs.Url;

Project p = Project.createProject( "jpx" );
File file = new File("c:/temp/test.jpx");
Url url = new Url(file);
p.saveAs(url);

In JB 9 this throws InvalidUrl exception. Why? What further
initialization
do I need to do before it will save correctly?

Unfortunately, there is no stack trace and no message with the
InvalidUrlException to give any clues.

Thanks.

- Frank


 

Re:JB9 Project.CreateProject() Problem

Quote
>Why not just use Project.createProject(Url) instead?
Unfortunately, there's no such method. If you're talking about
Project.getProject(URL), that's for restoring a project from disk - I'm
trying to create a brand new one.
One hypothesis is that there is some URL member of the project object that
needs to be initialized. That is, it may be that the project URL I'm trying
to save to is not the cause of the problem.
- Frank
 

{smallsort}

Re:JB9 Project.CreateProject() Problem

"Frank Leon Rose" < XXXX@XXXXX.COM >wrote in message
Quote
One hypothesis is that there is some URL member of the project object
that
needs to be initialized. That is, it may be that the project URL I'm
trying
to save to is not the cause of the problem.
You said there's no stack trace with the InvalidUrlException. There
will be if you catch it yourself. That might help show where the
problem is. In particular, I mean:
try {
Project p = Project.createProject( "jpx" );
File file = new File("c:/temp/test.jpx");
Url url = new Url(file);
p.saveAs(url);
} catch (InvalidUrlException e) {
e.printStackTrace();
}
--
Gillmer J. Derge (TeamB)
 

Re:JB9 Project.CreateProject() Problem

Sorry, I did mean Project.getProject(Url) and it does indeed create a
project in memory and associate it with that Url regardless if there is an
existing file.
"Frank Leon Rose" < XXXX@XXXXX.COM >wrote in message
Quote
>>Why not just use Project.createProject(Url) instead?

Unfortunately, there's no such method. If you're talking about
Project.getProject(URL), that's for restoring a project from disk - I'm
trying to create a brand new one.

One hypothesis is that there is some URL member of the project object that
needs to be initialized. That is, it may be that the project URL I'm
trying
to save to is not the cause of the problem.

- Frank


 

Re:JB9 Project.CreateProject() Problem

Quote
You said there's no stack trace with the InvalidUrlException. There
will be if you catch it yourself.
Thanks. I was catching it, and examining the exception object in the
de{*word*81} showed a null stack array, which made me think it had nothing.
But you're right that printing it out showed a stack trace with the error
happening in saveAs(). Score one for trace prints over visual debugging.
So, no clues there. I say it's still a problem that createProject() does
not seem to work.
However, getProject(url) *did* work, so we have a work-around.
Now to see whether that works on JB7 and 8...
- Frank
 

Re:JB9 Project.CreateProject() Problem

Quote
I did mean Project.getProject(Url) and it does indeed create a
project in memory and associate it with that Url regardless if there is an
existing file.
You are correct. That worked like a charm. Thank you very much.
- Frank
 

Re:JB9 Project.CreateProject() Problem

"Frank Leon Rose" < XXXX@XXXXX.COM >wrote in message
Quote
Thanks. I was catching it, and examining the exception object in the
de{*word*81} showed a null stack array, which made me think it had
nothing.
I think the stack trace is filled in on-demand.
--
Gillmer J. Derge (TeamB)