Win a copy of Modern frontends with htmx this week in the Spring forum!

rajesh chalavadi

Greenhorn
+ Follow
since Feb 13, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by rajesh chalavadi

'code-source' URL is specific to ORACLE Application server.

Please find more details in http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/util/ResourceUtils.html

about various protocols of websphere, weblogic, Oracle App server etc.
I am running into following SAXParseException when I am trying to create a Schema from a URL with the following code.

SchemaFactory sf = ShemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
sf.newSchema(url);

I have verified that schema document exists at the location of URL. Initially I thought this is because of space chars in the URL. But even after encoding the URL, I am running into the this exception.

Could any one please let me know the cause for this exception? Any help in this regard is highly appreciated.

Caused by: org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document
'code-source:/C:/ADE/rchalava_vw3/oracle%20spaces/mds/lib/mdsrt.jar!/oracle/mds/xsd/mdsConfig.xsd',
because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2245)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1590)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:438)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:556)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:523)
at com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.newSchema(SchemaFactoryImpl.java:206)
at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:489)
at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:521)
Brian, your solution seems working fine.

But the problem is - it is hard to track the focus between JTable cells. Actually I added focusListener to JTable. The FoucsGained() method on this listener is not getting called whenever I change the cell focus using the tab key!!

One solution could be, adding a key listener to JTable in FocusGained() method and tracking TAB keys.

I am wondering, Is there any other way to track the focus on each JTable cells?
16 years ago
Thanks Brian for the response.

I haven't get a chance to try your suggestion. Will try it today.
16 years ago
Thanks Stefan and bart for your replies.

I am not worrying about millisecond precision. But looking for a way to get the same behavior across the platforms.

As part of my requirements, am storing the file fetched time (System.currentTimeinMillis() ) and before updating the file, am comparing the fetched time with file.lastModifiedTime() to know whether the file got updated from the point we read it.

But because of precision problem, the code behaves in different ways on different platforms!.
16 years ago
Hi,

my swing code looks like..

JTable table = new JTable(tm)
TableColumn sportColumn = table.getColumnModel().getColumn(2);
sportColumn.setCellEditor(new CustomCellEditor(args));

======

In CustomCellEdtior.java (extends AbstractCellEditor implements TableCellEditor)

public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
{
// Depens on row, column value, combobox will be created.
JComboBox comboBox = new JComboBox();
comboBox.addItem("Snowboarding");
comboBox.addItem("Rowing");
comboBox.addItem("Chasing toddlers");
comboBox.addItem("Speed reading");
comboBox.addItem("Teaching high school");
comboBox.addItem("None");
return comboBox;
}

Now am trying to transfer the focus from jtable to insides jcomboBox when ever focus comes to 2nd column using a focus listener on jtable.

table.addFocusListener(new FocusListener()
{
public void focusGained(FocusEvent e)
{
System.out.println("got the focus on jtable");
JTable table = (JTable)e.getComponent();
int row = table.getSelectionModel().getAnchorSelectionIndex();
int col = table.getColumnModel().
getSelectionModel().getAnchorSelectionIndex();
System.out.println("row & column " + row + "-" + col);
if ( col == 2 )
{
Component comp =
table.prepareEditor(table.getCellEditor(row, col), row, col);
comp.transferFocus();
}
}

But, i guess, am doing some thing wrong in the above code. Focus is not coming to JcomboBox. Could any one help me in this issue?

I hope am clear in above usecase.
16 years ago
File.lastModified() javadoc says - A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs

But this method is rounding off the value on the Linux, to its nearest second unlike windows.
(for example if a file is modified at 1173423665215 msec, the above method is returning the value 1173423665000 on linux.)

1) Is there a way to avoid this rounding off on linux? OR
2) Are there any other methods available to get the file modified time in milliseconds.
3) Any method to know what is the precision of platform ( 1msec on windows and 1sec on linux.)

Any help is highly appreciated.
16 years ago