sunjavaplugin.cxx (9cf33c68) | sunjavaplugin.cxx (75db40d1) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 504 unchanged lines hidden (view full) --- 513 514 // We set an abort handler which is called when the VM calls _exit during 515 // JNI_CreateJavaVM. This happens when the LD_LIBRARY_PATH does not contain 516 // all some directories of the Java installation. This is necessary for 517 // all versions below 1.5.1 518 vecOptions.push_back(JavaVMOption()); 519 vecOptions.back().optionString = (char *) "abort"; 520 vecOptions.back().extraInfo = (void* )(sal_IntPtr)abort_handler; | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 504 unchanged lines hidden (view full) --- 513 514 // We set an abort handler which is called when the VM calls _exit during 515 // JNI_CreateJavaVM. This happens when the LD_LIBRARY_PATH does not contain 516 // all some directories of the Java installation. This is necessary for 517 // all versions below 1.5.1 518 vecOptions.push_back(JavaVMOption()); 519 vecOptions.back().optionString = (char *) "abort"; 520 vecOptions.back().extraInfo = (void* )(sal_IntPtr)abort_handler; |
521#if OSL_DEBUG_LEVEL >= 2 522 JFW_TRACE2(OString("VM option: ") + OString(vecOptions.back().optionString) + 523 OString("\n")); 524#endif |
|
521 rtl::OString sClassPathProp("-Djava.class.path="); 522 rtl::OString sClassPathOption; 523 for (int i = 0; i < cOptions; i++) 524 { 525#ifdef UNX 526 // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2) 527 // in the class path in order to have applet support. | 525 rtl::OString sClassPathProp("-Djava.class.path="); 526 rtl::OString sClassPathOption; 527 for (int i = 0; i < cOptions; i++) 528 { 529#ifdef UNX 530 // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2) 531 // in the class path in order to have applet support. |
528 rtl::OString sClassPath = arOptions[i].optionString; 529 if (sClassPath.match(sClassPathProp, 0) == sal_True) | 532 rtl::OString sOptionString = arOptions[i].optionString; 533 if (sOptionString.match(sClassPathProp, 0) == sal_True) |
530 { | 534 { |
531 bool emptyClassPath = (sClassPath == sClassPathProp); | 535 bool emptyClassPath = (sOptionString == sClassPathProp); |
532 char sep[] = {SAL_PATHSEPARATOR, 0}; 533 OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion); 534 if (sAddPath.getLength()) { | 536 char sep[] = {SAL_PATHSEPARATOR, 0}; 537 OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion); 538 if (sAddPath.getLength()) { |
535 sClassPathOption = sClassPath; | 539 sClassPathOption = sOptionString; |
536 if (!emptyClassPath) { 537 sClassPathOption += rtl::OString(sep); 538 } 539 sClassPathOption += sAddPath; 540 emptyClassPath = false; 541 } else | 540 if (!emptyClassPath) { 541 sClassPathOption += rtl::OString(sep); 542 } 543 sClassPathOption += sAddPath; 544 emptyClassPath = false; 545 } else |
542 sClassPathOption = sClassPath; | 546 sClassPathOption = sOptionString; |
543 if (!emptyClassPath) { 544 vecOptions.push_back(JavaVMOption()); 545 vecOptions.back().optionString = (char *) sClassPathOption.getStr(); 546 vecOptions.back().extraInfo = arOptions[i].extraInfo; 547 } // else avoid empty class path 548 } 549 else 550 { 551#endif 552 vecOptions.push_back(JavaVMOption()); 553 vecOptions.back().optionString = arOptions[i].optionString; 554 vecOptions.back().extraInfo = arOptions[i].extraInfo; 555#ifdef UNX 556 } 557#endif | 547 if (!emptyClassPath) { 548 vecOptions.push_back(JavaVMOption()); 549 vecOptions.back().optionString = (char *) sClassPathOption.getStr(); 550 vecOptions.back().extraInfo = arOptions[i].extraInfo; 551 } // else avoid empty class path 552 } 553 else 554 { 555#endif 556 vecOptions.push_back(JavaVMOption()); 557 vecOptions.back().optionString = arOptions[i].optionString; 558 vecOptions.back().extraInfo = arOptions[i].extraInfo; 559#ifdef UNX 560 } 561#endif |
562 sOptionString = vecOptions.back().optionString; 563 if (sOptionString.match(sClassPathProp, 0) == sal_True) { 564 // Check for empty entries in the class path 565 sal_Int32 nIndex = sClassPathProp.getLength(); 566 rtl::OString sToken; 567 char empty1[] = {'.', 0}; 568 char empty2[] = {'.', SAL_PATHDELIMITER, 0}; 569 const rtl::OString sEmpty1 = rtl::OString(empty1); 570 const rtl::OString sEmpty2 = rtl::OString(empty2); 571 do { 572 sToken = sOptionString.getToken(0, SAL_PATHSEPARATOR, nIndex); 573 if ((sToken.getLength() == 0) || 574 (sToken == sEmpty1) || 575 (sToken == sEmpty2)) { 576 fprintf(stderr,"[Java framework]sunjavaplugin" 577 SAL_DLLEXTENSION 578 " Rejecting empty class path entry !\n"); 579 return JFW_PLUGIN_E_INVALID_ARG; 580 } 581 } while (nIndex >= 0); 582 } |
|
558#if OSL_DEBUG_LEVEL >= 2 559 JFW_TRACE2(OString("VM option: ") + OString(vecOptions.back().optionString) + 560 OString("\n")); 561#endif 562 } 563 564#ifdef MACOSX 565 vm_args.version= JNI_VERSION_1_4; // issue 88987 --- 117 unchanged lines hidden --- | 583#if OSL_DEBUG_LEVEL >= 2 584 JFW_TRACE2(OString("VM option: ") + OString(vecOptions.back().optionString) + 585 OString("\n")); 586#endif 587 } 588 589#ifdef MACOSX 590 vm_args.version= JNI_VERSION_1_4; // issue 88987 --- 117 unchanged lines hidden --- |