Search Results

Search found 15 results on 1 pages for 'messageformat'.

Page 1/1 | 1 

  • Aligning messageformat on printing a JTable.

    - by DanielFH
    I'm using this for the moment to print out my table, and it works. But I'm not really happy with the layout of the messageformatting, I would like to have both pagenumber and date in the footer, and date format aligned to the left side of the table, and page to the right. How can I do that? Been reading some stuff about overriding the PrintTable method, but seems to get pretty complex from what I've read. Hope you can help me with this issue, thank you. :) import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.standard.OrientationRequested; import javax.swing.JTable; import dk.beesys.rims.ui.WindowInventory; public class Print { private static Print INSTANCE; public static Print getInstance() { if (INSTANCE == null) { INSTANCE = new Print(); } return INSTANCE; } private Print(){ } public void printList(java.awt.event.ActionEvent ignore) { String strDate = MessageFormat.format("{0,date,short} {0,time,short}", new Date()); MessageFormat header = new MessageFormat("- {0} -"); MessageFormat footer = new MessageFormat("Printed: " + strDate); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(OrientationRequested.LANDSCAPE); try { WindowInventory.getInstance().getTable().print(JTable.PrintMode.FIT_WIDTH, header, footer, true, aset, true); } catch (java.awt.print.PrinterException e) { System.err.format("Cannot print %s%n", e.getMessage()); } }

    Read the article

  • Can you get access to the NumberFormatter used by ICU MessageFormat

    - by Travis
    This may be a niche question but I'm working with ICU to format currency strings. I've bumped into a situation that I don't quite understand. When using the MesssageFormat class, is it possible to get access to the NumberFormat object it uses to format currency strings. When you create a NumberFormat instance yourself, you can specify attributes like precision and rounding used when creating currency strings. I have an issue where for the South Korean locale ("ko_KR"), the MessageFormat class seems to create currency strings w/ rounding (100.50 - ?100). In areas where I use NumberFormat directly, I set setMaximumFractionDigits and setMinimumFractionDigits to 2 but I can't seem to set this in the MessageFormat. Any ideas?

    Read the article

  • ICU MessageFormat Currency Value Precison Lost

    - by Travis
    This may be a niche question but I'm working with ICU to format currency strings. I've bumped into a situation that I don't quite understand. When using the MesssageFormat class, why for a certain locale (Korea "ko"KR" for example) does it round currency values (e.g. 100.50 becomes ?101). For most locales (such as the US "en_US"), the precision of the argument passed in remains untouched (e.g. 100.50 becomes $100.50). I thought this might be a default rounding issue that some locales have (Swiss Francs "fr_CH" for example have a default 0.05 rounding) but South Korea "ko_KR" has none. Any ideas?

    Read the article

  • The jsf2 h:outputText tag is not formating the h:outputText with the MessageFormat

    - by Thiago Diniz
    The jsf2 h:outputText tag is not formating the h:outputText with the MessageFormat my faces config <application> <resource-bundle> <base-name>Messages_pt_BR</base-name> <var>bundle</var> </resource-bundle> </application> My resource bundle: ... EventPageTitle=Event: {0} ... My JSF2 XHTML: <h:outputText value="#{bundle.EventPageTitle}" > <f:param value="#{seuTicketEventController.selected.eventName}"/> </h:outputText> The Output: Event: {0} Does anyone knows how to solve this problem? I have searched everywhere but i can't a solution!

    Read the article

  • How to print a JTable header in two lines?

    - by Eruls
    Program is to print a JTabel and used function is JTabel jt=new JTable(); MessageFormat headerFormat= new MessageFormat("My World Tomorrow"); MessageFormat footerFormat = new MessageFormat("Page {0}"); jt.Print(JTabel.Format,headerFormat,footerFormat); Query is: How to print the header in two lines that is My World Tomorrow Tired following solutions: new MessageFormat("My world \n Tomorrow"); new MessageFormat("My world \r\n Tomorrow"); new MessageFormat("My world" System.getProperty("line.separator")+"Tomorrow" ); Nothing works.

    Read the article

  • NLog Exception Details Renderer

    - by jtimperley
    Originally posted on: http://geekswithblogs.net/jtimperley/archive/2013/07/28/nlog-exception-details-renderer.aspxI recently switch from Microsoft's Enterprise Library Logging block to NLog.  In my opinion, NLog offers a simpler and much cleaner configuration section with better use of placeholders, complemented by custom variables. Despite this, I found one deficiency in my migration; I had lost the ability to simply render all details of an exception into our logs and notification emails. This is easily remedied by implementing a custom layout renderer. Start by extending 'NLog.LayoutRenderers.LayoutRenderer' and overriding the 'Append' method. using System.Text; using NLog; using NLog.Config; using NLog.LayoutRenderers;   [ThreadAgnostic] [LayoutRenderer(Name)] public class ExceptionDetailsRenderer : LayoutRenderer { public const string Name = "exceptiondetails";   protected override void Append(StringBuilder builder, LogEventInfo logEvent) { // Todo: Append details to StringBuilder } }   Now that we have a base layout renderer, we simply need to add the formatting logic to add exception details as well as inner exception details. This is done using reflection with some simple filtering for the properties that are already being rendered. I have added an additional 'Register' method, allowing the definition to be registered in code, rather than in configuration files. This complements by 'LogWrapper' class which standardizes writing log entries throughout my applications. using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using NLog; using NLog.Config; using NLog.LayoutRenderers;   [ThreadAgnostic] [LayoutRenderer(Name)] public sealed class ExceptionDetailsRenderer : LayoutRenderer { public const string Name = "exceptiondetails"; private const string _Spacer = "======================================"; private List<string> _FilteredProperties;   private List<string> FilteredProperties { get { if (_FilteredProperties == null) { _FilteredProperties = new List<string> { "StackTrace", "HResult", "InnerException", "Data" }; }   return _FilteredProperties; } }   public bool LogNulls { get; set; }   protected override void Append(StringBuilder builder, LogEventInfo logEvent) { Append(builder, logEvent.Exception, false); }   private void Append(StringBuilder builder, Exception exception, bool isInnerException) { if (exception == null) { return; }   builder.AppendLine();   var type = exception.GetType(); if (isInnerException) { builder.Append("Inner "); }   builder.AppendLine("Exception Details:") .AppendLine(_Spacer) .Append("Exception Type: ") .AppendLine(type.ToString());   var bindingFlags = BindingFlags.Instance | BindingFlags.Public; var properties = type.GetProperties(bindingFlags); foreach (var property in properties) { var propertyName = property.Name; var isFiltered = FilteredProperties.Any(filter => String.Equals(propertyName, filter, StringComparison.InvariantCultureIgnoreCase)); if (isFiltered) { continue; }   var propertyValue = property.GetValue(exception, bindingFlags, null, null, null); if (propertyValue == null && !LogNulls) { continue; }   var valueText = propertyValue != null ? propertyValue.ToString() : "NULL"; builder.Append(propertyName) .Append(": ") .AppendLine(valueText); }   AppendStackTrace(builder, exception.StackTrace, isInnerException); Append(builder, exception.InnerException, true); }   private void AppendStackTrace(StringBuilder builder, string stackTrace, bool isInnerException) { if (String.IsNullOrEmpty(stackTrace)) { return; }   builder.AppendLine();   if (isInnerException) { builder.Append("Inner "); }   builder.AppendLine("Exception StackTrace:") .AppendLine(_Spacer) .AppendLine(stackTrace); }   public static void Register() { Type definitionType; var layoutRenderers = ConfigurationItemFactory.Default.LayoutRenderers; if (layoutRenderers.TryGetDefinition(Name, out definitionType)) { return; }   layoutRenderers.RegisterDefinition(Name, typeof(ExceptionDetailsRenderer)); LogManager.ReconfigExistingLoggers(); } } For brevity I have removed the Trace, Debug, Warn, and Fatal methods. They are modelled after the Info methods. As mentioned above, note how the log wrapper automatically registers our custom layout renderer reducing the amount of application configuration required. using System; using NLog;   public static class LogWrapper { static LogWrapper() { ExceptionDetailsRenderer.Register(); }   #region Log Methods   public static void Info(object toLog) { Log(toLog, LogLevel.Info); }   public static void Info(string messageFormat, params object[] parameters) { Log(messageFormat, parameters, LogLevel.Info); }   public static void Error(object toLog) { Log(toLog, LogLevel.Error); }   public static void Error(string message, Exception exception) { Log(message, exception, LogLevel.Error); }   private static void Log(string messageFormat, object[] parameters, LogLevel logLevel) { string message = parameters.Length == 0 ? messageFormat : string.Format(messageFormat, parameters); Log(message, (Exception)null, logLevel); }   private static void Log(object toLog, LogLevel logLevel, LogType logType = LogType.General) { if (toLog == null) { throw new ArgumentNullException("toLog"); }   if (toLog is Exception) { var exception = toLog as Exception; Log(exception.Message, exception, logLevel, logType); } else { var message = toLog.ToString(); Log(message, null, logLevel, logType); } }   private static void Log(string message, Exception exception, LogLevel logLevel, LogType logType = LogType.General) { if (exception == null && String.IsNullOrEmpty(message)) { return; }   var logger = GetLogger(logType); // Note: Using the default constructor doesn't set the current date/time var logInfo = new LogEventInfo(logLevel, logger.Name, message); logInfo.Exception = exception; logger.Log(logInfo); }   private static Logger GetLogger(LogType logType) { var loggerName = logType.ToString(); return LogManager.GetLogger(loggerName); }   #endregion   #region LogType private enum LogType { General } #endregion } The following configuration is similar to what is provided for each of my applications. The 'application' variable is all that differentiates the various applications in all of my environments, the rest has been standardized. Depending on your needs to tweak this configuration while developing and debugging, this section could easily be pushed back into code similar to the registering of our custom layout renderer.   <?xml version="1.0"?>   <configuration> <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/> </configSections> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <variable name="application" value="Example"/> <targets> <target type="EventLog" name="EventLog" source="${application}" log="${application}" layout="${message}${onexception: ${newline}${exceptiondetails}}"/> <target type="Mail" name="Email" smtpServer="smtp.example.local" from="[email protected]" to="[email protected]" subject="(${machinename}) ${application}: ${level}" body="Machine: ${machinename}${newline}Timestamp: ${longdate}${newline}Level: ${level}${newline}Message: ${message}${onexception: ${newline}${exceptiondetails}}"/> </targets> <rules> <logger name="*" minlevel="Debug" writeTo="EventLog" /> <logger name="*" minlevel="Error" writeTo="Email" /> </rules> </nlog> </configuration>   Now go forward, create your custom exceptions without concern for including their custom properties in your exception logs and notifications.

    Read the article

  • Xcodebuild throws assert failures after successful build?

    - by Derek Clarkson
    Hi all, I'me getting the following after building from he command line using xcodebuild, ay ideas what might be wrong? ** BUILD SUCCEEDED ** 2010-06-06 20:20:12.916 xcodebuild[8267:80b] [MT] ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-1648/pbxcore/Target.subproj/PBXTarget.m:597 Details: Assertion failed: (nil == _buildContext) || (nil == [_buildContext target]) Object: <PBXLegacyTarget:0x104b97370> Method: -dealloc Thread: <NSThread: 0x100b141a0>{name = (null), num = 1} Backtrace: 0 0x000000010035feaf -[XCAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DevToolsCore) 1 0x000000010035fc1a _XCAssertionFailureHandler (in DevToolsCore) 2 0x00000001002790d1 -[PBXTarget dealloc] (in DevToolsCore) 3 0x00000001002911e8 -[PBXLegacyTarget dealloc] (in DevToolsCore) 4 0x00000001002c5b16 -[PBXTargetBookmark dealloc] (in DevToolsCore) 5 0x00007fff8224ff71 __CFBasicHashStandardCallback (in CoreFoundation) 6 0x00007fff82250931 __CFBasicHashDrain (in CoreFoundation) 7 0x00007fff822396b3 _CFRelease (in CoreFoundation) 8 0x0000000100254171 -[PBXProject dealloc] (in DevToolsCore) 9 0x00007fff82262d56 _CFAutoreleasePoolPop (in CoreFoundation) 10 0x00007fff841b530c -[NSAutoreleasePool drain] (in Foundation) 11 0x000000010000c60d 12 0x00000001000014f4 ** INTERNAL ERROR: Uncaught Exception ** Exception: ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-1648/pbxcore/Target.subproj/PBXTarget.m:597 Details: Assertion failed: (nil == _buildContext) || (nil == [_buildContext target]) Object: <PBXLegacyTarget:0x104b97370> Method: -dealloc Thread: <NSThread: 0x100b141a0>{name = (null), num = 1} Backtrace: 0 0x000000010035feaf -[XCAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DevToolsCore) 1 0x000000010035fc1a _XCAssertionFailureHandler (in DevToolsCore) 2 0x00000001002790d1 -[PBXTarget dealloc] (in DevToolsCore) 3 0x00000001002911e8 -[PBXLegacyTarget dealloc] (in DevToolsCore) 4 0x00000001002c5b16 -[PBXTargetBookmark dealloc] (in DevToolsCore) 5 0x00007fff8224ff71 __CFBasicHashStandardCallback (in CoreFoundation) 6 0x00007fff82250931 __CFBasicHashDrain (in CoreFoundation) 7 0x00007fff822396b3 _CFRelease (in CoreFoundation) 8 0x0000000100254171 -[PBXProject dealloc] (in DevToolsCore) 9 0x00007fff82262d56 _CFAutoreleasePoolPop (in CoreFoundation) 10 0x00007fff841b530c -[NSAutoreleasePool drain] (in Foundation) 11 0x000000010000c60d 12 0x00000001000014f4 Stack: 0 0x00007fff822ded06 __exceptionPreprocess (in CoreFoundation) 1 0x00007fff832470f3 objc_exception_throw (in libobjc.A.dylib) 2 0x00007fff823369b9 -[NSException raise] (in CoreFoundation) 3 0x000000010035ff6a -[XCAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DevToolsCore) 4 0x000000010035fc1a _XCAssertionFailureHandler (in DevToolsCore) 5 0x00000001002790d1 -[PBXTarget dealloc] (in DevToolsCore) 6 0x00000001002911e8 -[PBXLegacyTarget dealloc] (in DevToolsCore) 7 0x00000001002c5b16 -[PBXTargetBookmark dealloc] (in DevToolsCore) 8 0x00007fff8224ff71 __CFBasicHashStandardCallback (in CoreFoundation) 9 0x00007fff82250931 __CFBasicHashDrain (in CoreFoundation) 10 0x00007fff822396b3 _CFRelease (in CoreFoundation) 11 0x0000000100254171 -[PBXProject dealloc] (in DevToolsCore) 12 0x00007fff82262d56 _CFAutoreleasePoolPop (in CoreFoundation) 13 0x00007fff841b530c -[NSAutoreleasePool drain] (in Foundation) 14 0x000000010000c60d 15 0x00000001000014f4 Abort trap

    Read the article

  • Dynamically formatting a string

    - by TofuBeer
    Before I wander off and roll my own I was wondering if anyone knows of a way to do the following sort of thing... Currently I am using MessageFormat to create some strings. I now have the requirement that some of those strings will have a variable number of arguments. For example (current code): MessageFormat.format("{0} OR {1}", array[0], array[1]); Now I need something like: // s will have "1 OR 2 OR 3" String s = format(new int[] { 1, 2, 3 }); and: // s will have "1 OR 2 OR 3 OR 4" String s = format(new int[] { 1, 2, 3, 4 }); There are a couple ways I can think of creating the format string, such as having 1 String per number of arguments (there is a finite number of them so this is practical, but seems bad), or build the string dynamically (there are a lot of them so this could be slow). Any other suggestions?

    Read the article

  • Not able to save extjs combo using grails controller

    - by abhi
    Hi all, I am a newbie to grails/extjs I am developing a web based config tool for my team .My issue is with comboboxes of extjs I have three remote comboxes(many to one hibernate mappng).I am using hiddenName to submit its value field(which is id primay key of database) instead of its display field which is name which i get by rendering it as json.some how I see that if I select diff index other than which is loaded from db and try updating it.it definitely sends it as params but in save method of grails its not updated. I want to understand Why? I have pasted snippetof both combobox and grails method? { xtype : 'combo', id:'cpsServerid', fieldLabel : 'CpsServer', name : 'cpsServer', //hiddenId:'cpsID', hiddenName:'cpsID', store: cpsServerStore, displayField:'NAME', valueField:'ID', editable:true, typeAhead:true, mode:'remote', triggerAction:'all', width:300, autoScroll:true, selected:name, selectOnFocus:true}, GRAILS SAVE def saveApplicationSubscription = { println "saveApplicationSubscription, params = $params" ApplicationSubscription subscription if (params.id) { subscription = ApplicationSubscription.get(params.id as int) subscription.cpsServer = CpsServer.get(params.cpsID as int) subscription.topic = params.topic subscription.description = params.description subscription.subscriberApplication = SubscriberApplication.get(params.subAppID as int) subscription.outputQueue = OutputQueue.get(params.outputID as int) bindData(subscription , params) } else { params.id = 0 subscription = new ApplicationSubscription(params) subscription.id = params.id as int subscription.cpsServer = CpsServer.get(params.cpsID as int ) subscription.topic = params.topic subscription.description = params.description subscription.subscriberApplication = SubscriberApplication.get(params.subAppID as int) subscription.outputQueue = OutputQueue.get(params.outputID as int) // subscription.messageFormat = params.messageFormat } if (subscription.save()) { log.info("Saved ApplicationSubscription $subscription") render([success: true] as JSON) } else { log.info("Failed to save ApplicationSubscription $subscription, errors = ${subscription.errors}") render([success: false, errors: subscription.errors] as JSON) } } I would really apperciate any help

    Read the article

  • selectOneMenu - java.lang.NullPointerException when adding record to the database (JSF2 and JPA2-OpenJPA)

    - by rogie
    Good day to all; I'm developing a program using JSF2 and JPA2 (OpenJPA). Im also using IBM Rapid App Dev't v8 with WebSphere App Server v8 test server. I have two simple entities, Employee and Department. Each Department has many Employees and each Employee belongs to a Department (using deptno and workdept). My problem occurs when i tried to add a new employee and selecting a department from a combo box (using selectOneMenu - populated from Department table): when i run the program, the following error messages appeared: An Error Occurred: java.lang.NullPointerException Caused by: java.lang.NullPointerException - java.lang.NullPointerException I also tried to make another program using Deptno and Workdept as String instead of integer, still doesn't work. Pls help. Im also a newbie. Tnx and God bless. Below are my codes, configurations and setup. Just tell me if there are some codes that I forgot to include. Im also using Derby v10.5 as my database: CREATE SCHEMA RTS; CREATE TABLE RTS.DEPARTMENT (DEPTNO INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), DEPTNAME VARCHAR(30)); ALTER TABLE RTS.DEPARTMENT ADD CONSTRAINT PK_DEPARTMNET PRIMARY KEY (DEPTNO); CREATE TABLE RTS.EMPLOYEE (EMPNO INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), NAME VARCHAR(50), WORKDEPT INTEGER); ALTER TABLE RTS.EMPLOYEE ADD CONSTRAINT PK_EMPLOYEE PRIMARY KEY (EMPNO); Employee and Department Entities package rts.entities; import java.io.Serializable; import javax.persistence.*; @Entity public class Employee implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int empno; private String name; //bi-directional many-to-one association to Department @ManyToOne @JoinColumn(name="WORKDEPT") private Department department; ....... getter and setter methods package rts.entities; import java.io.Serializable; import javax.persistence.*; import java.util.List; @Entity public class Department implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int deptno; private String deptname; //bi-directional many-to-one association to Employee @OneToMany(mappedBy="department") private List<Employee> employees; ....... getter and setter methods JSF 2 snipet using combo box (populated from Department table) <tr> <td align="left">Department</td> <td style="width: 5px">&#160;</td> <td><h:selectOneMenu styleClass="selectOneMenu" id="department1" value="#{pc_EmployeeAdd.employee.department}"> <f:selectItems value="#{DepartmentManager.departmentSelectList}" id="selectItems1"></f:selectItems> </h:selectOneMenu></td> </tr> package rts.entities.controller; import com.ibm.jpa.web.JPAManager; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import com.ibm.jpa.web.NamedQueryTarget; import com.ibm.jpa.web.Action; import javax.persistence.PersistenceUnit; import javax.annotation.Resource; import javax.transaction.UserTransaction; import rts.entities.Department; import java.util.List; import javax.persistence.Query; import java.util.ArrayList; import java.text.MessageFormat; import javax.faces.model.SelectItem; @SuppressWarnings("unchecked") @JPAManager(targetEntity = rts.entities.Department.class) public class DepartmentManager { ....... public List<SelectItem> getDepartmentSelectList() { List<Department> departmentList = getDepartment(); List<SelectItem> selectList = new ArrayList<SelectItem>(); MessageFormat mf = new MessageFormat("{0}"); for (Department department : departmentList) { selectList.add(new SelectItem(department, mf.format( new Object[] { department.getDeptname() }, new StringBuffer(), null).toString())); } return selectList; } Converter: package rts.entities.converter; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import rts.entities.Department; import rts.entities.controller.DepartmentManager; import com.ibm.jpa.web.TypeCoercionUtility; public class DepartmentConverter implements Converter { public Object getAsObject(FacesContext facesContext, UIComponent arg1, String entityId) { DepartmentManager departmentManager = (DepartmentManager) facesContext .getApplication().createValueBinding("#{DepartmentManager}") .getValue(facesContext); int deptno = (Integer) TypeCoercionUtility.coerceType("int", entityId); Department result = departmentManager.findDepartmentByDeptno(deptno); return result; } public String getAsString(FacesContext arg0, UIComponent arg1, Object object) { if (object instanceof Department) { return "" + ((Department) object).getDeptno(); } else { throw new IllegalArgumentException("Invalid object type:" + object.getClass().getName()); } } } Method for Add button: public String createEmployeeAction() { EmployeeManager employeeManager = (EmployeeManager) getManagedBean("EmployeeManager"); try { employeeManager.createEmployee(employee); } catch (Exception e) { logException(e); } return ""; } faces-conf.xml <converter> <converter-for-class>rts.entities.Department</converter-for-class> <converter-class>rts.entities.converter.DepartmentConverter</converter-class> </converter> Stack trace javax.faces.FacesException: java.lang.NullPointerException at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241) at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:258) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1147) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:722) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1020) at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:886) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1655) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1650) Caused by: java.lang.NullPointerException at rts.entities.converter.DepartmentConverter.getAsString(DepartmentConverter.java:29) at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:656) at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.getSubmittedOrSelectedValuesAsSet(HtmlRendererUtils.java:444) at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:421) at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:359) at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:76) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:519) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:626) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:622) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:622) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:622) at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1320) at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:263) at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239) ... 24 more

    Read the article

  • Cleanest way to build an SQL string in Java

    - by Vidar
    I want to build an SQL string to do database manipulation (updates, deletes, inserts, selects, that sort of thing) - instead of the awful string concat method using millions of "+"'s and quotes which is unreadable at best - there must be a better way. I did think of using MessageFormat - but its supposed to be used for user messages, although I think it would do a reasonable job - but I guess there should be something more aligned to SQL type operations in the java sql libraries. Would Groovy be any good? Any help much appreciated.

    Read the article

  • How to extract messages to translate from a Play! application

    - by Martin
    I'm writing my first application using the Play! framework and I was wondering if there was a tool that could extract the messages that need translation from my views and controllers for me ? It is rather cumbersome to fill the conf/messages(.xx) file while I'm developing my app, but I'm afraid that if I don't do it as I go, I will never be able to completely translate my application afterwards. Such tools exist with other framework such as CakePHP for instance, and I think that it shouldn't be hard to write one by myself, but if there already is one... I was also wondering, what should I name the keys of the messages in my application ? Using gettext, it's not bad practice to directly type in the message in english as the key, but is it with the system that Play! uses (MessageFormat, right ?) ? Does anyone have an advice or naming convention (something like controller.action.describe_the_message maybe) ? Thank you for your advices !

    Read the article

  • Compile PHP 5.3.2 with intl extension on Snow Leopard 10.6.3

    - by fsb
    Does anyone have some tips on compiling PHP's intl extension on PHP? I'm getting compile errors each way I try it and I've been googling for ages and getting nowhere. Any help greatly appreciated. When make gets to the huge gcc command to compile libphp5.bundle, I get the following error: Undefined symbols: "___gxx_personality_v0", referenced from: icu_4_2::MessageFormatAdapter::getArgTypeList(icu_4_2::MessageFormat const&, int&)in msgformat_helpers.o _umsg_parse_helper in msgformat_helpers.o _umsg_format_arg_count in msgformat_helpers.o _umsg_format_helper in msgformat_helpers.o CIE in msgformat_helpers.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [libs/libphp5.bundle] Error 1 My compile commands are: MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch x86_64 -g -Os -pipe" CXXFLAGS="-arch x86_64 -g -Os -pipe" LDFLAGS="-arch x86_64 -bind_at_load" export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET ./configure --prefix=/usr \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --sysconfdir=/private/etc \ --with-apxs2=/usr/sbin/apxs \ --enable-cli \ --with-config-file-path=/etc \ --with-libxml-dir=/usr \ --with-openssl=/usr \ --with-zlib=/usr \ --with-bz2=/usr \ --with-curl=/usr \ --with-gd \ --with-jpeg-dir=/src/jpeg/jpeg-local \ --with-png-dir=/usr/X11R6 \ --with-freetype-dir=/usr/X11R6 \ --with-xpm-dir=/usr/X11R6 \ --with-ldap=/usr \ --with-ldap-sasl=/usr \ --enable-mbstring \ --enable-mbregex \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysql-sock=/var/mysql/mysql.sock \ --with-iodbc=/usr \ --enable-shmop \ --with-snmp=/usr \ --enable-soap \ --enable-sockets \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --with-xmlrpc \ --with-iconv-dir=/usr \ --with-xsl=/usr \ --with-pcre-regex=/src/pcre/pcre-local/usr/local \ --with-pcre-dir=/src/pcre/pcre-local/usr/local \ --with-icu-dir=/usr/local \ --enable-intl export EXTRA_CFLAGS="-lresolv" make

    Read the article

  • HttpPost request unsuccessful

    - by The Thom
    I have written a web service and am now writing a tester to perform integration testing from the outside. I am writing my tester using apache httpclient 4.3. Based on the code here: http://hc.apache.org/httpcomponents-client-4.3.x/quickstart.html and here: http://hc.apache.org/httpcomponents-client-4.3.x/tutorial/html/fundamentals.html#d5e186 I have written the following code. Map<String, String> parms = new HashMap<>(); parms.put(AirController.KEY_VALUE, json); postUrl(SERVLET, parms); ... protected String postUrl(String servletName, Map<String, String> parms) throws AirException{ String url = rootUrl + servletName; HttpPost post = new HttpPost(url); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); for(Map.Entry<String, String> entry:parms.entrySet()){ BasicNameValuePair parm = new BasicNameValuePair(entry.getKey(), entry.getValue()); nvps.add(parm); } try { post.setEntity(new UrlEncodedFormEntity(nvps)); } catch (UnsupportedEncodingException use) { String msg = "Invalid parameters:" + parms; throw new AirException(msg, use); } CloseableHttpResponse response; try { response = httpclient.execute(post); } catch (IOException ioe) { throw new AirException(ioe); } String result; if(HttpStatus.SC_OK == response.getStatusLine().getStatusCode()){ result = processResponse(response); } else{ String msg = MessageFormat.format("Invalid status code {0} received from query {1}.", new Object[]{response.getStatusLine().getStatusCode(), url}); throw new AirException(msg); } return result; } This code successfully reaches my servlet. In my servlet, I have (using Spring's AbstractController): protected ModelAndView post(HttpServletRequest request, HttpServletResponse response) { String json = String.valueOf(request.getParameter(KEY_VALUE)); if(json.equals("null")){ log.info("Received null value."); response.setStatus(406); return null; } And this code always falls into the null parameter code and returns a 406. I'm sure I'm missing something simple, but can't see what it is.

    Read the article

  • Integrate openid4java to GWT Project

    - by Slyker
    Hi, I created an GWT project in eclipse. Now I tried to implement openId with using the openid4java library. I imported the .jar files via properties--java build path: openid4java-0.9.5.jar lib/*.jar In addition I copied the .jar files into the war/WEB-INF/lib directory. The problem at hand comes up when I call the authenticate() method. Then I get a: HTTP ERROR 500 Problem accessing /openid/openid. Reason: access denied (java.lang.RuntimePermission modifyThreadGroup)Caused by:java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166) at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:191) at java.lang.ThreadGroup.checkAccess(Unknown Source) at java.lang.Thread.init(Unknown Source) at java.lang.Thread.<init>(Unknown Source) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ReferenceQueueThread.<init>(MultiThreadedHttpConnectionManager.java:1039) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.storeReferenceToConnection(MultiThreadedHttpConnectionManager.java:164) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.access$900(MultiThreadedHttpConnectionManager.java:64) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ConnectionPool.createConnection(MultiThreadedHttpConnectionManager.java:750) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:469) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:394) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:152) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324) at org.openid4java.util.HttpCache.head(HttpCache.java:296) at org.openid4java.discovery.yadis.YadisResolver.retrieveXrdsLocation(YadisResolver.java:360) at org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:229) at org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:221) at org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:179) at org.openid4java.discovery.Discovery.discover(Discovery.java:134) at org.openid4java.discovery.Discovery.discover(Discovery.java:114) at org.openid4java.consumer.ConsumerManager.discover(ConsumerManager.java:527) at auth.openid.server.OpenIDServlet.authenticate(OpenIDServlet.java:138) at auth.openid.server.OpenIDServlet.doGet(OpenIDServlet.java:101) at javax.servlet.http.HttpServlet.service(HttpServlet.java:693) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:51) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:349) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Here my servlet source: import com.google.gwt.user.client.rpc.RemoteService; import org.openid4java.OpenIDException; import org.openid4java.consumer.ConsumerException; import org.openid4java.consumer.ConsumerManager; import org.openid4java.consumer.VerificationResult; import org.openid4java.discovery.DiscoveryInformation; import org.openid4java.discovery.Identifier; import org.openid4java.message.AuthRequest; import org.openid4java.message.ParameterList; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.text.MessageFormat; import java.util.List; public final class OpenIDServlet extends HttpServlet implements RemoteService { private final ConsumerManager manager; public OpenIDServlet() { try { manager = new ConsumerManager(); } catch (ConsumerException e) { throw new RuntimeException("Error creating consumer manager", e); } } ... private void authenticate(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { final String loginString = request.getParameter(nameParameter); try { // perform discovery on the user-supplied identifier List discoveries = manager.discover(loginString); // attempt to associate with the OpenID provider // and retrieve one service endpoint for authentication DiscoveryInformation discovered = manager.associate(discoveries); // obtain a AuthRequest message to be sent to the OpenID provider AuthRequest authReq = manager.authenticate(discovered, "openid", null); // redirect to OpenID for authentication response.sendRedirect(authReq.getDestinationUrl(true)); } catch (OpenIDException e) { throw new ServletException("Login string probably caused an error. loginString = " + loginString, e); } } My question now is: What could be my fault? Did I make any mistakes in importing the openid4java library? (which?) All other methods in the servlet which do not use the openid4java implementation work fine. Thanks, Andreas

    Read the article

1