List of usage examples for java.net URISyntaxException toString
public String toString()
From source file:com.couchbase.sqoop.manager.CouchbaseManagerTest.java
@Before public void setUp() { super.setUp(); try {/*from w w w. j av a2s . co m*/ URI uri = new URI(CouchbaseUtils.CONNECT_STRING); String user = CouchbaseUtils.COUCHBASE_USER_NAME; String pass = CouchbaseUtils.COUCHBASE_USER_PASS; cb = new CouchbaseClient(Arrays.asList(uri), user, user, pass); } catch (URISyntaxException e) { LOG.error("Bad URL" + e.getMessage()); fail(e.toString()); } catch (IOException e) { LOG.error("Couldn't connect to server" + e.getMessage()); fail(e.toString()); } }
From source file:com.app.sniffy.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); settings = getSharedPreferences(PREFS_NAME, 0); storedKey = settings.getString("key", null); userConsent = settings.getBoolean("userconsent", false); context = this; // getting device id like IMEI no. TelephonyManager tMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); mDeviceId = tMgr.getDeviceId();//from www. j a va2 s . c o m if (userConsent == false) { showTerms(); } else if (storedKey == null) { try { new GetKey(this).execute(new URI(Utils.getConfigProperty(getResources(), "generate-key") + mDeviceId + Utils.getConfigProperty(getResources(), "securekey"))); } catch (URISyntaxException e1) { Log.d("main activity key generate", e1.toString()); } } }
From source file:com.app.sniffy.MainActivity.java
public void showTerms() { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View dialoglayout = inflater.inflate(R.layout.terms, null); WebView webView = (WebView) dialoglayout.findViewById(R.id.termsView); webView.loadUrl("file:///android_asset/license.html"); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Terms & Conditions"); builder.setView(dialoglayout).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { CheckBox checkBox = (CheckBox) dialoglayout.findViewById(R.id.checkBox); if (checkBox.isChecked()) { SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("userconsent", true); editor.commit(); try { new GetKey(context).execute( new URI(Utils.getConfigProperty(getResources(), "generate-key") + mDeviceId + Utils.getConfigProperty(getResources(), "securekey"))); } catch (URISyntaxException e1) { Log.d("main activity key generate", e1.toString()); }//from w w w .jav a 2 s .co m } else { showTerms(); } } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:org.deviceconnect.message.http.impl.factory.HttpRequestMessageFactory.java
@Override public HttpRequest newPackagedMessage(final DConnectMessage message) { mLogger.entering(this.getClass().getName(), "newPackagedMessage", message); mLogger.fine("create http request from dmessage"); HttpRequest request;/*ww w . ja v a2 s. c o m*/ try { request = createHttpRequest(message); } catch (URISyntaxException e) { mLogger.log(Level.INFO, e.toString(), e); mLogger.warning(e.toString()); throw new IllegalArgumentException(e.toString()); } mLogger.fine("put request headers"); for (Header header : createHttpHeader(message)) { request.addHeader(header); } mLogger.fine("put request body"); if (request instanceof HttpEntityEnclosingRequest) { HttpEntity entity = createHttpEntity(message); ((HttpEntityEnclosingRequest) request).setEntity(entity); request.addHeader(HTTP.CONTENT_LEN, "" + entity.getContentLength()); } else { request.addHeader(HTTP.CONTENT_LEN, "0"); } mLogger.exiting(this.getClass().getName(), "newPackagedMessage", request); return request; }
From source file:org.xenei.jdbc4sparql.J4SUrl.java
private void parseJ4SEndpoint(final String urlStr, final int pos) { try {//from ww w .j av a 2 s . c o m this.endpoint = new URI(urlStr.substring(pos)); } catch (final URISyntaxException e) { throw new IllegalArgumentException( "Not a valid J4S JDBC URL -- endpoint is not a valid URI : " + e.toString()); } }
From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesPresenter.java
String getCompleteURIFromFragment(final String fragment) { URI uri = null;/*w ww . j a v a2 s . com*/ try { uri = new URI(fragment); } catch (URISyntaxException e) { log.warn("Could not create URI from fragment {}. Exception: {}", fragment, e.toString()); } if (uri == null || uri.isAbsolute()) { return fragment; } return getWebAppRootURI() + fragment; }
From source file:net.issarlk.androbunny.inkbunny.File.java
public File(Parcel in) { this.id = in.readInt(); this.name = in.readString(); this.thumbnails = new Thumbnail[in.readInt()]; for (int i = this.thumbnails.length - 1; i >= 0; i--) { if (in.readInt() == 1) { this.thumbnails[i] = Thumbnail.CREATOR.createFromParcel(in); }/*from www . jav a 2 s. c om*/ } this.mimetype = in.readString(); this.submission_id = in.readInt(); this.user_id = in.readInt(); this.submission_file_order = in.readInt(); this.dimensions = new Dimension2D[in.readInt()]; for (int i = this.dimensions.length - 1; i >= 0; i--) { if (in.readInt() == 1) { this.dimensions[i] = Dimension2D.CREATOR.createFromParcel(in); } } this.md5s = new String[5]; in.readStringArray(this.md5s); this.file_urls = new URI[3]; for (int i = 0; i < 3; i++) { String tmp = in.readString(); if (tmp != null) { try { this.file_urls[i] = new URI(tmp); } catch (URISyntaxException e) { Log.e(TAG, e.toString()); } } } this.deleted = in.readInt(); this.create_datetime = in.readString(); this.create_datetime_usertime = in.readString(); }
From source file:net.issarlk.androbunny.inkbunny.Submission.java
public Submission(Parcel in) { if (in.readLong() != Submission.serialVersionUID) { throw new RuntimeException("Wrong UID"); }/*from ww w. ja v a2 s . c om*/ this.id = in.readInt(); this.hidden = in.readInt(); this.user = User.CREATOR.createFromParcel(in); this.create_datetime = in.readString(); this.create_datetime_usertime = in.readString(); this.file_name = in.readString(); this.thumbnails = new Thumbnail[in.readInt()]; for (int i = this.thumbnails.length - 1; i >= 0; i--) { if (in.readInt() == 1) { this.thumbnails[i] = Thumbnail.CREATOR.createFromParcel(in); } } this.title = in.readString(); this.deleted = in.readInt(); this.s_public = in.readInt(); this.mimetype = in.readString(); this.rating = Rating.CREATOR.createFromParcel(in); this.submission_type = SubmissionType.CREATOR.createFromParcel(in); this.digitalsales = in.readInt(); this.printsales = in.readInt(); this.guest_block = in.readInt(); // Full info if (in.readInt() == 1) { this.keywords = new Keyword[in.readInt()]; for (int i = this.keywords.length - 1; i >= 0; i--) { this.keywords[i] = Keyword.CREATOR.createFromParcel(in); } this.scraps = in.readInt(); this.favorite = in.readInt(); this.favorites_count = in.readInt(); this.comments_count = in.readInt(); this.files = new File[in.readInt()]; for (int i = this.files.length - 1; i >= 0; i--) { this.files[i] = File.CREATOR.createFromParcel(in); } this.file_urls = new URI[3]; for (int i = 0; i < 3; i++) { String tmp = in.readString(); if (tmp != null) { try { this.file_urls[FULL] = new URI(tmp); } catch (URISyntaxException e) { Log.e(TAG, e.toString()); } } } } //Description if (in.readInt() == 1) { this.description = in.readString(); } //Writing if (in.readInt() == 1) { this.writing = in.readString(); } }
From source file:com.grendelscan.ui.actionComposites.ManualRequestComposite.java
public void displayTransactionInManualRequest(final int transactionID) { StandardHttpTransaction transaction = Scan.getInstance().getTransactionRecord() .getTransaction(transactionID); if (transaction.getRequestWrapper().getNetworkHost() == null || transaction.getRequestWrapper().getNetworkHost().isEmpty()) { networkHostText.setText(transaction.getRequestWrapper().getHost()); } else {/*from www . j av a 2s .c o m*/ networkHostText.setText(transaction.getRequestWrapper().getNetworkHost()); } if (transaction.getRequestWrapper().getNetworkPort() > 0) { networkPortText.setText(transaction.getRequestWrapper().getNetworkPort() + ""); } else { networkPortText.setText("" + (transaction.getRequestWrapper().isSecure() ? 443 : 80)); } sslCheck.setSelection(transaction.getRequestWrapper().isSecure()); transactionComposite.clearData(); transactionComposite.switchToParsedRequest(); try { transactionComposite.updateRequestData(transaction.getRequestWrapper().getBytes()); } catch (URISyntaxException e) { IllegalStateException ise = new IllegalStateException("Really, really weird problem with uri parsing", e); LOGGER.error(e.toString(), e); throw ise; } }
From source file:com.streamsets.pipeline.stage.origin.websocket.WebSocketClientSource.java
@Override public List<ConfigIssue> init(Info info, Context context) { List<ConfigIssue> issues = new ArrayList<>(); this.context = context; String resourceUrl = conf.resourceUrl.toLowerCase(); if (!resourceUrl.startsWith("ws://") && !resourceUrl.startsWith("wss://")) { LOG.error("Invalid URL: " + conf.resourceUrl); issues.add(context.createConfigIssue(Groups.WEB_SOCKET.name(), RESOURCE_URL_CONFIG, Errors.WEB_SOCKET_02, conf.resourceUrl)); }/*from www . ja v a 2s .co m*/ try { new URI(conf.resourceUrl); } catch (URISyntaxException e) { LOG.error("Invalid URL: " + conf.resourceUrl, e); issues.add(context.createConfigIssue(Groups.WEB_SOCKET.name(), RESOURCE_URL_CONFIG, Errors.WEB_SOCKET_02, e.toString())); } webSocketClient = WebSocketCommon.createWebSocketClient(conf.resourceUrl, conf.tlsConfig); webSocketClient.setMaxIdleTimeout(0); conf.dataFormatConfig.stringBuilderPoolSize = getNumberOfThreads(); conf.dataFormatConfig.init(context, conf.dataFormat, Groups.DATA_FORMAT.name(), "dataFormatConfig", DataFormatConstants.MAX_OVERRUN_LIMIT, issues); dataParserFactory = conf.dataFormatConfig.getParserFactory(); responseConfig.dataGeneratorFormatConfig.init(context, responseConfig.dataFormat, WebSocketOriginGroups.WEB_SOCKET_RESPONSE.name(), "responseConfig.dataGeneratorFormatConfig", issues); dataGeneratorFactory = responseConfig.dataGeneratorFormatConfig.getDataGeneratorFactory(); errorQueue = new ArrayBlockingQueue<>(100); errorList = new ArrayList<>(100); return issues; }