Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 681462 Details for
Bug 899697
Allow alternate location for native libraries
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
0001-Add-alternative-common-location-for-all-native-modul.patch
0001-Add-alternative-common-location-for-all-native-modul.patch (text/x-patch), 3.80 KB, created by
Mladen Turk
on 2012-01-07 10:44:12 UTC
(
hide
)
Description:
0001-Add-alternative-common-location-for-all-native-modul.patch
Filename:
MIME Type:
Creator:
Mladen Turk
Created:
2012-01-07 10:44:12 UTC
Size:
3.80 KB
patch
obsolete
>From 63d42480dcf025b888f174b66d36957920aae08c Mon Sep 17 00:00:00 2001 >From: Mladen Turk <mturk@redhat.com> >Date: Sat, 7 Jan 2012 11:30:31 +0100 >Subject: [PATCH] Add alternative common location for all native modules > >--- > .../jboss/modules/NativeLibraryResourceLoader.java | 39 ++++++++++++++++++++ > 1 files changed, 39 insertions(+), 0 deletions(-) > >diff --git a/src/main/java/org/jboss/modules/NativeLibraryResourceLoader.java b/src/main/java/org/jboss/modules/NativeLibraryResourceLoader.java >index b0cf724..a69edf1 100644 >--- a/src/main/java/org/jboss/modules/NativeLibraryResourceLoader.java >+++ b/src/main/java/org/jboss/modules/NativeLibraryResourceLoader.java >@@ -35,15 +35,19 @@ public class NativeLibraryResourceLoader extends AbstractResourceLoader { > static { > final PropertyReadAction osNameReadAction = new PropertyReadAction("os.name"); > final PropertyReadAction osArchReadAction = new PropertyReadAction("os.arch"); >+ final PropertyReadAction moduleReadAction = new PropertyReadAction("module.path"); > final SecurityManager sm = System.getSecurityManager(); > final String sysName; > final String sysArch; >+ final String modPath; > if (sm != null) { > sysName = AccessController.doPrivileged(osNameReadAction).toUpperCase(Locale.US); > sysArch = AccessController.doPrivileged(osArchReadAction).toUpperCase(Locale.US); >+ modPath = AccessController.doPrivileged(moduleReadAction); > } else { > sysName = osNameReadAction.run().toUpperCase(Locale.US); > sysArch = osArchReadAction.run().toUpperCase(Locale.US); >+ modPath = moduleReadAction.run(); > } > final String realName; > final String realArch; >@@ -112,9 +116,16 @@ public class NativeLibraryResourceLoader extends AbstractResourceLoader { > realArch = "unknown"; > } > ARCH_NAME = realName + "-" + realArch; >+ if (modPath == null) { >+ //noinspection ZeroLengthArrayAllocation >+ LIBS_ROOT = new File[0]; >+ } else { >+ LIBS_ROOT = getFiles(modPath, 0, 0); >+ } > } > > private static final String ARCH_NAME; >+ private static final File[] LIBS_ROOT; > > /** > * The filesystem root of the resource loader. >@@ -130,8 +141,36 @@ public class NativeLibraryResourceLoader extends AbstractResourceLoader { > this.root = root; > } > >+ private static File[] getFiles(final String modulePath, final int stringIdx, final int arrayIdx) { >+ final int i = modulePath.indexOf(File.pathSeparatorChar, stringIdx); >+ final File[] files; >+ if (i == -1) { >+ files = new File[arrayIdx + 1]; >+ files[arrayIdx] = new File(modulePath.substring(stringIdx)).getAbsoluteFile(); >+ } else { >+ files = getFiles(modulePath, i + 1, arrayIdx + 1); >+ files[arrayIdx] = new File(modulePath.substring(stringIdx, i)).getAbsoluteFile(); >+ } >+ return files; >+ } >+ > /** {@inheritDoc} */ > public String getLibrary(final String name) { >+ for (File libs : LIBS_ROOT) { >+ String base = "native" + File.separatorChar; >+ if (ARCH_NAME.startsWith("win")) { >+ base += "bin"; >+ } else { >+ if (ARCH_NAME.endsWith("64")) { >+ base += "lib64"; >+ } else { >+ base += "lib"; >+ } >+ } >+ final File file = new File(libs, base + File.separatorChar + System.mapLibraryName(name)); >+ if (file.exists()) >+ return file.getAbsolutePath(); >+ } > final File file = new File(root, ARCH_NAME + File.separatorChar + System.mapLibraryName(name)); > return file.exists() ? file.getAbsolutePath() : null; > } >-- >1.7.7.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 899697
: 681462