求解这个异常怎么回事
                                                String resultStr = response.body().string();
                                                 JSONObject jsonObj = new JSONObject(resultStr);
                        String iconImg = jsonObj.getString("iconImg");
                        String result = jsonObj.getString("result");

运行 就报这个异常 org.json.JSONException: Value 260 of type java.lang.Integer cannot be converted to JSONObject

7个回答

我也觉得 应该是你的response.body().string() 有问题

yang1159
Aln_ 是的 谢谢你 resultStr = 0404 上传服务器失败了
2 年多之前 回复

你的resultStr是260吧,这个不能转,必须是键值对的字符串才能转

yang1159
Aln_ resultStr = 0404 服务器无响应
2 年多之前 回复

楼主,看log,异常报错原因是 JSONObject jsonObj = new JSONObject(resultStr);这句,看出你的resultStr是260 ,根据你下面解析的语句可得,你想得到的返回值应该是一个json串,先跟后台联调一下返回正确的值,找个问题就迎刃而解了

yang1159
Aln_ 谢谢你 resultStr = 0404 上传服务器出问题了 还没找出问题
2 年多之前 回复

Integer类型不能被转换为JSONObject ,你打印一下你的resultStr看看里面的值

yang1159
Aln_ resultStr = 0404 服务器无响应 醉了
2 年多之前 回复

应该是你的response.body().string() 有问题,打个断点看下这个拿到的数据是啥 ?

qq_30718829
csdn_邵 回复总有刁民想杀朕: 你这个是需要和后端对接的,你传的参和他们需要的参那里不对,我只看前端代码也是没用的
2 年多之前 回复
yang1159
Aln_ 回复csdn_邵: 方便加下邮箱么? 我把代码发给你看下 我邮箱alanjuster@163.com 谢谢
2 年多之前 回复
yang1159
Aln_ resultStr = 0404 服务器无响应啊
2 年多之前 回复
qq_30718829
csdn_邵 JSONException异常 怎么可能是那句
2 年多之前 回复

json解析格式不对,

使用String 类型去解析Int 类型的数据

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Qt平滑处理图片失败,异常求解

# Qt平滑图片出错,异常求解,希望能够获得帮助。。。。。 将图片转为灰度图进行平滑处理,代码如下 ![图片说明](https://img-ask.csdn.net/upload/202005/05/1588674713_675153.png) 选择图片 ![图片说明](https://img-ask.csdn.net/upload/202005/05/1588674814_20307.png) 运行结果 ![图片说明](https://img-ask.csdn.net/upload/202005/05/1588674829_877542.png) 图片全部为黑色,求解 大佬帮帮我吧!

Java自定义异常类的问题,新手求解。

