This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 122501 - [60cat] context.xml not properly reformatted
Summary: [60cat] context.xml not properly reformatted
Status: RESOLVED INCOMPLETE
Alias: None
Product: xml
Classification: Unclassified
Component: Text-Edit (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Samaresh Panda
URL:
Keywords:
Depends on: 137768 126040
Blocks:
  Show dependency tree
 
Reported: 2007-11-21 13:22 UTC by tomzi
Modified: 2008-11-18 17:25 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomzi 2007-11-21 13:22:33 UTC
[ BUILD # : 200711131200 ]
[ JDK VERSION : 1.6.0_03 ]

In my maven project I have a /META-INF/context.xml like with similar
entries like this one: 

<Context path="/xxxproject">
    <ResourceLink global="UserDatabase" name="users"
type="org.apache.catalina.UserDatabase"/>
    <Resource auth="Container"
driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="20"
maxIdle="10" maxWait="-1" name="jdbc/RDS" password="opentst2"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@0.0.0.0:1521:test2" username="user"/>
    <Resource auth="Container"
driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="20"
maxIdle="10" maxWait="-1" name="jdbc/JBPM" password="test2"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@0.0.0.0:1521:test2" username="jbpm"/>
    <Resource auth="Container"
driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="20"
maxIdle="10" maxWait="-1" name="jdbc/ACS" password="test1"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@0.0.0.0:1521:test1" username="user"/>
    <Realm className="org.apache.catalina.realm.JDBCRealm"
connectionName="con1" connectionPassword="con1passwd"
connectionURL="jdbc:oracle:thin:@0.0.0.0:1521:test2" debug="99"
driverName="oracle.jdbc.driver.OracleDriver" roleNameCol="rolename"
userCredCol="password" userNameCol="username" userRoleTable="(SELECT
username, service_id as rolename FROM (SELECT
o.username,sgm.service_id FROM onmanage.sgm_cache sgm,
onmanage.operator_privileges op, onmanage.operators o WHERE
o.id=op.operator_id AND op.group_id=sgm.group_id UNION SELECT
o.username,op.service_id FROM onmanage.operators o,
onmanage.operator_privileges op WHERE o.id=op.operator_id))"
userTable="(SELECT username,
krypt.krypt_password.password_des3decrypt(password_encrypt) AS
password FROM onmanage.operators)"/>
</Context>

But when I Souce/Format the file everything is formatted in serveral
long lines, not at all like an .xml file.
Comment 1 Samaresh Panda 2007-11-28 22:39:44 UTC
With RC1, first format, formats properly (except the </Context> tag) with all lines within the 80 column boundary. A
second format brings the </Context> tag to the right position.

Would you try a RC candidate (RC2 is available now) and let us know?
Comment 2 tomzi 2007-12-03 09:45:48 UTC
Well, I see. In the current implementation an exisiting line is just indented. But it does not
split a line that is eg 250characters long, when the right border is set to, say 100. So if I had something like:

<mytag attr1="value1" 
 attr2="value2" attr3="value3" attr4="value4" attr5="value5" attr6="value6"/>

it is currently reformated to 

<mytag attr1="value1" 
       attr2="value2" attr3="value3" attr4="value4" />

however, if right border is set to 25, it should be reformatted to:

<mytag attr1="value1" 
       attr2="value2" 
       attr3="value3" 
       attr4="value4" />


Comment 3 tomzi 2007-12-03 09:46:46 UTC
(oops forgot to delete attr5 and attr6, sorry for that,they should of course not be deleted :))
Comment 4 Samaresh Panda 2008-11-18 17:25:30 UTC
I'm not sure if there is a good solution to this issue. Seems like a chicken-egg problem. The fact that XMLs can be
deeply nested makes it impossible to honor the col boundary while honoring the indentation at the same time. We may be
able to handle it for this use-case, but no matter what we do, there will always be some use-case where it'll not
satisfy the conditions.

I would like to hear what you think. Thoughts, comments?