## My App Keeps o Stopping and there is an exception there [closed]

I Have Tried To Rebuild the project but nothing Happened

My Code Is Down

`

``        save_time.setOnClickListener {         val medicine = medicinea.text.toString()          val days = arrayOf("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")         for (aday in days) {            if(day_selected.toString() == aday) {               val shrd = getSharedPreferences("Add\$  day_selected", Context.MODE_PRIVATE)               val editor = shrd.edit()               editor.putString("medicine", medicine)               editor.putString("day", day_selected)               editor.putString("whenSelected", when_selected)               editor.putString("medicineSelected", medicine_selected)               editor.putString("time", time_selected)               editor.apply()               Toast.makeText(this@Add, "Saved To Internal Database", Toast.LENGTH_SHORT).show()           }       }            if (day_selected.toString() == "Friday") {             val intent = Intent(this, Friday::class.java)             CustomIntent.customType(this@Add, "fadein-to-fadeout")             startActivity(intent)           }          if (day_selected.toString() == "Saturday") {             val intent = Intent(this, Saturday::class.java)             CustomIntent.customType(this@Add, "fadein-to-fadeout")             startActivity(intent)  }         if (day_selected.toString() == "Sunday") {             val intent = Intent(this, Sunday::class.java)             CustomIntent.customType(this@Add, "fadein-to-fadeout")             startActivity(intent)          }         if (day_selected.toString() == "Monday") {             val intent = Intent(this, Monday::class.java)             CustomIntent.customType(this@Add, "fadein-to-fadeout")             startActivity(intent)         }          if (day_selected.toString() == "Tuesday") {             val intent = Intent(this, Tuesday::class.java)             CustomIntent.customType(this@Add, "fadein-to-fadeout")             startActivity(intent)         }         if (day_selected.toString() == "Wednesday") {             val intent = Intent(this, Wednesday::class.java)             CustomIntent.customType(this@Add, "fadein-to-fadeout")             startActivity(intent)         }         if (day_selected.toString() == "Thursday") {             val intent = Intent(this, Thursday::class.java)             CustomIntent.customType(this@Add, "fadein-to-fadeout")             startActivity(intent)         }      }` ``

From here if i go to Friday activity

`` package com.example.medicaltimetableapp   import android.content.Context  import com.example.medicaltimetableapp.R  import android.graphics.Color  import android.os.Build  import android.os.Bundle  import android.view.View  import android.widget.TextView  import androidx.annotation.RequiresApi  import androidx.appcompat.app.AppCompatActivity  import androidx.constraintlayout.widget.ConstraintSet  import kotlinx.android.synthetic.main.activity_add.*  import kotlinx.android.synthetic.main.activity_friday.*  import kotlinx.android.synthetic.main.activity_main.view.*   class Friday : AppCompatActivity() {  @RequiresApi(Build.VERSION_CODES.LOLLIPOP) override fun onCreate(savedInstanceState: Bundle?) {     super.onCreate(savedInstanceState)     setContentView(R.layout.activity_friday)        val pref = getSharedPreferences("AddFriday", MODE_PRIVATE)     val dayA = pref?.getString("day", "NOT FOUND ").toString()     val medicinea = pref?.getString("medicine", "NOT FOUND ").toString()     val whenSel = pref?.getString("whenSelected", "NOT FOUND ").toString()     val mediselec = pref?.getString("medicineSelected", "NOT FOUND ").toString()     val time = pref?.getString("time", "NOT FOUND ").toString()      val layout = fridaylayout      val dayview = add_view(dayA, R.id.dayf)     val constraintSet = ConstraintSet().apply {         clone(layout)         connect(R.id.dayf, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)         connect(R.id.dayf, ConstraintSet.RIGHT, ConstraintSet.PARENT_ID, ConstraintSet.RIGHT)     }     constraintSet.applyTo(layout)      val medicineview = add_view(medicinea, R.id.medicinef)     medicineview!!.x = +100F     val constraintSet1 = ConstraintSet().apply {         clone(layout)         connect(R.id.medicinef, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)         connect(R.id.medicinef, ConstraintSet.RIGHT, ConstraintSet.PARENT_ID, ConstraintSet.RIGHT)     }     constraintSet.applyTo(layout)      val whenselview = add_view(whenSel, R.id.whenf)     whenselview!!.x = +200F     val constraintSet2 = ConstraintSet().apply {         clone(layout)         connect(R.id.whenf, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)         connect(R.id.whenf, ConstraintSet.RIGHT, ConstraintSet.PARENT_ID, ConstraintSet.RIGHT)     }     constraintSet.applyTo(layout)      val mediselview = add_view(whenSel, R.id.howmuchf)     mediselview!!.x = +300F     val constraintSet3 = ConstraintSet().apply {         clone(layout)         connect(R.id.howmuchf, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)         connect(R.id.howmuchf, ConstraintSet.RIGHT, ConstraintSet.PARENT_ID, ConstraintSet.RIGHT)     }     constraintSet.applyTo(layout)      val timeview = add_view(whenSel, R.id.timef)     timeview!!.x = +400F     val constraintSet4 = ConstraintSet().apply {         clone(layout)         connect(R.id.timef, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)         connect(R.id.timef, ConstraintSet.RIGHT, ConstraintSet.PARENT_ID, ConstraintSet.RIGHT)     }     constraintSet.applyTo(layout)      layout.addView(dayview)     layout.addView(medicineview)     layout.addView(whenselview)     layout.addView(mediselview)     layout.addView(timeview)    }   private fun add_view(data: String, id: Int): View? {      val text = TextView(applicationContext)     text.setBackgroundColor(Color.rgb(255, 229, 229))     text.width = 100     text.height = 50     text.x = 21F     text.y = 88F     text.id = id     text.text = data      return text } ``

}