自定义一个异常FailException,表示不及格。 创建类Student,有两个属性表示平时成绩和期末成绩,一个方法计算总成绩,用平时成绩加上期末成绩的0.5倍来计算总成绩,如果总成绩小于60分,则抛出异常FailException. 创建测试类,实例化Student对象,调用getScore方法来计算总成绩,注意异常的捕获。 代码如下: class Student { private double regularGrade; private double finalGrade; public Student(double regularGrade, double finalGrade) { this.regularGrade = regularGrade; this.finalGrade = finalGrade; } public double getScore() throws FailException { if (getScore() < 60) { throw new FailException("你的成绩不及格!"); } return regularGrade + finalGrade * 0.5; } } class FailException extends Exception { public FailException() { super(); } public FailException(String message) { message = "你的成绩不及格!"; } public String getMessage() { return "未通过!" + super.getMessage(); } } public class Test { public static void main(String[] args) { // TODO Auto-generated method stub Student s1 = new Student(50, 60); try { s1.getScore(); } catch (FailException e) { System.out.print(e.toString()); } } } 请大家看一下我的代码有什么问题?我的意思是考试成绩低于60分,就抛出异常不及格,但是构造方法应该怎么写呢?我想用一个包含message和cause的方法,cause应该怎么写?

android studio 异常求解

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup.okio/okio/pom.xml File1: /Users/yunhwa/Documents/androidstudio/cfbchina/app/libs/okio-1.6.0.jar File2: /Users/yunhwa/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.6.0/98476622f10715998eacf9240d6b479f12c66143/okio-1.6.0.jar File3: /Users/yunhwa/Documents/androidstudio/cfbchina/app/build/intermediates/exploded-aar/cfbchina/PushSDK/unspecified/jars/classes.jar File4: /Users/yunhwa/Documents/androidstudio/cfbchina/app/build/intermediates/exploded-aar/cfbchina/meiqiaSdk/unspecified/jars/classes.jar

这个异常类是什么意思?为什么会调出这个信息。。。大神求解

![图片说明](https://img-ask.csdn.net/upload/201607/29/1469773425_413622.jpg) ![图片说明](https://img-ask.csdn.net/upload/201607/29/1469773434_658905.jpg)

空指针的异常没有找出来,求解

1. package com.bjsxt.utils; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.metamodel.source.annotations.entity.ConfiguredClass; import org.omg.CORBA.PRIVATE_MEMBER; import oracle.net.aso.f; public class HibernateUtil { private static String HIBERNATE_CONFIG_FILE = "hibernate.cfg.xml"; private static SessionFactory sessionFactory = null; private static ThreadLocal<Session> tl = new ThreadLocal<>(); private static Configuration configure = null; static{ try { configure = new Configuration().configure("HIBERNATE_CONFIG_FILE"); } catch (Exception e) { e.printStackTrace(); System.out.println("核心装置安装失败"); } try { sessionFactory = configure.buildSessionFactory(); } catch (Exception e) { e.printStackTrace(); System.out.println("C区以安放!"); } } private HibernateUtil(){ } /** * 获取session * @return */ public static Session getsession(){ Session session = tl.get(); if(session == null){ session = sessionFactory.openSession();----这块是报异常的地方 tl.set(session); } return session; } /** * 关闭session */ public static void closeSession(){ Session session = tl.get(); tl.set(null); if(session != null){ session.close(); } } } 2.![图片说明](https://img-ask.csdn.net/upload/201708/24/1503555931_523098.png) 3.![图片说明](https://img-ask.csdn.net/upload/201708/24/1503555952_89058.png) 不知道哪里来的空指针异常求解 发现问题了,就是sessionFactory是null,说是hibernate.cfg.xml没有用到,这是怎么回事? The value of the field HibernateUtil.HIBERNATE_CONFIG_FILE is not used。。怎么改?

CastException异常求解

代码大致如下 ``` public interface Kind{ // Some Field } public interface Catalog extends Kind{ // Some Field } public class KindDetail implements Kind{ // Some Field } public class CatalogDetail implements Catalog{ // Some Field } ``` ``` ..... public void method(List<Catalog> cata){ // DoSomething anothodMethod(cata); for(Object o : cata){ Kind kind = (King)o ; // Do Something } } public void anothodMethod(List list){ // Some Condition list.add(new KindDetail()); } ..... ``` 这段代码本机运行正常,服务上报 Caused by: java.lang.RuntimeException: java.lang.ClassCastException: com....bo.KindDetail cannot be cast to com.......bo.Catalog 求解~~ 本机运行编译环境 都是 1.6.0_45 服务器上编译1.5.0_21 , 运行1.6.0_45

vector变量出现的内存异常,困扰好久,求解!

![出现的异常如图](https://img-ask.csdn.net/upload/201903/16/1552743405_169952.png) 定义是 vector<wholepoint> allpoint_rec = { }; 此时出错的时候,allpoint_rec是size为0. 并且前边已经顺序结构已经执行过allpoint_rec.pushback(XXX) 一般是程序跑个半小时左右会出现问题,应该不是语法错误 困扰好久好久 各位大神求解

请问大家见过这个异常吗java.io.StreamCorruptedException: invalid stream header: 7371007E异常求解

代码如下 ``` package Chat; import java.io.IOException; import java.io.ObjectInputStream; import java.net.Socket; public class ClientConServerThread extends Thread{ private Socket client; public ClientConServerThread(Socket client){ this.client=client; } public Socket getClient() { return client; } public void run(){ while(true){ try { ObjectInputStream ois = new ObjectInputStream(client.getInputStream());//这里出现了异常 Message m=(Message)ois.readObject(); System.out.println(m.getCon()); } catch (IOException | ClassNotFoundException e) { e.printStackTrace(); } } } } ``` 异常如下 java.io.StreamCorruptedException: invalid stream header: 7371007E at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 00007400 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 01417400 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 0C323031 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 39303033 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 30313134 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 3274001C at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 54756520 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 41707220 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 32382031 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 353A3436 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 3A313920 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 43535420 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 32303230 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 74000C32 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 30313930 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) java.io.StreamCorruptedException: invalid stream header: 30333031 at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350) at Chat.ClientConServerThread.run(ClientConServerThread.java:20) Process finished with exit code -1

这段C#代码为什么会异常?求解

List<string> a = new List<string>(); a[0] = "100"; hostTextBox.Text = a[0];

ASP.NET mvc 输出FileResult抛异常求解

我要输出一个FileResult 最终返回的是File(filename, contentType,downloadname); 其中filename为一个网络路径http:/192.168.22.184:8088/f/xxx.txt 然而抛出了异常:"http:/172.16.22.184:8088/f/xxx.txt"不是有效的虚拟路径 求解 注意:文件和iis不在同一服务器

Mybatis非常诡异的异常,求解

![图片说明](https://img-ask.csdn.net/upload/201604/14/1460616926_183873.png) ------------------------------------------------------------------------------------- ![图片说明](https://img-ask.csdn.net/upload/201604/14/1460617042_165815.png) -------------------------------------------------------------------------------------- ![图片说明](https://img-ask.csdn.net/upload/201604/14/1460617085_872613.png) ### The error may exist in com/finaAss/entity/javaBeans/GoodsTypes.xml ### The error occurred while processing mapper_resultMap[basicMap] ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ''. Cause: java.lang.ClassNotFoundException: Cannot find class:

求解:Jdeveloper OAF调试异常

新手用Jdeveloper开发的OAF页面,在rebuild项目,run时候,产生的页面,产生以下异常: oracle.apps.fnd.framework.OAException: Application: FND, Message Name: FND_GENERIC_MESSAGE. Tokens: MESSAGE = oracle.apps.fnd.common.AppsException: oracle.apps.fnd.common.PoolException: Exception creating new Poolable object.; at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source) at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source) at _OAErrorPage._jspService(_OAErrorPage.java:77) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:473) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:734) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391) at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:280) at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:68) at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:214) at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284) at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:219) at com.evermind.server.http.EvermindPageContext.handlePageThrowable(EvermindPageContext.java:871) at com.evermind.server.http.EvermindPageContext.handlePageException(EvermindPageContext.java:816) at _runregion._jspService(_runregion.java:193) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:473) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:734) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:226) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:127) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:116) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298) at java.lang.Thread.run(Thread.java:662) 新手上路,求大神围观。。

