I have problem when I want to get my fonts form my dataBase.  This is my Activity :  public class Arrange_fur_secondaryActivity extends AppCompatActivity {     @Override     protected void onCreate(Bundle saveInstanceState) {         super.onCreate(saveInstanceState);         setContentView(R.layout.activity_warning);          String path = Environment.getExternalStorageDirectory().toString()+"/database";         Log.d("FilesFilesFiles", "PathPathPath: " + path);         File directory = new File(path);         File[] files = directory.listFiles();         Log.d("FilesFilesFilesFiles", "SizeSizeSizeSize: "+ files.length);         for (int i = 0; i &lt; files.length; i++)         {             Log.d("Files", "FileName:" + files[i].getName());         }     } }   And My Logcat Error :  **019-11-12 21:36:25.504 24221-24221/sungjusin.gatag3 E/AndroidRuntime: FATAL EXCEPTION: main     Process: sungjusin.gatag3, PID: 24221     java.lang.RuntimeException: Unable to start activity ComponentInfo{sungjusin.gatag3/sungjusin.gatag3.Arrange_fur_secondaryActivity}: java.lang.NullPointerException: Attempt to get length of null array         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)         at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)         at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)         at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)         at android.os.Handler.dispatchMessage(Handler.java:106)         at android.os.Looper.loop(Looper.java:193)         at android.app.ActivityThread.main(ActivityThread.java:6669)         at java.lang.reflect.Method.invoke(Native Method)         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)      Caused by: java.lang.NullPointerException: Attempt to get length of null array         at sungjusin.gatag3.Arrange_fur_secondaryActivity.onCreate(Arrange_fur_secondaryActivity.java:34)         at android.app.Activity.performCreate(Activity.java:7136)         at android.app.Activity.performCreate(Activity.java:7127)         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)          at android.os.Handler.dispatchMessage(Handler.java:106)          at android.os.Looper.loop(Looper.java:193)          at android.app.ActivityThread.main(ActivityThread.java:6669)          at java.lang.reflect.Method.invoke(Native Method)          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)  2019-11-12 21:36:25.527 24221-24221/sungjusin.gatag3 I/Process: Sending signal. PID: 24221 SIG: 9**
129
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
41937
I need to read a properties files that's buried in my package structure in com.al.common.email.templates.  I've tried everything and I can't figure it out.  In the end, my code will be running in a servlet container, but I don't want to depend on the container for anything. I write JUnit test cases and it needs to work in both.
102897
Anyone working on the Android ('gPhone') have or know of a place where I can find a good ORM tool for it? The code is written in Java, and the database is SQLite. What I would like to find is a tool that given the object definition, can auto-generate the tables and the CRUD functions (that would be awesome), or, barring that, a tool that can take the table definition, the object definition, and auto-generate the CRUD functionality. The rub is that all of this must happen within the Android framework, which has its own conventions as to how database access works.
107801
I posted the code below to the Sun developers forum since I thought it was erroring (the true error was before this code was even hit).  One of the responses I got said it would not work and to throw it away.  But it is actually working.  It might not be the best code (I am new to Java) but is there something inherently "wrong" with it?   =============  CODE:   private static void ImportFromCsvToAccessTable(String mdbFilePath, String accessTableName  , String csvDirPath , String csvFileName ) throws ClassNotFoundException, SQLException {      Connection msConn = getDestinationConnection(mdbFilePath);     try{          String strSQL = "SELECT * INTO " + accessTableName + " FROM [Text;HDR=YES;DATABASE=" + csvDirPath + ";].[" + csvFileName + "]";         PreparedStatement selectPrepSt = msConn.prepareStatement(strSQL );         boolean result = selectPrepSt.execute();                 System.out.println( "result = " + result );      } catch(Exception e) {         System.out.println(e);     } finally {         msConn.close();     } }
51760
I have been investigating a potential heap size problem in our production code, and I wanted to recreate some simple elements through the developer console.  To cause a heap size exception, I would select every standard field from account for 50,000 accounts into a list.  System.debug('Heap size before query = ' + Limits.getHeapSize() + ', out of maximum ' + Limits.getLimitHeapSize()); List&lt;Account&gt; accs = [select AccountNumber, AccountSource, AnnualRevenue, BillingCity, BillingCountry, BillingPostalCode, BillingState, BillingStreet,                              CreatedById, CreatedDate, CurrencyIsoCode, Description, Fax, FirstName, Id, Industry, IsCustomerPortal,                              IsDeleted, IsPersonAccount, Jigsaw, JigsawCompanyId, LastActivityDate, LastModifiedById, LastModifiedDate, LastName,                              MasterRecordId, Name, NumberOfEmployees, OwnerId, Ownership, ParentId, PersonBirthdate, PersonContactId, PersonEmail,                              PersonEmailBouncedDate, PersonEmailBouncedReason, PersonHomePhone, PersonLastCURequestDate, PersonLastCUUpdateDate, PersonLeadSource,                              PersonMailingCity, PersonMailingCountry, PersonMailingPostalCode, PersonMailingState, PersonMailingStreet, PersonMobilePhone, PersonOtherCity,                              PersonOtherCountry, PersonOtherPostalCode, PersonOtherState, PersonOtherStreet, PersonTitle, Phone, Rating, RecordTypeId, Salutation, ShippingCity,                              ShippingCountry, ShippingPostalCode, ShippingState, ShippingStreet, Sic, SicDesc, Site, SystemModstamp, TickerSymbol, Type, Website                       from account                       limit 50000]; System.debug('Heap size after query = ' + Limits.getHeapSize() + ', out of maximum ' + Limits.getLimitHeapSize());   This is a full copy sandbox and there are over 50,000 accounts. My expectation was that this would fail with a heap size limit exception.  Instead I get the output:  USER_DEBUG [1]|DEBUG|Heap size before query = 1069, out of maximum 6000000 USER_DEBUG [12]|DEBUG|Heap size after query = 33931975, out of maximum 6000000   Notice the heap size used is 34MB and the limit 6MB but no exception occurs. I have done some more experiments and I can iterate over the list and carry on executing code with the heap size above this level.  Here are the limit usage stats which seem to show 0 heap usage.    I can't find anywhere that this is expected behaviour for the developer console. My understanding was that the limits apply in all contexts.  Can anyone shed any light on this?
77080
This may sound repititve question. But the error incurs after following multiple links found like:  and .  The controller:  public with sharing class SFLoginCtrlr {     public static HTTPResponse getResp(String loginCred){         Map&lt;String, Object&gt; mapLoginCred = (Map&lt;String, Object&gt;)JSON.deserializeUnTyped(loginCred);         String username = ''+mapLoginCred.get('username');         String password = ''+mapLoginCred.get('password');         HttpRequest req = new HttpRequest();         req.setMethod('POST');            req.setTimeout(60000);         req.setEndpoint('https://www.salesforce.com/services/Soap/u/29.0');         req.setHeader('Content-Type', 'text/xml;charset=UTF-8');                 req.setHeader('SOAPAction', '""');         req.setBody('&lt;Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;Header/&gt;&lt;Body&gt;&lt;login xmlns="urn:partner.soap.sforce.com"&gt;&lt;username&gt;' +username+ '&lt;/username&gt;&lt;password&gt;' + password + '&lt;/password&gt;&lt;/login&gt;&lt;/Body&gt;&lt;/Envelope&gt;');                 HttpResponse res = new Http().send(req);         return res;     } }   The mock class:  @isTest global class ExampleCalloutMock implements HttpCalloutMock{   global HttpResponse respond(HTTPRequest req){     HttpResponse res = new HttpResponse();     res.setStatus('OK');     res.setStatusCode(200);     res.setBody('SUCCESS');     return res;   } }   The test class:  @isTest private class SFLoginCtrlrTest{     static testMethod void SFLoginCtrlrTestMethod(){         Test.startTest();          Test.setMock(HttpCalloutMock.class, new ExampleCalloutMock());          Map&lt;String, String&gt; logincred = new Map&lt;String, String&gt;();         logincred.put('username', 'dummy@user.com');         logincred.put('password', 'notapassword');          SFLoginCtrlr.getResp(JSON.serialize(logincred));          Test.stopTest();     } }   The error received while running test class:     Methods defined as TestMethod do not support Web service callouts   Not sure, where is the issue...
36802
\listfiles \documentclass[12pt]{standalone}      \usepackage{fontspec}  \begin{document}  test  \end{document}   creates  MiKTeX 2.9/tex/luatex/luaotfload/fontloader-2016-04-21.lua:353: attempt to call global 'getsubtype' (a nil value)  \endsa@boxit ... dvarwidth \color@endgroup \egroup  1.9 \end{document}  ?   Any ideas what this could be? I cannot imagein that I am wrong typsetting this example?
77839
when I try to run the code below I am getting this error: 'Too many DML rows: 10001'. The object that I am trying to update is one of the main object in the org. so it has multiples triggers, workflows, etc. and one API that runs all day long. I am trying to update 29000 records. can anybody please tell me why i am getting this error or if something is wrong with the code. I will appreciate any help!  Class code:     public class updateNRProdObject{    public Decimal Debug{ get; set; }         public void updateObject(){     List&lt;NRProducts__c&gt; products = [SELECT id  FROM NRProducts__c WHERE  Active__c = true];   Debug = products.size();    for(NRProducts__c p : products){       p.Active__c=false;    }    update products ;   } }
18236
Steps to Reproduce   Tap faster on the code. or Tap once on a huge code.   but happens only when  setupForGeneric() is called, might be a bug related to   private void setupForCode()   { String str = getIntent().getStringExtra("com.stackexchange.marvin:code_block"); PrettyWebView localPrettyWebView = (PrettyWebView)findViewById(R.id.code); localPrettyWebView.setPostBody("&lt;pre&gt;&lt;code&gt;" + TextUtils.htmlEncode(str) + "&lt;/pre&gt;&lt;/code&gt;", false); localPrettyWebView.setBackgroundColor("#eeeeee"); }  private void setupForGeneric() { String str = getIntent().getStringExtra("com.stackexchange.marvin:web_url"); PrettyWebView localPrettyWebView = (PrettyWebView)findViewById(R.id.code); localPrettyWebView.getSettings().setBuiltInZoomControls(true); localPrettyWebView.getSettings().setLoadWithOverviewMode(true); localPrettyWebView.getSettings().setUseWideViewPort(true); localPrettyWebView.loadUrl(str); localPrettyWebView.setBackgroundColor("#eeeeee"); }   Log  09-05 03:54:30.312: E/AndroidRuntime(26264): FATAL EXCEPTION: WebViewCoreThread  09-05 03:09:39.522: E/Crittercism(18318): java.lang.NullPointerException: [v0.1.22]  09-05 03:09:39.522: E/Crittercism(18318):   at android.content.ComponentName.&lt;init&gt;(ComponentName.java:75) 09-05 03:09:39.522: E/Crittercism(18318):   at android.content.Intent.&lt;init&gt;(Intent.java:3156) 09-05 03:09:39.522: E/Crittercism(18318):   at com.stackexchange.marvin.ui.ViewPopupActivity.showCode(ViewPopupActivity.java:25) 09-05 03:09:39.522: E/Crittercism(18318):   at com.stackexchange.marvin.ui.question.QuestionFragment$1.onCodeClicked(QuestionFragment.java:67) 09-05 03:09:39.522: E/Crittercism(18318):   at com.stackexchange.marvin.ui.common.PrettyWebView$WebAppInterface.codeClicked(PrettyWebView.java:197) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore.nativeTouchUp(Native Method) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore.nativeTouchUp(Native Method) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore.access$4000(WebViewCore.java:59) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1449) 09-05 03:09:39.522: E/Crittercism(18318):   at android.os.Handler.dispatchMessage(Handler.java:99) 09-05 03:09:39.522: E/Crittercism(18318):   at android.os.Looper.loop(Looper.java:137) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:790) 09-05 03:09:39.522: E/Crittercism(18318):   at java.lang.Thread.run(Thread.java:856)
17386
I know the file needs to be where the getClass().getResource(filename) can find it, but I don't know where that is.  I'm interested both in where to put the files on the filesystem itself, and how to go about using Eclipse's functionality to set up the resources.
92456
Alright, I have been doing the following (variable names have been changed):   FileInputStream fis = null; try {     fis = new FileInputStream(file);      ... process ...  } catch (IOException e) {     ... handle error ... } finally {     if (fis != null)         fis.close(); }    Recently, I started using FindBugs, which suggests that I am not properly closing streams.  I decide to see if there's anything that can be done with a finally{} block, and then I see, oh yeah, close() can throw IOException.  What are people supposed to do here?  The Java libraries throw too many checked exceptions.
116653
I have this:  If String.IsNullOrEmpty(editTransactionRow.pay_id.ToString()) = False Then     stTransactionPaymentID = editTransactionRow.pay_id 'Check for null value End If   Now, when editTransactionRow.pay_id is Null Visual Basic throws an exception. Is there something wrong with this code?
91444
I'm using NetBeans, trying to change the familiar Java coffee cup icon to a png file that I have saved in a resources directory in the jar file.  I've found many different web pages that claim they have a solution, but so far none of them work.  Here's what I have at the moment (leaving out the try-catch block):  URL url = new URL("com/xyz/resources/camera.png"); Toolkit kit = Toolkit.getDefaultToolkit(); Image img = kit.createImage(url); getFrame().setIconImage(img);   The class that contains this code is in the com.xyz package, if that makes any difference.  That class also extends JFrame.  This code is throwing a MalformedUrlException on the first line.  Anyone have a solution that works?
70680
I was loading an image resource with the following code and it works fine from my dev environment (netbeans) but threw an exception as soon as it ran from the desktop.  new ImageIcon(Images.class.getResource("images/highlighter24.gif"));   I traced it down to my file having different case than in the code.  Fine, my bad, but why the inconsistent behavior?  Gremlins?  Note: I'm running on windows before you ask.
109620
I used   Runtime.getRuntime().exec("_____")   but it throws a IOException as below:  java.io.IOException: CreateProcess: c:/ error=5   at java.lang.Win32Process.create(Native Method)   at java.lang.Win32Process.&lt;init&gt;(Win32Process.java:63)   at java.lang.Runtime.execInternal(Native Method   I don't know whether I have the problem with specifying the path or something else. Can anyone please help me with the code.
69551
I am working on the  collaborative platform. I am facing the following error code :  ./main.lof:18:  Missing $ inserted.  &lt;inserted text&gt; $  l.18 ...some figure_name}}{23}{figure.17}   The thing is, even after correcting/deleting the figure that causes this error, the compilation will always stop on this.  From my understanding, I would need to erase the .lof file to avoid this error again but I do not know how to access it on the overleaf platform.  Do you think I undersand well the situation? Do you know how to access the .lof file?
34575
I'm trying to work through the problems on  but I keep running into a couple of problems.  The first is a question of storing large quanities of elements in a List&lt;t&gt;. I keep getting OutOfMemoryException's when storing large quantities in the list.  Now I admit I might not be doing these things in the best way but, is there some way of defining how much memory the app can consume?  It usually crashes when I get abour 100,000,000 elements :S  Secondly, some of the questions require the addition of massive numbers. I use ulong data type where I think the number is going to get super big, but I still manage to wrap past the largest supported int and get into negative numbers.  Do you have any tips for working with incredibly large numbers?