camel-ftp: destination filename encoding error - character-encoding

developing on windows 10. Using Win10 IIS FTP server. create a camel context to transfer ftp files. Problem comes out on Chinese Files transfer. The Chinese file in destination path garbled.
I try to add charset(ios-8859-1, utf-8, gb2312 ...) param in both from() & to() URI, not works.
public void configure() throws Exception {
try {
from("ftp://127.0.0.1:2121?binary=true&charset=windows-1252&delay=5s&delete=true&passiveMode=true&recursive=true")
.to("file://E:/ftp_copy/local?charset=utf-8")
.log("Downloaded file ${file:name} complete.");
} catch (Exception e) {
throw e;
}
}
some log:
15:21:08.321 [Camel (camel-1) thread #1 - ftp://127.0.0.1:2121] DEBUG o.a.c.c.f.FileOperations - [writeFileByReaderWithCharset,462] - Using Reader to write file: E:\ftp_copy\local\ÖÐÎÄ°¦°¦.txt with charset: utf-8
15:21:08.322 [Camel (camel-1) thread #1 - ftp://127.0.0.1:2121] DEBUG o.a.c.c.f.GenericFileProducer - [writeFile,282] - Wrote [E:\ftp_copy\local\ÖÐÎÄ°¦°¦.txt] to [file://E:%5Cftp_copy%5Clocal?charset=utf-8]
15:21:08.324 [Camel (camel-1) thread #1 - ftp://127.0.0.1:2121] INFO route1 - [log,159] - Downloaded file ÖÐÎÄ°¦°¦.txt complete.
15:21:08.325 [Camel (camel-1) thread #1 - ftp://127.0.0.1:2121] DEBUG o.a.c.c.f.GenericFileOnCompletion - [onCompletion,75] - Done processing file: RemoteFile[ÖÐÎÄ°¦°¦.txt] using exchange: Exchange[ID-LAPTOP-7L49H3A5-1548141666835-0-1]
15:21:08.325 [Camel (camel-1) thread #1 - ftp://127.0.0.1:2121] DEBUG o.a.c.c.f.r.FtpOperations - [deleteFile,232] - Deleting file: ÖÐÎÄ°¦°¦.txt

Related

Exception thrown in SurfaceImageSource.as()

I'm back to C++ after a 31-year absence and have spent the last few months learning everything I can about Windows app development, UWP, C++/WinRT, DirectX, WinUI 3, XAML, etc. All within Visual Studio 2022 Community.
I'm currently working on creating an app template that brings together DirectX and WinUI 3, allowing me to draw on a surface within XAML/UI3. So far I've been able to create separate apps with each component (modifying existing Microsoft templates), but I'm struggling a bit bringing them all together.
The closest example I've found (using C++/WinRT) is the "DirectX and XAML interop" tutorial. I copied the example into my WinUI 3 project and it compiles no errors and the UI runs fine until I click on the button that invokes the tutorial code. Then it crashes trying to create a winrt::com_ptr to the SurfaceImageSource. I've spent a couple of days now trying to figure out why. The code in question is :
(C++/WinRT)
SurfaceImageSource surfaceImageSource( 500, 500 ) ;
winrt :: com_ptr <::ISurfaceImageSourceNativeWithD2D> sisNativeWithD2D {
surfaceImageSource.as <::ISurfaceImageSourceNativeWithD2D> () } ;
If I replace "surfaceImageSource.as" with "surfaceImageSource.try_as" the call returns, but .get() on the com_ptr returns nullptr. So it looks like internally, QueryInterface is not succeeding.
Any help with this would be greatly appreciated since I don't know where to go from here.
Thanks.
*** EDIT *** : additional information added per IInspectable's comment
Thanks IInspectable for your help. I can reproduce this with the following minimal setup :
1 - Create a new project from "Blank App, Packaged (WinUI 3 in Desktop)" C++/WinRT template. This project creates a blank window with a UI3 "Click Me" button in its center.
2 - In the file "MainWindow.xaml.cpp" :
a - at the top, add :
#include <windows.ui.xaml.media.dxinterop.h>
#include <winrt/Microsoft.UI.Xaml.Media.Imaging.h>
using namespace winrt::Microsoft::UI::Xaml::Media::Imaging;
b - further down, in the method "MainWindow::myButton_Click()" add the two lines mentioned earlier :
SurfaceImageSource surfaceImageSource(500, 500);
winrt::com_ptr <::ISurfaceImageSourceNativeWithD2D> sisNativeWithD2D{
surfaceImageSource.as <::ISurfaceImageSourceNativeWithD2D>() };
3 - that's it. Rebuild and the program crashes on the button click.
I put a breakpoint between the two lines above.
I then put another breakpoint in "Generated Files\winrt\base.h" on first line of "struct IUnknown :: as()":
template <typename To>
auto as() const
{ (breakpoint here)
return impl::as<To>(m_ptr);
}
When I continue execution, the program crashes immediately before returning to the next line of myButton_Click() (as far as I can determine).
Debug Output
'My_WinUI_3_project_4.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe\Microsoft.DirectManipulation.dll'.
onecoreuap\windows\frameworkudk\dxprivatescommon.cpp(53)\Microsoft.Internal.FrameworkUdk.dll!00007FFFABE09BC5: (caller: 00007FFFABE5ED0D) ReturnHr(1) tid(2508) 80004002 This interface is not supported
onecoreuap\windows\frameworkudk\dxprivatescommon.cpp(53)\Microsoft.Internal.FrameworkUdk.dll!00007FFFABE09BC5: (caller: 00007FFFABE5ED0D) ReturnHr(2) tid(2508) 80004002 This interface is not supported
onecoreuap\windows\frameworkudk\dxprivatescommon.cpp(53)\Microsoft.Internal.FrameworkUdk.dll!00007FFFABE09BC5: (caller: 00007FFFABE5ED0D) ReturnHr(3) tid(3670) 80004002 This interface is not supported
'My_WinUI_3_project_4.exe' (Win32): Loaded 'C:\Windows\System32\cabinet.dll'.
'My_WinUI_3_project_4.exe' (Win32): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\XamlDiagnostics\x64\WinUI3\Microsoft.VisualStudio.DesignTools.WinUITap.dll'.
Microsoft.UI.Xaml.dll!00007FFF8DAF3D45: (caller: 00007FFF90651CAF) ReturnHr(1) tid(2508) 80070057 Incorrect parameter.
Microsoft.UI.Xaml.dll!00007FFF8DAF3D45: (caller: 00007FFF90651CAF) ReturnHr(2) tid(2508) 80070057 Incorrect parameter.
Microsoft.UI.Xaml.dll!00007FFF8DAF3D45: (caller: 00007FFF90651CAF) ReturnHr(3) tid(2508) 80070057 Incorrect parameter.
Exception thrown at 0x00007FF83C644FD9 (KernelBase.dll) in My_WinUI_3_project_4.exe: WinRT originate error - 0x80004002 : 'This interface is not supported'.
Exception thrown at 0x00007FF83C644FD9 in My_WinUI_3_project_4.exe: Microsoft C++ exception: winrt::hresult_no_interface at memory location 0x0000005C234FA538.
Exception thrown at 0x00007FF83C644FD9 in My_WinUI_3_project_4.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
A breakpoint instruction (__debugbreak() statement or a similar call) was executed in My_WinUI_3_project_4.exe.
Call Stack
My_WinUI_3_project_4.exe!winrt::My_WinUI_3_project_4::implementation::App::{ctor}::__l2::<lambda>(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Microsoft::UI::Xaml::UnhandledExceptionEventArgs & e) Line 31 C++
My_WinUI_3_project_4.exe!winrt::impl::delegate<winrt::Microsoft::UI::Xaml::UnhandledExceptionEventHandler,void <lambda>(const winrt::Windows::Foundation::IInspectable &, const winrt::Microsoft::UI::Xaml::UnhandledExceptionEventArgs &)>::Invoke(void * sender, void * e) Line 4824 C++
[External Code]
My_WinUI_3_project_4.exe!winrt::impl::consume_Microsoft_UI_Xaml_IApplicationStatics<winrt::Microsoft::UI::Xaml::IApplicationStatics>::Start(const winrt::Microsoft::UI::Xaml::ApplicationInitializationCallback & callback) Line 157 C++
My_WinUI_3_project_4.exe!winrt::Microsoft::UI::Xaml::Application::Start::__l2::<lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics & f) Line 12146 C++
My_WinUI_3_project_4.exe!winrt::impl::factory_cache_entry<winrt::Microsoft::UI::Xaml::Application,winrt::Microsoft::UI::Xaml::IApplicationStatics>::call<void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) &>(winrt::Microsoft::UI::Xaml::Application::Start::__l2::void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) & callback) Line 6286 C++
My_WinUI_3_project_4.exe!winrt::impl::call_factory<winrt::Microsoft::UI::Xaml::Application,winrt::Microsoft::UI::Xaml::IApplicationStatics,void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &)>(winrt::Microsoft::UI::Xaml::Application::Start::__l2::void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) && callback) Line 6309 C++
My_WinUI_3_project_4.exe!winrt::Microsoft::UI::Xaml::Application::Start(const winrt::Microsoft::UI::Xaml::ApplicationInitializationCallback & callback) Line 12147 C++
[External Code]
This:
#include <windows.ui.xaml.media.dxinterop.h>
should be this:
#include <microsoft.ui.xaml.media.dxinterop.h>
when working with WinUI 3.0 Desktop apps and not UWP.