重新装的JDK,tomcat运行的时候显示这个怎么回事?求解

2015-11-24 13:29:34 org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\java_was\jre\bin\compressedrefs;D:\java_was\jre\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jdk1.6.0_39/bin/../jre/bin/server;C:/Program Files/Java/jdk1.6.0_39/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_39/bin/../jre/lib/amd64;C:\Program Files\Java\jdk1.6.0_39\bin; C:\Program Files\Java\jdk1.6.0_39\jre\bin;;D:\电脑软件\eclipse\eclipse;;. 2015-11-24 13:29:35 org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ASMP' did not find a matching property. 2015-11-24 13:29:35 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 2015-11-24 13:29:35 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1197 ms 2015-11-24 13:29:35 org.apache.catalina.core.StandardService start INFO: Starting service Catalina 2015-11-24 13:29:35 org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.32 2015-11-24 13:29:36 org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter FilterDispatcher Throwable occurred: java.lang.Error: Unresolved compilation problems: The type javax.servlet.FilterChain cannot be resolved. It is indirectly referenced from required .class files The type javax.servlet.ServletRequest cannot be resolved. It is indirectly referenced from required .class files The type javax.servlet.ServletResponse cannot be resolved. It is indirectly referenced from required .class files The import javax.servlet.FilterChain cannot be resolved The import javax.servlet.ServletException cannot be resolved The import javax.servlet.ServletRequest cannot be resolved The import javax.servlet.ServletResponse cannot be resolved The import javax.servlet.http.HttpServletRequest cannot be resolved The hierarchy of the type MyFilterDispatcher is inconsistent The type javax.servlet.Filter cannot be resolved. It is indirectly referenced from required .class files ServletRequest cannot be resolved to a type ServletResponse cannot be resolved to a type FilterChain cannot be resolved to a type ServletException cannot be resolved to a type HttpServletRequest cannot be resolved to a type HttpServletRequest cannot be resolved to a type at com.infoservice.asmp.app.action.materiallibrary.MyFilterDispatcher.<init>(MyFilterDispatcher.java:1) at java.lang.J9VMInternals.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1564) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 2015-11-24 13:29:36 org.apache.catalina.core.StandardContext start SEVERE: Error filterStart 2015-11-24 13:29:36 org.apache.catalina.core.StandardContext start SEVERE: Context [/ASMP] startup failed due to previous errors 2015-11-24 13:29:36 org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 2015-11-24 13:29:36 org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 2015-11-24 13:29:36 org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/69 config=null 2015-11-24 13:29:36 org.apache.catalina.startup.Catalina start INFO: Server startup in 1115 ms

