private void customizeColumnModel(TableColumnModel columnModel) {
int width = (table.getWidth() == 0)? ViewGUI.WINDOW_WIDTH : table.getWidth();
final int defaultColumnWidth = 100;
int columnWidth = defaultColumnWidth;
int columnCount = columnModel.getColumnCount();
int widthAllColumns = columnCount * defaultColumnWidth;
if (widthAllColumns < width) {
columnWidth = width / columnCount;
}
for (int i = 0; i < columnCount; i++) {
setColumnWidth(columnModel.getColumn(i), columnWidth, columnWidth, columnWidth);
}
}
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.xml.internal.bind.v2.runtime.reflect.Lister$CollectionLister.addToPack(Lister.java:289)
at com.sun.xml.internal.bind.v2.runtime.reflect.Lister$CollectionLister.addToPack(Lister.java:253)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Scope.add(Scope.java:106)
at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty$ReceiverImpl.receive(ArrayERProperty.java:198)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.endElement(UnmarshallingContext.java:597)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.endElement(SAXConnector.java:165)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:214)
at org.limantrade.model.xml.XmlParser.parse(XmlParser.java:59)
at org.limantrade.model.xml.XmlParser.parseXmlStaff(XmlParser.java:18)
at org.limantrade.model.PercoConnectorMock.getStaffList(PercoConnectorMock.java:42)
at org.limantrade.model.MainModel.loadTableModelEmployees(MainModel.java:68)
at org.limantrade.model.MainModel.loadTableModel(MainModel.java:51)
at org.limantrade.controller.MainController.onRefreshTable(MainController.java:29)
at org.limantrade.view.ViewGUI.fireUpdateTable(ViewGUI.java:163)
at org.limantrade.view.guicomponents.PanelTableWithButton.lambda$addComponents$0(PanelTableWithButton.java:57)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
long createTime = event.getCreateTime();
preparedStatement.setTimestamp(column, new java.sql.Timestamp(createTime), Calendar.newInstance());
# Базовый уровень логирования
log4j.rootLogger=TRACE, info_log_file, stdout, full_log_file
# Апендер для работы с файлами
log4j.appender.info_log_file=org.apache.log4j.RollingFileAppender
log4j.appender.info_log_file.File=info_log.log
log4j.appender.info_log_file.threshold=INFO
log4j.appender.info_log_file.MaxFileSize=1MB
log4j.appender.info_log_file.MaxBackupIndex=10
log4j.appender.info_log_file.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.info_log_file.layout.ConversionPattern=%d{ISO8601} [%-5p][%20c{-2}] - %m%n
#вывод в консоль
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.threshold=INFO
log4j.appender.stdout.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%-5p][%20c{-2}] - %m%n
# Апендер для работы с файлами
log4j.appender.full_log_file=org.apache.log4j.RollingFileAppender
log4j.appender.full_log_file.File=full_log.log
log4j.appender.full_log_file.threshold=TRACE
log4j.appender.full_log_file.MaxFileSize=1MB
log4j.appender.full_log_file.MaxBackupIndex=10
log4j.appender.full_log_file.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.full_log_file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p] [%c{1}:%L] - %m%n
private static String getClassLocation(Class<?> c) {
URL pathURL = c.getProtectionDomain().getCodeSource().getLocation();
try {
Path path = Paths.get(pathURL.toURI());
String rootStr = path.getRoot().toString();
return rootStr + path.subpath(0, path.getNameCount()-1).toString() + File.separator;
} catch (URISyntaxException e) {
e.printStackTrace();
return "";
}
}