Is Google Dataflow retrying DoFns when RuntimeException appears?

We have a simple pipeline, where we transforming data from Unbounded data source.
In one step, when we enrich the data from the external service, sometimes RuntimeException is thrown ( it's because Dataflow is so fast ( :p ) and the external services are not aware of this particular data ). After 10s it will be aware, and RuntimeException will not be thrown.
In this in mind we switched completely from using failsafe and we try to rely on native Dataflow mechanism ( according to this: https://cloud.google.com/dataflow/pipelines/troubleshooting-your-pipeline#detecting-an-exception-in-worker-code )
But we've found out, that this is not really working. I mean, the bundle is not redelivered to DoFn, so that our sink does not have all the data that comes to our source.
Also, when running locally, this exception also quits the execution of the whole.
Is that a problem only with this particular type of exception (RuntimeException)? How to force Dataflow to reprocess bundle?
update
The DoFn in which the exception appears:
#DoFn.ProcessElement
public void processElement(ProcessContext c) {
String txHash = c.element().getHash();
try {
LOG.info("TransformId: " + txHash);
// here the RuntimeException is thrown
throw new new RuntimeException
}
} catch (Exception e) {
LOG.error("Exception during processing id: " + txHash, e);
throw e;
}
}
And logs:
2018-02-22 17:15:53.633 CET
Receiver: 00ff ( this is source, we are receiving id"
2018-02-22 17:15:53.634 CET
TransformId: 00ff ( beginning of the DoFn )
2018-02-22 17:15:53.634 CET
getTxRest invoked: 00ff ( the enriching service )
2018-02-22 17:15:53.638 CET
Exception during processing id: 00ff
2018-02-22 17:15:53.834 CET
Uncaught exception: ( and here are the details that the log name is: "xxx/logs dataflow.googleapis.com%2Fworker" )
Why am I saying that this is not retried? Because this id 00ff does not exists in the log elsewhere.
There could be 2 reasons:
If getHash() is non-deterministic
If you're reading from a custom UnboundedSource that does not provide at-least-once reads. E.g., the source might not support acking at all, or might be incorrectly acking records immediately when they are received, rather than in finalizeCheckpoint().
The second is more likely in this case. When the bundle is retried, it retries reading from the source, and the source doesn't give this record back again.
If the source can not be fixed, as a workaround, you can pass the data from the source through Reshuffle.viaRandomKey() - that will effectively temporarily materialize it so retries will concern only the processing but not the reading, at the expense of small performance overhead.

Webstorm - errors after pub:build

I wrote simple example code in the WebStorm EAP
void main() {
var main = new Element.html('<div class="main"></div>');
document.body.children.add(main);
}
in Dartium - all is well, after pub:debug - - all is well,
but after pub:build project, in realise/index.html I do not see anything, only an error in the console:
"main.dart.js:1159 Uncaught TypeError: Cannot read property 'at' of null"
Please explain to me what is the problem, and how can I get the correct build files.

NServiceBus RavenDB exception

From times to times I receive an exception that looks to be appearing when my NServiceBus console shows the following message:
NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver [(null)] <(null)> - Polling next retrieval is at 11/19/2015 11:20:49.
.
Exception:
A first chance exception of type 'System.Net.WebException' occurred in System.dll
Additional information: The remote server returned an error: (404) Not Found.
Callstack:
[External Code]
Raven.Client.Lightweight!Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(System.Func<System.Net.WebResponse> getResponse) Line 332 C#
Raven.Client.Lightweight!Raven.Client.Connection.HttpJsonRequest.ReadResponseJson() Line 225 C#
Raven.Client.Lightweight!Raven.Client.Connection.ServerClient.DirectGet(string serverUrl, string key) Line 203 C#
Raven.Client.Lightweight!Raven.Client.Connection.ReplicationInformer.RefreshReplicationInformation(Raven.Client.Connection.ServerClient commands) Line 351 C#
Raven.Client.Lightweight!Raven.Client.Connection.ReplicationInformer.UpdateReplicationInformationIfNeeded.AnonymousMethod__6() Line 134 C#
[External Code]
It's an exception that it's thrown and caught inside RavenDB code it self, so I suspect this doesn't interfere with my own code. But I might be hiding a problem.
So I'm wondering why is this exception happening and how can I avoid it?
That is fine, 404 error is raised when you are trying to load a non existant document.
This is expected and part of how this works.

Running a simple Dart test in WebStorm 10.0.4 [duplicate]

This question already has an answer here:
WebStorm DartUnit with test api, run/debug error
(1 answer)
Closed 7 years ago.
This should be trivial but it is not working as I think it should. I am new to WebStorm.
I have a simple test taken from Dart's new test offering at https://pub.dartlang.org/packages/test
.dart
import "package:test/test.dart";
void main() {
test("String.split() splits the string on the delimiter", () {
var string = "foo,bar,baz";
expect(string.split(","), equals(["foo", "bar", "baz"]));
});
test("String.trim() removes surrounding whitespace", () {
var string = " foo ";
expect(string.trim(), equals("foo"));
});
}
Running this simple test gives the following exception:
J:\dart\dart-sdk\bin\dart.exe --ignore-unrecognized-flags --checked --package-root=J:\workspace\epimss\dart\epimss_shared\packages --enable-vm-service:60110 --trace_service_pause_events C:\Users\st.clair.clarke\AppData\Local\Temp\jetbrains_unit_config.dart
Testing started at 3:07 AM ...
Observatory listening on http://127.0.0.1:60110
Unhandled exception:
No top-level setter 'unittestConfiguration=' declared.
NoSuchMethodError: method not found: 'unittestConfiguration='
Receiver: top-level
Arguments: [Instance of 'JetBrainsUnitConfig']
#0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:188)
#1 main (file:///x:/Users/zang/AppData/Local/Temp/jetbrains_unit_config.dart:10:3)
#2 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
Process finished with exit code 255
The problem seems to be the line unittestConfiguration = config; in the jetbrains configuration - something is expected for the config.
Any help is appreciated.
According to this issue, test package is not yet supported by WebStorm's testing framework.
You have two ways right now:
Run it as usual dart application, not as a test
Use deprecated unittest package instead of test until issue is resolved.

Resources