java 求最大子序列和问题递归求解报越界异常

``` /** * 分治递归求解问题: * 分为三种情况: * 1.最大子序列出现在左半边部分 * 2.最大子序列出现在右半边部分 * 3.最大子序列出现在中间部分,此时取两边的最大子序列的和之和(左边子序列包含最后一个元素,右边子序列包含第一个元素) * * @param array * @return */ public static int maxSubSum1(int[] array) { return maxSubSumRec(array,0,array.length-1); } /** * 闭区间 */ private static int maxSubSumRec(int[] array, int left, int right) { if(left==right) return array[left]>0?array[left]:0; int center = (left+right)/2; System.out.println(left+" "+center+" "+right); int maxLeft = maxSubSumRec(array,left,center); //左侧子串和最大值 int maxRight = maxSubSumRec(array,center+1,right); //右侧子串和最大值 //中间部分最大值 int maxLeftFromCenter = 0,maxRightFromCenter = 0; for(int i=center,currentSum = 0;i>=left;i--) { currentSum+=array[i]; if(currentSum > maxLeftFromCenter) maxLeftFromCenter = currentSum; } for(int i=center+1,currentSum = 0;i<=right;i++) { currentSum+=array[i]; if(currentSum > maxLeftFromCenter) maxRightFromCenter = currentSum; } int maxCenter = maxLeftFromCenter+maxRightFromCenter; return Math.max(Math.max(maxLeft, maxCenter),maxRight); } ``` 程序运行结果如下: ![图片说明](https://img-ask.csdn.net/upload/201604/06/1459873787_578559.png)

安装 tengine异常,求解

请教大神!!! 安装tengine-2.2.0 异常 src/event/ngx_event_openssl.c: In function ‘ngx_ssl_init’: src/event/ngx_event_openssl.c:112:5: error: ‘OPENSSL_config’ is deprecated [-Werror=deprecated-declarations] OPENSSL_config(NULL); ^ In file included from /usr/local/include/openssl/ct.h:13:0, from /usr/local/include/openssl/ssl.h:61, from src/event/ngx_event_openssl.h:15, from src/core/ngx_core.h:85, from src/event/ngx_event_openssl.c:9: /usr/local/include/openssl/conf.h:92:1: note: declared here DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name)) ^ src/event/ngx_event_openssl.c: In function ‘ngx_ssl_rsa512_key_callback’: src/event/ngx_event_openssl.c:753:9: error: ‘RSA_generate_key’ is deprecated [-Werror=deprecated-declarations] key = RSA_generate_key(512, RSA_F4, NULL, NULL); ^ In file included from /usr/local/include/openssl/rsa.h:13:0, from /usr/local/include/openssl/x509.h:31, from /usr/local/include/openssl/ssl.h:50, from src/event/ngx_event_openssl.h:15, from src/core/ngx_core.h:85, from src/event/ngx_event_openssl.c:9: /usr/local/include/openssl/rsa.h:193:1: note: declared here DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void ^ src/event/ngx_event_openssl.c: In function ‘ngx_ssl_dhparam’: src/event/ngx_event_openssl.c:943:11: error: dereferencing pointer to incomplete type ‘DH {aka struct dh_st}’ dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); ^ src/event/ngx_event_openssl.c: In function ‘ngx_ssl_handshake’: src/event/ngx_event_openssl.c:1166:31: error: dereferencing pointer to incomplete type ‘SSL {aka struct ssl_st}’ if (c->ssl->connection->s3) { ^ src/event/ngx_event_openssl.c: In function ‘ngx_ssl_connection_error’: src/event/ngx_event_openssl.c:1928:21: error: ‘SSL_R_NO_CIPHERS_PASSED’ undeclared (first use in this function) || n == SSL_R_NO_CIPHERS_PASSED /* 182 */ ^ src/event/ngx_event_openssl.c:1928:21: note: each undeclared identifier is reported only once for each function it appears in src/event/ngx_event_openssl.c: In function ‘ngx_ssl_session_cache’: src/event/ngx_event_openssl.c:2122:43: error: passing argument 2 of ‘SSL_CTX_sess_set_get_cb’ from incompatible pointer type [-Werror=incompatible-pointer-types] SSL_CTX_sess_set_get_cb(ssl->ctx, ngx_ssl_get_cached_session); ^ In file included from src/event/ngx_event_openssl.h:15:0, from src/core/ngx_core.h:85, from src/event/ngx_event_openssl.c:9: /usr/local/include/openssl/ssl.h:637:6: note: expected ‘SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, const unsigned char *, int, int *)}’ but argument is of type ‘SSL_SESSION * (*)(SSL *, u_char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, unsigned char *, int, int *)}’ void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, ^ src/event/ngx_event_openssl.c: In function ‘ngx_ssl_session_id_context’: src/event/ngx_event_openssl.c:2144:27: error: storage size of ‘md’ isn’t known EVP_MD_CTX md; ^ src/event/ngx_event_openssl.c:2210:5: error: implicit declaration of function ‘EVP_MD_CTX_cleanup’ [-Werror=implicit-function-declaration] EVP_MD_CTX_cleanup(&md); ^ src/event/ngx_event_openssl.c: In function ‘ngx_ssl_session_ticket_key_callback’: src/event/ngx_event_openssl.c:2872:9: error: ‘RAND_pseudo_bytes’ is deprecated [-Werror=deprecated-declarations] RAND_pseudo_bytes(iv, 16); ^ In file included from /usr/local/include/openssl/engine.h:19:0, from src/event/ngx_event_openssl.h:22, from src/core/ngx_core.h:85, from src/event/ngx_event_openssl.c:9: /usr/local/include/openssl/rand.h:47:1: note: declared here DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) ^ cc1: all warnings being treated as errors objs/Makefile:827: recipe for target 'objs/src/event/ngx_event_openssl.o' failed make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1 make[1]: Leaving directory '/home/hvm/桌面/Lib/tengine-tengine-2.2.0' Makefile:15: recipe for target 'install' failed make: *** [install] Error 2