And I Get This Exception

``E/AndroidRuntime: FATAL EXCEPTION: main     Process: com.example.medicaltimetableapp, PID: 24254    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.medicaltimetableapp/com.example.medicaltimetableapp.Tuesday}: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.constraintlayout.widget.ConstraintLayout.addView(android.view.View)' on a null object reference         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2805)        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2883)       at android.app.ActivityThread.-wrap11(Unknown Source:0)       at android.app.ActivityThread$$H.handleMessage(ActivityThread.java:1613) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6523) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$$MethodAndArgsCaller.run(RuntimeInit.java:438)       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.constraintlayout.widget.ConstraintLayout.addView(android.view.View)' on a null object reference     at com.example.medicaltimetableapp.Tuesday.onCreate(Tuesday.kt:44)          at android.app.Activity.performCreate(Activity.java:7023)     at android.app.Activity.performCreate(Activity.java:7014)     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2758)     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2883)      at android.app.ActivityThread.-wrap11(Unknown Source:0)      at android.app.ActivityThread$$H.handleMessage(ActivityThread.java:1613) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6523) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$$MethodAndArgsCaller.run(RuntimeInit.java:438)      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)  ``

My Manifiest File

``<?xml version="1.0" encoding="utf-8"?> ``

``<application     android:allowBackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:roundIcon="@mipmap/ic_launcher_round"     android:supportsRtl="true"     android:theme="@style/AppTheme">     <activity android:name=".MainActivity"></activity>     <activity android:name=".Add"></activity>     <activity android:name=".Sunday" />     <activity android:name=".Saturday" />     <activity android:name=".Friday" />     <activity android:name=".Thursday" />     <activity android:name=".Wednesday" />     <activity android:name=".Tuesday" />     <activity android:name=".Monday" />     <activity android:name=".homeanimation">         <intent-filter>             <action android:name="android.intent.action.MAIN" />              <category android:name="android.intent.category.LAUNCHER" />         </intent-filter>     </activity> </application> ``

## getting no subject alternative name present exception when the csr shows that the SANs are present

I am trying to setup ssl for grpc but no matter what I try I get a no subject alternative name present. I’ve verified the SANs are in the certificate signing request. The common name and also a SAN are the ip addr. I am trying to connect using the ipAddr. The exception I get is

``Caused by: java.security.cert.CertificateException: No subject alternative names present     at java.base/sun.security.util.HostnameChecker.matchIP(HostnameChecker.java:137)     at java.base/sun.security.util.HostnameChecker.match(HostnameChecker.java:96) ``

