List of usage examples for java.net UnknownHostException printStackTrace
public void printStackTrace()
From source file:org.squidy.nodes.plugin.PatternPlugin.java
@Plugin.Interface public PNode getInterface() { PropertiesTable table = new PropertiesTable(); TextFieldControl control = new TextFieldControl(remoteAddress); control.addPropertyUpdateListener(new PropertyUpdateListener<String>() { public void propertyUpdate(String value) { remoteAddress = value;//from w w w. ja v a 2 s .c o m disposeControlClient(); } }); TableEntry<TextFieldControl> entry = new TableEntry<TextFieldControl>("Remote IP", "Description", control, "", ""); table.addEntry(entry); control = new TextFieldControl(String.valueOf(remotePort)); control.addPropertyUpdateListener(new PropertyUpdateListener<String>() { public void propertyUpdate(String value) { remotePort = Integer.parseInt(value); disposeControlClient(); } }); entry = new TableEntry<TextFieldControl>("Remote Port", "Description", control, "", ""); table.addEntry(entry); control = new TextFieldControl(String.valueOf(patternWidth)); control.addPropertyUpdateListener(new PropertyUpdateListener<String>() { public void propertyUpdate(String value) { patternWidth = Integer.parseInt(value); } }); entry = new TableEntry<TextFieldControl>("Pattern Width", "Description", control, "", ""); table.addEntry(entry); control = new TextFieldControl(String.valueOf(patternHeight)); control.addPropertyUpdateListener(new PropertyUpdateListener<String>() { public void propertyUpdate(String value) { patternHeight = Integer.parseInt(value); } }); entry = new TableEntry<TextFieldControl>("Pattern Height", "Description", control, "", ""); table.addEntry(entry); control = new TextFieldControl(String.valueOf(patternColumns)); control.addPropertyUpdateListener(new PropertyUpdateListener<String>() { public void propertyUpdate(String value) { patternColumns = Integer.parseInt(value); } }); entry = new TableEntry<TextFieldControl>("Pattern Columns", "Description", control, "", ""); table.addEntry(entry); control = new TextFieldControl(String.valueOf(patternRows)); control.addPropertyUpdateListener(new PropertyUpdateListener<String>() { public void propertyUpdate(String value) { patternRows = Integer.parseInt(value); } }); entry = new TableEntry<TextFieldControl>("Pattern Rows", "Description", control, "", ""); table.addEntry(entry); GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); for (final GraphicsDevice device : graphicsEnvironment.getScreenDevices()) { CheckBoxControl control2 = new CheckBoxControl(false); control2.addPropertyUpdateListener(new PropertyUpdateListener<Boolean>() { /** * @param value */ public void propertyUpdate(Boolean value) { InetAddress address = null; try { address = InetAddress.getByName(remoteAddress); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { if (client == null) { client = new ControlClient(address, remotePort); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } SwitchableCommand command = new PatternScreen(device.getIDstring(), patternWidth, patternHeight, patternColumns - 1, patternRows - 1); command.setState(value ? Switch.ON : Switch.OFF); client.send(command); Designer.getInstance().requestFocus(); } }); TableEntry<CheckBoxControl> entry2 = new TableEntry<CheckBoxControl>("Device " + device.getIDstring(), "Description", control2, "", ""); table.addEntry(entry2); } CheckBoxControl loadImageControl = new CheckBoxControl(false); TableEntry<CheckBoxControl> loadImage = new TableEntry<CheckBoxControl>("Load Camera Image", "Description", loadImageControl, "", ""); table.addEntry(loadImage); // panelControl.setImage("C:\\projects\\Squidy\\squidy-2.0.0\\bayer.PNG"); return table; }
From source file:ntut.csie.ezScrum.web.InitialPlugIn.java
public void init(ActionServlet servlet, ModuleConfig config) throws ServletException { log.info("*************Plugin Initail***********"); // ?Server// ww w . j a va 2s . c o m ServletContext application = servlet.getServletContext(); String WebRootPath = application.getRealPath("/"); //??WebRootPath??/ // ? linux ?? // ? xxxxx\ezScrum\/RoleBase.xml ? // if((!WebRootPath.endsWith("/"))||(!WebRootPath.endsWith("\\"))) // { // WebRootPath = WebRootPath.concat("/"); // } if (!WebRootPath.endsWith(File.separator)) { WebRootPath = WebRootPath.concat(File.separator); } this.configManager = new InitialConfigManager(WebRootPath); // Start Set Properties System.setProperty(ISystemPropertyEnum.JOB_SCHEDULER, configManager.getConfig(ISystemPropertyEnum.JOB_SCHEDULER)); System.setProperty(ISystemPropertyEnum.APP_PATH, WebRootPath); /*----------------------------------------------------------- * Workspace Path??? -------------------------------------------------------------*/ String WebRootPath_Workspace = System.getProperty(ISystemPropertyEnum.WORKSPACE_PATH); if (WebRootPath_Workspace == null) { System.setProperty(ISystemPropertyEnum.WORKSPACE_PATH, WebRootPath + "Workspace"); } System.setProperty(ISystemPropertyEnum.LIB_PATH, WebRootPath + "WEB-INF" + File.separator + "lib"); //jake, mantis task 616, jcis 632 System.setProperty(ISystemPropertyEnum.SNAPSHOT_NAME, "MySnapshot"); System.setProperty(ISystemPropertyEnum.SNAPSHOT_PATH, WebRootPath + System.getProperty(ISystemPropertyEnum.SNAPSHOT_NAME)); ////jake, mantis task 616, jcis 632 end System.setProperty(ISystemPropertyEnum.INTEGRATOR_REPORT_XSLPATH, WebRootPath + "IntegrationReport.xsl"); System.setProperty(ISystemPropertyEnum.BUILDER_REPORT_XSLPATH, WebRootPath + "xsl"); System.setProperty(ISystemPropertyEnum.ACCOUT_MANAGER, "ntut.csie.jcis.account.core.internal.XMLAccountManager"); System.setProperty(ISystemPropertyEnum.ACCOUT_MANAGER_PATH, WebRootPath + "RoleBase.xml"); System.setProperty(ISystemPropertyEnum.WEB_APP_NAME, "ezScrum"); System.setProperty(ISystemPropertyEnum.REMOTE_MACHINE_LINUX, "127.0.0.1"); System.setProperty(ISystemPropertyEnum.FULL_WEB_APP_NAME, "http://localhost:8080/JCIS/"); // ?web serverip address try { System.setProperty(ISystemPropertyEnum.WEB_ROOT_ADDRESS, "http://" + InetAddress.getLocalHost().getHostAddress() + ":8080/ezScrum/"); } catch (UnknownHostException e) { e.printStackTrace(); String ip = this.configManager.getConfig(ISystemPropertyEnum.WEB_ROOT_ADDRESS); System.setProperty(ISystemPropertyEnum.WEB_ROOT_ADDRESS, "http://" + ip + ":8080/ezScrum/"); } System.setProperty(ISystemPropertyEnum.RSS_PATH, WebRootPath + File.separator + "Pages" + File.separator + "RSS"); // ezScrum system version information this.configManager.ezScrumConfigLoad(); System.setProperty("System_Version", this.configManager.getConfig("System_Version")); log.info("ezScrum Version: " + System.getProperty("System_Version")); // update ezScrum server url System.setProperty("System_UpdateURL", this.configManager.getConfig("ezScrum.update.server.url")); log.info("ezScrum Update Server: " + System.getProperty("System_UpdateURL")); // update ezScrum workspace path System.setProperty("System_UpdateWorkspace", System.getProperty("user.home") + File.separator + ".ezScrum" + File.separator + "updates"); log.info("ezScrum Update Download Path: " + System.getProperty("System_UpdateWorkspace")); // ezScrum System.setProperty("System_Start_Time", (new Date()).toString()); log.info("ezScrum Start Time: " + System.getProperty("System_Start_Time")); // ProjectLogic projectLogic = new ProjectLogic(); // projectLogic.cloneDefaultFile(); ezSCrum v1.8?? // ============================================= // ? v1.2 ?? // ? RoleBase // projectLogic.check_default_role(); ezSCrum v1.8?? // ? ScrumRole ? guest // projectLogic.check_role_guest(); ezSCrum v1.8?? // ============================================= /* * ezScrum system information * ?? String systemTeam = this.configManager.getConfig("System_Team"); String contactInformation = this.configManager.getConfig("contact_information"); try { systemTeam = new String(systemTeam.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } try { contactInformation = new String(contactInformation.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } System.setProperty("System_Team",systemTeam); System.setProperty("contact_information",contactInformation); */ // log.info("ntut.csie.jcis.ApplicationRoot=\t" // + System.getProperty("ntut.csie.jcis.ApplicationRoot")); // log.info("ntut.csie.jcis.resource.WorkspaceRoot=\t" // + System.getProperty("ntut.csie.jcis.resource.WorkspaceRoot")); // log.info("ntut.csie.jcis.LibPath=\t" // + System.getProperty("ntut.csie.jcis.LibPath")); // log.info("ntut.csie.jcis.SnapshotName=\t" // + System.getProperty("ntut.csie.jcis.SnapshotName")); // log.info("ntut.csie.jcis.SnapshotPath=\t" // + System.getProperty("ntut.csie.jcis.SnapshotPath")); // log // .info("ntut.csie.jcis.integrationReport.xslPath=\t" // + System // .getProperty("ntut.csie.jcis.integrationReport.xslPath")); // log.info("ntut.csie.jcis.builderReport.xslPath=\t" // + System.getProperty("ntut.csie.jcis.builderReport.xslPath")); // log.info("ntut.csie.jcis.WebAppName=\t" // + System.getProperty("ntut.csie.jcis.WebAppName")); // log.info("ntut.csie.jcis.accountManager=\t" // + System.getProperty("ntut.csie.jcis.accountManager")); // log.info("ntut.csie.jcis.accountManager.path=\t" // + System.getProperty("ntut.csie.jcis.accountManager.path")); // // System.setProperty(ISystemPropertyEnum.BACKUP_PATH, WebRootPath // + "Backup"); // log.info("ntut.csie.jcis.UseVirtualEnvironment=\t" // + System.getProperty("ntut.csie.jcis.UseVirtualEnvironment")); // log.info("ntut.csie.jcis.VMMSIPAddress=\t" // + System.getProperty("ntut.csie.jcis.VMMSIPAddress")); // log.info("ntut.csie.jcis.temp.workspaceRoot=\t" // + System.getProperty("ntut.csie.jcis.temp.workspaceRoot")); // log.info("ntut.csie.jcis.tempDownloadURL=\t" // + System.getProperty("ntut.csie.jcis.tempDownloadURL")); // log.info("ntut.csie.jcis.UploadPath=\t" // + System.getProperty("ntut.csie.jcis.UploadPath")); // log.info("ntut.csie.jcis.UploadUrl=\t" // + System.getProperty("ntut.csie.jcis.UploadUrl")); // log.info("ntut.csie.jcis.SourceServerPath=\t" // + System.getProperty("ntut.csie.jcis.SourceServerPath")); // log.info("ntut.csie.jcis.SourceServerUrl=\t" // + System.getProperty("ntut.csie.jcis.SourceServerUrl")); // log.info("Create PIC"); // ProjectInfoCenter.getInstance(); log.info("*************Plugin Initail END***********"); // log.info("*************Start Patch***********"); // Patcher patcher = new Patcher(WebRootPath+"Patch", WebRootPath+"..", WebRootPath+"Backup"); // patcher.patchAll(); // log.info("*************Start End***********"); }
From source file:plugins.KerberosSsoTest.java
private FirefoxDriver getNegotiatingFirefox(KerberosContainer kdc, String tokenCache) { FirefoxProfile profile = new FirefoxProfile(); profile.setAlwaysLoadNoFocusLib(true); // Allow auth negotiation for jenkins under test String trustedUris = jenkins.url.toExternalForm(); String jenkins_local_hostname = System.getenv("JENKINS_LOCAL_HOSTNAME"); // if JENKINS_LOCAL_HOSTNAME is set, we add this to FF nego uris if (jenkins_local_hostname != null && !jenkins_local_hostname.isEmpty()) { try {//from www. j ava 2 s . c o m // In the case where JENKINS_LOCAL_HOSTNAME is an IP, // we need to add its resolved hostname for auth negociation String hostName = InetAddress.getByName(jenkins_local_hostname).getCanonicalHostName(); trustedUris = trustedUris + ", " + hostName; } catch (UnknownHostException e) { e.printStackTrace(); throw new Error(e); } } profile.setPreference("network.negotiate-auth.trusted-uris", trustedUris); profile.setPreference("network.negotiate-auth.delegation-uris", trustedUris); FirefoxBinary binary = new FirefoxBinary(); // Inject config and TGT binary.setEnvironmentProperty("KRB5CCNAME", tokenCache); binary.setEnvironmentProperty("KRB5_CONFIG", kdc.getKrb5ConfPath()); // Turn debug on binary.setEnvironmentProperty("KRB5_TRACE", diag.touch("krb5_trace.log").getAbsolutePath()); binary.setEnvironmentProperty("NSPR_LOG_MODULES", "negotiateauth:5"); binary.setEnvironmentProperty("NSPR_LOG_FILE", diag.touch("firefox.nego.log").getAbsolutePath()); String display = FallbackConfig.getBrowserDisplay(); if (display != null) { binary.setEnvironmentProperty("DISPLAY", display); } final FirefoxDriver driver = new FirefoxDriver(binary, profile); cleaner.addTask(new Statement() { @Override public void evaluate() throws Throwable { try { driver.quit(); } catch (UnreachableBrowserException ex) { System.err.println("Browser died already"); ex.printStackTrace(); } } @Override public String toString() { return "Close Kerberos WebDriver after test"; } }); return driver; }
From source file:edu.ku.brc.specify.utilapps.RegProcEntry.java
private void discoverHostName() { if (hostName == null) { String ip = props.getProperty("ip"); if (ip == null) { ip = ""; hostName = ""; props.put("hostname", hostName); } else {//from ww w. ja v a 2 s .co m hostName = ipHash.get(ip); } if (hostName == null) { try { InetAddress addr = InetAddress.getByName(ip); hostName = addr.getHostName(); ipHash.put(ip, hostName); } catch (UnknownHostException e) { e.printStackTrace(); } } props.put("hostname", hostName); } }
From source file:com.wisedu.scc.love.widget.http.SyncRequestHandler.java
private String makeRequestWithRetries(HttpUriRequest request) throws IOException { boolean retry = true; IOException cause = null;//from ww w. j av a 2s .co m HttpRequestRetryHandler retryHandler = client.getHttpRequestRetryHandler(); while (retry) { try { HttpResponse response = client.execute(request, context); return entityHandler.handleEntity(response.getEntity(), null, charset); } catch (UnknownHostException e) { cause = e; retry = retryHandler.retryRequest(cause, ++executionCount, context); } catch (IOException e) { cause = e; retry = retryHandler.retryRequest(cause, ++executionCount, context); } catch (NullPointerException e) { e.printStackTrace(); // HttpClient 4.0.x ?bug // http://code.google.com/p/android/issues/detail?id=5255 cause = new IOException("NPE in HttpClient" + e.getMessage()); retry = retryHandler.retryRequest(cause, ++executionCount, context); } catch (Exception e) { cause = new IOException("Exception" + e.getMessage()); retry = retryHandler.retryRequest(cause, ++executionCount, context); } } if (cause != null) throw cause; else throw new IOException(""); }
From source file:de.jaetzold.networking.SimpleServiceDiscovery.java
private InetAddress getAndroidLocalIP() { String ipv4 = getIPAddress(true); StringTokenizer tk = new StringTokenizer(ipv4, "."); int a = 0;/*from w w w. ja v a 2 s . c o m*/ int b = 0; int c = 0; int d = 0; try { a = Integer.parseInt(tk.nextToken()); b = Integer.parseInt(tk.nextToken()); c = Integer.parseInt(tk.nextToken()); d = Integer.parseInt(tk.nextToken()); } catch (Exception e) { try { return InetAddress.getByAddress(new byte[] { (byte) a, (byte) b, (byte) c, (byte) d }); } catch (UnknownHostException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } try { return InetAddress.getByAddress(new byte[] { (byte) a, (byte) b, (byte) c, (byte) d }); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
From source file:com.ifoer.util.NetPOSPrinter.java
public int printPic(Bitmap bmp) { WifiManager wifi_service = (WifiManager) this.mContext.getSystemService("wifi"); DhcpInfo dhcpinfo = wifi_service.getDhcpInfo(); WifiInfo wifi_info = wifi_service.getConnectionInfo(); if (wifi_info != null && wifi_info.getSSID() != null && !wifi_info.getSSID().startsWith("X-431PRINTER")) { return PRINT_NOT_CONNECT; }//from w w w .j ava 2 s.c o m this.serverAddress = dhcpinfo.serverAddress; try { this.wifiSocket = new Socket(Formatter.formatIpAddress(this.serverAddress), PRINT_PORT); this.dos = new DataOutputStream(this.wifiSocket.getOutputStream()); this.in = new DataInputStream(this.wifiSocket.getInputStream()); } catch (UnknownHostException e1) { e1.printStackTrace(); } catch (IOException e12) { e12.printStackTrace(); } if (this.dos == null || this.in == null) { return PRINT_NOT_CONNECT; } byte[] data = new byte[3]; data[0] = (byte) 27; data[ERROR_PRINT_JAM] = (byte) 51; try { this.dos.write(data, 0, data.length); data[0] = (byte) 0; data[ERROR_PRINT_JAM] = (byte) 0; data[ERROR_PRINT_WILL_NO_PAPER] = (byte) 0; } catch (IOException e122) { e122.printStackTrace(); } byte[] escj = new byte[3]; escj[0] = (byte) 27; escj[ERROR_PRINT_JAM] = (byte) 74; int i = 3; byte[] esccheck = new byte[] { (byte) 29, (byte) 114, (byte) 73 }; byte[] escBmp = new byte[5]; escBmp[0] = (byte) 27; escBmp[ERROR_PRINT_JAM] = (byte) 42; escBmp[ERROR_PRINT_WILL_NO_PAPER] = SmileConstants.TOKEN_LITERAL_NULL; escBmp[3] = (byte) (bmp.getWidth() % KEYRecord.OWNER_ZONE); escBmp[ERROR_PRINT_NO_PAPER] = (byte) (bmp.getWidth() / KEYRecord.OWNER_ZONE); for (int i2 = 0; i2 < (bmp.getHeight() / 24) + ERROR_PRINT_JAM; i2 += ERROR_PRINT_JAM) { try { this.dos.write(escBmp, 0, escBmp.length); } catch (IOException e) { e.printStackTrace(); } for (int j = 0; j < bmp.getWidth(); j += ERROR_PRINT_JAM) { for (int k = 0; k < 24; k += ERROR_PRINT_JAM) { if ((i2 * 24) + k < bmp.getHeight()) { if (Color.red(bmp.getPixel(j, (i2 * 24) + k)) == 0) { int i3 = k / ERROR_PRINT_ACTUATOR_FAULT; data[i3] = (byte) (data[i3] + ((byte) (ERROR_PRINT_HEAD_OVERHEATING >> (k % ERROR_PRINT_ACTUATOR_FAULT)))); } } } try { this.dos.write(data, 0, data.length); data[0] = (byte) 0; data[ERROR_PRINT_JAM] = (byte) 0; data[ERROR_PRINT_WILL_NO_PAPER] = (byte) 0; } catch (IOException e2) { e2.printStackTrace(); } } try { if (i2 % 10 == 0) { this.dos.write(esccheck); if (this.in.readByte() == null) { this.dos.write(escj, 0, escj.length); } } else { this.dos.write(escj, 0, escj.length); } } catch (IOException e22) { e22.printStackTrace(); } } i = 3; byte[] escf = new byte[] { (byte) 29, (byte) 122, (byte) 49 }; i = 3; byte[] esck = new byte[] { (byte) 27, (byte) 74, (byte) 64 }; try { this.dos.write(escf); this.dos.write(esck); this.result = this.in.readByte(); try { this.dos.close(); this.in.close(); } catch (IOException e222) { e222.printStackTrace(); } return this.result; } catch (IOException e3) { return PRINT_NOT_CONNECT; } }
From source file:org.openqa.selenium.server.htmlrunner.DatabaseTestResults.java
public void write() throws IOException { // insert Database TestSuiteName String setname = "";// TODO - implement suite.getName()? String runId = productName.toUpperCase() + timestamp; String bTcDesc = System.getProperty("database.tc_desc", "false"); String username = System.getProperty("gitak.username", System.getProperty("user.name")); String hostname = System.getProperty("gitak.hostname"); if (hostname == null) { try {// w w w . j a v a2 s. c om InetAddress addr = InetAddress.getLocalHost(); hostname = addr.getHostName(); } catch (UnknownHostException e) { e.printStackTrace(); } } if (this.getDbReportOption()) { this.connectDatabase(); String sqlstmt = "INSERT INTO tsi_tests_run(RUN_ID, HOSTNAME, PLATFORM, USER_NAME, " + "START_TIME, END_TIME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_BUILD, CATEGORY, STATUS, " + "NUM_TC_STARTED, NUM_TC_PASSED, NUM_TC_FAILED, NUM_TC_MANUAL, NUM_TC_UNCERTAIN, LOG_URL, " + "NOTE, T_TESTS_VERSION) VALUES(" + "'" + runId + "', '" + hostname + "', '" + runtimePlatform + "', '" + username + "', " + //"to_date('" + formatDateTime(runTime) + "', 'yyyy/mm/dd-hh24:mi:ss'), " + " SYSDATE," + // "to_date('" + formatDateTime(null) + "', 'yyyy/mm/dd-hh24:mi:ss'), " + " SYSDATE," + " '" + productName + // PDMS predefine product acronym "', '" + productVersion + // Version id like 3.5.1.7 "', '" + productBuild + // Top level label, use full version id like 3.5.1V7 "', '" + dbCategory + // -Ddatabase.category=ui for PDMS UI test category "', 'COMPLETED', " + numTestTotal + ", " + numTestPasses + ", " + numTestFailures + ", 0, 0, '" + logUrl + "', null, '" + this.seleniumVersion + "' )"; qaSqlExecute(sqlstmt); if (testPassed.size() > 0) { String[] split = splitTestString(testPassed.get(0), "::"); setname = split[0]; } else if (testFailed.size() > 0) { String[] split = splitTestString(testFailed.get(0), "::"); setname = split[0]; } if (setname.length() > 27) { setname = setname.substring(0, 27); // set_name column size = 30 } log.info("Test Suite = " + setname); String sqlset = "INSERT INTO tsi_tests_set(RUN_ID, SEQ_NO, SET_NAME, OWNER," + "START_TIME, END_TIME, NUM_TC_STARTED, NUM_TC_PASSED, NUM_TC_FAILED, NUM_TC_MANUAL, NUM_TC_UNCERTAIN, LOG_URL, NOTE) " + " VALUES('" + runId + "', null, '" + setname + "', '" + username + "', " + //"to_date('" + formatDateTime(runTime) + "', 'yyyy/mm/dd-hh24:mi:ss'), " + " SYSDATE, SYSDATE, 0, 0, 0, 0, 0, null, null)"; qaSqlExecute(sqlset); for (String aTestFailed : testFailed) { String tfail = aTestFailed.replace("\u00a0", " "); // parse failed test string and insert to Database String[] values = splitTestString(tfail, "\\|"); if (values.length > 0) { String[] names = splitTestString(values[0], "::"); String testSet = names[0]; String testCase = names[1]; if (bTcDesc.equals("true") && names.length > 2) { String testDesc = names[2]; log.info("Test Desc -->" + testDesc); String descStmt = this.createSqlTestCaseDescription(testSet, testCase, testDesc); qaSqlExecute(descStmt); } qaSqlExecute(this.createSqlTestCaseStatement(runId, testSet, testCase, false, tfail)); } } for (String aTestPassed : testPassed) { String tpass = aTestPassed.replace("\u00a0", " "); String[] names = splitTestString(tpass, "::"); String testSet = names[0]; String testCase = names[1]; if (bTcDesc.equals("true") && names.length > 2) { String testDesc = names[2]; log.info("Test Desc -->" + testDesc); String descStmt = this.createSqlTestCaseDescription(testSet, testCase, testDesc); qaSqlExecute(descStmt); } String stmt = this.createSqlTestCaseStatement(runId, testSet, testCase, true, null); qaSqlExecute(stmt); } // Update runtime with actual elapsed time from posted result runTime.setTime(runTime.getTime() + this.getTotalTime()); // Updating test set/suite to close String updateSet = "update tsi_tests_set set seq_no=0, owner=''{0}'', end_time=to_date(''{1}'',''yyyy/mm/dd-hh24:mi:ss'')," + " num_tc_passed={2}, num_tc_failed={3} where run_id=''{4}'' and set_name=''{5}''"; // update ? log_url='' Object[] setVal = { username, formatDateTime(runTime), numTestPasses, numTestFailures, runId, setname }; qaSqlExecute(MessageFormat.format(updateSet, setVal)); // Updating test run to close String updateRun = "update tsi_tests_run set end_time=to_date(''{0}'',''yyyy/mm/dd-hh24:mi:ss''), status=''COMPLETED''," + " NUM_TC_PASSED={1}, NUM_TC_FAILED={2} where run_id = ''{3}''"; Object[] runVal = { formatDateTime(runTime), numTestPasses, numTestFailures, runId }; qaSqlExecute(MessageFormat.format(updateRun, runVal)); closeDatabase(); } // if this.getDbReportOption }
From source file:org.dawnsci.commandserver.core.process.ProgressableProcess.java
public ProgressableProcess(final URI uri, final String statusTName, final String statusQName, StatusBean bean) { this.uri = uri; this.statusTName = statusTName; this.statusQName = statusQName; this.bean = bean; this.broadcaster = new Broadcaster(uri, statusQName, statusTName); bean.setStatus(Status.QUEUED);//from w w w . java 2s . c om try { bean.setHostName(InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException e) { // Not fatal but would be nice... e.printStackTrace(); } broadcast(bean); }
From source file:de.jaetzold.networking.SimpleServiceDiscovery.java
/** * Send a SSDP search message with the given search target (ST) and return a list of received responses. *//*from w w w. j a va2s .c o m*/ public Map<String, URL> discover(String searchTarget) { Log.d("HUE", "ServiceDiscovery.discover"); final InetSocketAddress address; // standard multicast port for SSDP try { // multicast address with administrative scope address = new InetSocketAddress(InetAddress.getByName(MULTICAST_ADDRESS), MULTICAST_PORT); //address = InetAddress.getByName(MULTICAST_ADDRESS); } catch (UnknownHostException e) { e.printStackTrace(); throw new IllegalStateException("Can not get multicast address", e); } final MulticastSocket socket; try { socket = new MulticastSocket(null); InetAddress localhost = getAndroidLocalIP(); InetSocketAddress srcAddress = new InetSocketAddress(localhost, MULTICAST_PORT); Log.d("HUE", "" + srcAddress.getAddress()); socket.bind(srcAddress); Log.d("HUE", "step 1"); } catch (IOException e) { e.printStackTrace(); throw new IllegalStateException("Can not create multicast socket"); } try { socket.setSoTimeout(socketTimeout); Log.d("HUE", "step 2"); } catch (SocketException e) { e.printStackTrace(); throw new IllegalStateException("Can not set socket timeout", e); } try { socket.joinGroup(InetAddress.getByName(MULTICAST_ADDRESS)); Log.d("HUE", "step 3"); } catch (IOException e) { e.printStackTrace(); throw new IllegalStateException("Can not make multicast socket joinGroup " + address, e); } try { socket.setTimeToLive(ttl); Log.d("HUE", "step 4"); } catch (IOException e) { e.printStackTrace(); throw new IllegalStateException("Can not set TTL " + ttl, e); } final byte[] transmitBuffer; try { transmitBuffer = constructSearchMessage(searchTarget).getBytes(CHARSET_NAME); Log.d("HUE", "step 5"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); throw new IllegalStateException("WTF? " + CHARSET_NAME + " is not supported?", e); } DatagramPacket packet = null; try { packet = new DatagramPacket(transmitBuffer, transmitBuffer.length, address); Log.d("HUE", "step 6"); } catch (SocketException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { socket.send(packet); Log.d("HUE", "step 7"); } catch (IOException e) { e.printStackTrace(); throw new IllegalStateException("Can not send search request", e); } Map<String, URL> result = new HashMap<String, URL>(); byte[] receiveBuffer = new byte[1536]; while (true) { try { Log.d("HUE", "sending packets"); final DatagramPacket receivePacket = new DatagramPacket(receiveBuffer, receiveBuffer.length, InetAddress.getByName(MULTICAST_ADDRESS), MULTICAST_PORT); socket.receive(receivePacket); //Log.d("HUE", new String(receivePacket.getData())); HueBridge response = parseResponsePacket(receivePacket); if (response != null) { Log.d("HUE", "resonse not null"); ////System.out.println("resonse not null"); result.put(response.getUDN(), response.getBaseUrl()); } else { Log.d("HUE", "no bridge"); } } catch (SocketTimeoutException e) { Log.e("HUE", "timeout exception"); break; } catch (IOException e) { throw new IllegalStateException("Problem receiving search responses", e); } } return result; }