- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我们正在利用 Bonobo Git 服务器托管一些内部 git 存储库。当尝试检查我们的一个存储库时,我们收到此错误:
RPC Failed; result=22, HTTP code = 500
fatal: The remote end hung up unexpectedly
在 Windows 事件查看器中它会记录此消息:
Exception information:
Exception type: ArithmeticException
Exception message: Overflow or underflow in the arithmetic operation.
Request information:
Request URL: http://localhost:50287/MyRepo.git/git-upload-pack
Request path: /MyRepo.git/git-upload-pack
如果我在本地调试 Bonobo,在 C# 中不会抛出异常;它来自 git 进程的外流。该代码使用 Process
来运行 git.exe
,如下所示:
using (var process = System.Diagnostics.Process.Start(info))
{
inStream.CopyTo(process.StandardInput.BaseStream);
process.StandardInput.Write('\0');
process.StandardOutput.BaseStream.CopyTo(outStream);
process.WaitForExit();
}
传递给 git 的命令参数是:
upload-pack --stateless-rpc D:\PathToRepos\MyRepo
如果我在命令提示符下使用克隆命令运行 git.exe
,项目会正确克隆(并出现 templates not found
警告)
我认为这是 C# 和 git 流式传输到 Response.OutputStream
之间的数据类型问题。
最佳答案
问题是由于响应缓冲了输出。它会尝试在发送之前将整个流缓冲到内存中,对于大型存储库,这会导致 ArithmeticException
。由于 Response.Buffer
默认为 true
,因此必须在发送数据之前将其显式设置为 false
。数据显然也必须以 block 的形式读取和流式传输。
Response.Buffer = false;
while ((read = process.StandardOutput.BaseStream.Read(buffer, 0, buffer.Length)) > 0)
{
Response.OutputStream.Write(buffer, 0, read);
Response.OutputStream.Flush();
}
关于c# - 克隆 Git 存储库抛出 ArithmeticException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20893126/
我已经为数据表实现了 LazyLoading。当我使用分页浏览数据表时,出现以下异常。 com.sun.faces.context.PartialViewContextImpl processPart
这个问题已经有答案了: Operator precedence in Java (3 个回答) 已关闭 4 年前。 当我尝试编写真值表时,我试图找出算法,然后我发现了一个可行的算法。但是现在我不明白为
该程序可以正确计算带分数。我希望 while 循环在输入两个零后终止。但是,当我输入由空格分隔的两个零时,我得到“Exception in thread "main"java.lang.Arithme
我有一个 JAVA(在 Android 上运行)方法,它偶尔会因被零除而捕获 ArithmeticException,尽管变量 inSampleSize 在循环之前设置为 1,并且每次只乘以 2。以下
我正在用 Java 做这个数独求解器,由于某种原因,我的代码中有一个我无法修复的错误。我的代码有一个 guess 函数,它在检查每个框中的 1-9 数字的同时检查数字是否已经写入。 错误在行中: e
这个问题在这里已经有了答案: try-catch for division by zero (7 个答案) 关闭 7 年前。 我一定是做了什么蠢事。但我似乎无法弄清楚为什么这个简单的代码不起作用。
我想使用标准的 java MonetaryConversions 来转换货币。 乍一看它工作得很好而且简单: @Test public void testConversion()
@Override public StreamObserver mdtDialout(StreamObserver responseObserver) { return new StreamO
我想修改ArithmeticException输出消息。因此,为此我做了一些实验。我通过 ExtenderClass 类扩展了 ArithmeticException 类。这个问题的重点不仅在于找到修
为什么这段代码不抛出ArithmeticException?看看: public class NewClass { public static void main(String[] args)
该方法的目的是迭代一个名为 grid[][] 的二维整数数组,并根据最大和最小值将整数转换为 100 到 250 之间的较小范围(原来的最小值变为 100 ,原来的最大值变成250,中间的一切都分别计
我在解决从 Student 类中的 getAverageScore() 方法中获取的 ArithmeticException 时遇到问题。我正在尝试编写一个程序来读取以下文本文件 scores.txt
我正在使用计算器并使用 NetBeans GUI 生成器,因此它可能有点不清楚和令人困惑。(完整代码 http://pastebin.com/ZLcM74ZQ ,因为它太长了) package rec
我正在研究一种算法来检查数字是否为质数,并且需要处理非常大的数字,因此我正在使用 BigInteger 类。问题是抛出此异常ArithmeticException BigInteger 会溢出支持的范
我正在用JUnit练习,这是我想测试的简单方法 public float divide(int a, int b){ return (float)a/(float)b; } 这是测试(Ma
我对整个捕获处理异常概念有点陌生,我想知道为什么抛出 ArithmeticException 不会在退出时产生异常错误消息(在本例中/为零),而是在编译期间产生异常错误消息。 不应该正常编译然后在屏幕
我们在客户机器上的以下行中得到一个ArithmeticException(算术运算中上溢或下溢。)。我们无法在任何 PC(客户或我们的)上复制它: var actualFullness = (byte
下面的代码执行时没有任何歧义的编译错误,输出是“ArithmeticException”。各位大侠能帮我看看原因吗。 class Test { public static void main(
我正在尝试在 Android 应用程序中实现 RSA 算法。我正在使用 java.math.BigInteger.modPow() 函数进行加密/解密,它适用于我的计算机(Windows 和 Xubu
这只发生在 x64 版本中 An unhandled exception of type 'System.ArithmeticException' occurred in WindowsBase.dl
我是一名优秀的程序员,十分优秀!