The text of my csr follows:

``sysadmin@rit5 san]\$   openssl req -in my.csr -noout -text     Certificate Request: Data:     Version: 0 (0x0)     Subject: C=US, ST=TX, L=Austin, O=MYCOMPANY, OU=MYUNIT, CN=172.28.4.89     Subject Public Key Info:         Public Key Algorithm: rsaEncryption             Public-Key: (2048 bit)             Modulus:                 00:b9:1d:0c:80:ee:b3:20:06:df:6e:f1:04:e5:10:                 54:5d:70:07:fd:68:25:33:12:37:73:98:45:8b:35:                 ba:cf:9b:7c:63:82:0a:e2:16:0d:33:36:10:dd:b5:                 f9:21:da:04:8c:18:15:77:e2:65:72:e8:c9:6e:01:                 dc:47:48:53:ce:45:c9:a9:f1:9d:d0:0f:a7:cb:d5:                 5b:55:eb:b4:38:cb:50:5d:51:c2:bb:65:f6:76:09:                 76:8d:34:0a:c6:35:95:e3:0f:8f:71:be:73:22:78:                 84:26:4f:5e:d3:6a:2c:69:b4:57:e1:fc:37:47:e6:                 56:80:6c:bf:7a:97:78:20:17:22:d0:fc:c6:0c:17:                 0b:dc:23:8f:0e:8a:cb:48:6d:a6:0c:ce:4b:24:54:                 66:82:d0:29:dd:bf:5b:5f:cd:b8:f3:2f:3a:40:09:                 cd:84:6c:2f:74:60:74:e2:3a:13:b9:2e:5c:df:39:                 a3:47:07:96:5a:ed:be:14:71:42:58:6b:53:77:a2:                 af:0a:6d:c3:57:ba:e0:95:ed:55:78:2f:21:cc:af:                 95:e7:de:50:3d:7d:7e:29:4e:ed:bf:9e:14:36:0e:                 71:a3:e4:79:03:12:cd:55:c3:77:00:0f:02:2d:d1:                 e6:2f:a5:b0:3e:62:76:4e:bd:2a:33:56:76:8f:8d:                 2f:b5             Exponent: 65537 (0x10001)     Attributes:     Requested Extensions:         X509v3 Key Usage:              Key Encipherment, Data Encipherment         X509v3 Extended Key Usage:              TLS Web Server Authentication         X509v3 Subject Alternative Name:              DNS:172.28.4.89, DNS:rit5.mycompany.com, DNS:rit5 Signature Algorithm: sha512WithRSAEncryption      17:18:63:dc:d9:84:90:da:de:b6:8e:82:ce:84:6a:a3:5d:11:      87:37:2b:e7:56:6e:e5:ea:42:11:4c:8f:66:28:8b:44:4f:0a:      b9:89:d9:67:86:f4:0f:8a:44:b8:b2:87:62:65:c2:9c:7a:08:      bf:74:4a:b3:f4:35:82:45:50:7f:3f:ab:c4:97:60:59:99:8c:      8e:8b:12:0f:3b:dd:2a:6d:a9:be:06:8a:70:e7:e6:08:22:57:      89:e8:c0:86:f1:26:dc:23:08:aa:ab:2f:07:0d:0b:78:0b:3d:      d9:ce:ac:92:32:80:81:18:25:17:d4:04:22:e2:f9:f2:96:b1:      be:76:96:0c:70:39:cf:64:d3:7d:66:b9:f8:b5:20:18:17:66:      a4:f8:26:a7:02:42:0e:9f:6f:1e:4c:19:1d:d5:19:7b:17:0c:      64:45:34:d0:12:af:e1:8e:9d:e1:ce:84:49:54:87:78:c9:ba:      10:f0:65:5b:0e:f4:4f:3f:91:de:cc:46:36:fa:45:ff:0d:7a:      a4:c7:9b:b7:82:f6:b0:3b:c4:f3:9f:45:94:43:a8:ad:ae:e2:      e2:a2:66:59:d1:5e:b2:ee:a6:55:90:27:4c:57:c8:04:4b:30:      bd:02:bf:e5:3e:7c:b1:c6:0f:04:50:f5:96:76:37:bb:ed:7a:      ba:3c:7c:07 ``