求解“System.NotSupportedException”类型的异常!

![图片说明](https://img-ask.csdn.net/upload/201603/07/1457317742_46706.png) ds无数据。 报错:ds.defaultViewManager.System.ComponentModel.IBindingList.IsSorted”引发了“System.NotSupportedException”类型的异常

c3p0异常求解

[code="java"] com.mchange.v2.async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@16597ba APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! com.mchange.v2.async.ThreadPoolAsynchronousRunner -163073277 [Timer-0] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@16597ba APPARENT DEADLOCK!!! Complete Status: [num_managed_threads: 10, num_active: 10; activeTasks: com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@a1f903 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@1e35936 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#8), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@f5e931 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#7), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@a0cbf4 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@ae1f44 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@186daf2 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#6), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@906a8d (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@1438396 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@173f6bb (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#9), com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@4b8a67 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#5); pendingTasks: com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@16b9960, com.mchange.v2.resourcepool.BasicResourcePool$6@1227588, com.mchange.v2.resourcepool.BasicResourcePool$6@152658a, com.mchange.v2.resourcepool.BasicResourcePool$6@885610, com.mchange.v2.resourcepool.BasicResourcePool$6@ca3add, com.mchange.v2.resourcepool.BasicResourcePool$6@dea987, com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4beff3, com.mchange.v2.resourcepool.BasicResourcePool$6@1765f99, com.mchange.v2.resourcepool.BasicResourcePool$6@7e7001] [/code] [code="java"] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner - Task com.mchange.v2.c3p0.stmt.GooGooStatementCache$1@f5e931 (in deadlocked PoolThread) failed to complete in maximum time 60000ms. Trying interrupt(). [/code] 中午重启后运行正常,隔天访问就会这样,求解。。。 附上配置 [code="java"] c3p0.acquireIncrement=3 c3p0.initialPoolSize=3 c3p0.idleConnectionTestPeriod=1800 c3p0.minPoolSize=1 c3p0.maxPoolSize=10 c3p0.maxStatements=100 c3p0.numHelperThreads=10 c3p0.maxIdleTime=600 c3p0.automaticTestTable=C3P0TestTable [/code] 框架用的是SSI

sftp 异常,有遇到的吗?求解

com.jcraft.jsch.JSchException: Auth cancel <br /> at com.jcraft.jsch.Session.connect(Session.java:460) <br /> at com.jcraft.jsch.Session.connect(Session.java:154) <br /> at cn.vivame.util.ftp.SftpServerAccess.connect(SftpServerAccess.java:100)

Java异常相关的一些问题,求解

java中的异常分类,throw与throws的区别,抛出的父类异常是否可以在子类异常之前

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

再不跳槽,应届毕业生拿的都比我多了!

跳槽几乎是每个人职业生涯的一部分,很多HR说“三年两跳”已经是一个跳槽频繁与否的阈值了,可为什么市面上有很多程序员不到一年就跳槽呢?他们不担心影响履历吗? PayScale之前发布的**《员工最短任期公司排行榜》中,两家码农大厂Amazon和Google**,以1年和1.1年的员工任期中位数分列第二、第四名。 PayScale:员工最短任期公司排行榜 意外的是,任期中位数极小的这两家公司,薪资...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

数据库——玩转SQL语句(以MySQL为例)

一、前言 照着大学的SQL server来学

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

华为初面+综合面试(Java技术面)附上面试题

华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

HTTP与HTTPS的区别

面试官问HTTP与HTTPS的区别,我这样回答让他竖起大拇指!

程序员毕业去大公司好还是小公司好?

虽然大公司并不是人人都能进,但我仍建议还未毕业的同学,尽力地通过校招向大公司挤,但凡挤进去,你这一生会容易很多。 大公司哪里好?没能进大公司怎么办?答案都在这里了,记得帮我点赞哦。 目录: 技术氛围 内部晋升与跳槽 啥也没学会,公司倒闭了? 不同的人脉圈,注定会有不同的结果 没能去大厂怎么办? 一、技术氛围 纵观整个程序员技术领域,哪个在行业有所名气的大牛,不是在大厂? 而且众所...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《C语言函数速查》main()主函数

每一个C程序都必须有一main()函数, 可以根据自己的爱好把它放在程序的某个地方。有些程序员把它放在最前面, 而另一些程序员把它放在最后面, 无论放在哪个地方, 以下几点说明都是适合的。

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

立即提问
相关内容推荐