The config file I used to create the csr and key is here

``[req] distinguished_name = req_distinguished_name req_extensions = v3_req prompt = no  [req_distinguished_name] C = US ST = TX L = Austin O = MYCOMPANY OU = MYUNIT CN = 172.28.4.89  [v3_req] keyUsage = keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth subjectAltName = @alt_names [alt_names] DNS.1 = 172.28.4.89 DNS.2 = rit5.mycompany.com DNS.3 = rit5 ``

To generate the csr I used the following command

``openssl req -new -out my.csr -newkey rsa:2048 -nodes -sha512 -keyout my-private-key.pem -config ssl.ext ``

To self sign it used the following command

`` openssl x509 \         -signkey my-private-key.pem \         -in my.csr \         -req -days 365 -out my-public-key-cert.pem ``

I’m at my wits end. Any help would be appreciated. The certificate is generated without the SANs.

``Certificate:     Data:         Version: 1 (0x0)         Serial Number:             c7:af:ad:c2:98:be:7b:c1     Signature Algorithm: sha256WithRSAEncryption         Issuer: C=US, ST=TX, L=Austin, O=MYCOMPANY, OU=MYUNIT, CN=172.28.4.89         Validity             Not Before: Jun  5 20:26:00 2020 GMT             Not After : Jun  5 20:26:00 2021 GMT         Subject: C=US, ST=TX, L=Austin, O=MYCOMPANY, OU=MYUNIT, CN=172.28.4.89         Subject Public Key Info:             Public Key Algorithm: rsaEncryption                 Public-Key: (2048 bit)                 Modulus:                     00:b9:1d:0c:80:ee:b3:20:06:df:6e:f1:04:e5:10:                     54:5d:70:07:fd:68:25:33:12:37:73:98:45:8b:35:                     ba:cf:9b:7c:63:82:0a:e2:16:0d:33:36:10:dd:b5:                     f9:21:da:04:8c:18:15:77:e2:65:72:e8:c9:6e:01: ``

## Monogame – SpriteFont Exception: Text contains characters that cannot be resolved by this SpriteFont

I’m trying to put text on the screen and if I put anything but an empty string I get “Text contains characters that cannot be resolved by this SpriteFont.\nParameter name: text”

``_spriteBatch.DrawString(screenText, "A", new Vector2(0, 200), Color.Black); ``

screenText is the name of my SpriteFont variable.

``<?xml version="1.0" encoding="utf-8"?> <!-- This file contains an xml description of a font, and will be read by the XNA Framework Content Pipeline. Follow the comments to customize the appearance of the font in your game, and to change the characters which are available to draw with. --> <XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">   <Asset Type="Graphics:LocalizedFontDescription">      <!--     Modify this string to change the font that will be imported.     -->     <FontName>Arial</FontName>      <!--     Size is a float value, measured in points. Modify this value to change     the size of the font.     -->     <Size>6</Size>      <!--     Spacing is a float value, measured in pixels. Modify this value to change     the amount of spacing in between characters.     -->     <Spacing>0</Spacing>      <!--     UseKerning controls the layout of the font. If this value is true, kerning information     will be used when placing characters.     -->     <UseKerning>true</UseKerning>      <!--     Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",     and "Bold, Italic", and are case sensitive.     -->     <Style>Regular</Style>      <!--     If you uncomment this line, the default character will be substituted if you draw     or measure text that contains characters which were not included in the font.     -->     <!-- <DefaultCharacter>*</DefaultCharacter> -->      <!--     CharacterRegions control what letters are available in the font. Every     character from Start to End will be built and made available for drawing. The     default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin     character set. The characters are ordered according to the Unicode standard.     See the documentation for more information.     For localized fonts you can leave this empty as the character range will be picked up     from the Resource Files.     -->     <CharacterRegions>       <CharacterRegion>         <Start>&#32;</Start>         <End>&#32;</End>       </CharacterRegion>     </CharacterRegions>     <!--     ResourceFiles control the charaters which will be in the font. It does this     by scanning the text in each of the resource files and adding those specific     characters to the font.      -->     <ResourceFiles>         <!-- <Resx>Strings.resx</Resx> -->     </ResourceFiles>   </Asset> </XnaContent> ``

I did build and rebuild the spritefont file using the Content Builder.

## Creating a personal exception to anti magic? DnD 5e

Does anyone have any in game or hypothetical experience with creating an object, a battery, or some such that grants a character the ability to still cast/power magics while in a dead magic zone or anti magic field?

## I get this exception or whatever it is?

``void b2World::DestroyBody(b2Body* b) {     b2Assert(m_bodyCount > 0);     b2Assert(IsLocked() == false);     if (IsLocked())     {         return;     }      // Delete the attached joints.     b2JointEdge* je = b->m_jointList;     while (je)     {         b2JointEdge* je0 = je;         je = je->next;          if (m_destructionListener)         {             m_destructionListener->SayGoodbye(je0->joint);         }          DestroyJoint(je0->joint);          b->m_jointList = je;     }     b->m_jointList = NULL;      // Delete the attached contacts.     b2ContactEdge* ce = b->m_contactList;     while (ce)     {         b2ContactEdge* ce0 = ce;         ce = ce->next;         m_contactManager.Destroy(ce0->contact);     }     b->m_contactList = NULL;      // Delete the attached fixtures. This destroys broad-phase proxies.     b2Fixture* f = b->m_fixtureList;     while (f)     {         b2Fixture* f0 = f;         f = f->m_next;          if (m_destructionListener)         {             m_destructionListener->SayGoodbye(f0);         }          f0->DestroyProxies(&m_contactManager.m_broadPhase);         f0->Destroy(&m_blockAllocator);         f0->~b2Fixture();         m_blockAllocator.Free(f0, sizeof(b2Fixture));          b->m_fixtureList = f;         b->m_fixtureCount -= 1;     }     b->m_fixtureList = NULL;     b->m_fixtureCount = 0;      // Remove world body list.     if (b->m_prev)     {         b->m_prev->m_next = b->m_next;     }      if (b->m_next)     {         b->m_next->m_prev = b->m_prev;     }      if (b == m_bodyList)     {         m_bodyList = b->m_next;     }      --m_bodyCount;     b->~b2Body();     m_blockAllocator.Free(b, sizeof(b2Body)); } ``

Debugger points out to first line : b2Assert(m_bodyCount>0); What exactly it means? I get this exception when i close the game.

## IIS url rewrite exception

We are hosting some sites on IIS. We have the url rewrite module installed and are rewriting anything that isn't https to https.

Now we come across an issue where for a very specific file we need to turn this rewrite off. But for some reason it doesn't work. It still rewrites to https.

Can anyone see what I am doing wrong?

Thanks.

## Truststore with root certificate throwing the sslhandshake Exception

I got to know from below post that having root ca certificate in the truststore is enough. If that’s the case, I just created my own truststore and added the root certificate to that truststore and trying to establish the connection using this truststore then I’m getting following exception. `javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target` Please someone help me with this. TIA

## Deny access to all PHP files using FilesMatch, but make an exception for one

Currently, using htaccess I am denying access to any PHP file in a directory, but not the JS, PNG, CSS files in the same directory.

``<FilesMatch "\.php\$  "> Order deny,allow Deny from all </FilesMatch> ``

What if I want to make an exception for one file (“foobar.php” for example) however? Can I write multiple statements in a single htaccess? What is the order of execution?

## Error en NetBeans con conexión a SQL SERVER: Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException

Buen día,

Al tratar de ejecutar un código que llama a la conexión con la BD me arroja error: Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException. El error se presenta al ejecutar el metodo activado por le botón

Comparto el códido donde se configura el error y el códido de la conexión de con la BD, además del error completo

``import java.awt.Image; import java.awt.Toolkit; import java.sql.Connection; import java.util.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Vector; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.table.DefaultTableModel; import tveterinaria.conexion;   /**  *  * @author wolfc  */ public class citas extends javax.swing.JFrame {      /**      * Creates new form citas      */     public ResultSet res;     public citas() {       initComponents();        this.setLocationRelativeTo(null);       Image imagen = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("icon/incono.png"));       this.setIconImage(imagen);       cargarcomboboxdueno(jcdueno);       cargarprofe(jcprofesional);       //cargarmascota(jcmascota);       }      public void consultar() {       DefaultTableModel modelo = (DefaultTableModel) jtcitas.getModel();       modelo.setRowCount(0);       res = tveterinaria.conexion.Consulta("Select * from citas");        try {         while (res.next()) {           Vector v = new Vector();           v.add(res.getInt(1));           v.add(res.getDate(2));           v.add(res.getString(3));           v.add(res.getInt(4));           v.add(res.getInt(5));           v.add(res.getInt(6));           v.add(res.getString(7));           modelo.addRow(v);           jtcitas.setModel(modelo);          }        } catch (SQLException e) {         JOptionPane.showMessageDialog(null, e);       }     }      public void consultacitaiddueno() {       DefaultTableModel modelo = (DefaultTableModel) jtcitas.getModel();       modelo.setRowCount(0);       res = tveterinaria.conexion.Consulta("Select * from citas where iddueno =" + jcdueno.getSelectedItem() + "");       try {         while (res.next()) {           Vector v = new Vector();           v.add(res.getInt(1));           v.add(res.getDate(2));           v.add(res.getString(3));           v.add(res.getInt(4));           v.add(res.getInt(5));           v.add(res.getInt(6));           v.add(res.getString(7));           modelo.addRow(v);           jtcitas.setModel(modelo);          }        } catch (SQLException e) {         JOptionPane.showMessageDialog(null, e);       }     }      public void consultacitaidmascota() {       DefaultTableModel modelo = (DefaultTableModel) jtcitas.getModel();       modelo.setRowCount(0);       res = tveterinaria.conexion.Consulta("Select * from citas where idmascota =" + jcmascota.getSelectedItem() + "");       try {         while (res.next()) {           Vector v = new Vector();           v.add(res.getInt(1));           v.add(res.getDate(2));           v.add(res.getString(3));           v.add(res.getInt(4));           v.add(res.getInt(5));           v.add(res.getInt(6));           v.add(res.getString(7));           modelo.addRow(v);           jtcitas.setModel(modelo);            txtidcita.setText(res.getString(1));           txtidcita.setText(res.getString(2));           txtidcita.setText(res.getString(3));           txtidcita.setText(res.getString(4));           txtidcita.setText(res.getString(5));           txtidcita.setText(res.getString(6));           txtidcita.setText(res.getString(7));          }        } catch (SQLException e) {         JOptionPane.showMessageDialog(null, e);       }     }     DefaultComboBoxModel com;     public void consultacitaidprofe() {       DefaultTableModel modelo = (DefaultTableModel) jtcitas.getModel();       modelo.setRowCount(0);       res = tveterinaria.conexion.Consulta("Select * from citas where idprofesional =" + jcprofesional.getSelectedItem() + "");       try {         while (res.next()) {           Vector v = new Vector();           v.add(res.getInt(1));           v.add(res.getDate(2));           v.add(res.getString(3));           v.add(res.getInt(4));           v.add(res.getInt(5));           v.add(res.getInt(6));           v.add(res.getString(7));           modelo.addRow(v);           jtcitas.setModel(modelo);          }        } catch (SQLException e) {         JOptionPane.showMessageDialog(null, e);       }     }       public void cargarcomboboxdueno(JComboBox jcdueno) {       conexion con = new conexion();       String sql = " SELECT iddueno from citas group by iddueno ";       try {         Connection cn = con.getConexion();         PreparedStatement entrada = cn.prepareStatement(sql);         ResultSet rs = entrada.executeQuery();         jcdueno.addItem("Seleccione la cédula del dueño");         while (rs.next()) {           jcdueno.addItem(rs.getInt(1));         }       } catch (Exception e) {         JOptionPane.showMessageDialog(null, "Error: " + e);       }     }     public void cargarprofe(JComboBox jcprofesional) {       {         conexion con = new conexion();         String sql = " SELECT idprofesional from citas group by idprofesional ";          try {           Connection cn = con.getConexion();           PreparedStatement entrada = cn.prepareStatement(sql);           ResultSet rs = entrada.executeQuery();           jcprofesional.addItem("Seleccione la cédula del profesional");            while (rs.next()) {             jcprofesional.addItem(rs.getInt(1));           }         } catch (Exception e) {           JOptionPane.showMessageDialog(null, "Error: " + e);         }       }     }     public void cargarmascota(JComboBox jcmascota) {        conexion con = new conexion();        if (jcdueno.getSelectedItem().toString().equals("Seleccione la cédula del dueño")) {         String sql = " SELECT idmascota from citas group by idmascota";         try {           Connection cn = con.getConexion();           PreparedStatement entrada = cn.prepareStatement(sql);           ResultSet rs = entrada.executeQuery();           jcmascota.addItem("Seleccione el ID de la mascota");            while (rs.next()) {             jcmascota.addItem(rs.getInt(1));           }         } catch (Exception e) {           JOptionPane.showMessageDialog(null, "Error: " + e);         }        } else {         com = new DefaultComboBoxModel();         jcmascota.setModel(com);         String sql = " SELECT idmascota from citas where iddueno=" +           jcdueno.getSelectedItem() + "group by idmascota";         try {           Connection cn = con.getConexion();           PreparedStatement entrada = cn.prepareStatement(sql);           ResultSet rs = entrada.executeQuery();           jcmascota.addItem("Seleccione el ID de la mascota");            while (rs.next()) {             jcmascota.addItem(rs.getInt(1));           }         } catch (Exception e) {           JOptionPane.showMessageDialog(null, "Error: " + e);         }       }     }       private void btnconsultarActionPerformed(java.awt.event.ActionEvent evt) {       // TODO add your handling code here       if (jcprofesional.getSelectedItem().toString().equals("Seleccione la cédula del profesional") &&         jcdueno.getSelectedItem().toString().equals("Seleccione la cédula del dueño")) {         consultacitaidmascota();       } else {         if (jcmascota.getSelectedItem().equals("Seleccione el ID de la mascota") &&           jcdueno.getSelectedItem().equals("Seleccione la cédula del dueño")) {           consultacitaidprofe();         } else {           if (jcmascota.getSelectedItem().equals("Seleccione el ID de la mascota") &&             jcprofesional.getSelectedItem().equals("Seleccione la cédula del profesional")) {             consultacitaiddueno();           } else {             if (jcmascota.getSelectedItem().equals("Seleccione el ID de la mascota") &&               jcdueno.getSelectedItem().equals("Seleccione la cédula del dueño") &&               jcprofesional.getSelectedItem().equals("Seleccione la cédula del profesional")) {               consultar();             } else {               JOptionPane.showMessageDialog(null, "Coma mierda");             }           }         }       }     }``

Adicionalmente comparto el metodo de la conexión a la BD el cual arroja el error

``public static ResultSet Consulta(String consulta) {   Connection con = getConexion();   Statement declarar;   try {     declarar = con.createStatement();     ResultSet respuesta = declarar.executeQuery(consulta);     return respuesta;   } catch (SQLException e) {     JOptionPane.showMessageDialog(null, "Error en consultas" + e.getMessage(),       "Error de Conexion consulta", JOptionPane.ERROR_MESSAGE);   }   return null; }``

Si bien es cierto que el metodo devuelve un valor null, es código reciclado tal al pie de la letra y nunca antes había arrojado un error similar. Incluso en otras partes del proyecto se usa de la misma manera el metodo y no se ve afectado por el error.

I have a WCF service hosted in IIS on Domain 1. This service is accepting a request to upload a file, and then uploading the file to a SharePoint 2010 Server on Domain 2, using the client object model.

Everything works fine when I hardcode the username, password & domain using:

``context.Credentials = new NetworkCredential(login, password, domain); ``

However, due to the compliance & security we cannot do this in our company. We need to use integrated security if possible. I have tried setting the credentials to both

``context.Credentials = CredentialCache.DefaultCredentials; context.Credentials = CredentialCache.DefaultNetworkCredentials; ``

But neither appear to work, we receive the error

System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate() at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest() at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()

Can someone provide any tips on how to fix this? Or tips that might lead us to the resolution, logs to check etc. I am not the developer of the SharePoint site, but can chase them down. I have gone through many questions/answers here and none seem to help us.